From 914c18aa66a7fbde2d54a05cdf583138bf7f230b Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期日, 27 十月 2024 16:59:19 +0800
Subject: [PATCH] 计划任务更新

---
 src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts |   46 ++++++++++++++++++++++++++++++----------------
 1 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts
index a15001d..60af179 100644
--- a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts
+++ b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts
@@ -1,19 +1,20 @@
+/* eslint-disable no-var */
+/* eslint-disable no-fallthrough */
 /*
  * @Description: 浜у搧宸ヨ壓璺嚎鐩稿叧
  * @Author: Ben Lin
  * @version:
  * @Date: 2024-06-19 20:34:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-10-22 09:57:47
+ * @LastEditTime: 2024-10-24 01:21:57
  */
 
-import { Ref, h, ref, render, unref } from 'vue';
+import { Ref, unref } from 'vue';
 import {
   DeleteProdRoute,
   GetRoutePTree,
   RouteToCust,
   RouteToProd,
-  SetDefaultRoute,
 } from '/@/api/tigerapi/mes/router';
 import { GetEnum, SaveEntity, convertToTree, getEntity } from '/@/api/tigerapi/system';
 import { useLocale } from '/@/locales/useLocale';
@@ -33,6 +34,7 @@
 import { buildUUID } from '/@/utils/uuid';
 import { AddOrEditLabelVarByWorkOrder } from '/@/api/tigerapi/mes/wo';
 import { useProdRouteStore } from '/@/store/modules/prodRoute';
+import { useWebSocketStore } from '/@/store/modules/websocket';
 
 const { t } = useI18n();
 const { createErrorModal } = useMessage();
@@ -91,12 +93,12 @@
      * @return {*}
      */
     fetchTreeData: async (type: string, itemCode: string) => {
-      let data = { title: '', treeData: [] as any[], fieldNames: {} };
-      let prodTreeData = (await GetRoutePTree({
+      const data = { title: '', treeData: [] as any[], fieldNames: {} };
+      const prodTreeData = (await GetRoutePTree({
         prodCode: itemCode,
         orgCode: useUserStore().getUserInfo.orgCode,
       })) as unknown as MesRotTree[];
-      let _treeData = convertToTree(prodTreeData, 'pid', 'tid', 'root');
+      const _treeData = convertToTree(prodTreeData, 'pid', 'tid', 'root');
       data.title = '宸ヨ壓璺嚎';
       data.fieldNames = { key: 'tid', title: 'name' };
       if (
@@ -170,7 +172,7 @@
     nodeChange: (params: { useForms: Ref<any>; objParams: Ref<any>; selectedNodes: any[] }) =>
       new Promise<any>(async (resolve, reject) => {
         // params['useForms'].value = methods.GetUseForm();
-        let result = { isShow: {} };
+        const result = { isShow: {} };
         let sqlcmd = ' 1=1 ';
         if (!isNullOrEmpty(params['objParams'].value['CODE'])) {
           sqlcmd += `And PROD_CODE = '${params['objParams'].value['CODE']}'`;
@@ -233,9 +235,7 @@
                 ? ents.Data.Items
                 : JSON.parse(res.Data.Items[0].OPTION_1);
               /* 濡傛灉OPTION_1瀛楁涓虹┖灏辨妸鍖呰淇℃伅杞琂SON瀛樺埌OPTION_1瀛楁 */
-              res.Data.Items[0].OPTION_1 = isNullOrEmpty(res.Data.Items[0].OPTION_1)
-                ? JSON.stringify(ents.Data.Items)
-                : res.Data.Items[0].OPTION_1;
+              res.Data.Items[0].OPTION_1 = JSON.stringify(result['BAS_PKG_DTL']);
             } /* 濡傛灉鏄粍瑁呬笂鏂� */
             if (res.Data.Items[0].ACT_TYPE == 2) {
               result['name'] = 'ItemCode';
@@ -395,7 +395,7 @@
           break;
         case 'assyadd':
           const items = d.values['val'].split(',');
-          let data: any[] = [];
+          const data: any[] = [];
           if (!isNullOrEmpty(items) && items.length > 0) {
             items.map((x) => {
               data.push({
@@ -446,7 +446,7 @@
             });
             return;
           }
-          let codes = d.values.id.split(',');
+          const codes = d.values.id.split(',');
           var i;
           for (i = 0; i < codes.length; i++) {
             if (d.which == 'addRoute') {
@@ -464,7 +464,7 @@
             });
             return;
           }
-          let rotIds = d.ROT_ID.split(',');
+          const rotIds = d.ROT_ID.split(',');
           var i;
           for (i = 0; i < rotIds.length; i++) {
             RouteToCust({ rotId: rotIds[i], prodCode: args[1]['CODE'], custCode: d.CUST_CODE });
@@ -627,7 +627,7 @@
      * @return {*}
      */
     SelectNode: (selectedNodes: Ref<any[]>, code: string) => {
-      let result = {
+      const result = {
         showConfig: false,
         showNav: false,
         type: selectedNodes.value[0].type,
@@ -853,7 +853,7 @@
               resolve('OK');
               break;
             case 'BAS_LABEL_VAR_WO':
-              param.values['WORK_ORDER'] = param.others['WORK_ORDER'];
+              param.values['PROD_CODE'] = param.others['PROD_CODE'];
               param.values['ID'] = buildUUID();
               var action = await AddOrEditLabelVarByWorkOrder(
                 param.values as unknown as BAS_LABEL_VAR_WO,
@@ -863,6 +863,14 @@
               /* 璁剧疆榛樿宸ヨ壓璺嚎 */
               var action = await useProdRoute.setDefaulRoute(param);
               resolve(action);
+            case 'delete':
+              const webSocketStore = useWebSocketStore();
+              if (webSocketStore.GetSocketState == 1) {
+                webSocketStore.sendMessage(
+                  `wsGetNew ${param.values['LABEL_ID']}_#_${param.values['PROD_CODE']}`,
+                );
+              }
+              break;
           }
         } catch (e) {
           reject(e);
@@ -1846,11 +1854,17 @@
       title: '宸ュ崟鍙�',
       dataIndex: 'WORK_ORDER',
       width: 280,
-      editRow: true,
+      // editRow: true,
       // editable: true,
       ifShow: false,
     },
     {
+      title: '宸ュ崟鍙�',
+      dataIndex: 'PROD_CODE',
+      width: 280,
+      ifShow: false,
+    },
+    {
       title: '鍙橀噺鍚�',
       dataIndex: 'VAR_NAME',
     },

--
Gitblit v1.9.3