From af10c85c8f71ccdf2f60989a067804dd8b3aa667 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 26 六月 2024 19:21:13 +0800 Subject: [PATCH] 产品工艺路线更新 --- src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts | 2 src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue | 52 -- src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts | 412 +++++++++++++++++++++ src/views/tigerprojects/system/lowcode/entityts/QMS_INS_STD.ts | 4 src/views/tigerprojects/system/lowcode/composition/index.vue | 93 ---- src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts | 4 src/views/tigerprojects/system/lowcode/normal/mainTable.vue | 4 src/views/tigerprojects/system/lowcode/composition/Config.vue | 446 ++-------------------- src/views/tigerprojects/system/lowcode/composition/LeftTree.vue | 97 +++++ src/api/tigerapi/model/basModel.ts | 8 src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_PV.ts | 4 11 files changed, 593 insertions(+), 533 deletions(-) diff --git a/src/api/tigerapi/model/basModel.ts b/src/api/tigerapi/model/basModel.ts index 33d382b..c510a3a 100644 --- a/src/api/tigerapi/model/basModel.ts +++ b/src/api/tigerapi/model/basModel.ts @@ -109,7 +109,9 @@ export interface EntityCustFunctionType { CreateAction: (fnName: string) => {}; ActionItem: (params: Recordable<any>, data, ...args) => ActionItem[]; - EditeOperation: (data: Ref<any[]>, d, u) => void; + EditOperation: (data: Ref<any[]>, d, u) => void; + OpenSelectItem: (openItemModal: Fn, ...args) => void; + GetSelectSuccess: (d, u, ...args) => {}; GetHomeUrl: () => string; GetBaseColumns: () => []; GetSearchForm: () => []; @@ -117,4 +119,8 @@ GetBaseForm: () => []; GetBaseCards: () => []; OthersValues: (val: string, id: string) => {} + GetTitle: () => {}; + GetCrudColSlots: () => []; + nodeChange: ({}) => void, + CreateIcon: (params: Recordable<any>) => string; } diff --git a/src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue b/src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue index 4e21485..d59402e 100644 --- a/src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue +++ b/src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-20 12:13:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-25 00:07:08 + * @LastEditTime: 2024-06-26 16:00:06 --> <template> <Card title="娣诲姞宸ヨ壓"> @@ -29,11 +29,12 @@ import { useTabs } from '/@/hooks/web/useTabs'; import { useMessage } from '/@/hooks/web/useMessage'; + const objParams = inject('objParams') as Ref<any>; + const custImport = ref<any[]>(await import(`../entityts/${objParams.value['Name']}.ts`)); + const [{ EditeOperation, GetBaseColumns, GetSearchForm, GetCrudForm, OthersValues }] = + custImport.value['default'](); const { refreshPage } = useTabs(); const { createErrorModal } = useMessage(); - // const props = defineProps({ - // prodCode: { type: String }, - // }); const { t } = useI18n(); const [register, { openModal }] = useModal(); interface NavItem { @@ -43,7 +44,6 @@ url: string; action: string; } - const Prod_Code = inject('prodCode') as Ref<string>; // watch( // () => Prod_Code, @@ -71,42 +71,6 @@ url: '/addCustomer', action: 'addCustomer', }, - // { - // title: '閿�鍞嚭搴撳崟', - // icon: 'Out|svg', - // color: '#e18525', - // url: '/saleoutorder', - // }, - // { - // title: '瀹屽伐鍏ュ簱鍗�', - // icon: 'In|svg', - // color: '#3fb27f', - // url: '/finishedwarehouse', - // }, - // { - // title: '鐢熶骇閫�鏂欏崟', - // icon: 'materialret|svg', - // color: '#4daf1bc9', - // url: '/materialret', - // }, - // { - // title: '鐩樼偣鍗�', - // icon: 'inventory|svg', - // color: '#00d8ff', - // url: '/inventory', - // }, - // { - // title: '璋冩嫧鍗�', - // icon: 'transfer|svg', - // color: '#00d8ff', - // url: '/transfer', - // }, - // { - // title: '瀹炴椂搴撳瓨', - // icon: 'WmsItem|svg', - // color: '#00d8ff', - // url: '/WmsItem', - // }, ]; function changeItem(action) { openModal(true, { @@ -152,7 +116,7 @@ * @return {*} */ async function handleSuccess(d, u) { - if (isNullOrEmpty(Prod_Code.value)) { + if (isNullOrEmpty(objParams.value['CODE'])) { createErrorModal({ title: t('sys.api.errorTip'), content: '浜у搧涓虹┖锛屼笉鑳芥坊鍔犲伐鑹鸿矾绾匡紝璇风偣鍑诲乏渚ч�夋嫨浜у搧', @@ -163,9 +127,9 @@ var i; for (i = 0; i < codes.length; i++) { if (d.which == 'addRoute') { - await RouteToProd({ rotId: codes[i], prodCode: Prod_Code.value }); + await RouteToProd({ rotId: codes[i], prodCode: objParams.value['CODE'] }); } else { - await RouteToCust({ rotId: codes[i], prodCode: Prod_Code.value, custCode: '' }); + await RouteToCust({ rotId: codes[i], prodCode: objParams.value['CODE'], custCode: '' }); } } diff --git a/src/views/tigerprojects/system/lowcode/composition/Config.vue b/src/views/tigerprojects/system/lowcode/composition/Config.vue index 05bbb61..6bab5db 100644 --- a/src/views/tigerprojects/system/lowcode/composition/Config.vue +++ b/src/views/tigerprojects/system/lowcode/composition/Config.vue @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-24 23:44:31 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-25 21:34:33 + * @LastEditTime: 2024-06-26 18:45:42 --> <template> <Card title="琛屼负閰嶇疆"> @@ -27,209 +27,50 @@ </template> <script lang="ts" setup> import { Ref, inject, nextTick, onMounted, ref, unref, watch } from 'vue'; - import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; + import { BasicForm, useForm } from '/@/components/Form/index'; import { Card } from 'ant-design-vue'; import { useModal } from '/@/components/Modal'; import GeneralModal from '/@/views/components/GeneralModal.vue'; - import { useUserStore } from '/@/store/modules/user'; import { useI18n } from '/@/hooks/web/useI18n'; - import { GetEnum, getEntity } from '/@/api/tigerapi/system'; - import { useLocale } from '/@/locales/useLocale'; - import { isNullOrEmpty } from '/@/utils/is'; + import { isNullOrUnDef } from '/@/utils/is'; + import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel'; const { t } = useI18n(); - const { getLocale } = useLocale(); const emit = defineEmits(['success', 'register']); const [registerItemAdd, { openModal: openItemModal }] = useModal(); - const Prod_Code = inject('prodCode') as Ref<string>; - const ACT_ID = inject('actionCode') as Ref<string>; - const Cust_Code = inject('custCode') as Ref<string>; - const crudColSlots = ref<any>([ - 'scanadd', - 'assyadd', - 'testadd', - 'auditadd', - 'printadd', - 'pkgadd', + const objParams = inject('objParams') as Ref<any>; + const custImport = ref<any[]>([]); + const EntityCustFunction = ref([ + { + ActionItem(params, data, ...args) {}, + EditOperation(data, d, u) {}, + GetBaseColumns() {}, + GetSearchForm() {}, + GetCrudForm() {}, + GetCrudColSlots(val, id) {}, + OpenSelectItem(openItemModal: Fn, ...args) {}, + GetSelectSuccess(d, u, ...args) {}, + nodeChange(params: { + resetFields: any; + setFieldsValue: any; + objParams: Ref<any>; + selectedNodes: Ref<any[]>; + }) {}, + } as EntityCustFunctionType, ]); + /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ + try { + custImport.value = await import(`../entityts/${objParams.value['Name']}.ts`); + } catch (e) {} + const [{ GetCrudForm, GetCrudColSlots, nodeChange, OpenSelectItem, GetSelectSuccess }] = + isNullOrUnDef(custImport.value['default']) + ? EntityCustFunction.value + : custImport.value['default'](); + const crudColSlots = ref<any>(GetCrudColSlots()); - const isNormal = (type: number) => type === 0; - const isScan = (type: number) => type === 1; - const isAssy = (type: number) => type === 2; - const isTest = (type: number) => type === 3; - const isAudit = (type: number) => type === 4; - const isPrint = (type: number) => type === 5; - const isPackage = (type: number) => type === 6; - const formSchema: FormSchema[] = [ - { - field: 'PROD_CODE', - label: '浜у搧缂栫爜', - component: 'Input', - dynamicDisabled: ({ values }) => { - return true; - }, - colProps: { span: 12 }, - }, - { - field: 'ID', - label: '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', - }, - { - 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 }, - }, - ]; const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ labelWidth: 120, - schemas: formSchema, + schemas: GetCrudForm(), actionColOptions: { offset: 8, span: 24, @@ -241,46 +82,28 @@ submitButtonOptions: { text: '鎻愪氦', }, + submitFunc: customSubmitFunc, }); + /* 娉ㄥ叆閫変腑鑺傜偣鏁版嵁 */ + const selectedNodes = inject('selectedNodes') as Ref<any>; watch( - () => ACT_ID.value, - (newVal, oldVal) => { + () => selectedNodes.value, + (newVal, oldVal) => { nextTick(() => { - getActType(); + /* 鑺傜偣鍒囨崲浜嬩欢 */ + nodeChange({ resetFields, setFieldsValue, objParams, selectedNodes }); }); - }, - { deep: true, immediate: true }, -); + }, + { deep: true, immediate: true }, + ); onMounted(() => { - getActType(); + /* 鑺傜偣鍒囨崲浜嬩欢 */ + nodeChange({ resetFields, setFieldsValue, objParams, selectedNodes }); }); - function getActType() { - resetFields(); - let sqlcmd = ' 1=1 '; - if (!isNullOrEmpty(Prod_Code.value)) { - sqlcmd += `And PROD_CODE = '${Prod_Code.value}'`; - } - if (!isNullOrEmpty(Cust_Code.value)) { - sqlcmd += `And CUST_CODE = '${Cust_Code.value}'`; - } - if (!isNullOrEmpty(ACT_ID.value)) { - sqlcmd += `And ACT_ID = '${ACT_ID.value}'`; - } - getEntity({ - sqlcmd: sqlcmd, - entityName: 'MES_PROD_ACTION', - }).then((res) => { - setFieldsValue({ - PROD_CODE: Prod_Code.value, - ACT_TYPE: res.Data.Items[0].ACT_TYPE - }); - }); - } - - async function handleSubmit() { + async function customSubmitFunc() { // try { // const values = await validate(); // setDrawerProps({ confirmLoading: true }); @@ -303,163 +126,13 @@ // } } - const itemCodeModalCfg = { - title: '鐗╂枡鍒楄〃', - schemas: [ - { - field: 'ITEM_CODE', - component: 'Input', - label: '鐗╂枡缂栫爜', - colProps: { - span: 12, - }, - }, - ], - ItemColumns: [ - { - title: t('鐗╂枡缂栫爜'), - dataIndex: 'ITEM_CODE', - resizable: true, - sorter: true, - width: 200, - }, - { - title: t('鐗╂枡鍚嶇О'), - dataIndex: 'ITEM_NAME', - resizable: true, - sorter: true, - width: 180, - }, - ], - tableName: 'BAS_ITEM', - rowKey: 'ITEM_CODE', - searchInfo: { TABLE_NAME: 'BAS_ITEM' }, - }; - - const ruleModalCfg = { - title: '瑙勫垯鍒楄〃', - schemas: [ - { - field: 'RULE_CODE', - component: 'Input', - label: '瑙勫垯缂栫爜', - colProps: { - span: 12, - }, - }, - ], - ItemColumns: [ - { - title: t('瑙勫垯缂栫爜'), - dataIndex: 'RULE_CODE', - resizable: true, - sorter: true, - width: 200, - }, - { - title: t('瑙勫垯鍚嶇О'), - dataIndex: 'RULE_NAME', - resizable: true, - sorter: true, - width: 180, - }, - ], - tableName: 'BAS_CODE_RULE', - rowKey: 'RULE_CODE', - searchInfo: { TABLE_NAME: 'BAS_CODE_RULE' }, - }; - - const printModalCfg = { - title: '鎵撳嵃妯℃澘鍒楄〃', - schemas: [ - { - field: 'LABEL_CODE', - component: 'Input', - label: '妯℃澘缂栫爜', - colProps: { - span: 12, - }, - }, - ], - ItemColumns: [ - { - title: t('妯℃澘缂栫爜'), - dataIndex: 'LABEL_CODE', - resizable: true, - sorter: true, - width: 200, - }, - { - title: t('妯℃澘鍚嶇О'), - dataIndex: 'LABEL_NAME', - resizable: true, - sorter: true, - width: 180, - }, - ], - tableName: 'BAS_LABEL_TEMP', - rowKey: 'LABEL_CODE', - searchInfo: { TABLE_NAME: 'BAS_LABEL_TEMP' }, - }; - - const pkgModalCfg = { - title: '鍖呰瑙勫垯鍒楄〃', - schemas: [ - { - field: 'RULE_CODE', - component: 'Input', - label: '鍖呰瑙勫垯缂栫爜', - colProps: { - span: 12, - }, - }, - ], - ItemColumns: [ - { - title: t('鍖呰瑙勫垯缂栫爜'), - dataIndex: 'RULE_CODE', - resizable: true, - sorter: true, - width: 200, - }, - { - title: t('鍖呰瑙勫垯鍚嶇О'), - dataIndex: 'RULE_NAME', - resizable: true, - sorter: true, - width: 180, - }, - ], - tableName: 'BAS_PKG_RULE', - rowKey: 'RULE_CODE', - searchInfo: { TABLE_NAME: 'BAS_PKG_RULE' }, - }; - /** * @description: 鐐瑰嚮鎵撳紑寮瑰嚭閫夋嫨鍒楄〃妗� * @param {*} item * @return {*} */ function handleSelectItem(item) { - let config = {}; - switch (item) { - case 'scanadd': - config = ruleModalCfg; - break; - case 'assyadd': - config = itemCodeModalCfg; - break; - case 'testadd': - config = itemCodeModalCfg; - break; - case 'printadd': - config = printModalCfg; - break; - case 'pkgadd': - config = pkgModalCfg; - break; - } - openItemModal(true, config); + OpenSelectItem(openItemModal, item); } /** @@ -470,29 +143,6 @@ * @return {*} */ function handleItemSuccess(d, u, item) { - let value = {}; - switch (item) { - case 'scanadd': - value = { - RULE_CODE: d.values['val'], - }; - break; - case 'assyadd': - value = { - ITEM_CODE: d.values['val'], - }; - break; - case 'printadd': - value = { - LABEL_CODE: d.values['val'], - }; - break; - case 'pkgadd': - value = { - pkgRULE_CODE: d.values['val'], - }; - break; - } - setFieldsValue(value); + setFieldsValue(GetSelectSuccess(d, u, item)); } </script> diff --git a/src/views/tigerprojects/system/lowcode/composition/LeftTree.vue b/src/views/tigerprojects/system/lowcode/composition/LeftTree.vue new file mode 100644 index 0000000..33c6f61 --- /dev/null +++ b/src/views/tigerprojects/system/lowcode/composition/LeftTree.vue @@ -0,0 +1,97 @@ +<!-- + * @Description: 缁勫悎椤甸潰宸︿晶鏍戝舰 + * @Author: Ben Lin + * @version: + * @Date: 2024-06-26 15:31:43 + * @LastEditors: Ben Lin + * @LastEditTime: 2024-06-26 18:48:09 +--> +<template> + <GeneralTree + @select="handleSelect" + @UnSelect="UnSelect" + :title="title" + :treeData="treeData" + :create-icon="createIcon" + :fieldNames="fieldNames" + /><!-- + add + @handle-add="handleAdd" --> +</template> +<script lang="ts" setup> + import { Ref, inject, onMounted, ref } from 'vue'; + import { isNullOrUnDef } from '/@/utils/is'; + import GeneralTree from '/@/views/components/GeneralTree.vue'; + import { TreeItem } from '/@/components/TigerTree'; + import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel'; + + const objParams = inject('objParams') as Ref<any>; + const nodeType = inject('nodeType') as Ref<any>; + const selectedNodes = inject('selectedNodes') as Ref<any>; + const custImport = ref<any[]>([]); + const EntityCustFunction = ref([ + { + CreateIcon(params: Recordable<any>) {}, + } as EntityCustFunctionType, + ]); + /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ + try { + custImport.value = await import(`../entityts/${objParams.value['Name']}.ts`); + } catch (e) {} + const [{ CreateIcon }] = isNullOrUnDef(custImport.value['default']) + ? EntityCustFunction.value + : custImport.value['default'](); + const treeData = ref<TreeItem[]>([]); + const title = ref(''); + const fieldNames = ref({}); + + onMounted(async () => { + await fetch(objParams.value['Name']); + }); + + /** + * @description: 鏍戝舰鑺傜偣鍥炬爣 + * @param {*} params + * @param {*} type + * @return {*} + */ + function createIcon(params: Recordable<any>) { + return CreateIcon(params); + } + + /** + * @description: 鑾峰彇鏍戝舰鏁版嵁 + * @param {*} type + * @return {*} + */ + async function fetch(type: string) { + if (!isNullOrUnDef(custImport.value)) { + const [{ fetchTreeData }] = custImport.value['default'](); + //鏍规嵁type鑾峰彇鏍戝舰鏁版嵁 + const data = await fetchTreeData(type, objParams.value['CODE']); + title.value = data.title; + treeData.value = data.treeData; + fieldNames.value = data.fieldNames; + } + } + + function handleSelect(Id = '', info) { + // searchInfo.Id = Id; + nodeType.value = info.selectedNodes[0].type; + selectedNodes.value = info.selectedNodes; + // prodCode.value =rotType.value=='Product'? info.selectedNodes[0].code: prodCode.value; + // actionCode.value = rotType.value == 'Action' ? info.selectedNodes[0].code : actionCode.value; + // custCode.value = rotType.value == 'Customer' ? info.selectedNodes[0].code : custCode.value; + // reload(); + } + + /** + * @description: 鍙栨秷閫夋嫨鏃朵簨浠惰繑鍥炴柟娉� + * @param {*} node + * @return {*} + */ + function UnSelect(node) { + nodeType.value = ''; + // reload(); + } +</script> diff --git a/src/views/tigerprojects/system/lowcode/composition/index.vue b/src/views/tigerprojects/system/lowcode/composition/index.vue index 6d22739..9803491 100644 --- a/src/views/tigerprojects/system/lowcode/composition/index.vue +++ b/src/views/tigerprojects/system/lowcode/composition/index.vue @@ -8,22 +8,15 @@ :content="pageContent" @back="goBack" > - <GeneralTree - class="w-1/4 xl:w-1/5" - v-if="isMounted" - @select="handleSelect" - @UnSelect="UnSelect" - :title="title" - :treeData="treeData" - :create-icon="createIcon" - :fieldNames="fieldNames" - /><!-- - add - @handle-add="handleAdd" --> - <div class="w-3/4 xl:w-4/5 p-5"> - <CarGridNav v-if="entityName == 'ProdRouteBinding' && rotType == 'Product'" /> - <Config v-if="entityName == 'ProdRouteBinding' && rotType == 'Action'" /> - </div> + <Suspense class="w-1/4 xl:w-1/5"> + <LeftTree /> + </Suspense> + <Suspense> + <div class="w-3/4 xl:w-4/5 p-5"> + <CarGridNav v-if="entityName == 'ProdRouteBinding' && nodeType == 'Product'" /> + <Config v-if="entityName == 'ProdRouteBinding' && nodeType == 'Action'" /> + </div> + </Suspense> <!-- <BasicTable class="w-3/4 xl:w-4/5" @register="registerTable"> <template #toolbar> <a-button type="primary" @click="handleCreate" preIcon="add_02|svg"> 鏂板 </a-button> @@ -65,18 +58,17 @@ </template> <script lang="ts" setup> import { PageWrapper } from '@/components/Page'; - import GeneralTree from '/@/views/components/GeneralTree.vue'; import { useModal } from '@/components/Modal'; import GeneralModal from '/@/views/components/GeneralModal.vue'; import CarGridNav from './CarGridNav.vue'; import Config from './Config.vue'; + import LeftTree from './LeftTree.vue'; import CustModal from '/@/views/components/CustModal.vue'; import { OpenCustModal } from '../data'; import { Ref, onMounted, provide, reactive, ref } from 'vue'; import { useRoute } from 'vue-router'; import { useDrawer } from '/@/components/Drawer'; import { BasicForm, useForm } from '/@/components/Form/index'; - import { TreeItem } from '/@/components/TigerTree'; import { useTabs } from '/@/hooks/web/useTabs'; import { isNullOrUnDef } from '/@/utils/is'; import { useGo } from '/@/hooks/web/usePage'; @@ -99,41 +91,22 @@ const baseCards = ref([] as any[]); const otherCards = ref([] as any[]); const searchInfo = reactive<Recordable>({}); - const treeData = ref<TreeItem[]>([]); - const title = ref(''); - const fieldNames = ref({}); const dense = isNullOrUnDef(objParams.value.dense) ? ref(false) : ref(objParams.value.dense); const pageTitle = ref(objParams.value.pageTitle); const pageContent = ref(objParams.value.pageContent); - const prodCode = ref(objParams.value.CODE); const actionCode = ref(''); const custCode = ref(''); - const rotType = ref(''); + const nodeType = ref(''); + const selectedNodes = ref([]); const isMounted = ref(false); const custImport = ref<any>(null); const [registerCust, { openModal: openCustomModal, closeModal }] = useModal(); const [registerItemAdd, { openModal: openItemModal }] = useModal(); const [registerDrawer, { openDrawer }] = useDrawer(); - provide<Ref<string>>('prodCode', prodCode); - provide<Ref<string>>('actionCode', actionCode); - provide<Ref<string>>('custCode', custCode); + provide<Ref<string>>('nodeType', nodeType); + provide<Ref<any>>('objParams', objParams); + provide<Ref<any>>('selectedNodes', selectedNodes); setTitle(objParams.value.Title); //璁剧疆鏍囩椤垫爣棰� - - /** - * @description: 鑾峰彇鏍戝舰鏁版嵁 - * @param {*} type - * @return {*} - */ - async function fetch(type: string) { - if (!isNullOrUnDef(custImport.value)) { - const [{ fetchTreeData }] = custImport.value['default'](); - //鏍规嵁type鑾峰彇鏍戝舰鏁版嵁 - const data = await fetchTreeData(type, objParams.value.CODE); - title.value = data.title; - treeData.value = data.treeData; - fieldNames.value = data.fieldNames; - } - } /** * @description: 椤甸潰宸︿晶鐐瑰嚮杩斿洖閾炬帴鏃剁殑鎿嶄綔 @@ -151,50 +124,14 @@ // console.log('handleAdd'); // } - /** - * @description: 鏍戝舰鑺傜偣鍥炬爣 - * @param {*} params - * @param {*} type - * @return {*} - */ - function createIcon(params: Recordable<any>) { - if (isNullOrUnDef(custImport.value)) { - return ''; - } else { - const [{ CreateIcon }] = custImport.value['default'](); - return CreateIcon(params); - } - } - onMounted(async () => { isMounted.value = false; /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ try { custImport.value = await import(`../entityts/${entityName.value}.ts`); - await fetch(entityName.value); isMounted.value = true; } catch (e) {} }); - - function handleSelect(deptId = '', info) { - searchInfo.deptId = deptId; - rotType.value = info.selectedNodes[0].type; - // prodCode.value =rotType.value=='Product'? info.selectedNodes[0].code: prodCode.value; - actionCode.value = rotType.value == 'Action' ? info.selectedNodes[0].code : actionCode.value; - custCode.value = rotType.value == 'Customer' ? info.selectedNodes[0].code : custCode.value; - // reload(); - } - - /** - * @description: 鍙栨秷閫夋嫨鏃朵簨浠惰繑鍥炴柟娉� - * @param {*} node - * @return {*} - */ - function UnSelect(node) { - prodCode.value = ''; - rotType.value = ''; - // reload(); - } /** * @description: 寮瑰嚭妗嗙‘瀹氳繑鍥� diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts index e9ad4a0..c71ee66 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-25 11:28:25 + * @LastEditTime: 2024-06-26 18:33:05 */ import { ActionItem, BasicColumn } from '/@/components/Table'; @@ -85,7 +85,7 @@ * @param {Fn} openItemModal * @return {*} */ - OpenSelectItem: (openItemModal: Fn) => { + OpenSelectItem: (openItemModal: Fn, ...args) => { openItemModal(true, { title: '鐗╂枡鍒楄〃', schemas: [ diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_PV.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_PV.ts index 458233e..23e501e 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_PV.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_PV.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-22 23:40:02 + * @LastEditTime: 2024-06-26 18:33:09 */ import { ActionItem, BasicColumn } from '/@/components/Table'; @@ -49,7 +49,7 @@ VAR_VALUE: d.values['val'], }; }, - OpenSelectItem:(openItemModal: Fn) => { + OpenSelectItem:(openItemModal: Fn, ...args) => { openItemModal(true, { title: '杩囩▼鍙橀噺鍒楄〃', schemas: [ diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts index cc90c02..35571ce 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts @@ -75,7 +75,7 @@ RSNG_CODE: d.values['val'], }; }, - OpenSelectItem:(openItemModal: Fn) => { + OpenSelectItem:(openItemModal: Fn, ...args) => { openItemModal(true, { title: '涓嶈壇鍘熷洜缁勫垪琛�', schemas: [ diff --git a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts index b4c7f43..7098435 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts @@ -4,13 +4,26 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-25 18:30:51 + * @LastEditTime: 2024-06-26 18:41:16 */ +import { Ref, unref } from 'vue'; import { GetRoutePTree } from '/@/api/tigerapi/mes/router'; -import { convertToTree } from '/@/api/tigerapi/system'; +import { GetEnum, convertToTree, getEntity } from '/@/api/tigerapi/system'; +import { useLocale } from '/@/locales/useLocale'; +import { isNullOrEmpty } from '/@/utils/is'; +import { useI18n } from '/@/hooks/web/useI18n'; +const { t } = useI18n(); +const { getLocale } = useLocale(); function _default() { + const isNormal = (type: number) => type === 0; + const isScan = (type: number) => type === 1; + const isAssy = (type: number) => type === 2; + const isTest = (type: number) => type === 3; + const isAudit = (type: number) => type === 4; + const isPrint = (type: number) => type === 5; + const isPackage = (type: number) => type === 6; const methods = { /** * @description: 鑾峰彇鏍戝舰鍥炬爣 @@ -41,7 +54,7 @@ /** * @description: 楂樼骇琛ㄥ崟鍜岃鎯呴〉闈㈣繑鍥炰富椤甸潰鐨剈rl * @return {*} - */ + */ GetHomeUrl: () => { return `/V_BAS_PROD/LC/${encodeURI(JSON.stringify({ ID: 'V_BAS_PROD', colSlots: [], crudColSlots: [] }))}`; }, @@ -58,6 +71,399 @@ data.fieldNames = { key: 'id', 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: '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', + }, + { + 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 }, + }, + ]; + }, + /** + * @description: 鑾峰彇琛ㄥ崟涓殑瀛楁鎻掓Ы鍒楄〃 + * @return {*} + */ + GetCrudColSlots: () => { + return ['scanadd', 'assyadd', 'testadd', 'auditadd', 'printadd', 'pkgadd']; + }, + nodeChange: (params: { + resetFields: any; + setFieldsValue: any; + objParams: Ref<any>; + selectedNodes: Ref<any[]>; + }) => { + params['resetFields'](); + let sqlcmd = ' 1=1 '; + 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}'`; + } + getEntity({ + sqlcmd: sqlcmd, + entityName: 'MES_PROD_ACTION', + }).then((res) => { + params['setFieldsValue']({ + PROD_CODE: params['objParams'].value['CODE'], + ACT_TYPE: res.Data.Items[0].ACT_TYPE, + }); + }); + }, + /** + * @description: 寮瑰嚭閫夋嫨妗嗘墦寮�鏂规硶 + * @param {Fn} openItemModal + * @return {*} + */ + OpenSelectItem: (openItemModal: Fn, ...args) => { + let config = {}; + switch (args[0]) { + case 'scanadd': + config = ruleModalCfg; + break; + case 'assyadd': + config = itemCodeModalCfg; + break; + case 'testadd': + config = itemCodeModalCfg; + break; + case 'printadd': + config = printModalCfg; + break; + case 'pkgadd': + config = pkgModalCfg; + break; + } + openItemModal(true, config); + }, + /** + * @description: 寮瑰嚭閫夋嫨妗嗛�夋嫨鎴愬姛杩斿洖 + * @param {*} d + * @param {*} u + * @return {*} + */ + GetSelectSuccess: (d, u, ...args) => { + let value = {}; + switch (args[0]) { + case 'scanadd': + value = { + RULE_CODE: d.values['val'], + }; + break; + case 'assyadd': + value = { + ITEM_CODE: d.values['val'], + }; + break; + case 'printadd': + value = { + LABEL_CODE: d.values['val'], + }; + break; + case 'pkgadd': + value = { + pkgRULE_CODE: d.values['val'], + }; + break; + } + return value; + }, + }; + + const itemCodeModalCfg = { + title: '鐗╂枡鍒楄〃', + schemas: [ + { + field: 'ITEM_CODE', + component: 'Input', + label: '鐗╂枡缂栫爜', + colProps: { + span: 12, + }, + }, + ], + ItemColumns: [ + { + title: t('鐗╂枡缂栫爜'), + dataIndex: 'ITEM_CODE', + resizable: true, + sorter: true, + width: 200, + }, + { + title: t('鐗╂枡鍚嶇О'), + dataIndex: 'ITEM_NAME', + resizable: true, + sorter: true, + width: 180, + }, + ], + tableName: 'BAS_ITEM', + rowKey: 'ITEM_CODE', + searchInfo: { TABLE_NAME: 'BAS_ITEM' }, + }; + + const ruleModalCfg = { + title: '瑙勫垯鍒楄〃', + schemas: [ + { + field: 'RULE_CODE', + component: 'Input', + label: '瑙勫垯缂栫爜', + colProps: { + span: 12, + }, + }, + ], + ItemColumns: [ + { + title: t('瑙勫垯缂栫爜'), + dataIndex: 'RULE_CODE', + resizable: true, + sorter: true, + width: 200, + }, + { + title: t('瑙勫垯鍚嶇О'), + dataIndex: 'RULE_NAME', + resizable: true, + sorter: true, + width: 180, + }, + ], + tableName: 'BAS_CODE_RULE', + rowKey: 'RULE_CODE', + searchInfo: { TABLE_NAME: 'BAS_CODE_RULE' }, + }; + + const printModalCfg = { + title: '鎵撳嵃妯℃澘鍒楄〃', + schemas: [ + { + field: 'LABEL_CODE', + component: 'Input', + label: '妯℃澘缂栫爜', + colProps: { + span: 12, + }, + }, + ], + ItemColumns: [ + { + title: t('妯℃澘缂栫爜'), + dataIndex: 'LABEL_CODE', + resizable: true, + sorter: true, + width: 200, + }, + { + title: t('妯℃澘鍚嶇О'), + dataIndex: 'LABEL_NAME', + resizable: true, + sorter: true, + width: 180, + }, + ], + tableName: 'BAS_LABEL_TEMP', + rowKey: 'LABEL_CODE', + searchInfo: { TABLE_NAME: 'BAS_LABEL_TEMP' }, + }; + + const pkgModalCfg = { + title: '鍖呰瑙勫垯鍒楄〃', + schemas: [ + { + field: 'RULE_CODE', + component: 'Input', + label: '鍖呰瑙勫垯缂栫爜', + colProps: { + span: 12, + }, + }, + ], + ItemColumns: [ + { + title: t('鍖呰瑙勫垯缂栫爜'), + dataIndex: 'RULE_CODE', + resizable: true, + sorter: true, + width: 200, + }, + { + title: t('鍖呰瑙勫垯鍚嶇О'), + dataIndex: 'RULE_NAME', + resizable: true, + sorter: true, + width: 180, + }, + ], + tableName: 'BAS_PKG_RULE', + rowKey: 'RULE_CODE', + searchInfo: { TABLE_NAME: 'BAS_PKG_RULE' }, }; return [methods]; diff --git a/src/views/tigerprojects/system/lowcode/entityts/QMS_INS_STD.ts b/src/views/tigerprojects/system/lowcode/entityts/QMS_INS_STD.ts index 3a3ceb9..00fc392 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/QMS_INS_STD.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/QMS_INS_STD.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-26 02:57:35 + * @LastEditTime: 2024-06-26 18:33:23 */ import { ActionItem, BasicColumn } from '/@/components/Table'; @@ -87,7 +87,7 @@ * @param {Fn} openItemModal * @return {*} */ - OpenSelectItem: (openItemModal: Fn) => { + OpenSelectItem: (openItemModal: Fn, ...args) => { openItemModal(true, { title: '鐗╂枡鍒楄〃', schemas: [ diff --git a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue index 03b71a1..988a7d1 100644 --- a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue +++ b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue @@ -84,7 +84,7 @@ const EntityCustFunction = ref([ { ActionItem(params, data, ...args) {}, - EditeOperation(data, d, u) {}, + EditOperation(data, d, u) {}, GetBaseColumns() {}, GetSearchForm() {}, GetCrudForm() {}, @@ -98,7 +98,7 @@ const [ { ActionItem: nActionItem, - EditeOperation, + EditOperation, GetBaseColumns, GetSearchForm, GetCrudForm, -- Gitblit v1.9.3