From 44ef538691b8be0fd925ca80c49157bad14962e8 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期六, 06 七月 2024 22:01:26 +0800 Subject: [PATCH] 一些优化 --- src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts | 183 ++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 179 insertions(+), 4 deletions(-) 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 9b096df..6e0f3b1 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts @@ -4,10 +4,19 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-23 00:28:56 + * @LastEditTime: 2024-06-28 10:53:28 */ -import { ActionItem, BasicColumn } from "/@/components/Table"; +import { Tag, Tooltip } from 'ant-design-vue'; +import { ActionItem, BasicColumn } from '/@/components/Table'; +import { useI18n } from '/@/hooks/web/useI18n'; +import { h, unref } from 'vue'; +import { GetEnum } from '/@/api/tigerapi/system'; +import { useLocale } from '/@/locales/useLocale'; + +const { getLocale } = useLocale(); + +const { t } = useI18n(); function _default() { const ActionColumn: BasicColumn = { @@ -17,12 +26,17 @@ slots: { customRender: 'action' }, fixed: undefined, }; + + /** + * @description: 涓�浜涜嚜瀹氫箟鏂规硶 + * @return {*} + */ const methods = { /** * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓猴紝蹇呴渶瑕佹湁鐨勬柟娉� * @return {*} */ - CreateAction: () => { + CreateAction: (fnName: string) => { return { action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) }; @@ -34,9 +48,170 @@ ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => { return data; }, + /** + * @description: 楂樼骇琛ㄥ崟鍜岃鎯呴〉闈㈣繑鍥炰富椤甸潰鐨剈rl + * @return {*} + */ GetHomeUrl: () => { return `/BAS_LABEL_TEMP/LC/${encodeURI(JSON.stringify({ ID: 'BAS_LABEL_TEMP', colSlots: [], crudColSlots: [] }))}`; - } + }, + GetBaseColumns: () => { + return [ + { + dataIndex: 'LABEL_ID', + title: '鏍囩妯℃澘ID', + ifShow: false, + sorter: true, + resizable: true, + }, + { + dataIndex: 'VAR_NAME', + title: '鍙橀噺鍚嶇О', + ifShow: true, + sorter: true, + resizable: true, + customRender: () => {}, + }, + { + dataIndex: 'VAR_TYPE', + title: '鍙橀噺绫诲瀷', + ifShow: true, + sorter: true, + resizable: true, + customRender: ({ record }) => { + let color = ''; + let text = ''; + switch (record.VAR_TYPE) { + case 0: + text = '甯搁噺'; + color = 'green'; + break; + case 1: + text = '杩囩▼鍙橀噺'; + color = 'orange'; + break; + case 2: + text = '鏃ユ湡鍙橀噺'; + color = '#4f68b0'; + break; + case 3: + text = '鑷畾涔夊彉閲�'; + color = '#bfbfbf'; + break; + } + return h(Tooltip, { title: text }, () => h(Tag, { color: color }, () => text)); + }, + }, + { + dataIndex: 'VAR_VALUE', + title: '鍙橀噺鍊�', + ifShow: true, + sorter: true, + resizable: true, + }, + { + dataIndex: 'REMARK', + title: '澶囨敞', + ifShow: true, + sorter: true, + resizable: true, + }, + ]; + }, + GetSearchForm: () => { + return [ + { + field: 'VAR_NAME', + label: t('鍙橀噺鍚�'), + colProps: { span: 8 }, + component: 'Input', + }, + ]; + }, + GetCrudForm: () => { + let isShow = false; + return [ + { + field: 'ID', + label: '鍙橀噺ID', + component: 'Input', + colProps: { + span: 20, + }, + show: false, + }, + { + field: 'LABEL_ID', + label: '鏍囩妯℃澘ID', + component: 'Input', + colProps: { + span: 20, + }, + show: false, + }, + { + field: 'VAR_NAME', + label: '鍙橀噺鍚�', + required: true, + component: 'Input', + isexist: 'Y', + colProps: { + span: 20, + }, + }, + { + field: 'VAR_TYPE', + label: '鍙橀噺绫诲瀷', + component: 'ApiSelect', + colProps: { + span: 20, + }, + componentProps: { + api: GetEnum, + params: { name: 'BAS_LABEL_VAR+VAR_TYPEs' }, + resultField: 'Data', + labelField: unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name', + valueField: 'Value', + onChange: (e) => { + if (e == 1) { + isShow = true; + } else { + isShow = false; + } + }, + }, + }, + { + field: 'VAR_VALUE', + label: '鍙橀噺鍊�', + required: true, + component: 'Input', + colProps: { + span: 20, + }, + }, + { + field: 'BAS_LABEL_PV1PSelect_0', //鎸変綆浠g爜閰嶇疆鐨勮鍒欙紝瀹炰綋鍚�+搴忓彿+PSelect_0锛屽簭鍙风敤鏉ュ尯鍒嗗涓殑鏃跺�欙紝PSelect_0杩欐槸涓浐瀹氬悗缂� + label: '1', + defaultValue: 'BAS_LABEL_PV', + component: 'Input', + colProps: { span: 4 }, + ifShow: ({ values }) => isShow, + colSlot: 'BAS_LABEL_PV1add', //鎸変綆浠g爜閰嶇疆鐨勮鍒欙紝瀹炰綋鍚�+搴忓彿+add锛屽簭鍙风敤鏉ュ尯鍒嗗涓殑鏃跺�欙紝add杩欐槸涓浐瀹氬悗缂� + }, + { + field: 'REMARK', + label: '澶囨敞', + component: 'Input', + colProps: { + span: 20, + }, + }, + ]; + }, + KeyFieldValues: (val: string, id: string) => { + return { LABEL_ID: id }; + }, }; return [methods, ActionColumn]; -- Gitblit v1.9.3