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_PKG_DTL.ts |   98 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 77 insertions(+), 21 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts
index e94bebc..8dd0f38 100644
--- a/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts
+++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts
@@ -4,23 +4,18 @@
  * @version:
  * @Date: 2024-06-19 20:34:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-06-22 00:34:46
+ * @LastEditTime: 2024-06-23 00:22:36
  */
 
+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 = custDel.bind(null, args[1], params);
-    return data;
-  }
-
   /**
    * @description: 鑷畾涔夊垹闄ゆ柟娉�
    * @param {Fn} args
@@ -46,17 +41,78 @@
       });
     }
   }
-  /**
-   * @description: 鍏敤缂栬緫鏂规硶
-   * @param {Fn} fn
-   * @param {*} params
-   * @return {*}
-   */
-  function editRecord(fn: Fn, params: {}) {
-    fn(true, params);
-  }
 
-  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 = custDel.bind(null, args[1], 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,
+              PKG_CODE: d.PKG_CODE,
+              PKG_LEVEL: d.PKG_LEVEL,
+              PKG_QTY: d.PKG_QTY,
+              LABEL_CODE: d.LABEL_CODE,
+              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_PKG_RULE/LC/${encodeURI(JSON.stringify({ ID: 'BAS_PKG_RULE', colSlots: [], crudColSlots: [] }))}`;
+    }
+  };
+
+  return [methods, ActionColumn];
 }
 
 export default _default;

--
Gitblit v1.9.3