From e23fdf87e6c3bc6d42198b9309617195f2efd6c0 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期六, 06 七月 2024 23:40:08 +0800
Subject: [PATCH] 高级表单优化

---
 src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts |   81 +++++++++++++++++++++++++++-------------
 1 files changed, 54 insertions(+), 27 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts
index 7ebd613..7855c62 100644
--- a/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts
+++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts
@@ -4,33 +4,16 @@
  * @version:
  * @Date: 2024-06-19 20:34:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-06-24 15:52:18
+ * @LastEditTime: 2024-07-04 09:24:50
  */
 
 import { ActionItem, BasicColumn } from '/@/components/Table';
 import { buildUUID } from '/@/utils/uuid';
 import { useI18n } from '/@/hooks/web/useI18n';
+import { isNullOrUnDef } from '/@/utils/is';
 
 const { t } = useI18n();
 function _default() {
-  /**
-   * @description: 鑷畾涔夌紪杈戞柟娉�
-   * @param {Fn} args
-   * @param {*} params
-   * @return {*}
-   */
-  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',
-      IsID: false,
-    };
-    args[5](`/BAS_DEFECT/High/${encodeURI(JSON.stringify(param))}`);
-  }
-
   const ActionColumn: BasicColumn = {
     width: 100,
     title: '鎿嶄綔',
@@ -38,7 +21,10 @@
     slots: { customRender: 'action' },
     fixed: 'right',
   };
-
+  /**
+   * @description: 涓�浜涜嚜瀹氫箟鏂规硶
+   * @return {*}
+   */
   const methods = {
     /**
      * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓�
@@ -53,25 +39,39 @@
           ID: buildUUID(),
           Name: 'BAS_DEFECT',
           Title: '鏂板涓嶈壇浠g爜缁�',
-          pCode: 'DFTG_CODE',
+          // pCode: 'DFTG_CODE',
           IsID: false,
+          drawers: [{ name: 'BAS_DEFECT', code: 'DFTG_CODE', type: 'one', keyName: 'BAS_DEFECT' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃
         },
       };
     },
     /**
-     * @description: 浜у搧缁戝畾宸ヨ壓璺嚎鎿嶄綔瀛楁鑷畾涔夋寜閽�
+     * @description: 鎿嶄綔瀛楁鑷畾涔夋寜閽�
      * @return {*}
      */
     ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => {
-      data[0].onClick = DftGrpEdit.bind(null, args, params);
+      if (!isNullOrUnDef(data[0])) {
+        data[0].onClick = DftGrpEdit.bind(null, args, params);
+      }
       return data;
     },
-    GetSelectSuccess:(d, u) => {
+    /**
+     * @description: 寮瑰嚭閫夋嫨妗嗘垚鍔熻繑鍥炴柟娉�
+     * @param {*} d
+     * @param {*} u
+     * @return {*}
+     */
+    GetSelectSuccess: (d, u) => {
       return {
         ITEM_CODE: d.values['val'],
       };
     },
-    OpenSelectItem:(openItemModal: Fn) => {
+    /**
+     * @description: 寮瑰嚭閫夋嫨妗嗘墦寮�鏂规硶
+     * @param {Fn} openItemModal
+     * @return {*}
+     */
+    OpenSelectItem: (openItemModal: Fn, ...args) => {
       openItemModal(true, {
         title: '鐗╂枡鍒楄〃',
         schemas: [
@@ -102,11 +102,38 @@
         ],
         tableName: 'BAS_ITEM',
         rowKey: 'ITEM_CODE',
-        searchInfo: {TABLE_NAME: 'BAS_ITEM'}
+        searchInfo: { TABLE_NAME: 'BAS_ITEM' },
       });
-    }
+    },
   };
 
+  /* 浠ヤ笅鏄唴閮ㄦ柟娉曪紝涓峞xport锛屼緵涓婇潰鐨勬柟娉曡皟鐢� */
+
+  /**
+   * @description: 鑷畾涔夌紪杈戞柟娉�
+   * @param {Fn} args
+   * @param {*} params
+   * @return {*}
+   */
+  function DftGrpEdit(args: Fn[], params: {}) {
+    const param = {
+      CODE: params['record']['DFTG_CODE'],
+      ID: params['record']['ID'],
+      Name: 'BAS_DEFECT',
+      SessionName: 'BAS_DEFECT_update',
+      Title: `缂栬緫涓嶈壇浠g爜缁勶細${params['record']['DFTG_CODE']}`,
+      pCode: 'DFTG_CODE',
+      IsID: false,
+      drawers: [{ name: 'BAS_DEFECT', code: 'DFTG_CODE', type: 'one', keyName: 'BAS_DEFECT' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃
+    };
+    // 灏嗗璞¤浆鎹负JSON瀛楃涓插苟淇濆瓨鍒皊essionStorage
+    sessionStorage.removeItem(`${param.SessionName}_params`);
+    sessionStorage.setItem(`${param.SessionName}_params`, encodeURI(JSON.stringify(param)));
+    args[5](
+      `/BAS_DEFECT/High/${encodeURI(JSON.stringify({ sName: param.SessionName, Name: param.Name }))}`,
+    );
+  }
+
   return [methods, ActionColumn];
 }
 

--
Gitblit v1.9.3