From cdd0a28197fb9b432a45bbf9ebc0cfd8db939125 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 25 七月 2024 10:34:44 +0800 Subject: [PATCH] websocket更新,配置文件增加websocket地址 --- src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts | 102 ++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 85 insertions(+), 17 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts b/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts index 942ade7..0ee7fd2 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts @@ -4,11 +4,19 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-07-22 18:38:48 + * @LastEditTime: 2024-07-24 20:03:25 */ import { Ref, h, ref, render, unref } from 'vue'; -import { GetRoutePTree, GetWoPTree, RouteToCust, RouteToProd, SP_MES_PROD2WO, SP_MES_WO2CUST } from '/@/api/tigerapi/mes/router'; +import { + DeleteWoRoute, + GetRoutePTree, + GetWoPTree, + RouteToCust, + RouteToProd, + SP_MES_PROD2WO, + SP_MES_WO2CUST, +} from '/@/api/tigerapi/mes/router'; import { GetEnum, SaveEntity, convertToTree, getEntity } from '/@/api/tigerapi/system'; import { useLocale } from '/@/locales/useLocale'; import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; @@ -20,6 +28,9 @@ import { initRoute } from '../data'; import { CustModalParams } from '/@/api/tigerapi/model/systemModel'; import { useUserStore } from '/@/store/modules/user'; +import { EventDataNode } from 'ant-design-vue/lib/tree'; +import { ContextMenuItem } from '/@/components/TigerTree'; +import { UpdateWoStatus } from '/@/api/tigerapi/mes/wo'; const { t } = useI18n(); const { createErrorModal } = useMessage(); @@ -78,7 +89,7 @@ */ fetchTreeData: async (type: string, wo: string) => { let data = { title: '', treeData: [] as any[], fieldNames: {} }; - let prodTreeData = await GetWoPTree({wo: wo}); + let prodTreeData = await GetWoPTree({ wo: wo }); // let uniqueArr = prodTreeData.reduce((acc, current) => { // if (!acc.some((x) => x.pid == current.pid && x.id == current.id && x.seq == current.seq && x.type == current.type)) { // acc.push(current); @@ -86,7 +97,7 @@ // return acc; // }, [] as V_MES_ROUTE_PTREE[]); data.treeData = convertToTree(prodTreeData, 'pid', 'tid', 'root'); - if(data.treeData.length == 0){ + if (data.treeData.length == 0) { data.treeData.push({ pid: 'root', tid: '', @@ -94,7 +105,7 @@ wo: wo, prod: '', name: wo, - type: 'WorkOrder' + type: 'WorkOrder', }); } data.title = '宸ュ崟宸ヨ壓璺嚎'; @@ -277,15 +288,37 @@ }); return; } - let codes = d.values.id.split(','); - var i; - for (i = 0; i < codes.length; i++) { - if (d.which == 'addRoute') { - SP_MES_PROD2WO({ rotId: codes[i], wo: args[1]['CODE'] }); + /* 鏇存柊宸ュ崟鐘舵�佸苟鐢熸垚宸ュ崟鐨勫伐鑹鸿矾绾� */ + UpdateWoStatus({ + UserId: useUserStore().getUserInfo.userId as string, + WorkOrder: args[1]['CODE'], + Status: -1, + RouteStatus: 1, + }).then((action) => { + if (action.IsSuccessed) { + SP_MES_PROD2WO({ rotId: d.values.id, wo: args[1]['CODE'] }).then((action) => { + if (action.IsSuccessed) { + args[2](); + } else { + UpdateWoStatus({ + UserId: useUserStore().getUserInfo.userId as string, + WorkOrder: args[1]['CODE'], + Status: -1, + RouteStatus: 0, + }); + createErrorModal({ + title: t('sys.api.errorTip'), + content: t(action.LocaleMsg), + }); + } + }); + } else { + createErrorModal({ + title: t('sys.api.errorTip'), + content: t(action.LocaleMsg), + }); } - } - - args[2](); + }); break; case 'addCustomer': if (isNullOrEmpty(args[1]['CODE'])) { @@ -295,7 +328,7 @@ }); return; } - SP_MES_WO2CUST({ wo: args[1]['CODE']}); + SP_MES_WO2CUST({ wo: args[1]['CODE'] }); args[2](); break; @@ -442,10 +475,10 @@ }); return; } - SP_MES_WO2CUST({ wo: args[2][0]['wo']}); + SP_MES_WO2CUST({ wo: args[2][0]['wo'] }); break; case 'editRoute': - args[1](true, { rotId: args[2][0].id, slotName: '' }); + args[1](true, { rotId: args[2][0].code, slotName: '' }); break; } }, @@ -456,7 +489,7 @@ GetBaseCards: (type: string) => { let reusts: any[] = []; switch (type) { - case 'Product': + case 'WorkOrder': reusts = []; break; case 'Route': @@ -508,6 +541,41 @@ GetUseForm: () => { return {}; }, + /** + * @description: 鑾峰彇鍙抽敭鑿滃崟鍒楄〃 + * @param {EventDataNode} node + * @return {*} + */ + GetRightMenuList: (node: EventDataNode, ...args): ContextMenuItem[] => { + const emit = args[0]; + const menu = [ + // { + // label: '鏂板', + // handler: () => { + // console.log('鐐瑰嚮浜嗘柊澧�', node); + // }, + // icon: 'bi:plus', + // }, + { + label: '鍒犻櫎', + handler: () => { + console.log('鐐瑰嚮浜嗗垹闄�', node); + DeleteWoRoute({ rotId: '', rotCode: node.code, wo: node.wo }).then((action) => { + if (action.IsSuccessed) { + emit('deletenode', node); + } else { + createErrorModal({ + title: t('sys.api.errorTip'), + content: t(action.LocaleMsg), + }); + } + }); + }, + icon: 'bx:bxs-folder-open', + }, + ]; + return node.type == 'Route' ? menu : []; + }, }; /* 浠ヤ笅鏄唴閮ㄦ柟娉曪紝涓峞xport锛屼緵涓婇潰鐨勬柟娉曡皟鐢� */ -- Gitblit v1.9.3