From 3d2c48733b86a03fc2e5a1f12ac3667ab0863b80 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期五, 08 十一月 2024 01:03:56 +0800
Subject: [PATCH] 标签模板,主页,默认工艺路线更新

---
 src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts |  107 +++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 83 insertions(+), 24 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts
index 25b7921..5169b8a 100644
--- a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts
+++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts
@@ -4,7 +4,7 @@
  * @version:
  * @Date: 2024-06-19 20:34:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-07-31 23:07:14
+ * @LastEditTime: 2024-10-22 11:40:44
  */
 
 import { Tag, Tooltip } from 'ant-design-vue';
@@ -26,8 +26,7 @@
   BasLabelTempInput,
 } from '/@/api/tigerapi/model/mesModel';
 import { useUserStore } from '/@/store/modules/user';
-import { uploadApi } from '/@/api/sys/upload';
-import { useWebSocketStore } from '/@/store/modules/websocket';
+import { cloneDeep } from 'lodash-es';
 
 const { getLocale } = useLocale();
 
@@ -168,7 +167,7 @@
           component: 'Input',
           isexist: 'N',
           show: true,
-          required: true,
+          // required: true,
           colProps: {
             span: 7,
           },
@@ -348,6 +347,15 @@
     GetNewRow: (type: string) => {
       let values = {};
       switch (type) {
+        case 'BAS_LABEL_VAR':
+          values = {
+            VAR_NAME: '',
+            VAR_TYPE: '',
+            VAR_VALUE: '',
+            BARCODE_RULE: '',
+            REMARK: '',
+          };
+          break;
         case 'BAS_LABEL_VAR_WO':
           values = newRow;
           break;
@@ -382,7 +390,7 @@
     GetBaseCards: (type: string) => {
       return [
         {
-          name: 'BaseForm',
+          name: 'BaseForm', //绗竴涓崱鐗囧悕绉板繀闇�鏄疊aseForm
           slots: [],
           preIcons: {},
           title: '妯℃澘淇℃伅',
@@ -399,14 +407,15 @@
         {
           BAS_LABEL_VAR: useDrawer(),
         },
-        { BAS_LABEL_VAR_WO: useDrawer() },
+        // { BAS_LABEL_VAR_WO: useDrawer() },
       ];
-    } /**
+    },
+    /**
      * @description: 鑾峰彇琛ㄦ牸use鍒楄〃
      * @param {string} type
      * @param {array} args
      * @return {*}
-     */,
+     */
     GetUseTables: (data: Ref<{}>, ...args) => {
       // _data = data;
       return {
@@ -428,13 +437,13 @@
           // rowSelection: {
           //   type: 'radio', //'checkbox'
           // },
-          // actionColumn: {
-          //   width: 130,
-          //   title: '鎿嶄綔',
-          //   dataIndex: 'action',
-          //   slots: { customRender: 'action' },
-          //   fixed: 'right',
-          // }, //鑷畾涔夋搷浣滃垪
+          actionColumn: {
+            width: 130,
+            title: '鎿嶄綔',
+            dataIndex: 'action',
+            slots: { customRender: 'action' },
+            fixed: 'right',
+          }, //鑷畾涔夋搷浣滃垪
         }),
         BAS_LABEL_VAR_WO: useTable({
           title: '鍒楄〃淇℃伅',
@@ -542,13 +551,13 @@
           LABEL_CODE: label.LABEL_CODE,
           LABEL_NAME: label.LABEL_NAME,
           TEMP_TYPE: label.TEMP_TYPE,
-          TEMP_PATH: label.TEMP_PATH[0],
+          TEMP_PATH: label.TEMP_PATH,
           CUST_CODE: label.CUST_CODE,
           PROD_CODE: label.PROD_CODE,
           REMARK: '',
         } as unknown as BAS_LABEL_TEMP,
-        LabelVars: {} as unknown as BAS_LABEL_VAR[],
-        LabelVarWos: {} as unknown as BAS_LABEL_VAR_WO[],
+        LabelVars: [] as unknown as BAS_LABEL_VAR[],
+        LabelVarWos: [] as unknown as BAS_LABEL_VAR_WO[],
       };
       drawers.forEach((d) => {
         let where = `${d['code']} = '${keyFieldValues.value[d['code']]}'`;
@@ -717,6 +726,27 @@
         }
       });
     },
+    /**
+     * @desc 淇濆瓨鏂规硶
+     */
+    SaveRow: (param: CustModalParams) => {
+      return new Promise((resolve, reject) => {
+        try {
+          param.data.value[param.cType] = param.data.value[param.cType].map((d) => {
+            if (d.ID == param.values['ID']) {
+              d.VAR_NAME = param.values['VAR_NAME'];
+              d.VAR_TYPE = param.values['VAR_TYPE'];
+              d.VAR_VALUE = param.values['VAR_VALUE'];
+              d.BARCODE_RULE = param.values['BARCODE_RULE'];
+              d.REMARK = param.values['REMARK'];
+            }
+            return d;
+          });
+        } catch {
+          reject(false);
+        }
+      });
+    },
   };
 
   let columns: BasicColumn[] = [];
