From 8cfe56d782e4f8cddf0fa8f0cff84a5b4034aa3d Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期日, 23 六月 2024 00:40:40 +0800
Subject: [PATCH] 一些优化

---
 src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts |   88 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 76 insertions(+), 12 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts
index 18cd2bb..bb4dcce 100644
--- a/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts
+++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts
@@ -4,23 +4,18 @@
  * @version:
  * @Date: 2024-06-19 20:34:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-06-22 00:59:05
+ * @LastEditTime: 2024-06-23 00:21:58
  */
 
+import { Ref } from 'vue';
 import { DeleteEntity } from '/@/api/tigerapi/system';
-import { ActionItem } from '/@/components/Table';
+import { ActionItem, BasicColumn } from '/@/components/Table';
 import { isNullOrEmpty } from '/@/utils/is';
+import { buildUUID } from '/@/utils/uuid';
+import { useUserStore } from '/@/store/modules/user';
+import { formatToDateTime } from '/@/utils/dateUtil';
 
 function _default() {
-  /**
-   * @description: 浜у搧缁戝畾宸ヨ壓璺嚎鎿嶄綔瀛楁鑷畾涔夋寜閽�
-   * @return {*}
-   */
-  function ActionItem(params: Recordable<any>, data, ...args): ActionItem[] {
-    data[1].popConfirm.confirm = rsnGrpDel.bind(null, args, params);
-    return data;
-  }
-
   /**
    * @description: 鑷畾涔夊垹闄ゆ柟娉�
    * @param {Fn} args
@@ -47,7 +42,76 @@
     }
   }
 
-  return [ActionItem];
+  const ActionColumn: BasicColumn = {
+    width: 80,
+    title: '鎿嶄綔',
+    dataIndex: 'action',
+    slots: { customRender: 'action' },
+    fixed: undefined,
+  };
+
+  const methods = {
+    /**
+     * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓�
+     * @return {*}
+     */
+    CreateAction: () => {
+      return {
+        action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�)
+      };
+    },
+    /**
+     * @description: 浜у搧缁戝畾宸ヨ壓璺嚎鎿嶄綔瀛楁鑷畾涔夋寜閽�
+     * @return {*}
+     */
+    ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => {
+      data[1].popConfirm.confirm = rsnGrpDel.bind(null, args, params);
+      return data;
+    },
+    /**
+     * @description: 鑷畾涔夋槑缁嗚〃涓紪杈戣繑鍥炴柟娉�
+     * @param {string} type
+     * @param {*} d
+     * @param {*} u
+     * @return {*}
+     */
+    EditeOperation:( data: Ref<any[]>, d, u) => {
+      if (u.isUpdate) {
+        //鏇存柊
+        var _data = data.value.map((item) => {
+          if (item['ID'] == d.ID)
+            return {
+              ...item,
+              RSN_CODE: d.RSN_CODE,
+              RSN_NAME: d.RSN_NAME,
+              NEED_REPLACE: d.NEED_REPLACE,
+              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;
+      }
+    },
+    GetHomeUrl: () => {
+      return `/BAS_REASON_GRP/LC/${encodeURI(JSON.stringify({ ID: 'BAS_REASON_GRP', colSlots: [], crudColSlots: [] }))}`;
+    }
+  };
+
+  return [methods, ActionColumn];
 }
 
 export default _default;

--
Gitblit v1.9.3