From 439e3b0f076280311b7cd4251a95820730242780 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 07 八月 2024 10:43:33 +0800 Subject: [PATCH] 一些更新 --- src/views/tigerprojects/mes/eng/route/components/ProductProps.vue | 199 ++++++++++++++++++ src/views/tigerprojects/system/lowcode/entityts/EMS_INS_ITEM.ts | 251 ++++++++++++++++++++++ src/views/components/GeneralModal.vue | 7 src/views/tigerprojects/bas/checkrule/checkrule.data.ts | 52 ++++ src/views/tigerprojects/system/lowcode/composition/index.vue | 9 src/views/tigerprojects/bas/checkrule/ruleDetail.vue | 4 src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts | 32 ++ src/api/tigerapi/system.ts | 7 src/views/tigerprojects/system/lowcode/normal/index.vue | 29 ++ src/api/tigerapi/model/basModel.ts | 1 src/views/tigerprojects/system/lowcode/normalDrawer.vue | 10 11 files changed, 577 insertions(+), 24 deletions(-) diff --git a/src/api/tigerapi/model/basModel.ts b/src/api/tigerapi/model/basModel.ts index 1e0ec0c..6eb476c 100644 --- a/src/api/tigerapi/model/basModel.ts +++ b/src/api/tigerapi/model/basModel.ts @@ -157,4 +157,5 @@ GetCustData: () => {}; GetRightMenuList: (node: EventDataNode, ...args) => ContextMenuItem[]; GetNewRow: (type: string) => {}; + InitCrudFormSchema: (type: string, ...args) => {}; } diff --git a/src/api/tigerapi/system.ts b/src/api/tigerapi/system.ts index cec6dc0..6903b0a 100644 --- a/src/api/tigerapi/system.ts +++ b/src/api/tigerapi/system.ts @@ -31,8 +31,9 @@ pParams, } from './model/systemModel'; import { defHttp } from '/@/utils/http/axios'; -import { isArray, isNullOrEmpty, isTimeViaRegExp8601 } from '/@/utils/is'; +import { isArray, isNullOrEmpty, isNullOrUnDef, isTimeViaRegExp8601 } from '/@/utils/is'; import { isNumber } from 'xe-utils'; +import { dateUtil, formatToDateTime } from '/@/utils/dateUtil'; export enum Api { QueryUrl = '/Base/Query', @@ -779,10 +780,6 @@ export async function SaveEntity<T>(params: T, isUpdate: boolean, entityName: string, ...args) { let data; - /* 閽堝妯℃澘鍦板潃鍋氭浛鎹紝鐗规畩澶勭悊 */ - // if(params['TEMP_PATH']){ - // params['TEMP_PATH'] = params['TEMP_PATH'].toString().replace('/','//'); - // } if (isUpdate) { data = await defHttp.post( { url: Api.UpdateEntity, params: genAction(entityName, params) }, diff --git a/src/views/components/GeneralModal.vue b/src/views/components/GeneralModal.vue index be69e53..0daed62 100644 --- a/src/views/components/GeneralModal.vue +++ b/src/views/components/GeneralModal.vue @@ -42,7 +42,7 @@ const emit = defineEmits(['success', 'register']); const checkedKeys = ref<Array<string | number>>([]); const checkedIds = ref<Array<string | number>>([]); - const [registerTable, { reload, getForm }] = useTable({ + const [registerTable, { reload, getForm, setProps }] = useTable({ title: '鍒楄〃淇℃伅', api: getListByPage, searchInfo: searchInfo, @@ -81,6 +81,9 @@ }); const [register, { setModalProps, closeModal }] = useModalInner((data) => { setModalProps({ confirmLoading: false }); + setProps({ + dataSource: [], + }); data && onDataReceive(data); }); @@ -101,7 +104,7 @@ checkedKeys.value = []; which.value = data?.which; getForm().resetFields(); - reload(); + // reload(); } // function handleVisibleChange(v) { diff --git a/src/views/tigerprojects/bas/checkrule/checkrule.data.ts b/src/views/tigerprojects/bas/checkrule/checkrule.data.ts index 21f0591..0dd63c3 100644 --- a/src/views/tigerprojects/bas/checkrule/checkrule.data.ts +++ b/src/views/tigerprojects/bas/checkrule/checkrule.data.ts @@ -21,6 +21,49 @@ dataIndex: 'DESCRIPTION', }, { + title: '鏁版嵁绫诲瀷', + dataIndex: 'DATA_TYPE', + customRender: ({ record }) => { + const type = record.DATA_TYPE; + var text = ''; + var color = 'blue'; + switch (type) { + case Data_Types.Character: + text = '绾瓧姣�'; + break; + case Data_Types.Numeric: + text = '绾暟瀛�'; + color = 'yellow'; + break; + case Data_Types.DateCode: + text = '鏃ユ湡'; + color = 'orange'; + break; + case Data_Types.TimeCode: + text = '鏃堕棿'; + color = '#bfbfbf'; + break; + case Data_Types.DbCheck: + text = '鍏宠仈鏍¢獙'; + color = '#0b9da9'; + break; + case Data_Types.FixedCode: + text = '鍥哄畾鍊�'; + color = 'green'; + break; + case Data_Types.SerialCode: + text = '娴佹按鍙�'; + color = '#b442df'; + break; + } + return h(Tag, { color: color }, () => text); + }, + }, + { + title: '鏍¢獙浣嶆暟', + dataIndex: 'CHECK_LENGTH', + }, + { title: '鏍¢獙浣嶆暟', dataIndex: 'CHECK_LENGTH', }, @@ -192,7 +235,7 @@ formModel.CHECK_LENGTH = ''; } if (e == Data_Types.DbCheck || e == Data_Types.NoCheck) { - formModel.DATA_REGEX = `(.{${formModel.CHECK_LENGTH}}){${formModel.REPEAT_TIMES}}`; + formModel.DATA_REGEX = formModel.CHECK_LENGTH>0? `(.{${formModel.CHECK_LENGTH}}){${formModel.REPEAT_TIMES}}`: `(.*){${formModel.REPEAT_TIMES}}`; } if (e == Data_Types.SerialCode) { formModel.DATA_REGEX = `([0-9]{${formModel.CHECK_LENGTH}}){${formModel.REPEAT_TIMES}}`; @@ -616,8 +659,13 @@ formModel.DATA_REGEX = `(${_regex}){${formModel.REPEAT_TIMES}}`; } } + //formModel.CHECK_LENGTH>0? `(.{${formModel.CHECK_LENGTH}}){${formModel.REPEAT_TIMES}}`: `(.*){${formModel.REPEAT_TIMES}}`; if ( - formModel.DATA_TYPE == Data_Types.DbCheck || + formModel.DATA_TYPE == Data_Types.DbCheck + ) { + formModel.DATA_REGEX = val>0? `(.{${val}}){${formModel.REPEAT_TIMES}}`: `(.*){${formModel.REPEAT_TIMES}}`; + } + if ( formModel.DATA_TYPE == Data_Types.NoCheck ) { formModel.DATA_REGEX = `(.{${val}}){${formModel.REPEAT_TIMES}}`; diff --git a/src/views/tigerprojects/bas/checkrule/ruleDetail.vue b/src/views/tigerprojects/bas/checkrule/ruleDetail.vue index 3b0f5a5..ce09c07 100644 --- a/src/views/tigerprojects/bas/checkrule/ruleDetail.vue +++ b/src/views/tigerprojects/bas/checkrule/ruleDetail.vue @@ -15,6 +15,7 @@ { icon: 'clarity:note-edit-line', onClick: handleEdit.bind(null, record), + name: '' }, { icon: 'ant-design:delete-outlined', @@ -24,6 +25,7 @@ placement: 'left', confirm: handleDelete.bind(null, record), }, + name: '' }, ]" /> </template> @@ -281,7 +283,7 @@ var CHECK_TYPE = 0; var CHECK_REGEX = '^'; const total = data.value.reduce((length, item) => { - if (item.DATA_TYPE == 5) { + if (item.DATA_TYPE == 6) { CHECK_TYPE = 1; } CHECK_REGEX += item.DATA_REGEX; diff --git a/src/views/tigerprojects/mes/eng/route/components/ProductProps.vue b/src/views/tigerprojects/mes/eng/route/components/ProductProps.vue new file mode 100644 index 0000000..37b98a9 --- /dev/null +++ b/src/views/tigerprojects/mes/eng/route/components/ProductProps.vue @@ -0,0 +1,199 @@ +<!-- + * @Description: 浜у搧缁戝畾鐩稿叧 + * @Author: Ben Lin + * @version: + * @Date: 2024-06-11 21:07:04 + * @LastEditors: Ben Lin + * @LastEditTime: 2024-08-07 09:46:29 +--> +<!-- + * @Description: 鍙充晶灞炴�ч潰鏉挎帶浠� 琛ㄥ崟灞炴�ч潰鏉� +--> +<template> + <div class="m-1"> + <BasicTable @register="registerTable"> + <template #toolbar> + <a-button type="primary" @click="handleCreate" preIcon="add_02|svg" :size="size"> + 鏂板 + </a-button> + </template> + <template #action="{ record }"> + <TableAction + :actions="[ + { + icon: 'ant-design:delete-outlined', + color: 'error', + popConfirm: { + title: '鏄惁纭鍒犻櫎?', + placement: 'left', + confirm: handleDelete.bind(null, record), + }, + name: '', + }, + ]" + /> + </template> + </BasicTable> + </div> + + <GeneralModal @register="register" @success="handleSuccess"></GeneralModal> +</template> +<script lang="ts" setup> + import { notification } from 'ant-design-vue'; + import { BasicTable, TableAction, useTable } from '/@/components/Table'; + import { SizeType } from 'ant-design-vue/es/config-provider'; + import { nextTick, onMounted, ref, unref, watch } from 'vue'; + import { useModal } from '/@/components/Modal'; + import GeneralModal from '/@/views/components/GeneralModal.vue'; + import { useI18n } from '/@/hooks/web/useI18n'; + import { DeleteWhere, getListByPage } from '/@/api/tigerapi/system'; + import { useRouteDesignState } from '../hooks/useRouteDesignState'; + import { SaveRouteNodePost, SaveWoRouteNodePost } from '/@/api/tigerapi/mes/router'; + + const { t } = useI18n(); + const { routeConfig, mesRoute } = useRouteDesignState(); + const size = ref<SizeType>('small'); + const columns = [ + { + title: '浜у搧缂栫爜', + dataIndex: 'ITEM_CODE', + key: 'ITEM_CODE', + slots: { customRender: 'ITEM_CODE' }, + }, + { + title: '浜у搧鍚嶇О', + dataIndex: 'ITEM_NAME', + key: 'ITEM_NAME', + }, + // { + // title: t('浜х嚎缂栫爜'), + // dataIndex: 'LINE_CODE', + // key: 'LINE_CODE', + // }, + ]; + + const [register, { openModal }] = useModal(); + const [registerTable, { reload }] = useTable({ + title: '鍒楄〃', + api: getListByPage, + searchInfo: { TABLE_NAME: 'V_BAS_PROD', NODE_ID: routeConfig['currentItem'].ID }, + columns, + useSearchForm: false, + showTableSetting: false, + bordered: true, + showIndexColumn: false, + pagination: { pageSize: 10 }, + actionColumn: { + width: 80, + title: '鎿嶄綔', + dataIndex: 'action', + slots: { customRender: 'action' }, + }, + }); + defineExpose({ + reload, + }); + // watch( + // () => routeConfig.currentItem.ID, + // (newVal, oldVal) => { + // if (newVal != oldVal) { + // nextTick(() => { + // reload(); + // }); + // } + // }, + // { deep: true, immediate: true }, + // ); + + onMounted(() => {}); + + /** + * @description: 鏂板鏂规硶 + * @return {*} + */ + function handleCreate() { + openModal(true, { + title: '宀椾綅璧勬簮鍒楄〃', + schemas: [ + { + field: 'POST_CODE', + component: 'Input', + label: '宀椾綅璧勬簮缂栫爜', + colProps: { + span: 12, + }, + }, + ], + ItemColumns: [ + { + title: t('宀椾綅璧勬簮缂栫爜'), + dataIndex: 'POST_CODE', + resizable: true, + sorter: true, + width: 200, + }, + { + title: t('宀椾綅璧勬簮鍚嶇О'), + dataIndex: 'POST_NAME', + resizable: true, + sorter: true, + width: 180, + }, + { + title: t('浜х嚎缂栫爜'), + dataIndex: 'LINE_CODE', + resizable: true, + sorter: true, + width: 180, + }, + ], + tableName: 'MES_POSITION', + rowKey: 'POST_CODE', + searchInfo: { TABLE_NAME: 'MES_POSITION' }, + }); + } + + /** + * @description: 鍒犻櫎 + * @param {*} record + * @return {*} + */ + function handleDelete(record: Recordable) { + let entityName = routeConfig['isWorkOrder'] ? 'MES_WO_NODE_POST' : 'MES_ROUTE_NODE_POST'; + DeleteWhere( + `POST_CODE = '${record.POST_CODE}' And NODE_ID = '${record.NODE_ID}'`, + entityName, + ).then((res) => { + reload(); + }); + } + + /** + * @description: 閫夋嫨宀椾綅璧勬簮鎴愬姛杩斿洖鏂规硶 + * @param {*} d + * @param {*} u + * @return {*} + */ + function handleSuccess(d, u) { + let codes = d.values.val.split(','); + let eintity: any[] = []; + var i; + for (i = 0; i < codes.length; i++) { + eintity.push({ + NODE_ID: routeConfig['currentItem'].ID, + POST_CODE: codes[i], + REMARK: '', + WORK_ORDER: routeConfig['currentItem'].WORK_ORDER, + }); + } + if (routeConfig['isWorkOrder']) { + SaveWoRouteNodePost(eintity).then((res) => { + reload(); + }); + } else { + SaveRouteNodePost(eintity).then((res) => { + reload(); + }); + } + } +</script> diff --git a/src/views/tigerprojects/system/lowcode/composition/index.vue b/src/views/tigerprojects/system/lowcode/composition/index.vue index 4724e35..dffeb96 100644 --- a/src/views/tigerprojects/system/lowcode/composition/index.vue +++ b/src/views/tigerprojects/system/lowcode/composition/index.vue @@ -4,13 +4,11 @@ * @version: * @Date: 2024-06-18 23:30:30 * @LastEditors: Ben Lin - * @LastEditTime: 2024-08-04 17:50:50 + * @LastEditTime: 2024-08-06 10:04:20 --> <template> <PageWrapper - :dense="dense" contentFullHeight - fixedHeight contentClass="flex" :title="pageTitle" :content="pageContent" @@ -268,3 +266,8 @@ ); //[openRvModal], selectVals.value['ID']杩欐槸鑷畾涔夊弬鏁帮紝鎸夊疄闄呴渶姹� } </script> +<style lang="less"> +.vben-page-wrapper .vben-page-wrapper-content { + margin: 1px; +} +</style> diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts index 451177f..7c6f308 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-08-03 14:09:58 + * @LastEditTime: 2024-08-06 22:41:33 */ import { Tag, Tooltip } from 'ant-design-vue'; @@ -402,7 +402,7 @@ { BAS_LABEL_VAR_WO: useDrawer() }, ]; }, - /** + /** * @description: 鑾峰彇琛ㄦ牸use鍒楄〃 * @param {string} type * @param {array} args @@ -760,7 +760,8 @@ labelField: unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name', valueField: 'Value', onChange: (e, v) => { - if (e == 1) { + if (e == 1 || e == 4) { + const where = e == 1? { TABLE_NAME: 'BAS_LABEL_PV', VAR_TYPE: 0}: { TABLE_NAME: 'BAS_LABEL_PV', VAR_TYPE: 1}; emit('opencust', { data: column.record, name: 'BAS_LABEL_VAR', @@ -794,7 +795,7 @@ ], tableName: 'BAS_LABEL_PV', rowKey: 'VAR_CODE', - searchInfo: { TABLE_NAME: 'BAS_LABEL_PV' }, + searchInfo: where, }, }); } @@ -821,6 +822,10 @@ text = '鑷畾涔夊彉閲�'; color = '#bfbfbf'; break; + case 4: + text = '鏉$爜鐢熸垚'; + color = '#b442df'; + break; } return h(Tooltip, { title: text }, () => h(Tag, { color: color }, () => text)); }, @@ -842,6 +847,25 @@ resizable: true, }, { + dataIndex: 'BARCODE_RULE', + title: '鏉$爜鐢熸垚瑙勫垯', + ifShow: true, + edit: true, + editRule: true, + sorter: true, + resizable: true, + editComponent: 'ApiSelect', + editComponentProps: (column) => { + return { + api: getEntity, + params: { entityName: 'BAS_CODE_RULE', sqlcmd: ' 1=1 ' }, + resultField: 'Data.Items', + labelField: 'RULE_NAME', + valueField: 'RULE_CODE', + }; + }, + }, + { dataIndex: 'REMARK', title: '澶囨敞', ifShow: true, diff --git a/src/views/tigerprojects/system/lowcode/entityts/EMS_INS_ITEM.ts b/src/views/tigerprojects/system/lowcode/entityts/EMS_INS_ITEM.ts new file mode 100644 index 0000000..d417eb0 --- /dev/null +++ b/src/views/tigerprojects/system/lowcode/entityts/EMS_INS_ITEM.ts @@ -0,0 +1,251 @@ +/* + * @Description: 鐐规椤圭洰鐩稿叧 + * @Author: Ben Lin + * @version: + * @Date: 2024-06-19 20:34:27 + * @LastEditors: Ben Lin + * @LastEditTime: 2024-08-06 19:46:17 + */ + +import { ActionItem, BasicColumn } from '/@/components/Table'; +import { useI18n } from '/@/hooks/web/useI18n'; + +const { t } = useI18n(); +const isQuantitative = (type: number) => type === 0; +const isQualitative = (type: number) => type === 1; +function _default() { + const ActionColumn: BasicColumn = { + width: 80, + title: '鎿嶄綔', + dataIndex: 'action', + slots: { customRender: 'action' }, + fixed: undefined, + }; + + /** + * @description: 涓�浜涜嚜瀹氫箟鏂规硶 + * @return {*} + */ + const methods = { + /** + * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓� + * @return {*} + */ + CreateAction: (type: string) => { + return { + action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) + }; + }, + /** + * @description: 鎿嶄綔瀛楁鑷畾涔夋寜閽� + * @return {*} + */ + ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => { + return data; + }, + /** + * @description: 閫夋嫨杩囩▼鍙橀噺寮瑰嚭閫夋嫨妗嗘垚鍔熻繑鍥炶祴鍊兼柟娉� + * @param {*} d + * @param {*} u + * @return {*} + */ + GetSelectSuccess: (d, u) => { + return { + CUST_CODE: d.values['val'], + }; + }, + InitCrudFormSchema: (type: string, ...args) => { + return [ + { + field: 'INS_CODE', + label: '鐐规椤圭洰缂栫爜', + component: 'Input', + isexist: 'Y', + show: true, + required: true, + colProps: { + span: 24, + }, + }, + { + field: 'INS_NAME', + label: '鐐规椤圭洰鍚嶇О', + component: 'Input', + isexist: 'N', + show: true, + required: true, + colProps: { + span: 24, + }, + }, + { + field: 'IS_NECESSARY', + label: '鏄惁蹇呮(Y/N)', + component: 'Select', + isexist: 'N', + componentProps: { + options: [ + { + label: '鏄�', + value: 'Y', + key: '0', + }, + { + label: '鍚�', + value: 'N', + key: '0', + }, + ], + }, + show: true, + required: true, + colProps: { + span: 24, + }, + }, + { + field: 'IS_JUDGE', + label: '鏄惁鍒ゅ畾缁撴灉(Y/N)', + component: 'Select', + isexist: 'N', + componentProps: { + options: [ + { + label: '鏄�', + value: 'Y', + key: '0', + }, + { + label: '鍚�', + value: 'N', + key: '0', + }, + ], + }, + show: true, + required: false, + colProps: { + span: 24, + }, + }, + { + field: 'INS_MODE', + label: '妫�楠屾柟寮�', + component: 'ApiSelect', + isexist: 'N', + componentProps: { + api: 'GetEnum', + params: {}, + resultField: 'Data', + labelField: 'Desc', + valueField: 'Value', + }, + show: true, + required: false, + colProps: { + span: 24, + }, + }, + { + field: 'QNTV_UNIT', + label: '娴嬭瘯鍊煎崟浣�', + component: 'Input', + isexist: 'N', + ifShow: ({ values }) => isQuantitative(values.INS_MODE), + required: false, + colProps: { + span: 24, + }, + }, + { + field: 'QNTV_TIMES', + label: '娴嬭瘯娆℃暟(0-20)', + component: 'Input', + isexist: 'N', + ifShow: ({ values }) => isQuantitative(values.INS_MODE), + required: false, + colProps: { + span: 24, + }, + }, + { + field: 'QNTV_DEVIATION', + label: '鍋忓樊鍊�', + component: 'Input', + isexist: 'N', + ifShow: ({ values }) => isQuantitative(values.INS_MODE), + required: false, + colProps: { + span: 24, + }, + }, + { + field: 'QNTV_UPPER', + label: '娴嬭瘯鑼冨洿涓婇檺', + component: 'Input', + isexist: 'N', + ifShow: ({ values }) => isQuantitative(values.INS_MODE), + required: false, + colProps: { + span: 24, + }, + }, + { + field: 'QNTV_LOWER', + label: '娴嬭瘯鑼冨洿涓嬮檺', + component: 'Input', + isexist: 'N', + ifShow: ({ values }) => isQuantitative(values.INS_MODE), + required: false, + colProps: { + span: 24, + }, + }, + { + field: 'QLTV_LIST', + label: '娴嬭瘯椤瑰垪琛�', + component: 'Input', + isexist: 'N', + ifShow: ({ values }) => isQualitative(values.INS_MODE), + required: false, + colProps: { + span: 24, + }, + renderComponentContent: (_, { disabled }) => { + return { + suffix: () => '鐢ㄢ�渱鈥濆垎闅旓紝鏈�澶�20椤�', + }; + }, + }, + { + field: 'REMARK', + label: '澶囨敞', + component: 'Input', + isexist: 'N', + show: true, + required: false, + colProps: { + span: 24, + }, + }, + { + field: 'ID', + label: '鍞竴ID', + component: '', + show: false, + required: false, + colProps: { + span: 24, + }, + }, + ]; + }, + GetUseForm: () => { + return {}; + }, + }; + + return [methods, ActionColumn]; +} + +export default _default; diff --git a/src/views/tigerprojects/system/lowcode/normal/index.vue b/src/views/tigerprojects/system/lowcode/normal/index.vue index 520b804..bcb8a02 100644 --- a/src/views/tigerprojects/system/lowcode/normal/index.vue +++ b/src/views/tigerprojects/system/lowcode/normal/index.vue @@ -4,7 +4,7 @@ * @version: * @Date: 2024-05-30 13:28:20 * @LastEditors: Ben Lin - * @LastEditTime: 2024-07-25 14:50:59 + * @LastEditTime: 2024-08-06 19:57:41 --> <template> <div> @@ -26,6 +26,8 @@ import { useGo } from '/@/hooks/web/usePage'; import { useI18n } from '/@/hooks/web/useI18n'; import { getRoleButtons } from '/@/api/sys/menu'; + import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel'; + import { isFunction } from 'xe-utils'; const { getLocale } = useLocale(); const { t } = useI18n(); @@ -34,12 +36,12 @@ const go = useGo(); const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); const entityName = ref(objParams.value.ID); - const _columns = ref([]); - const _searchFormSchema = ref([]); - const _crudFormSchema = ref([]); + const _columns = ref<any[]>([]); + const _searchFormSchema = ref<any[]>([]); + const _crudFormSchema = ref<any[]>([]); const useModalData = ref({}); //琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶 const isExistSql = ref(''); - const custImport = ref<any>(null); + const custImport = ref<any[]>([]); const isMounted = ref(false); const buttons = ref([]); const AuthOption = ref({ @@ -76,10 +78,18 @@ // } // _columns.value = objs; isMounted.value = false; + const EntityCustFunction = ref([ + { + ActionItem(params: Recordable<any>, data, ...args) {}, + } as EntityCustFunctionType, + ]); /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ try { custImport.value = await import(`../entityts/${objParams.value.ID}.ts`); } catch (e) {} + const [{ InitCrudFormSchema }] = isNullOrUnDef(custImport.value['default']) + ? EntityCustFunction.value + : custImport.value['default'](); isMounted.value = true; //鑾峰彇琛ㄥ崟涓彃妲芥覆鏌撶殑鎸夐挳鐐瑰嚮寮瑰嚭妯℃�佺獥鍙g殑瀹炰緥 @@ -115,7 +125,14 @@ onChangeConfig(searchForms[i]); } _searchFormSchema.value = searchForms; - var _cruds = JSON.parse(data.Data.Items[0].FORM_JSON); + var _cruds: any[] = []; + /* 濡傛灉鏈夊垵濮嬪寲澧炲垹鏀归〉闈㈢粨鏋勭殑鏂规硶锛屽垯杩涘叆 */ + if (InitCrudFormSchema && isFunction(InitCrudFormSchema)) { + _cruds = InitCrudFormSchema(objParams.value.ID); + } else { + /* 娌℃湁鍒濆鍖栧鍒犳敼椤甸潰缁撴瀯鐨勬柟娉曟椂杩涘叆 */ + _cruds = JSON.parse(data.Data.Items[0].FORM_JSON); + } for (const i in _cruds) { if ( !isNullOrEmpty(_cruds[i].componentProps) && diff --git a/src/views/tigerprojects/system/lowcode/normalDrawer.vue b/src/views/tigerprojects/system/lowcode/normalDrawer.vue index 87ebe3d..6a39f5a 100644 --- a/src/views/tigerprojects/system/lowcode/normalDrawer.vue +++ b/src/views/tigerprojects/system/lowcode/normalDrawer.vue @@ -64,11 +64,12 @@ import GeneralModal from '/@/views/components/GeneralModal.vue'; import { SaveEntity, fetchJson, formatValues } from '/@/api/tigerapi/system'; import { useModal } from '/@/components/Modal'; - import { isNullOrUnDef } from '/@/utils/is'; + import { isNullOrUnDef, isTimeViaRegExp8601 } from '/@/utils/is'; import { useMessage } from '/@/hooks/web/useMessage'; import { useI18n } from '/@/hooks/web/useI18n'; import { isFunction } from 'xe-utils'; import { useUserStore } from '/@/store/modules/user'; + import { dateUtil } from '/@/utils/dateUtil'; const emit = defineEmits(['success', 'register']); const { t } = useI18n(); @@ -108,6 +109,13 @@ setDrawerProps({ confirmLoading: false }); if (unref(isUpdate)) { + /* 寰幆瀛楁鍚嶏紝鍒ゆ柇濡傛灉鏄椂闂寸殑灏辫浆鎹㈡垚dayjs鏍煎紡锛屽惁鍒欐椂闂撮�夋嫨鍣ㄤ細鍑洪敊 */ + const Keys = Object.getOwnPropertyNames(data.record); + for (const k in Keys) { + if (!isNullOrUnDef(data.record[Keys[k]]) && isTimeViaRegExp8601(data.record[Keys[k]])) { + data.record[Keys[k]] = dateUtil(data.record[Keys[k]]); //杞崲鎴恉ayjs鏍煎紡 + } + } setFieldsValue({ ...data.record, }); -- Gitblit v1.9.3