@@ -739,13 +769,14 @@
         title: '鍙橀噺鍚嶇О',
         ifShow: true,
         sorter: true,
+        editRow: true,
         resizable: true,
         customRender: () => {},
       },
       {
         dataIndex: 'VAR_TYPE',
         title: '鍙橀噺绫诲瀷',
-        edit: true,
+        editRow: true,
         editRule: true,
         ifShow: true,
         sorter: true,
@@ -759,7 +790,11 @@
             labelField: unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name',
             valueField: 'Value',
             onChange: (e, v) => {
-              if (e == 1) {
+              if (e == 1 || e == 4) {
+                const where =
+                  e == 1
+                    ? { TABLE_NAME: 'BAS_LABEL_PV', VAR_TYPE: 0 }
+                    : { TABLE_NAME: 'BAS_LABEL_PV', VAR_TYPE: 1 };
                 emit('opencust', {
                   data: column.record,
                   name: 'BAS_LABEL_VAR',
@@ -793,7 +828,7 @@
                     ],
                     tableName: 'BAS_LABEL_PV',
                     rowKey: 'VAR_CODE',
-                    searchInfo: { TABLE_NAME: 'BAS_LABEL_PV' },
+                    searchInfo: where,
                   },
                 });
               }
@@ -820,6 +855,10 @@
               text = '鑷畾涔夊彉閲�';
               color = '#bfbfbf';
               break;
+            case 4:
+              text = '鏉$爜鐢熸垚';
+              color = '#b442df';
+              break;
           }
           return h(Tooltip, { title: text }, () => h(Tag, { color: color }, () => text));
         },
@@ -833,7 +872,7 @@
             {
               dataIndex: 'VAR_VALUE',
               title: '鍙橀噺鍊�',
-              edit: true,
+              editRow: true,
               // editable: true,
               editRule: true,
               ifShow: (column) => true,
@@ -841,9 +880,29 @@
               resizable: true,
             },
             {
+              dataIndex: 'BARCODE_RULE',
+              title: '鏉$爜鐢熸垚瑙勫垯',
+              ifShow: true,
+              editRow: true,
+              editRule: true,
+              sorter: true,
+              resizable: true,
+              editComponent: 'ApiSelect',
+              editComponentProps: (column) => {
+                return {
+                  api: getEntity,
+                  params: { entityName: 'BAS_CODE_RULE', sqlcmd: ' 1=1 ' },
+                  resultField: 'Data.Items',
+                  labelField: 'RULE_NAME',
+                  valueField: 'RULE_CODE',
+                };
+              },
+            },
+            {
               dataIndex: 'REMARK',
               title: '澶囨敞',
               ifShow: true,
+              editRow: true,
               sorter: true,
               resizable: true,
             },
@@ -884,8 +943,8 @@
                 title: `锛堝彉閲忥級${x.VAR_NAME}榛樿鍊糮,
                 dataIndex: `DEFAULT_VALUE_${x.VAR_NAME}`,
                 width: 280,
-                edit: true,
-                editRule: true,
+                // edit: true,
+                // editRule: true,
                 resizable: true,
                 ifShow: true,
               },

--
Gitblit v1.9.3