From 8e288eefbd4e8dbf7d0180dd880ce93256daa7a5 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期六, 22 六月 2024 01:05:18 +0800 Subject: [PATCH] 低代码优化 --- src/views/tigerprojects/system/lowcode/normal/basReasonGrp.ts | 251 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 249 insertions(+), 2 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/normal/basReasonGrp.ts b/src/views/tigerprojects/system/lowcode/normal/basReasonGrp.ts index ed04bd8..835d779 100644 --- a/src/views/tigerprojects/system/lowcode/normal/basReasonGrp.ts +++ b/src/views/tigerprojects/system/lowcode/normal/basReasonGrp.ts @@ -1,7 +1,14 @@ -import { ActionItem, BasicColumn } from '/@/components/Table'; +import { ActionItem, BasicColumn, FormSchema } from '/@/components/Table'; import { useMessage } from '/@/hooks/web/useMessage'; import { useI18n } from '/@/hooks/web/useI18n'; import { FunctionType } from '/@/api/tigerapi/model/systemModel'; +import { DeleteEntity, getEntity } from '/@/api/tigerapi/system'; +import { Tag } from 'ant-design-vue'; +import { Ref, h } from 'vue'; +import { isNullOrEmpty } from '/@/utils/is'; +import { buildUUID } from '/@/utils/uuid'; +import { useUserStore } from '/@/store/modules/user'; +import { formatToDateTime } from '/@/utils/dateUtil'; const { t } = useI18n(); const { notification } = useMessage(); @@ -32,9 +39,48 @@ }, ]; +/** + * @description: 鑷畾涔夋槑缁嗚〃涓紪杈戣繑鍥炴柟娉� + * @param {string} type + * @param {*} d + * @param {*} u + * @return {*} + */ +export function rsnEditeOperation( data: Ref<any[]>, d, u) { + if (u.isUpdate) { + //鏇存柊 + var _data = data.value.map((item) => { + if (item['ID'] == d.ID) + return { + ...item, + RSN_CODE: d.RSN_CODE, + RSN_NAME: d.RSN_NAME, + NEED_REPLACE: d.NEED_REPLACE, + REMARK: d.REMARK, + }; + return item; + }); + data.value = _data; + } else { + //鏂板 + d.ID = buildUUID(); + d.CREATE_USER = useUserStore().getUserInfo.userId as string; + d.UPDATE_TIME = formatToDateTime(new Date()); + d.UPDATE_USER = useUserStore().getUserInfo.userId as string; + var _data2: any[] = []; + if (!isNullOrEmpty(data.value)) { + _data2 = data.value.map((item) => { + return item; + }); + } + _data2.push(d); + data.value = _data2; + } +} + export function rsGrpGetSelectSuccess(d, u) { return { - RSNG_CODE: d.values.values, + RSNG_CODE: d.values['val'], }; } @@ -69,6 +115,7 @@ ], tableName: 'BAS_REASON_GRP', rowKey: 'RSNG_CODE', + searchInfo: {TABLE_NAME: 'BAS_REASON_GRP'} }); } @@ -83,3 +130,203 @@ }, XXX: (e) => {}, }; + +/** + * @description: 涓嶈壇鍘熷洜涓诲熀鏈俊鎭〃鍗曞瓧娈� + * @return {*} + */ +export const rsnBaseSchema: FormSchema[] = [ + { + field: 'RSNG_CODE', + label: '涓嶈壇鍘熷洜缁勭紪鐮�', + component: 'Input', + required: true, + colProps: { + span: 8, + }, + }, + { + label: '涓嶈壇鍘熷洜缁勫悕绉�', + field: 'RSNG_NAME', + required: true, + component: 'Input', + colProps: { + span: 8, + }, + }, + { + label: '澶囨敞', + field: 'REMARK', + component: 'Input', + colProps: { + span: 8, + }, + }, + { + label: 'ID', + field: 'ID', + component: 'Input', + colProps: { + span: 8, + }, + show: false, + }, +]; + +/** + * @description: 涓嶈壇鍘熷洜澧炲垹鏀瑰瓧娈� + * @return {*} + */ +export const rsnCrudSchema: FormSchema[] = [ + { + field: 'RSN_CODE', + label: '涓嶈壇鍘熷洜缂栫爜', + component: 'Input', + required: true, + colProps: { + span: 24, + }, + }, + { + label: '涓嶈壇鍘熷洜鍚嶇О', + field: 'RSN_NAME', + component: 'Input', + required: true, + colProps: { + span: 24, + }, + }, + { + label: '涓嶈壇鍘熷洜缁勭紪鐮�', + field: 'RSNG_CODE', + component: 'ApiSelect', + colProps: { + span: 24, + }, + componentProps: { + api: getEntity, + params: { entityName: 'BAS_REASON_GRP', sqlcmd: ' 1=1 ' }, + resultField: 'Data.Items', + labelField: 'RSNG_NAME', + valueField: 'RSNG_CODE', + }, + dynamicDisabled: ({ values }) => { + return true; + }, + }, + { + label: '鏄惁蹇呴』鏇存崲闆朵欢', + field: 'NEED_REPLACE', + component: 'Select', + required: true, + colProps: { + span: 24, + }, + componentProps: { + options: [ + { + label: '鏇存崲', + value: 'Y', + key: 'Y', + }, + { + label: '涓嶆洿鎹�', + value: 'N', + key: 'N', + }, + ], + }, + }, + { + label: '澶囨敞', + field: 'REMARK', + component: 'Input', + colProps: { + span: 24, + }, + }, + { + label: 'ID', + field: 'ID', + component: 'Input', + colProps: { + span: 24, + }, + show: false, + }, +]; + +/** + * @description: 涓嶈壇鍘熷洜鏌ヨ瀛楁 + * @return {*} + */ +export const rsnSearchSchema: FormSchema[] = [ + { + field: 'RSN_CODE', + label: '涓嶈壇鍘熷洜缂栫爜', + component: 'Input', + colProps: { + span: 8, + }, + }, + { + label: '涓嶈壇鍘熷洜鍚嶇О', + field: 'RSN_NAME', + component: 'Input', + colProps: { + span: 8, + }, + }, +]; + +/** + * @description: 涓嶈壇鍘熷洜琛ㄦ牸鍒� + * @return {*} + */ +export const rsnBaseColumn: BasicColumn[] = [ + { + title: '涓嶈壇鍘熷洜缂栫爜', + dataIndex: 'RSN_CODE', + // ifShow: false, + width: 180, + }, + { + title: '涓嶈壇鍘熷洜鍚嶇О', + dataIndex: 'RSN_NAME', + }, + { + title: '鏄惁蹇呴』鏇存崲闆朵欢', + dataIndex: 'NEED_REPLACE', + customRender: ({ record }) => { + const type = record.NEED_REPLACE; + var text = ''; + var color = 'green'; + switch (type) { + case 'Y': + text = '鏇存崲'; + break; + case 'N': + color = 'blue'; + text = '涓嶆洿鎹�'; + break; + } + return h(Tag, { color: color }, () => text); + }, + }, + { + title: '涓嶈壇鍘熷洜缁勭紪鐮�', + dataIndex: 'RSNG_CODE', + }, + { + title: '澶囨敞', + dataIndex: 'REMARK', + }, + { + title: '鏇存柊鏃堕棿', + dataIndex: 'UPDATE_TIME', + }, + { + title: '鏇存柊浜�', + dataIndex: 'UPDATE_USER', + }, +]; -- Gitblit v1.9.3