From efcc2e97beb8c3b05f422fe7efafa059447473de Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 01 八月 2024 17:23:58 +0800 Subject: [PATCH] 产品绑定工艺路线更新 --- src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts | 113 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 91 insertions(+), 22 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts index 511f9a2..71f97eb 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts @@ -4,11 +4,11 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-29 02:57:03 + * @LastEditTime: 2024-08-01 17:17:09 */ import { Ref, h, ref, render, unref } from 'vue'; -import { GetRoutePTree, RouteToCust, RouteToProd } from '/@/api/tigerapi/mes/router'; +import { DeleteProdRoute, GetRoutePTree, RouteToCust, RouteToProd } 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'; @@ -18,6 +18,10 @@ import { useModal } from '/@/components/Modal'; import { FormSchema } from '/@/components/Table'; 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'; const { t } = useI18n(); const { createErrorModal } = useMessage(); @@ -76,7 +80,7 @@ */ fetchTreeData: async (type: string, itemCode: string) => { let data = { title: '', treeData: [] as any[], fieldNames: {} }; - let prodTreeData = await GetRoutePTree(itemCode); + let prodTreeData = await GetRoutePTree({prodCode: itemCode, orgCode: useUserStore().getUserInfo.orgCode}); // 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); @@ -139,6 +143,7 @@ sqlcmd: sqlcmd, entityName: params['selectedNodes'].value[0].type == 'Action' ? 'MES_PROD_ACTION' : 'MES_PROD_OPER', + order: '', }).then((res) => { params['resetFields'](); if (params['selectedNodes'].value[0].type == 'Action') { @@ -173,6 +178,7 @@ CAN_SKIP: res.Data.Items[0].CAN_SKIP, IS_INPUT: res.Data.Items[0].IS_INPUT, IS_OUTPUT: res.Data.Items[0].IS_OUTPUT, + ALLOW_DFT_IN: res.Data.Items[0].ALLOW_DFT_IN, REMARK: res.Data.Items[0].REMARK, PROD_CODE: params['objParams'].value['CODE'], CUST_CODE: params['selectedNodes'].value[0].cust, @@ -194,6 +200,8 @@ entityName = 'MES_PROD_OPER'; break; } + values.AUTH_ORG = useUserStore().getUserInfo.orgCode; + values.AUTH_PROD = useUserStore().getUserInfo.prodCode; SaveEntity(values, true, entityName).then((action) => { if (action.IsSuccessed) { emit('success'); @@ -254,6 +262,7 @@ value = { pkgRULE_CODE: d.values['val'], }; + break; case 'addRoute': if (isNullOrEmpty(args[1]['CODE'])) { createErrorModal({ @@ -387,8 +396,6 @@ */ navChangeItem: (action: any, ...args) => { switch (action) { - case 'editRoute': - break; case 'addRoute': args[0](true, { title: '宸ヨ壓璺嚎鍒楄〃', @@ -420,7 +427,7 @@ ], tableName: 'MES_ROUTE', rowKey: 'ROT_CODE', - returnFieldName: 'ROUTE_CODE', //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О + returnFieldName: ['ROUTE_CODE'], //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О searchInfo: { TABLE_NAME: 'MES_ROUTE' }, which: action, }); @@ -429,6 +436,9 @@ args[0](true, { title: '璇峰畬鎴愪互涓嬫楠�', }); + break; + case 'editRoute': + args[1](true, { rotId: args[2][0].id, slotName: '' }); break; } }, @@ -472,7 +482,7 @@ // newElement.textContent = 'New Element =>'+type; // newElement.style.height = '250px'; newElement.id = 'lfContainer'; - newElement.className = "h-full"; + newElement.className = 'h-full'; // newElement.style.color = 'blue'; // newElement.style.fontSize = '16px'; return newElement; @@ -483,10 +493,48 @@ * @param {array} args * @return {*} */ - CustFunc: (type: string | undefined, ...args) => { - if (type == 'Route') { - initRoute(args[0], args[1]); + CustFunc: (param: CustModalParams) => { + if (param.cType == 'Route') { + // initRoute(args[0], args[1]); } + }, + 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); + DeleteProdRoute({rotId:node.id,rotCode: node.code, prodCode: args[1]}).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: []; }, }; @@ -732,7 +780,7 @@ field: 'RULE_CODE', label: '鎵爜楠岃瘉', component: 'Input', - colProps: { span: 10 }, + colProps: { span: 11 }, ifShow: ({ values }) => isScan(values.ACT_TYPE), }, { @@ -740,14 +788,14 @@ label: '1', defaultValue: '', component: 'Input', - colProps: { span: 2, pull: 1 }, + colProps: { span: 1, pull: 1 }, ifShow: ({ values }) => isScan(values.ACT_TYPE), colSlot: 'scanadd', }, { field: 'ITEM_CODE', label: '缁勮涓婃枡', - colProps: { span: 10 }, + colProps: { span: 11 }, component: 'Input', ifShow: ({ values }) => isAssy(values.ACT_TYPE), }, @@ -756,14 +804,14 @@ label: '1', defaultValue: '', component: 'Input', - colProps: { span: 2, pull: 1 }, + colProps: { span: 1, pull: 1 }, ifShow: ({ values }) => isAssy(values.ACT_TYPE), colSlot: 'assyadd', }, { field: 'TEST_CODE', label: '浜у搧娴嬭瘯', - colProps: { span: 10 }, + colProps: { span: 11 }, component: 'Input', ifShow: ({ values }) => isTest(values.ACT_TYPE), }, @@ -772,14 +820,14 @@ label: '1', defaultValue: '', component: 'Input', - colProps: { span: 2, pull: 1 }, + colProps: { span: 1, pull: 1 }, ifShow: ({ values }) => isTest(values.ACT_TYPE), colSlot: 'testadd', }, { field: 'SAPL_CODE', label: '浜у搧鎶芥', - colProps: { span: 10 }, + colProps: { span: 11 }, component: 'Input', ifShow: ({ values }) => isAudit(values.ACT_TYPE), }, @@ -788,14 +836,14 @@ label: '1', defaultValue: '', component: 'Input', - colProps: { span: 2, pull: 1 }, + colProps: { span: 1, pull: 1 }, ifShow: ({ values }) => isAudit(values.ACT_TYPE), colSlot: 'auditadd', }, { field: 'LABEL_CODE', label: '鏍囩鎵撳嵃', - colProps: { span: 10 }, + colProps: { span: 11 }, component: 'Input', ifShow: ({ values }) => isPrint(values.ACT_TYPE), }, @@ -804,14 +852,14 @@ label: '1', defaultValue: '', component: 'Input', - colProps: { span: 2, pull: 1 }, + colProps: { span: 1, pull: 1 }, ifShow: ({ values }) => isPrint(values.ACT_TYPE), colSlot: 'printadd', }, { field: 'pkgRULE_CODE', label: '鍖呰瑙勫垯', - colProps: { span: 10 }, + colProps: { span: 11 }, component: 'Input', ifShow: ({ values }) => isPackage(values.ACT_TYPE), }, @@ -820,7 +868,7 @@ label: '1', defaultValue: '', component: 'Input', - colProps: { span: 2, pull: 1 }, + colProps: { span: 1, pull: 1 }, ifShow: ({ values }) => isPackage(values.ACT_TYPE), colSlot: 'pkgadd', }, @@ -995,6 +1043,27 @@ }, }, { + field: 'ALLOW_DFT_IN', + label: '鏄惁鍏佽涓嶈壇鍝佽繘绔�', + required: true, + component: 'Select', + colProps: { span: 12 }, + componentProps: { + options: [ + { + label: '鏄�', + value: 'Y', + key: 'Y', + }, + { + label: '鍚�', + value: 'N', + key: 'N', + }, + ], + }, + }, + { field: 'REMARK', label: '澶囨敞', component: 'Input', -- Gitblit v1.9.3