From 3bf0e1e45acfb85fb6054dc55d1c1204a6750998 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期二, 24 九月 2024 23:53:53 +0800 Subject: [PATCH] 通用增删改模态窗口更新,工单维护更新 --- src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts | 483 +++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 373 insertions(+), 110 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts index 9b9144c..f2aa37f 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-08-04 01:13:27 + * @LastEditTime: 2024-09-23 01:57:24 */ import { Ref, h, ref, render, unref } from 'vue'; @@ -14,12 +14,7 @@ RouteToCust, RouteToProd, } from '/@/api/tigerapi/mes/router'; -import { - GetEnum, - SaveEntity, - convertToTree, - getEntity, -} from '/@/api/tigerapi/system'; +import { GetEnum, SaveEntity, convertToTree, getEntity } from '/@/api/tigerapi/system'; import { useLocale } from '/@/locales/useLocale'; import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; import { useI18n } from '/@/hooks/web/useI18n'; @@ -81,7 +76,7 @@ * @return {*} */ GetHomeUrl: () => { - return `/V_BAS_PROD/LC/${encodeURI(JSON.stringify({ ID: 'V_BAS_PROD', colSlots: [], crudColSlots: [] }))}`; + return `/V_BAS_PROD_R/LC/${encodeURI(JSON.stringify({ ID: 'V_BAS_PROD_R', colSlots: [], crudColSlots: [] }))}`; }, /** * @description: 鑾峰彇鏍戝舰鏁版嵁 @@ -119,9 +114,9 @@ case 'Node': form = nodeFormShema; break; - case 'BAS_PKG_DTL': + default: form = crudForms[type]; - break; + break; } return form; }, @@ -130,7 +125,15 @@ * @return {*} */ GetCrudColSlots: () => { - return ['scanadd', 'assyadd', 'testadd', 'auditadd', 'printadd', 'pkgadd']; + return [ + { name: 'scanadd', icon: 'search|svg' }, + { name: 'assyadd', icon: 'search|svg' }, + { name: 'testadd', icon: 'search|svg' }, + { name: 'auditadd', icon: 'search|svg' }, + { name: 'printadd', icon: 'search|svg' }, + { name: 'pkgadd', icon: 'search|svg' }, + { name: 'labeladd', icon: 'search|svg' }, + ]; }, /** * @description: 鍒囨崲鑺傜偣鏃朵簨浠舵柟娉� @@ -139,7 +142,7 @@ nodeChange: (params: { useForms: Ref<any>; objParams: Ref<any>; selectedNodes: any[] }) => new Promise<any>(async (resolve, reject) => { // params['useForms'].value = methods.GetUseForm(); - let result = {}; + let result = { isShow: {} }; let sqlcmd = ' 1=1 '; if (!isNullOrEmpty(params['objParams'].value['CODE'])) { sqlcmd += `And PROD_CODE = '${params['objParams'].value['CODE']}'`; @@ -183,14 +186,38 @@ PROD_CODE: params['objParams'].value['CODE'], ACT_TYPE: res.Data.Items[0].ACT_TYPE, CUST_CODE: params['selectedNodes'][0].cust, + OPTION_1: res.Data.Items[0].OPTION_1, + OPTION_2: res.Data.Items[0].OPTION_2, }); - 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'] = ents.Data.Items; + /* 濡傛灉鏄寘瑁呰鍒� */ + 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') { resetFieldsNode(); @@ -222,6 +249,12 @@ PROD_CODE: params['objParams'].value['CODE'], CUST_CODE: params['selectedNodes'][0].cust, }); + // result['Node'] = res.Data.Items; + result['name'] = 'Node'; + result['isShow'] = { + BAS_PKG_DTL: false, + ItemCode: false, + }; } resolve(result); } catch (e) { @@ -292,15 +325,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': @@ -308,7 +355,7 @@ value: { LABEL_CODE: d.values['val'], }, - isShow: false, + isShow: { BAS_PKG_DTL: false, ItemCode: false }, }; break; case 'pkgadd': @@ -321,8 +368,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': @@ -380,7 +428,7 @@ }; }, /** - * @description: 鑾峰彇琛ㄦ牸use鍒楄〃 + * @description: 鑾峰彇琛ㄦ牸use鍒楄〃锛岃繖閲岃窡涓婚〉闈紶杩囨潵鐨凮therTableName: ['BAS_PKG_DTL', 'ItemCode']鍐呯殑鍚嶇О鏄竴鑷寸殑銆� * @param {string} type * @param {array} args * @return {*} @@ -388,12 +436,35 @@ GetUseTables: (data: Ref<{}>, ...args) => { // data.value['Table'] = []; 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, @@ -452,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' ? '涓婃枡鍒楄〃' : '鍖呰灞傜骇鍒楄〃') : '', }; }, /** @@ -470,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.value)) { return result; @@ -478,15 +549,15 @@ if (selectedNodes.value[0].type == 'Product' || 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; @@ -582,7 +653,12 @@ }); break; case 'editRoute': - args[1](true, { rotId: args[2][0].id, slotName: '' }); + args[1](true, { + rotId: args[2][0].id, + slotName: '', + prodCode: args[3], + custCode: args[2][0].cust, + }); break; } }, @@ -637,15 +713,33 @@ * @param {array} args * @return {*} */ - CustFunc: async (param: CustModalParams, ...args) => { - if (param.ctype == 'BAS_PKG_DTL') { - let useTables = args[0]; - 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; + CustFunc: async (param: CustModalParams) => { + 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; } }, /** @@ -696,71 +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: '鏍囩妯℃澘缂栫爜', - // 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); - // }, - // }; - // }, - }, - ]; + 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; } @@ -1097,10 +1266,39 @@ colSlot: 'pkgadd', }, { + field: 'OPTION_2', + label: '鏄惁绉伴噸', + required: true, + component: 'Select', + colProps: { span: 12 }, + ifShow: ({ values }) => isPackage(values.ACT_TYPE), + componentProps: { + options: [ + { + label: '鏄�', + value: 'Y', + key: 'Y', + }, + { + label: '鍚�', + value: 'N', + key: 'N', + }, + ], + }, + }, + { field: 'REMARK', label: '澶囨敞', component: 'Input', colProps: { span: 12 }, + }, + { + field: 'OPTION_1', + label: '琛屼负閫夐」1', + component: 'Input', + colProps: { span: 12 }, + show: false, }, ]; @@ -1300,7 +1498,7 @@ colProps: { span: 12 }, }, ]; - + const crudForms = { BAS_PKG_DTL: [ { @@ -1352,7 +1550,7 @@ label: '妯℃澘缂栫爜', component: 'Input', show: true, - required: true, + // required: true, colProps: { span: 22, }, @@ -1395,6 +1593,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