From 0fdfd2fe63697590d755f50ff8e7ae9bdf7f1f7d Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期二, 13 八月 2024 16:15:11 +0800 Subject: [PATCH] 工单绑定工艺更新 --- src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts | 406 ++++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 322 insertions(+), 84 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts b/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts index b729596..92ff1d9 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-08-04 16:44:05 + * @LastEditTime: 2024-08-13 16:05:42 */ import { Ref, h, ref, render, unref } from 'vue'; @@ -123,7 +123,7 @@ case 'Node': form = nodeFormShema; break; - case 'BAS_PKG_DTL': + default: form = crudForms[type]; break; } @@ -144,12 +144,35 @@ */ GetUseTables: (data: Ref<{}>, ...args) => { return { - Table: useTable({ + BAS_PKG_DTL: useTable({ title: '鍒楄〃淇℃伅', // api: getListByPage, // searchInfo: { TABLE_NAME: 'V_BAS_PKG_DTL' }, - dataSource: data.value['Table'], - columns: GetBaseColumns('', args[0], data), + dataSource: data.value['BAS_PKG_DTL'], + columns: GetBaseColumns('BAS_PKG_DTL', args[0], data), + maxHeight: 520, + useSearchForm: false, + showTableSetting: false, + bordered: true, + canResize: true, + showIndexColumn: false, + // rowSelection: { + // type: 'radio', //'checkbox' + // }, + actionColumn: { + width: 100, + title: '鎿嶄綔', + dataIndex: 'action', + slots: { customRender: 'action' }, + fixed: 'right', + }, //鑷畾涔夋搷浣滃垪 + }), + ItemCode: useTable({ + title: '鍒楄〃淇℃伅', + // api: getListByPage, + // searchInfo: { TABLE_NAME: 'V_BAS_PKG_DTL' }, + dataSource: data.value['ItemCode'], + columns: GetBaseColumns('ItemCode', args[0], data), maxHeight: 520, useSearchForm: false, showTableSetting: false, @@ -209,7 +232,7 @@ */ nodeChange: (params: { useForms: Ref<any>; objParams: Ref<any>; selectedNodes: any[] }) => new Promise<any>(async (resolve, reject) => { - let result = {}; + let result = { isShow: {} }; let sqlcmd = ' 1=1 '; if (!isNullOrEmpty(params['objParams'].value['CODE'])) { sqlcmd += `And WORK_ORDER = '${params['objParams'].value['CODE']}'`; @@ -253,19 +276,34 @@ PROD_CODE: params['selectedNodes'][0].prod, OPTION_1: res.Data.Items[0].OPTION_1, }); - result['isShow'] = isNullOrEmpty(res.Data.Items[0].PKG_CODE) ? false : true; - const ents = await getEntity({ - sqlcmd: `RULE_CODE ='${res.Data.Items[0].PKG_CODE}'`, - entityName: 'V_BAS_PKG_DTL', - order: '', - }); - result['Table'] = isNullOrEmpty(res.Data.Items[0].OPTION_1) - ? 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; + /* 濡傛灉鏄寘瑁呰鍒� */ + if (res.Data.Items[0].ACT_TYPE == 6) { + result['name'] = 'BAS_PKG_DTL'; + result['isShow'] = { + BAS_PKG_DTL: isNullOrEmpty(res.Data.Items[0].PKG_CODE) ? false : true, + ItemCode: false, + }; + const ents = await getEntity({ + sqlcmd: `RULE_CODE ='${res.Data.Items[0].PKG_CODE}'`, + entityName: 'V_BAS_PKG_DTL', + order: '', + }); + result['BAS_PKG_DTL'] = isNullOrEmpty(res.Data.Items[0].OPTION_1) + ? 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; + } /* 濡傛灉鏄粍瑁呬笂鏂� */ + if (res.Data.Items[0].ACT_TYPE == 2) { + result['name'] = 'ItemCode'; + result['ItemCode'] = JSON.parse(res.Data.Items[0].OPTION_1); + result['isShow'] = { + BAS_PKG_DTL: false, + ItemCode: true, + }; + } result['Action'] = res.Data.Items; } if (params['selectedNodes'][0].type == 'Node') { @@ -287,6 +325,11 @@ CUST_CODE: params['selectedNodes'][0].cust, PROD_CODE: params['selectedNodes'][0].prod, }); + result['name'] = 'Node'; + result['isShow'] = { + BAS_PKG_DTL: false, + ItemCode: false, + }; } resolve(result); } catch (e) { @@ -355,15 +398,29 @@ value: { RULE_CODE: d.values['val'], }, - isShow: false, + isShow: { BAS_PKG_DTL: false, ItemCode: false }, }; break; case 'assyadd': + const items = d.values['val'].split(','); + let data: any[] = []; + if (!isNullOrEmpty(items) && items.length > 0) { + items.map((x) => { + data.push({ + ITEM_CODE: x, + RULE_CODE: '', + IsBatchItem: 'N', + QTY: 1, + }); + }); + } value = { value: { ITEM_CODE: d.values['val'], }, - isShow: false, + isShow: { BAS_PKG_DTL: false, ItemCode: true }, + data: data, + name: 'ItemCode', }; break; case 'printadd': @@ -371,7 +428,7 @@ value: { LABEL_CODE: d.values['val'], }, - isShow: false, + isShow: { BAS_PKG_DTL: false, ItemCode: false }, }; break; case 'pkgadd': @@ -384,8 +441,9 @@ value: { PKG_CODE: d.values['val'], }, - isShow: true, + isShow: { BAS_PKG_DTL: true, ItemCode: false }, data: ents.Data.Items, + name: 'BAS_PKG_DTL', }; break; case 'addRoute': @@ -465,11 +523,11 @@ * @param {string} type * @return {*} */ - GetTitle: (type: string) => { + GetTitle: (type: string, item) => { return { configTitle: type == 'Action' ? '琛屼负閰嶇疆' : '宸ュ簭閰嶇疆', navTitle: type == 'Product' ? '娣诲姞宸ヨ壓璺嚎' : '宸ヨ壓璺嚎缁存姢', - tableTitle: type == 'Action' ? '鍖呰灞傜骇鍒楄〃' : '', + tableTitle: type == 'Action' ? (item == 'ItemCode' ? '涓婃枡鍒楄〃' : '鍖呰灞傜骇鍒楄〃') : '', }; }, /** @@ -483,7 +541,7 @@ showNav: false, type: selectedNodes.value[0].type, nodes: selectedNodes.value, - showOtherTable: false, + showOtherTable: { BAS_PKG_DTL: false, ItemCode: false }, }; if (isNullOrUnDef(selectedNodes)) { return result; @@ -491,15 +549,15 @@ if (selectedNodes.value[0].type == 'WorkOrder' || selectedNodes.value[0].type == 'Route') { result.showNav = true; result.showConfig = false; - result.showOtherTable = false; + result.showOtherTable = { BAS_PKG_DTL: false, ItemCode: false }; } if (selectedNodes.value[0].type == 'Action' || selectedNodes.value[0].type == 'Node') { result.showNav = false; result.showConfig = true; if (selectedNodes.value[0].type == 'Action') { - result.showOtherTable = true; + result.showOtherTable = { BAS_PKG_DTL: false, ItemCode: false }; } else { - result.showOtherTable = false; + result.showOtherTable = { BAS_PKG_DTL: false, ItemCode: false }; } } return result; @@ -656,12 +714,35 @@ * @return {*} */ CustFunc: async (param: CustModalParams) => { - param.data.value['Table'].map((x) => { - if (x.PKG_CODE == param.values['PKG_CODE']) { - x.LABEL_CODE = param.values['LABEL_CODE']; - } - }); - param.data.value['Action'][0]['OPTION_1'] = JSON.stringify(param.data.value['Table']); + switch (param['ctype']) { + case 'BAS_PKG_DTL': + // const ents = await getEntity({ + // sqlcmd: `PKG_RULE_ID ='${param.values['PKG_RULE_ID']}'`, + // entityName: 'V_BAS_PKG_DTL', + // order: '', + // }); + // param.data.value['Table'] = ents.Data.Items; + param.data.value['BAS_PKG_DTL'].map((x) => { + if (x.PKG_CODE == param.values['PKG_CODE']) { + x.LABEL_CODE = param.values['LABEL_CODE']; + } + }); + param.data.value['Action'][0]['OPTION_1'] = JSON.stringify( + param.data.value['BAS_PKG_DTL'], + ); + break; + case 'ItemCode': + param.data.value['ItemCode'].map((x) => { + if (x.ITEM_CODE == param.values['ITEM_CODE']) { + x.IsBatchItem = param.values['IsBatchItem']; + x.RULE_CODE = param.values['RULE_CODE']; + } + }); + param.data.value['Action'][0]['OPTION_1'] = JSON.stringify( + param.data.value['ItemCode'], + ); + break; + } }, /** * @description: 鑾峰彇鍙抽敭鑿滃崟鍒楄〃 @@ -709,54 +790,146 @@ * @return {*} */ function GetBaseColumns(type: string, emit, data: Ref<{}>) { - columns = [ - { - dataIndex: 'PKG_RULE_ID', - title: '鍖呰瑙勫垯ID', - ifShow: false, - sorter: true, - resizable: true, - }, - { - dataIndex: 'PKG_CODE', - title: '鍖呰缂栫爜', - ifShow: false, - sorter: true, - resizable: true, - customRender: () => {}, - }, - { - dataIndex: 'PKG_NAME', - title: '鍖呰鍚嶇О', - ifShow: true, - sorter: true, - resizable: true, - customRender: () => {}, - }, - { - dataIndex: 'PKG_QTY', - title: '鍖呰鏁伴噺', - ifShow: true, - sorter: true, - resizable: true, - customRender: () => {}, - }, - { - dataIndex: 'PKG_LEVEL', - title: '鍖呰灞傜骇', - ifShow: true, - sorter: true, - resizable: true, - customRender: () => {}, - }, - { - dataIndex: 'LABEL_CODE', - title: '鏍囩妯℃澘缂栫爜', - ifShow: true, - sorter: true, - resizable: true, - }, - ]; + switch (type) { + case 'BAS_PKG_DTL': + columns = [ + { + dataIndex: 'PKG_RULE_ID', + title: '鍖呰瑙勫垯ID', + ifShow: false, + sorter: true, + resizable: true, + }, + { + dataIndex: 'PKG_CODE', + title: '鍖呰缂栫爜', + ifShow: false, + sorter: true, + resizable: true, + customRender: () => {}, + }, + { + dataIndex: 'PKG_NAME', + title: '鍖呰鍚嶇О', + ifShow: true, + sorter: true, + resizable: true, + customRender: () => {}, + }, + { + dataIndex: 'PKG_QTY', + title: '鍖呰鏁伴噺', + ifShow: true, + sorter: true, + resizable: true, + customRender: () => {}, + }, + { + dataIndex: 'PKG_LEVEL', + title: '鍖呰灞傜骇', + ifShow: true, + sorter: true, + resizable: true, + customRender: () => {}, + }, + { + dataIndex: 'LABEL_CODE', + title: '鏍囩妯℃澘缂栫爜', + // edit: true, + // editRule: true, + ifShow: true, + sorter: true, + resizable: true, + // editComponent: 'Input', + // editComponentProps: (column) => { + // return { + // onClick: (event) => { + // console.log(column); + // }, + // }; + // }, + // customCell: (record, rowIndex) => { + // return { + // onClick: (event) => { + // console.log(record); + // }, + // }; + // }, + }, + ] as BasicColumn[]; + break; + case 'ItemCode': + /* + public string ITEM_CODE { get; set; } + public string RULE_CODE { get; set; } + /// <summary> + /// 鏄惁鎵规鐗╂枡 + /// </summary> + public bool IsBatchItem { get; set; } + /// <summary> + /// 涓婃枡鏁伴噺 + /// </summary> + public int QTY { get; set; } + */ + columns = [ + { + dataIndex: 'ITEM_CODE', + title: '鐗╂枡缂栫爜', + ifShow: true, + sorter: true, + resizable: true, + }, + { + dataIndex: 'RULE_CODE', + title: '瑙勫垯缂栫爜', + ifShow: true, + sorter: true, + resizable: true, + customRender: () => {}, + }, + { + dataIndex: 'IsBatchItem', + title: '鏄惁鎵规鐗╂枡', + ifShow: true, + sorter: true, + resizable: true, + customRender: () => {}, + }, + { + dataIndex: 'QTY', + title: '涓婃枡鏁伴噺', + ifShow: true, + sorter: true, + resizable: true, + customRender: () => {}, + }, + // { + // dataIndex: 'LABEL_CODE', + // title: '鏍囩妯℃澘缂栫爜', + // // edit: true, + // // editRule: true, + // ifShow: true, + // sorter: true, + // resizable: true, + // // editComponent: 'Input', + // // editComponentProps: (column) => { + // // return { + // // onClick: (event) => { + // // console.log(column); + // // }, + // // }; + // // }, + // // customCell: (record, rowIndex) => { + // // return { + // // onClick: (event) => { + // // console.log(record); + // // }, + // // }; + // // }, + // }, + ] as BasicColumn[]; + break; + } return columns; } /** @@ -1360,7 +1533,7 @@ label: '妯℃澘缂栫爜', component: 'Input', show: true, - required: true, + // required: true, colProps: { span: 22, }, @@ -1403,6 +1576,71 @@ show: false, }, ] as FormSchema[], + ItemCode: [ + { + label: '鐗╂枡缂栫爜', + field: 'ITEM_CODE', + component: 'Input', + colProps: { + span: 24, + }, + dynamicDisabled: ({ values }) => { + return false; + }, + }, + { + field: 'RULE_CODE', + label: '瑙勫垯缂栫爜', + component: 'Input', + colProps: { + span: 22, + }, + dynamicDisabled: ({ values }) => { + return false; + }, + }, + { + field: 'BAS_CODE_RULE1PSelect_0', //鎸変綆浠g爜閰嶇疆鐨勮鍒欙紝瀹炰綋鍚�+搴忓彿+PSelect_0锛屽簭鍙风敤鏉ュ尯鍒嗗涓殑鏃跺�欙紝PSelect_0杩欐槸涓浐瀹氬悗缂� + label: '1', + defaultValue: 'BAS_CODE_RULE', + component: 'Input', + colProps: { span: 2 }, + colSlot: 'BAS_CODE_RULE1add', //鎸変綆浠g爜閰嶇疆鐨勮鍒欙紝瀹炰綋鍚�+搴忓彿+add锛屽簭鍙风敤鏉ュ尯鍒嗗涓殑鏃跺�欙紝add杩欐槸涓浐瀹氬悗缂� + }, + { + label: '鏄惁鎵规鐗╂枡', + field: 'IsBatchItem', + colProps: { + span: 24, + }, + component: 'Select', + componentProps: { + options: [ + { + label: '鏄�', + value: 'Y', + key: 'Y', + }, + { + label: '鍚�', + value: 'N', + key: 'N', + }, + ], + }, + }, + { + label: '涓婃枡鏁伴噺', + field: 'QTY', + component: 'Input', + colProps: { + span: 24, + }, + dynamicDisabled: ({ values }) => { + return false; + }, + }, + ] as FormSchema[], }; return [methods]; -- Gitblit v1.9.3