From 530096340198888eb1808f39c0c75a6f1f6d1132 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期六, 15 六月 2024 16:32:44 +0800
Subject: [PATCH] 一些更新

---
 src/views/tigerprojects/system/lowcode/normal/basDefectGrp.ts |   52 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/normal/basDefectGrp.ts b/src/views/tigerprojects/system/lowcode/normal/basDefectGrp.ts
index c6a85ec..ea50ef5 100644
--- a/src/views/tigerprojects/system/lowcode/normal/basDefectGrp.ts
+++ b/src/views/tigerprojects/system/lowcode/normal/basDefectGrp.ts
@@ -1,10 +1,13 @@
-import { h, unref } from 'vue';
+import { Ref, h, unref } from 'vue';
 import { ActionItem, BasicColumn, FormSchema } from '/@/components/Table';
 import { useI18n } from '/@/hooks/web/useI18n';
 import { useLocale } from '/@/locales/useLocale';
 import { Tag } from 'ant-design-vue';
 import { DeleteEntity, GetEnum, getEntity } from '/@/api/tigerapi/system';
 import { isNullOrEmpty } from '/@/utils/is';
+import { buildUUID } from '/@/utils/uuid';
+import { useUserStore } from '/@/store/modules/user';
+import { formatToDateTime } from '/@/utils/dateUtil';
 
 const { t } = useI18n();
 const { getLocale } = useLocale();
@@ -61,7 +64,7 @@
  * @return {*}
  */
 export function DftGrpEdit(args: Fn[], params: {}) {
-  const param = { CODE: params['record']['DFTG_CODE'], ID: params['record']['ID'], Name: 'BAS_DEFECT', Title: `缂栬緫涓嶈壇浠g爜缁勶細${params['record']['DFTG_CODE']}`, pCode: 'DFTG_CODE' };
+  const param = { CODE: params['record']['DFTG_CODE'], ID: params['record']['ID'], Name: 'BAS_DEFECT', Title: `缂栬緫涓嶈壇浠g爜缁勶細${params['record']['DFTG_CODE']}`, pCode: 'DFTG_CODE', IsID: false };
   args[5](`/BAS_DEFECT/High/${encodeURI(JSON.stringify(param))}`);
 }
 
@@ -82,12 +85,51 @@
       dataSource: params['data'],
     });
     args[1]();
-  }else{
+  } else {
     DeleteEntity(params['record'], params['entityName']).then((action) => {
       if (action.IsSuccessed) {
         args[1]();
       }
     });
+  }
+}
+
+/**
+ * @description: 鑷畾涔夋槑缁嗚〃涓紪杈戣繑鍥炴柟娉�
+ * @param {string} type
+ * @param {*} d
+ * @param {*} u
+ * @return {*}
+ */
+export function dftEditeOperation(data: Ref<any[]>, d, u) {
+  if (u.isUpdate) {
+    //鏇存柊
+    var _data = data.value.map((item) => {
+      if (item['ID'] == d.ID)
+        return {
+          ...item,
+          DFT_CODE: d.DFT_CODE,
+          DFT_NAME: d.DFT_NAME,
+          DFT_LEVEL: d.DFT_LEVEL,
+          REMARK: d.REMARK,
+        };
+      return item;
+    });
+    data.value = _data;
+  } else {
+    //鏂板
+    d.ID = buildUUID();
+    d.CREATE_USER = useUserStore().getUserInfo.userId as string;
+    d.UPDATE_TIME = formatToDateTime(new Date());
+    d.UPDATE_USER = useUserStore().getUserInfo.userId as string;
+    var _data2: any[] = [];
+    if (!isNullOrEmpty(data.value)) {
+      _data2 = data.value.map((item) => {
+        return item;
+      });
+    }
+    _data2.push(d);
+    data.value = _data2;
   }
 }
 
@@ -156,7 +198,7 @@
 }
 
 /**
- * @description: 鍩烘湰淇℃伅
+ * @description: 涓嶈壇浠g爜鍩烘湰淇℃伅
  * @return {*}
  */
 export const baseSchema: FormSchema[] = [
@@ -208,7 +250,7 @@
 ];
 
 /**
- * @description: 鑾峰彇澧炲垹鏀硅〃鍗�
+ * @description: 鑾峰彇涓嶈壇浠g爜澧炲垹鏀硅〃鍗�
  * @return {*}
  */
 export const crudSchema: FormSchema[] = [

--
Gitblit v1.9.3