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/components/StepModal.vue | 25 + src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts | 643 ++++++++++++++++++++++++++++-------------- src/views/tigerprojects/system/lowcode/detail/detail.vue | 99 ++---- src/views/tigerprojects/system/lowcode/composition/index.vue | 16 + src/views/tigerprojects/system/lowcode/composition/Config.vue | 50 ++- src/api/tigerapi/model/basModel.ts | 10 src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_PV.ts | 2 src/views/tigerprojects/system/lowcode/normalDrawer.vue | 6 8 files changed, 543 insertions(+), 308 deletions(-) diff --git a/src/api/tigerapi/model/basModel.ts b/src/api/tigerapi/model/basModel.ts index 2945463..108931d 100644 --- a/src/api/tigerapi/model/basModel.ts +++ b/src/api/tigerapi/model/basModel.ts @@ -124,17 +124,17 @@ GetHomeUrl: () => string; GetBaseColumns: () => []; GetSearchForm: () => []; - GetCrudForm: () => []; + GetCrudForm: (type: string) => []; GetBaseForm: () => []; GetBaseCards: () => []; - OthersValues: (val: string, id: string) => {} - GetTitle: () => {}; + OthersValues: (val: string, id: string) => {}; + GetTitle: (type: string) => {}; GetCrudColSlots: () => []; - nodeChange: ({}) => void, + nodeChange: ({}) => void; CreateIcon: (params: Recordable<any>) => string; SelectNode: (selectedNodes: Ref<any[]>) => {}; GetNavItems: () => NavItem[]; navChangeItem: (action: any, ...args) => void; GetUseModals: () => {}; - SubmitFunc: (values: Recordable<any>, emit) => void; + SubmitFunc: (values: Recordable<any>, type: string, emit) => void; } diff --git a/src/views/components/StepModal.vue b/src/views/components/StepModal.vue index 477052d..86f80a9 100644 --- a/src/views/components/StepModal.vue +++ b/src/views/components/StepModal.vue @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-26 22:54:42 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-27 10:44:54 + * @LastEditTime: 2024-06-27 22:14:51 --> <template> <BasicModal @@ -42,10 +42,13 @@ import { BasicModal, useModalInner } from '/@/components/Modal'; import { Steps } from 'ant-design-vue'; import { useI18n } from '/@/hooks/web/useI18n'; + import { isNullOrUnDef } from '/@/utils/is'; + import { useMessage } from '/@/hooks/web/useMessage'; defineOptions({ name: 'StepModal' }); const emit = defineEmits(['success']); + const { createErrorModal } = useMessage(); const { t } = useI18n(); const title = ref(''); const current = ref(0); @@ -78,6 +81,20 @@ */ async function handleSubmit() { try { + if (isNullOrUnDef(step1Values.value['CUST_CODE'])) { + createErrorModal({ + title: t('sys.api.errorTip'), + content: '姝ラ1鏈畬鎴愶紝璇峰畬鎴愬啀淇濆瓨鎻愪氦', + }); + return; + } + if (isNullOrUnDef(step2Values.value['ROT_CODE'])) { + createErrorModal({ + title: t('sys.api.errorTip'), + content: '姝ラ2鏈畬鎴愶紝璇峰畬鎴愬啀淇濆瓨鎻愪氦', + }); + return; + } closeModal(); emit('success', { ...step1Values.value, ...step2Values.value }); } finally { @@ -94,6 +111,12 @@ function handleStepPrev() { current.value--; + if(current.value == 1){ + step2Values.value = ''; + } + if(current.value == 0){ + step1Values.value = ''; + } } function handleStep2Next(Values: any) { diff --git a/src/views/tigerprojects/system/lowcode/composition/Config.vue b/src/views/tigerprojects/system/lowcode/composition/Config.vue index 91284d8..801bf03 100644 --- a/src/views/tigerprojects/system/lowcode/composition/Config.vue +++ b/src/views/tigerprojects/system/lowcode/composition/Config.vue @@ -4,10 +4,10 @@ * @version: * @Date: 2024-06-24 23:44:31 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-27 16:28:34 + * @LastEditTime: 2024-06-27 22:52:24 --> <template> - <Card :title="GetTitle()['configTitle']"> + <Card :title="GetTitle(props.configType)['configTitle']"> <BasicForm @register="registerForm"> <template #[item]="{ field }" v-for="item in GetCrudColSlots()" :key="item"> <a-button @@ -27,7 +27,7 @@ </template> <script lang="ts" setup> import { Ref, inject, nextTick, onMounted, ref, unref, watch } from 'vue'; - import { BasicForm, useForm } from '/@/components/Form/index'; + import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; import { Card } from 'ant-design-vue'; import { useModal } from '/@/components/Modal'; import GeneralModal from '/@/views/components/GeneralModal.vue'; @@ -37,37 +37,50 @@ const { t } = useI18n(); const emit = defineEmits(['success', 'register']); + const props = defineProps({ + configType: { type: String }, + }); const [registerItemAdd, { openModal: openItemModal }] = useModal(); const objParams = inject('objParams') as Ref<any>; const custImport = ref<any[]>([]); const EntityCustFunction = ref([ { - GetCrudForm() {}, + GetCrudForm(type: string) {}, GetCrudColSlots(val, id) {}, OpenSelectItem(openItemModal: Fn, ...args) {}, GetSelectSuccess(d, u, ...args) {}, - GetTitle() {}, + GetTitle(type: string) {}, nodeChange(params: { resetFields: any; setFieldsValue: any; objParams: Ref<any>; selectedNodes: Ref<any[]>; }) {}, - SubmitFunc(values: Recordable<any>, emit) {}, + SubmitFunc(values: Recordable<any>, type: string, emit) {}, } as EntityCustFunctionType, ]); /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ try { custImport.value = await import(`../entityts/${objParams.value['Name']}.ts`); } catch (e) {} - const [{ GetCrudForm, GetCrudColSlots, nodeChange, OpenSelectItem, GetSelectSuccess, GetTitle, SubmitFunc }] = - isNullOrUnDef(custImport.value['default']) - ? EntityCustFunction.value - : custImport.value['default'](); + const [ + { + GetCrudForm, + GetCrudColSlots, + nodeChange, + OpenSelectItem, + GetSelectSuccess, + GetTitle, + SubmitFunc, + }, + ] = isNullOrUnDef(custImport.value['default']) + ? EntityCustFunction.value + : custImport.value['default'](); - const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ + let formSchema: FormSchema[] = GetCrudForm(props.configType); + const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useForm({ labelWidth: 120, - schemas: GetCrudForm(), + schemas: formSchema, actionColOptions: { offset: 8, span: 24, @@ -77,7 +90,7 @@ }, showActionButtonGroup: true, submitButtonOptions: { - text: '鎻愪氦', + text: '淇濆瓨', }, submitFunc: customSubmitFunc, }); @@ -88,8 +101,15 @@ () => selectedNodes.value, (newVal, oldVal) => { nextTick(() => { + setProps({ + schemas: [] + }); /* 鑺傜偣鍒囨崲浜嬩欢 */ nodeChange({ resetFields, setFieldsValue, objParams, selectedNodes }); + formSchema = GetCrudForm(selectedNodes.value[0].type); + setProps({ + schemas: formSchema + }); }); }, { deep: true, immediate: true }, @@ -103,7 +123,7 @@ async function customSubmitFunc() { try { const values = await validate(); - SubmitFunc(values, emit); + SubmitFunc(values,props.configType, emit); // values.AUTH_PROD = useUserStore().getUserInfo.prodCode; // values.FACTORY = useUserStore().getUserInfo.prodCode; // const apiAction = SaveEntity(values, true, 'MES_PROD_ACTION'); @@ -112,7 +132,7 @@ // emit('success'); // } // }); - }catch(e) {} + } catch (e) {} } /** diff --git a/src/views/tigerprojects/system/lowcode/composition/index.vue b/src/views/tigerprojects/system/lowcode/composition/index.vue index 7d1bda7..85d8972 100644 --- a/src/views/tigerprojects/system/lowcode/composition/index.vue +++ b/src/views/tigerprojects/system/lowcode/composition/index.vue @@ -1,3 +1,11 @@ +<!-- + * @Description: 閫氱敤缁勫悎椤甸潰锛屽乏杈规槸鏍戯紝鍙宠竟鏄厤缃� + * @Author: Ben Lin + * @version: + * @Date: 2024-06-18 23:30:30 + * @LastEditors: Ben Lin + * @LastEditTime: 2024-06-27 22:31:13 +--> <template> <PageWrapper :dense="dense" @@ -14,7 +22,7 @@ <Suspense> <div class="w-3/4 xl:w-4/5 p-5"> <CarGridNav v-if="showNav" /> - <Config v-if="showConfig" @success="configSuccess"/> + <Config v-if="showConfig" :configType="configType" @success="configSuccess"/> </div> </Suspense> <!-- <BasicTable class="w-3/4 xl:w-4/5" @register="registerTable"> @@ -94,6 +102,7 @@ const isMounted = ref(false); const showNav = ref(false); const showConfig = ref(false); + const configType = ref(''); const custImport = ref<any>(null); const [registerCust, { openModal: openCustomModal, closeModal }] = useModal(); provide<Ref<string>>('nodeType', nodeType); @@ -134,8 +143,13 @@ function NodeSelect(e) { showConfig.value = e.showConfig; showNav.value = e.showNav; + configType.value = e.type } + /** + * @description: 淇濆瓨閰嶇疆鎴愬姛杩斿洖鏂规硶 + * @return {*} + */ function configSuccess() { notification.success({ message: '鎴愬姛淇濆瓨琛屼负閰嶇疆鏁版嵁' }); } diff --git a/src/views/tigerprojects/system/lowcode/detail/detail.vue b/src/views/tigerprojects/system/lowcode/detail/detail.vue index 7fef75c..608ff90 100644 --- a/src/views/tigerprojects/system/lowcode/detail/detail.vue +++ b/src/views/tigerprojects/system/lowcode/detail/detail.vue @@ -37,6 +37,7 @@ import { useGo } from '/@/hooks/web/usePage'; import { DeleteEntity, getListByPage } from '/@/api/tigerapi/system'; import { useI18n } from '/@/hooks/web/useI18n'; + import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel'; const { t } = useI18n(); @@ -55,9 +56,37 @@ const dtlSlots = ref([] as any[]); const useModalData = ref({}); //琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶 const useFormData = ref({}); - const custImport = ref<any[]>(await import(`../entityts/${props.entityName}.ts`)); - const [{ EditeOperation, GetBaseColumns, GetSearchForm, GetCrudForm, OthersValues }] = - custImport.value['default'](); + const custImport = ref<any[]>([]); + const EntityCustFunction = ref([ + { + ActionItem(params, data, ...args) {}, + EditOperation(data, d, u) {}, + GetBaseColumns() {}, + GetSearchForm() {}, + GetCrudForm() {}, + OthersValues(val, id) {}, + GetSelectSuccess(d, u, ...args) {}, + OpenSelectItem(openItemModal: Fn, ...args) {}, + } as EntityCustFunctionType, + ]); + /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ + try { + custImport.value = await import(`../entityts/${objParams['Name']}.ts`); + } catch (e) {} + const [ + { + ActionItem: nActionItem, + EditOperation, + GetBaseColumns, + GetSearchForm, + GetCrudForm, + OthersValues, + GetSelectSuccess, + OpenSelectItem, + }, + ] = isNullOrUnDef(custImport.value['default']) + ? EntityCustFunction.value + : custImport.value['default'](); others.value = OthersValues(objParams['CODE'], objParams['ID']); const [registerTable, { getForm, reload, setProps }] = useTable({ title: `${objParams['firstTitle']}鍒楄〃`, @@ -121,8 +150,7 @@ if (isNullOrUnDef(custImport.value)) { return actionItem; } - const [{ ActionItem }] = custImport.value['default'](); - return ActionItem( + return nActionItem( params, actionItem, openDrawer, @@ -198,21 +226,7 @@ * @return {*} */ function handleItemSuccess(d, u, item) { - /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ - try { - import( - `../entityts/${getForm().getFieldsValue()[`${item.replace(/form-/, '').replace(/add/, '')}PSelect_0`]}.ts` - ) - .then((m) => { - const [{ GetSelectSuccess }] = m.default(); - getForm().setFieldsValue(GetSelectSuccess(d, u)); - }) - .catch(() => { - getForm().setFieldsValue({ - ITEM_CODE: d.values['val'], - }); - }); - } catch (e) {} + getForm().setFieldsValue(GetSelectSuccess(d, u)); } /** @@ -221,49 +235,6 @@ * @return {*} */ function handleSelectItem(item) { - /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ - try { - import( - `../entityts/${props.useTableData['table'][1].getForm().getFieldsValue()[`${item.replace(/form-/, '').replace(/add/, '')}PSelect_0`]}.ts` - ) - .then((m) => { - const [{ OpenSelectItem }] = m.default(); - OpenSelectItem(openItemModal); - }) - .catch(() => { - openItemModal(true, { - 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' }, - }); - }); - } catch (e) {} + OpenSelectItem(openItemModal); } </script> 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 23e501e..8e041f5 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-26 18:33:09 + * @LastEditTime: 2024-06-27 20:40:25 */ import { ActionItem, BasicColumn } from '/@/components/Table'; 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; } diff --git a/src/views/tigerprojects/system/lowcode/normalDrawer.vue b/src/views/tigerprojects/system/lowcode/normalDrawer.vue index 7a430d7..7e6f330 100644 --- a/src/views/tigerprojects/system/lowcode/normalDrawer.vue +++ b/src/views/tigerprojects/system/lowcode/normalDrawer.vue @@ -158,8 +158,7 @@ function handleItemSuccess(d, u, item) { /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ try { - import( - /* @vite-ignore */ `./entityts/${getFieldsValue()[`${item.replace(/add/, '')}PSelect_0`]}` + import(`./entityts/${getFieldsValue()[`${item.replace(/add/, '')}PSelect_0`]}.ts` ) .then((m) => { const [{ GetSelectSuccess }] = m.default(); @@ -181,8 +180,7 @@ function handleSelectItem(item) { /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ try { - import( - /* @vite-ignore */ `./entityts/${getFieldsValue()[`${item.replace(/add/, '')}PSelect_0`]}` + import(`./entityts/${getFieldsValue()[`${item.replace(/add/, '')}PSelect_0`]}.ts` ) .then((m) => { const [{ OpenSelectItem }] = m.default(); -- Gitblit v1.9.3