From 226ad601bb8326814c3e94efd6f476014f6a9e66 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 27 六月 2024 23:06:47 +0800 Subject: [PATCH] 产品工艺路线工序配置更新 --- src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts | 643 ++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 426 insertions(+), 217 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts index 69b5dd5..0654eb0 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-27 19:19:49 + * @LastEditTime: 2024-06-27 22:57:45 */ import { Ref, ref, unref } from 'vue'; @@ -16,7 +16,6 @@ import { NavItem } from '/@/api/tigerapi/model/basModel'; import { useMessage } from '/@/hooks/web/useMessage'; import { useModal } from '/@/components/Modal'; -import { V_MES_ROUTE_PTREE } from '/@/api/tigerapi/model/router'; const { t } = useI18n(); const { createErrorModal } = useMessage(); @@ -82,198 +81,371 @@ data.fieldNames = { key: 'tid', title: 'name' }; return data; }, - GetCrudForm: () => { - return [ - { - field: 'PROD_CODE', - label: '浜у搧缂栫爜', - component: 'Input', - dynamicDisabled: ({ values }) => { - return true; - }, - colProps: { span: 12 }, - }, - { - field: 'ID', - label: 'ID', - component: 'Input', - show: false, - }, - { - field: 'ACT_ID', - label: 'ACT_ID', - component: 'Input', - show: false, - }, - { - field: 'ROT_ID', - label: 'ROT_ID', - component: 'Input', - show: false, - }, - { - field: 'ACT_CODE', - label: 'ACT_CODE', - component: 'Input', - show: false, - }, - { - field: 'NODE_ID', - label: 'NODE_ID', - component: 'Input', - show: false, - }, - { - field: 'CUST_CODE', - label: '瀹㈡埛缂栫爜', - component: 'Input', - dynamicDisabled: ({ values }) => { - return true; - }, - colProps: { span: 12 }, - }, - { - field: 'ACT_TYPE', - label: '琛屼负绫诲瀷', - component: 'ApiSelect', - colProps: { span: 12 }, - defaultValue: 0, - componentProps: { - api: GetEnum, - params: { name: 'MES_PROD_ACTION+ACT_TYPEs' }, - resultField: 'Data', - labelField: unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name', - valueField: 'Value', - // onChange: (e, v) => { - // alert(e) - // console.log('ApiSelect====>:', e, v); - // }, - }, - }, - { - field: 'IS_ACTIVE', - label: '鏄惁鍚敤', - required: true, - component: 'Select', - colProps: { span: 12 }, - componentProps: { - options: [ - { - label: '鏄�', - value: 'Y', - key: 'Y', + GetCrudForm: (type: string) => { + let form: any[] = []; + switch (type) { + case 'Action': + form = [ + { + field: 'PROD_CODE', + label: '浜у搧缂栫爜', + component: 'Input', + dynamicDisabled: ({ values }) => { + return true; }, - { - label: '鍚�', - value: 'N', - key: 'N', + colProps: { span: 12 }, + }, + { + field: 'ID', + label: 'ID', + component: 'Input', + show: false, + }, + { + field: 'ACT_ID', + label: 'ACT_ID', + component: 'Input', + show: false, + }, + { + field: 'ROT_ID', + label: 'ROT_ID', + component: 'Input', + show: false, + }, + { + field: 'ACT_CODE', + label: 'ACT_CODE', + component: 'Input', + show: false, + }, + { + field: 'NODE_ID', + label: 'NODE_ID', + component: 'Input', + show: false, + }, + { + field: 'CUST_CODE', + label: '瀹㈡埛缂栫爜', + component: 'Input', + dynamicDisabled: ({ values }) => { + return true; }, - ], - }, - }, - { - field: 'RULE_CODE', - label: '鎵爜楠岃瘉', - component: 'Input', - colProps: { span: 10 }, - ifShow: ({ values }) => isScan(values.ACT_TYPE), - }, - { - field: '0', - label: '1', - defaultValue: '', - component: 'Input', - colProps: { span: 2, pull: 1 }, - ifShow: ({ values }) => isScan(values.ACT_TYPE), - colSlot: 'scanadd', - }, - { - field: 'ITEM_CODE', - label: '缁勮涓婃枡', - colProps: { span: 10 }, - component: 'Input', - ifShow: ({ values }) => isAssy(values.ACT_TYPE), - }, - { - field: '00', - label: '1', - defaultValue: '', - component: 'Input', - colProps: { span: 2, pull: 1 }, - ifShow: ({ values }) => isAssy(values.ACT_TYPE), - colSlot: 'assyadd', - }, - { - field: 'TEST_CODE', - label: '浜у搧娴嬭瘯', - colProps: { span: 10 }, - component: 'Input', - ifShow: ({ values }) => isTest(values.ACT_TYPE), - }, - { - field: 'test0', - label: '1', - defaultValue: '', - component: 'Input', - colProps: { span: 2, pull: 1 }, - ifShow: ({ values }) => isTest(values.ACT_TYPE), - colSlot: 'testadd', - }, - { - field: 'SAPL_CODE', - label: '浜у搧鎶芥', - colProps: { span: 10 }, - component: 'Input', - ifShow: ({ values }) => isAudit(values.ACT_TYPE), - }, - { - field: 'audit0', - label: '1', - defaultValue: '', - component: 'Input', - colProps: { span: 2, pull: 1 }, - ifShow: ({ values }) => isAudit(values.ACT_TYPE), - colSlot: 'auditadd', - }, - { - field: 'LABEL_CODE', - label: '鏍囩鎵撳嵃', - colProps: { span: 10 }, - component: 'Input', - ifShow: ({ values }) => isPrint(values.ACT_TYPE), - }, - { - field: 'print0', - label: '1', - defaultValue: '', - component: 'Input', - colProps: { span: 2, pull: 1 }, - ifShow: ({ values }) => isPrint(values.ACT_TYPE), - colSlot: 'printadd', - }, - { - field: 'pkgRULE_CODE', - label: '鍖呰瑙勫垯', - colProps: { span: 10 }, - component: 'Input', - ifShow: ({ values }) => isPackage(values.ACT_TYPE), - }, - { - field: 'pkg0', - label: '1', - defaultValue: '', - component: 'Input', - colProps: { span: 2, pull: 1 }, - ifShow: ({ values }) => isPackage(values.ACT_TYPE), - colSlot: 'pkgadd', - }, - { - field: 'REMARK', - label: '澶囨敞', - component: 'Input', - colProps: { span: 12 }, - }, - ]; + colProps: { span: 12 }, + }, + { + field: 'ACT_TYPE', + label: '琛屼负绫诲瀷', + component: 'ApiSelect', + colProps: { span: 12 }, + defaultValue: 0, + componentProps: { + api: GetEnum, + params: { name: 'MES_PROD_ACTION+ACT_TYPEs' }, + resultField: 'Data', + labelField: unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name', + valueField: 'Value', + // onChange: (e, v) => { + // alert(e) + // console.log('ApiSelect====>:', e, v); + // }, + }, + }, + { + field: 'IS_ACTIVE', + label: '鏄惁鍚敤', + required: true, + component: 'Select', + colProps: { span: 12 }, + componentProps: { + options: [ + { + label: '鏄�', + value: 'Y', + key: 'Y', + }, + { + label: '鍚�', + value: 'N', + key: 'N', + }, + ], + }, + }, + { + field: 'RULE_CODE', + label: '鎵爜楠岃瘉', + component: 'Input', + colProps: { span: 10 }, + ifShow: ({ values }) => isScan(values.ACT_TYPE), + }, + { + field: '0', + label: '1', + defaultValue: '', + component: 'Input', + colProps: { span: 2, pull: 1 }, + ifShow: ({ values }) => isScan(values.ACT_TYPE), + colSlot: 'scanadd', + }, + { + field: 'ITEM_CODE', + label: '缁勮涓婃枡', + colProps: { span: 10 }, + component: 'Input', + ifShow: ({ values }) => isAssy(values.ACT_TYPE), + }, + { + field: '00', + label: '1', + defaultValue: '', + component: 'Input', + colProps: { span: 2, pull: 1 }, + ifShow: ({ values }) => isAssy(values.ACT_TYPE), + colSlot: 'assyadd', + }, + { + field: 'TEST_CODE', + label: '浜у搧娴嬭瘯', + colProps: { span: 10 }, + component: 'Input', + ifShow: ({ values }) => isTest(values.ACT_TYPE), + }, + { + field: 'test0', + label: '1', + defaultValue: '', + component: 'Input', + colProps: { span: 2, pull: 1 }, + ifShow: ({ values }) => isTest(values.ACT_TYPE), + colSlot: 'testadd', + }, + { + field: 'SAPL_CODE', + label: '浜у搧鎶芥', + colProps: { span: 10 }, + component: 'Input', + ifShow: ({ values }) => isAudit(values.ACT_TYPE), + }, + { + field: 'audit0', + label: '1', + defaultValue: '', + component: 'Input', + colProps: { span: 2, pull: 1 }, + ifShow: ({ values }) => isAudit(values.ACT_TYPE), + colSlot: 'auditadd', + }, + { + field: 'LABEL_CODE', + label: '鏍囩鎵撳嵃', + colProps: { span: 10 }, + component: 'Input', + ifShow: ({ values }) => isPrint(values.ACT_TYPE), + }, + { + field: 'print0', + label: '1', + defaultValue: '', + component: 'Input', + colProps: { span: 2, pull: 1 }, + ifShow: ({ values }) => isPrint(values.ACT_TYPE), + colSlot: 'printadd', + }, + { + field: 'pkgRULE_CODE', + label: '鍖呰瑙勫垯', + colProps: { span: 10 }, + component: 'Input', + ifShow: ({ values }) => isPackage(values.ACT_TYPE), + }, + { + field: 'pkg0', + label: '1', + defaultValue: '', + component: 'Input', + colProps: { span: 2, pull: 1 }, + ifShow: ({ values }) => isPackage(values.ACT_TYPE), + colSlot: 'pkgadd', + }, + { + field: 'REMARK', + label: '澶囨敞', + component: 'Input', + colProps: { span: 12 }, + }, + ]; + break; + case 'Node': + form = [ + { + field: 'PROD_CODE', + label: '浜у搧缂栫爜', + component: 'Input', + dynamicDisabled: ({ values }) => { + return true; + }, + colProps: { span: 12 }, + }, + { + field: 'ID', + label: 'ID', + component: 'Input', + show: false, + }, + { + field: 'ACT_ID', + label: 'ACT_ID', + component: 'Input', + show: false, + }, + { + field: 'ROT_ID', + label: 'ROT_ID', + component: 'Input', + show: false, + }, + { + field: 'NODE_ID', + label: 'NODE_ID', + component: 'Input', + show: false, + }, + { + field: 'NODE_NAME', + label: '宸ュ簭鑺傜偣鍚嶇О', + component: 'Input', + }, + { + field: 'CUST_CODE', + label: '瀹㈡埛缂栫爜', + component: 'Input', + dynamicDisabled: ({ values }) => { + return true; + }, + colProps: { span: 12 }, + }, + { + field: 'OPER_CODE', + label: '宸ュ簭缂栫爜', + component: 'Input', + }, + { + field: 'IS_ACTIVE', + label: '鏄惁鍚敤', + required: true, + component: 'Select', + colProps: { span: 12 }, + componentProps: { + options: [ + { + label: '鏄�', + value: 'Y', + key: 'Y', + }, + { + label: '鍚�', + value: 'N', + key: 'N', + }, + ], + }, + }, + { + field: 'IS_CALC_FPY', + label: '鏄惁璁$畻鐩撮�氱巼', + required: true, + component: 'Select', + colProps: { span: 12 }, + componentProps: { + options: [ + { + label: '鏄�', + value: 'Y', + key: 'Y', + }, + { + label: '鍚�', + value: 'N', + key: 'N', + }, + ], + }, + }, + { + field: 'CAN_SKIP', + label: '鏄惁鍏佽璺崇珯', + required: true, + component: 'Select', + colProps: { span: 12 }, + componentProps: { + options: [ + { + label: '鏄�', + value: 'Y', + key: 'Y', + }, + { + label: '鍚�', + value: 'N', + key: 'N', + }, + ], + }, + }, + { + field: 'IS_INPUT', + label: '鏄惁鎶曞叆绔�', + required: true, + component: 'Select', + colProps: { span: 12 }, + componentProps: { + options: [ + { + label: '鏄�', + value: 'Y', + key: 'Y', + }, + { + label: '鍚�', + value: 'N', + key: 'N', + }, + ], + }, + }, + { + field: 'IS_OUTPUT', + 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', + colProps: { span: 12 }, + }, + ]; + break; + } + return form; }, /** * @description: 鑾峰彇琛ㄥ崟涓殑瀛楁鎻掓Ы鍒楄〃 @@ -292,38 +464,75 @@ if (!isNullOrEmpty(params['objParams'].value['CODE'])) { sqlcmd += `And PROD_CODE = '${params['objParams'].value['CODE']}'`; } - // if (!isNullOrEmpty(Cust_Code.value)) { - // sqlcmd += `And CUST_CODE = '${Cust_Code.value}'`; - // } - if (!isNullOrEmpty(params['selectedNodes'].value[0].code)) { - sqlcmd += `And ACT_ID = '${params['selectedNodes'].value[0].code}'`; + if (!isNullOrEmpty(params['selectedNodes'].value[0].cust)) { + sqlcmd += `And CUST_CODE = '${params['selectedNodes'].value[0].cust}'`; + } + if (!isNullOrEmpty(params['selectedNodes'].value[0].id)) { + sqlcmd += + params['selectedNodes'].value[0].type == 'Action' + ? `And ACT_ID = '${params['selectedNodes'].value[0].id}'` + : `And NODE_ID = '${params['selectedNodes'].value[0].id}'`; } getEntity({ sqlcmd: sqlcmd, - entityName: 'MES_PROD_ACTION', + entityName: + params['selectedNodes'].value[0].type == 'Action' ? 'MES_PROD_ACTION' : 'MES_PROD_OPER', }).then((res) => { params['resetFields'](); - params['setFieldsValue']({ - ID: res.Data.Items[0].ID, - ACT_ID: res.Data.Items[0].ACT_ID, - ROT_ID: res.Data.Items[0].ROT_ID, - NODE_ID: res.Data.Items[0].NODE_ID, - IS_ACTIVE: res.Data.Items[0].IS_ACTIVE, - ITEM_CODE: res.Data.Items[0].ITEM_CODE, - ACT_CODE: res.Data.Items[0].ACT_CODE, - REMARK: res.Data.Items[0].REMARK, - PROD_CODE: params['objParams'].value['CODE'], - ACT_TYPE: res.Data.Items[0].ACT_TYPE, - CUST_CODE: params['selectedNodes'].value[0].cust, - }); + if (params['selectedNodes'].value[0].type == 'Action') { + params['setFieldsValue']({ + ID: res.Data.Items[0].ID, + ACT_ID: res.Data.Items[0].ACT_ID, + ROT_ID: res.Data.Items[0].ROT_ID, + NODE_ID: res.Data.Items[0].NODE_ID, + IS_ACTIVE: res.Data.Items[0].IS_ACTIVE, + ITEM_CODE: res.Data.Items[0].ITEM_CODE, + RULE_CODE: res.Data.Items[0].RULE_CODE, + TEST_CODE: res.Data.Items[0].TEST_CODE, + SAPL_CODE: res.Data.Items[0].SAPL_CODE, + LABEL_CODE: res.Data.Items[0].LABEL_CODE, + PKG_CODE: res.Data.Items[0].PKG_CODE, + ACT_CODE: res.Data.Items[0].ACT_CODE, + REMARK: res.Data.Items[0].REMARK, + PROD_CODE: params['objParams'].value['CODE'], + ACT_TYPE: res.Data.Items[0].ACT_TYPE, + CUST_CODE: params['selectedNodes'].value[0].cust, + }); + } + if (params['selectedNodes'].value[0].type == 'Node') { + params['setFieldsValue']({ + ID: res.Data.Items[0].ID, + OPER_CODE: res.Data.Items[0].OPER_CODE, + ROT_ID: res.Data.Items[0].ROT_ID, + NODE_ID: res.Data.Items[0].NODE_ID, + NODE_NAME: res.Data.Items[0].NODE_NAME, + IS_ACTIVE: res.Data.Items[0].IS_ACTIVE, + IS_CALC_FPY: res.Data.Items[0].IS_CALC_FPY, + CAN_SKIP: res.Data.Items[0].CAN_SKIP, + IS_INPUT: res.Data.Items[0].IS_INPUT, + IS_OUTPUT: res.Data.Items[0].IS_OUTPUT, + REMARK: res.Data.Items[0].REMARK, + PROD_CODE: params['objParams'].value['CODE'], + CUST_CODE: params['selectedNodes'].value[0].cust, + }); + } }); }, /** * @description: 鑷畾涔夋彁浜ゆ柟娉� * @return {*} */ - SubmitFunc: (values: Recordable<any>, emit) => { - SaveEntity(values, true, 'MES_PROD_ACTION').then((action) => { + SubmitFunc: (values: Recordable<any>, type: string, emit) => { + let entityName = ''; + switch (type) { + case 'Action': + entityName = 'MES_PROD_ACTION'; + break; + case 'Node': + entityName = 'MES_PROD_OPER'; + break; + } + SaveEntity(values, true, entityName).then((action) => { if (action.IsSuccessed) { emit('success'); } @@ -437,9 +646,9 @@ * @param {string} type * @return {*} */ - GetTitle: () => { + GetTitle: (type: string) => { return { - configTitle: '琛屼负閰嶇疆', + configTitle: type == 'Action' ? '琛屼负閰嶇疆' : '宸ュ簭閰嶇疆', navTitle: '娣诲姞宸ヨ壓璺嚎', }; }, @@ -449,7 +658,7 @@ * @return {*} */ SelectNode: (selectedNodes: Ref<any[]>) => { - let result = { showConfig: false, showNav: false }; + let result = { showConfig: false, showNav: false, type: selectedNodes.value[0].type }; if (isNullOrUnDef(selectedNodes)) { return result; } @@ -457,7 +666,7 @@ result.showNav = true; result.showConfig = false; } - if (selectedNodes.value[0].type == 'Action') { + if (selectedNodes.value[0].type == 'Action' || selectedNodes.value[0].type == 'Node') { result.showNav = false; result.showConfig = true; } -- Gitblit v1.9.3