From 6e6fec028ffc9a27b3c8d30eb484cd361a119d76 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期一, 25 十一月 2024 23:53:12 +0800
Subject: [PATCH] 入库单更新

---
 src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts |  190 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 142 insertions(+), 48 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts
index 4ef3a4c..542c71c 100644
--- a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts
+++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts
@@ -4,14 +4,16 @@
  * @version:
  * @Date: 2024-06-19 20:34:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-07-27 13:20:29
+ * @LastEditTime: 2024-08-20 15:03:44
  */
 
+import { DeleteLabelTemplate } from '/@/api/tigerapi/mes/label';
 import { CustModalParams } from '/@/api/tigerapi/model/systemModel';
 import { ActionItem, BasicColumn } from '/@/components/Table';
 import { useWebSocketStore } from '/@/store/modules/websocket';
-import { buildUUID } from '/@/utils/uuid';
+import { useI18n } from '/@/hooks/web/useI18n';
 
+const { t } = useI18n();
 function _default() {
   const ActionColumn: BasicColumn = {
     width: 120,
@@ -30,29 +32,45 @@
      * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓�
      * @return {*}
      */
-    CreateAction: (fnName: string) => {
+    CreateAction: (type: string, ...args) => {
       return {
-        action: 'go', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�)
-        url: 'BAS_LABEL_VAR/High',
-        params: {
-          CODE: '0',
-          ID: buildUUID(),
-          Name: 'BAS_LABEL_VAR', //瀹炰綋鍚�
-          Title: '鏂板妯℃澘', //鏍囬
-          pCode: 'LABEL_CODE', //涓讳俊鎭叧閿瓧娈礐ODE
-          IsID: false, //鏄惁甯﹁繃鍘讳晶杈规鐨勬槸ID锛宖alse灏辨槸CODE锛宼rue鏄疘D
-          drawers: [
-            { name: 'BAS_LABEL_VAR', code: 'LABEL_ID', type: 'one', keyName: 'BAS_LABEL_VAR', order: 'VAR_NAME' },
-            // {
-            //   name: 'MES_SHIFT_PRD',
-            //   code: 'SFT_CODE',
-            //   type: 'all',
-            //   keyName: 'MES_SHIFT',
-            //   order: 'SFT_CODE, SEQ',
-            // },
-          ], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃
-        },
+        action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�)
       };
+      // const colSlots = args[0];
+      // return {
+      //   action: 'go', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) | edit(濡傛灉鏄〃鏍煎彲缂栬緫椤甸潰灏辨槸鑷畾涔夋柟娉�)
+      //   url: 'BAS_LABEL_VAR/High',
+      //   params: {
+      //     CODE: '0',
+      //     ID: buildUUID(),
+      //     Name: 'BAS_LABEL_VAR', //瀹炰綋鍚�
+      //     Title: '鏂板妯℃澘', //鏍囬
+      //     pCode: 'LABEL_CODE', //涓讳俊鎭叧閿瓧娈礐ODE
+      //     IsID: true, //鏄惁甯﹁繃鍘讳晶杈规鐨勬槸ID锛宖alse灏辨槸CODE锛宼rue鏄疘D
+      //     colSlots: colSlots,
+      //     colSlotsInHigh: ['BAS_LABEL_VAR1add', 'BAS_LABEL_VAR2add'],
+      //     drawers: [
+      //       {
+      //         name: 'BAS_LABEL_VAR', //瀹炰綋鍚�
+      //         code: 'LABEL_ID', //浼犻�掕繃鍘婚珮绾ц〃鍗曢〉闈㈢殑鍏抽敭瀛楁鍚�
+      //         type: 'one', //one-琛ㄧず闇�瑕乧ode鐨勪竴涓�硷紝榛樿鏄繖涓�
+      //         keyName: 'BAS_LABEL_VAR', //鍏抽敭琛ㄥ悕锛堝疄浣撳悕锛�
+      //         order: 'VAR_NAME', //鎺掑簭
+      //         showTbButton: false, //鏄惁鏄剧ず宸ュ叿鏍忔寜閽�
+      //         FnName: '', //鑷畾涔夋柟娉曞悕
+      //       },
+      //       {
+      //         name: 'BAS_LABEL_VAR_WO', //瀹炰綋鍚�
+      //         code: 'LABEL_ID', //浼犻�掕繃鍘婚珮绾ц〃鍗曢〉闈㈢殑鍏抽敭瀛楁鍚�
+      //         type: 'one', //all-琛ㄧず闇�瑕乧ode鐨勬墍鏈夌殑鍊�
+      //         keyName: 'BAS_LABEL_VAR_WO', //鍏抽敭琛ㄥ悕锛堝疄浣撳悕锛�
+      //         order: '',
+      //         showTbButton: true, //鏄惁鏄剧ず宸ュ叿鏍忔寜閽�
+      //         FnName: 'AddRow', //鑷畾涔夋柟娉曞悕
+      //       },
+      //     ], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃锛屽強鎸夐挳鐨勬墽琛屾柟娉�
+      //   },
+      // };
     },
     /**
      * @description: 鎿嶄綔瀛楁鑷畾涔夋寜閽�
@@ -60,9 +78,13 @@
      */
     ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => {
       data.map((x) => {
-        if (x.name == 'Edit') {
+        if (x.name == 'goDetail') {
           x.onClick = goDetail.bind(null, args[5], params);
           x.tooltip = '妯℃澘鍙橀噺';
+        }
+        if (x.name == 'Delete') {
+          x.popConfirm.confirm = Del.bind(null, args, params);
+          x.tooltip = '鍒犻櫎';
         }
       });
       return data;
@@ -78,11 +100,62 @@
      */
     CustFunc: (param: CustModalParams) => {
       const webSocketStore = useWebSocketStore();
-      if (webSocketStore.GetSocketState == 1) {
+      if (webSocketStore.GetSocketState == 1 && param.values['TEMP_TYPE'] == 0) {
         webSocketStore.sendMessage(
-          `wsSubStrings ${param.values['ID']}_#_${param.values['TEMP_PATH']}`
+          `wsSubStrings ${param.values['ID']}_#_${param.values['TEMP_PATH']}`,
         );
       }
+    },
+    /**
+     * @description: 閫夋嫨杩囩▼鍙橀噺寮瑰嚭閫夋嫨妗嗘垚鍔熻繑鍥炶祴鍊兼柟娉�
+     * @param {*} d
+     * @param {*} u
+     * @return {*}
+     */
+    GetSelectSuccess: (d, u) => {
+      return {
+        LABEL_CODE: d.values['val'],
+      };
+    },
+    /**
+     * @description: 鎵撳紑瀹㈡埛寮瑰嚭閫夋嫨妗�
+     * @param {Fn} openItemModal
+     * @param {array} args
+     * @return {*}
+     */
+    OpenSelectItem: (openItemModal: Fn, ...args) => {
+      openItemModal(true, {
+        title: '鎵撳嵃妯℃澘鍒楄〃',
+        schemas: [
+          {
+            field: 'LABEL_CODE',
+            component: 'Input',
+            label: '妯℃澘缂栫爜',
+            colProps: {
+              span: 12,
+            },
+          },
+        ],
+        ItemColumns: [
+          {
+            title: t('妯℃澘缂栫爜'),
+            dataIndex: 'LABEL_CODE',
+            resizable: true,
+            sorter: true,
+            width: 200,
+          },
+          {
+            title: t('妯℃澘鍚嶇О'),
+            dataIndex: 'LABEL_NAME',
+            resizable: true,
+            sorter: true,
+            width: 180,
+          },
+        ],
+        tableName: 'BAS_LABEL_TEMP',
+        rowKey: 'LABEL_CODE',
+        searchInfo: { TABLE_NAME: 'BAS_LABEL_TEMP' },
+      });
     },
   };
 
@@ -94,21 +167,6 @@
    * @return {*}
    */
   function goDetail(go: Fn, params: Recordable) {
-    // const id = {
-    //   ID: params['record'].ID,
-    //   CODE: params['record']['LABEL_CODE'],
-    //   Name: 'BAS_LABEL_VAR',
-    //   firstTabName: '鏍囩妯℃澘鍙橀噺',
-    //   secondTabName: '', //'鏍囩杩囩▼鍙橀噺',
-    //   firstTitle: '妯℃澘鍙橀噺',
-    //   secondTitle: '', //'杩囩▼鍙橀噺',
-    //   pageTitle: '鏍囩妯℃澘鍙橀噺', //璇︽儏椤甸潰鏍囬
-    //   contentStr: '杩欓噷鏄爣绛炬ā鏉垮彉閲忕鐞嗛〉闈紝鍙互绠$悊鏍囩鐨勬ā鏉垮彉閲忔垨鑰呮墦鍗拌繃绋嬩腑鐨勫彉閲�',
-    //   detailName: `妯℃澘[${params['record'].LABEL_NAME}]`,
-    //   keyFieldValues: { LABEL_ID: params['record'].ID },
-    //   colSlots: ['BAS_LABEL_PV1add'],
-    //   SessionName: 'BAS_LABEL_VAR_update',
-    // };
     const id = {
       CODE: params['record']['LABEL_CODE'],
       ID: params['record']['ID'],
@@ -117,21 +175,57 @@
       Title: `缂栬緫妯℃澘${params['record']['LABEL_CODE']}鐨勫彉閲廯,
       pCode: 'LABEL_CODE',
       IsID: true,
+      ifSave: false,
+      colSlots: params['colSlots'].value, //['BAS_LABEL_VAR1add', 'BAS_LABEL_VAR2add'],
+      colSlotsInHigh: ['BAS_LABEL_VAR1add', 'BAS_LABEL_VAR2add'],
       drawers: [
-        { name: 'BAS_LABEL_VAR', code: 'LABEL_ID', type: 'one', keyName: 'BAS_LABEL_VAR', order: 'VAR_NAME' },
+        {
+          name: 'BAS_LABEL_VAR',
+          code: 'LABEL_ID',
+          type: 'one',
+          keyName: 'BAS_LABEL_VAR',
+          order: 'VAR_NAME',
+          showTbButton: true,
+          FnName: 'AddRow',
+        },
         // {
-        //   name: 'MES_SHIFT_PRD',
-        //   code: 'SFT_CODE',
-        //   type: 'all',
-        //   keyName: 'MES_SHIFT',
-        //   order: 'SFT_CODE, SEQ',
+        //   name: 'BAS_LABEL_VAR_WO',
+        //   code: 'LABEL_ID',
+        //   type: 'one',
+        //   keyName: 'BAS_LABEL_VAR_WO',
+        //   order: '',
+        //   showTbButton: true,
+        //   FnName: 'AddRow',
         // },
       ], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃
     };
+    // const webSocketStore = useWebSocketStore();
+    // if (webSocketStore.GetSocketState == 1) {
+    //   webSocketStore.sendMessage(
+    //     `wsSubStrings 1d441e20c43a469286319de9b0df5d7b_#_http://localhost:8800/files/10浣嶅敮涓�ID.btw`,
+    //   );
+    // }
     // 灏嗗璞¤浆鎹负JSON瀛楃涓插苟淇濆瓨鍒皊essionStorage
     sessionStorage.removeItem(`${id.SessionName}_params`);
     sessionStorage.setItem(`${id.SessionName}_params`, encodeURI(JSON.stringify(id)));
-    go(`/BAS_LABEL_VAR/High/${encodeURI(JSON.stringify({ sName: id.SessionName, Name: id.Name }))}`);
+    go(
+      `/BAS_LABEL_VAR/High/${encodeURI(JSON.stringify({ sName: id.SessionName, Name: id.Name }))}`,
+    );
+  }
+
+  /**
+   * @description: 鑷畾涔夊垹闄ゆ柟娉�
+   * @param {Fn} args
+   * @param {*} params
+   * @return {*}
+   */
+  function Del(args: Fn[], params: {}) {
+    const reload = args[1];
+    DeleteLabelTemplate(params['record']['ID']).then((action) => {
+      if (action.IsSuccessed) {
+        reload();
+      }
+    });
   }
 
   return [methods, ActionColumn];

--
Gitblit v1.9.3