From 46c3d28c5633baaddad0da441185310b9360a45b Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 03 七月 2024 14:56:21 +0800 Subject: [PATCH] 高级表单优化 --- src/views/tigerprojects/system/lowcode/entityts/MES_SHIFT.ts | 14 +- src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts | 4 src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts | 2 src/views/tigerprojects/system/lowcode/entityts/QMS_INS_STD.ts | 6 src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT.ts | 2 src/views/tigerprojects/system/lowcode/data.ts | 2 src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts | 6 src/views/tigerprojects/system/lowcode/high/index.vue | 74 ++++++-------- src/views/tigerprojects/system/lowcode/entityts/V_BAS_PROD.ts | 2 src/views/tigerprojects/system/lowcode/detail/index.vue | 6 src/views/tigerprojects/system/lowcode/entityts/MES_SHIFT_SYS.ts | 10 +- src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts | 2 src/api/tigerapi/model/basModel.ts | 3 src/views/tigerprojects/system/lowcode/entityts/QMS_INS_ITEM.ts | 2 src/views/tigerprojects/system/lowcode/normalDrawer.vue | 4 src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts | 6 src/views/tigerprojects/system/lowcode/high/dtl.vue | 59 ++++++----- src/views/tigerprojects/system/lowcode/detail/detail.vue | 14 +- src/views/tigerprojects/system/lowcode/normal/mainTable.vue | 18 +-- src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_RULE.ts | 6 src/views/tigerprojects/system/lowcode/normal/index.vue | 6 src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts | 2 22 files changed, 122 insertions(+), 128 deletions(-) diff --git a/src/api/tigerapi/model/basModel.ts b/src/api/tigerapi/model/basModel.ts index c2a9d7e..49a8891 100644 --- a/src/api/tigerapi/model/basModel.ts +++ b/src/api/tigerapi/model/basModel.ts @@ -131,7 +131,7 @@ GetCrudForm: (type: string | undefined,) => [] | {}; GetBaseForm: () => [] | {}; GetBaseCards: (type: string | undefined) => []; - OthersValues: (val: string, id: string) => {}; + KeyFieldValues: (val: string, id: string) => {}; GetTitle: (type: string | undefined) => {}; GetCrudColSlots: () => []; nodeChange: ({}) => void; @@ -147,4 +147,5 @@ GetSlots: (type: string | undefined) => {}; GenerateHtml: (type: string | null) => HTMLElement | null; CustFunc: (type: string | undefined, ...args) => void | any; + SubmitAll: (data: Ref<any[]>) => void | any; } diff --git a/src/views/tigerprojects/system/lowcode/data.ts b/src/views/tigerprojects/system/lowcode/data.ts index 80cde58..20bc750 100644 --- a/src/views/tigerprojects/system/lowcode/data.ts +++ b/src/views/tigerprojects/system/lowcode/data.ts @@ -30,7 +30,7 @@ * 5. 鍒濆鍖栬〃鏍� GetBasicColumnAndInit * 6. 璁剧疆杩斿洖 getHomeUrl * 7. 璁剧疆鏍囬 getTitle - * 8. 璁剧疆鏂板鏃跺氨榛樿鐨勫�� getOthersValues + * 8. 璁剧疆鏂板鏃跺氨榛樿鐨勫�� getKeyFieldValues * 9. 鏇挎崲鍒犻櫎鏂规硶 GetActionsData * @param {*} params * @param {array} args diff --git a/src/views/tigerprojects/system/lowcode/detail/detail.vue b/src/views/tigerprojects/system/lowcode/detail/detail.vue index 526315c..38b9a5c 100644 --- a/src/views/tigerprojects/system/lowcode/detail/detail.vue +++ b/src/views/tigerprojects/system/lowcode/detail/detail.vue @@ -47,7 +47,7 @@ }); const objParams = inject('objParams') as Ref<any>; const data = inject('data') as Ref<Recordable[]>; - const others = inject('others') as Ref<Recordable[]>; + const keyFieldValues = inject('keyFieldValues') as Ref<Recordable[]>; const go = useGo(); const [registerDrawer, { openDrawer }] = useDrawer(); const [registerItemAdd, { openModal: openItemModal }] = useModal(); @@ -60,11 +60,11 @@ const EntityCustFunction = ref([ { ActionItem(params, data, ...args) {}, - EditOperation(data, d, u) {}, + EditOperation(data, d, u, item) {}, GetBaseColumns(type: string | undefined) {}, GetSearchForm(type: string | undefined) {}, GetCrudForm(type: string | undefined, ...args) {}, - OthersValues(val, id) {}, + KeyFieldValues(val, id) {}, GetSelectSuccess(d, u, ...args) {}, OpenSelectItem(openItemModal: Fn, ...args) {}, } as EntityCustFunctionType, @@ -80,18 +80,18 @@ GetBaseColumns, GetSearchForm, GetCrudForm, - OthersValues, + KeyFieldValues, GetSelectSuccess, OpenSelectItem, }, ] = isNullOrUnDef(custImport.value['default']) ? EntityCustFunction.value : custImport.value['default'](); - others.value = OthersValues(objParams['CODE'], objParams['ID']); + keyFieldValues.value = KeyFieldValues(objParams['CODE'], objParams['ID']); const [registerTable, { getForm, reload, setProps }] = useTable({ title: `${objParams['firstTitle']}鍒楄〃`, api: getListByPage, - searchInfo: { TABLE_NAME: objParams['Name'], ...objParams['others'] }, + searchInfo: { TABLE_NAME: objParams['Name'], ...objParams['keyFieldValues'] }, columns: GetBaseColumns(), formConfig: { labelWidth: 140, @@ -203,7 +203,7 @@ entityName: props.entityName, formJson: GetCrudForm(), //getFormSchema(`${entityName.value}_Crud`), crudColSlots: colSlots.value, - others: others.value, + keyFieldValues: keyFieldValues.value, isExistSql: isExistSql, }); } diff --git a/src/views/tigerprojects/system/lowcode/detail/index.vue b/src/views/tigerprojects/system/lowcode/detail/index.vue index c450952..65c2228 100644 --- a/src/views/tigerprojects/system/lowcode/detail/index.vue +++ b/src/views/tigerprojects/system/lowcode/detail/index.vue @@ -4,7 +4,7 @@ * @version: * @Date: 2024-05-30 13:28:20 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-25 14:41:28 + * @LastEditTime: 2024-07-03 08:46:37 --> <template> <PageWrapper :title="pageTitle" :content="contentStr" contentBackground @back="goBack"> @@ -94,9 +94,9 @@ const cType = ref(''); const dtlSlots = ref([] as any[]); const selectVals = ref({}); - const others = ref<any>(null); + const keyFieldValues = ref<any>(null); provide<Ref<any>>('objParams', objParams.value); - provide<Ref<any>>('others', others); + provide<Ref<any>>('keyFieldValues', keyFieldValues); const [registerCust] = useModal(); var currentKey = ref('detailfirst'); diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT.ts index d2cd403..d809216 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT.ts @@ -192,7 +192,7 @@ } return data; }, - OthersValues: (val: string, id: string) => { + KeyFieldValues: (val: string, id: string) => { return { DFTG_CODE: val }; } /** * @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 a450218..76d4285 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-07-02 21:06:18 + * @LastEditTime: 2024-07-03 11:42:26 */ import { ActionItem, BasicColumn } from '/@/components/Table'; @@ -41,7 +41,7 @@ Title: '鏂板涓嶈壇浠g爜缁�', // pCode: 'DFTG_CODE', IsID: false, - drawers: [{ name: 'BAS_DEFECT', code: 'DFTG_CODE' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 + drawers: [{ name: 'BAS_DEFECT', code: 'DFTG_CODE', type: 'one' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 }, }; }, @@ -124,7 +124,7 @@ Title: `缂栬緫涓嶈壇浠g爜缁勶細${params['record']['DFTG_CODE']}`, pCode: 'DFTG_CODE', IsID: false, - drawers: [{ name: 'BAS_DEFECT', code: 'DFTG_CODE' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 + drawers: [{ name: 'BAS_DEFECT', code: 'DFTG_CODE', type: 'one' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 }; // 灏嗗璞¤浆鎹负JSON瀛楃涓插苟淇濆瓨鍒皊essionStorage sessionStorage.removeItem(`${param.SessionName}_params`); diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts index c00d7ca..cca2279 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-28 10:52:45 + * @LastEditTime: 2024-07-03 08:52:24 */ import { ActionItem, BasicColumn } from '/@/components/Table'; @@ -69,7 +69,7 @@ pageTitle: '鏍囩妯℃澘鍙橀噺', //璇︽儏椤甸潰鏍囬 contentStr: '杩欓噷鏄爣绛炬ā鏉垮彉閲忕鐞嗛〉闈紝鍙互绠$悊鏍囩鐨勬ā鏉垮彉閲忔垨鑰呮墦鍗拌繃绋嬩腑鐨勫彉閲�', detailName: `妯℃澘[${params['record'].LABEL_NAME}]`, - others: { LABEL_ID: params['record'].ID }, + keyFieldValues: { LABEL_ID: params['record'].ID }, colSlots: ['BAS_LABEL_PV1add'], }; go(`/BAS_LABEL_VAR/${encodeURI(JSON.stringify(id))}`); 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 288d9f2..6e0f3b1 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts @@ -209,7 +209,7 @@ }, ]; }, - OthersValues: (val: string, id: string) => { + KeyFieldValues: (val: string, id: string) => { return { LABEL_ID: id }; }, }; diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts index d26dd9d..c52f115 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts @@ -102,7 +102,7 @@ GetCrudForm: (type: string) => { return crudForms[type]; }, - OthersValues: (val: string, id: string) => { + KeyFieldValues: (val: string, id: string) => { return { PKG_RULE_ID: id }; }, /** diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_RULE.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_RULE.ts index a4ccad7..0913481 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_RULE.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_RULE.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-07-02 21:03:23 + * @LastEditTime: 2024-07-03 11:42:41 */ import { ActionItem, BasicColumn } from '/@/components/Table'; @@ -40,7 +40,7 @@ Title: '鏂板鍖呰瑙勫垯', pCode: 'PKG_RULE_ID', IsID: true, - drawers: [{ name: 'BAS_PKG_DTL', code: 'PKG_RULE_ID' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 + drawers: [{ name: 'BAS_PKG_DTL', code: 'PKG_RULE_ID', type: 'one' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 }, }; }, @@ -73,7 +73,7 @@ Title: `缂栬緫鍖呰瑙勫垯锛�${params['record']['RULE_CODE']}`, pCode: 'PKG_RULE_ID', IsID: true, - drawers: [{ name: 'BAS_PKG_DTL', code: 'PKG_RULE_ID' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 + drawers: [{ name: 'BAS_PKG_DTL', code: 'PKG_RULE_ID', type: 'one' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 }; // 灏嗗璞¤浆鎹负JSON瀛楃涓插苟淇濆瓨鍒皊essionStorage sessionStorage.removeItem(`${param.SessionName}_params`); diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts index 2474329..b7359b0 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts @@ -201,7 +201,7 @@ } return data; }, - OthersValues: (val: string, id: string) => { + KeyFieldValues: (val: string, id: string) => { return { RSNG_CODE: val }; }, /** 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 7b03b74..a78d860 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-07-02 21:29:04 + * @LastEditTime: 2024-07-03 11:42:48 */ import { ActionItem, BasicColumn } from '/@/components/Table'; @@ -43,7 +43,7 @@ Title: '鏂板涓嶈壇鍘熷洜缁�', pCode: 'RSNG_CODE', IsID: false, - drawers: [{ name: 'BAS_REASON', code: 'RSNG_CODE' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 + drawers: [{ name: 'BAS_REASON', code: 'RSNG_CODE', type: 'one' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 }, }; }, @@ -115,7 +115,7 @@ Title: `缂栬緫涓嶈壇鍘熷洜缁勶細${params['record']['RSNG_CODE']}`, pCode: 'RSNG_CODE', IsID: false, - drawers: [{ name: 'BAS_REASON', code: 'RSNG_CODE' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 + drawers: [{ name: 'BAS_REASON', code: 'RSNG_CODE', type: 'one' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 }; // 灏嗗璞¤浆鎹负JSON瀛楃涓插苟淇濆瓨鍒皊essionStorage sessionStorage.removeItem(`${param.SessionName}_params`); diff --git a/src/views/tigerprojects/system/lowcode/entityts/MES_SHIFT.ts b/src/views/tigerprojects/system/lowcode/entityts/MES_SHIFT.ts index be4ec99..e2ad384 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/MES_SHIFT.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/MES_SHIFT.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-07-02 19:41:38 + * @LastEditTime: 2024-07-03 10:15:44 */ import { Ref, h, ref, unref } from 'vue'; @@ -251,9 +251,10 @@ } return data; }, - OthersValues: (val: string, id: string) => { + KeyFieldValues: (val: string, id: string) => { return { SFTS_CODE: val }; - } /** + } + /** * @description: 鑷畾涔夋槑缁嗚〃涓紪杈戣繑鍥炴柟娉� * @param {string} type * @param {*} d @@ -303,14 +304,15 @@ * @return {*} */ function Del(args: Fn[], params: {}) { + const name = params['name']; if (!isNullOrEmpty(params['data'])) { - var _data = params['data'].value.filter((item) => item['ID'] != params['record']['ID']); - params['data'].value = _data; + var _data = params['data'].value[name].filter((item) => item['ID'] != params['record']['ID']); + params['data'].value[name] = _data; args[6]({ dataSource: [], }); args[6]({ - dataSource: params['data'], + dataSource: params['data'].value[name], }); args[1](); } else { diff --git a/src/views/tigerprojects/system/lowcode/entityts/MES_SHIFT_SYS.ts b/src/views/tigerprojects/system/lowcode/entityts/MES_SHIFT_SYS.ts index ab2ffb7..f2b795d 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/MES_SHIFT_SYS.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/MES_SHIFT_SYS.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-07-02 21:28:53 + * @LastEditTime: 2024-07-03 11:42:15 */ import { ActionItem, BasicColumn } from '/@/components/Table'; @@ -42,8 +42,8 @@ pCode: 'SFTS_CODE', //涓讳俊鎭叧閿瓧娈礐ODE IsID: false, //鏄惁甯﹁繃鍘讳晶杈规鐨勬槸ID锛宖alse灏辨槸CODE锛宼rue鏄疘D drawers: [ - { name: 'MES_SHIFT', code: 'SFTS_CODE' }, - { name: 'MES_SHIFT_PRD', code: 'SFT_CODE' }, + { name: 'MES_SHIFT', code: 'SFTS_CODE', type: 'one' }, + { name: 'MES_SHIFT_PRD', code: 'SFT_CODE', type: 'all', keyName: 'MES_SHIFT' }, ], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 }, }; @@ -128,8 +128,8 @@ // pCode: 'SFTS_CODE', //涓讳俊鎭叧閿瓧娈礐ODE锛岄珮绾ц〃鍗曠敤涓嬮潰drawers閲岀殑code IsID: false, //鏄惁甯﹁繃鍘讳晶杈规鐨勬槸ID锛宖alse灏辨槸CODE锛宼rue鏄疘D drawers: [ - { name: 'MES_SHIFT', code: 'SFTS_CODE' }, - { name: 'MES_SHIFT_PRD', code: 'SFT_CODE' }, + { name: 'MES_SHIFT', code: 'SFTS_CODE', type: 'one' }, //type: one-琛ㄧず闇�瑕乧ode: 'SFTS_CODE'鍙鍞竴鍊� + { name: 'MES_SHIFT_PRD', code: 'SFT_CODE', type: 'all', keyName: 'MES_SHIFT' }, //type: all-琛ㄧず闇�瑕乧ode: 'SFT_CODE'鎵�鏈夌殑鍊硷紝keyName锛氳〃绀洪渶瑕佹墍鏈夊�肩殑code鐨勫疄浣撳悕 ], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 }; // 灏嗗璞¤浆鎹负JSON瀛楃涓插苟淇濆瓨鍒皊essionStorage diff --git a/src/views/tigerprojects/system/lowcode/entityts/QMS_INS_ITEM.ts b/src/views/tigerprojects/system/lowcode/entityts/QMS_INS_ITEM.ts index 1efbb48..edf92bf 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/QMS_INS_ITEM.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/QMS_INS_ITEM.ts @@ -215,7 +215,7 @@ } return data; }, - OthersValues: (val: string, id: string) => { + KeyFieldValues: (val: string, id: string) => { return { TECH_STD: val }; }, /** 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 78087a2..4f7c633 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-07-02 21:29:12 + * @LastEditTime: 2024-07-03 11:43:01 */ import { ActionItem, BasicColumn } from '/@/components/Table'; @@ -43,7 +43,7 @@ pCode: 'TECH_STD', //璺宠浆鍒伴珮绾ц〃鍗曠殑鍏抽敭瀛楁鍚� mCode: 'STD_CODE', //璺宠浆鍒伴珮绾ц〃鍗曠殑鍏抽敭瀛楁鍚嶆槧灏勫瓧娈� IsID: false, - drawers: [{ name: 'QMS_INS_ITEM', code: 'STD_CODE' }], //IfShow: true:楂樼骇琛ㄥ崟鏄惁鏄剧ず瀛愯〃鏍煎鍒犳敼锛宒rawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 + drawers: [{ name: 'QMS_INS_ITEM', code: 'STD_CODE', type: 'one' }], //IfShow: true:楂樼骇琛ㄥ崟鏄惁鏄剧ず瀛愯〃鏍煎鍒犳敼锛宒rawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 }, }; }, @@ -127,7 +127,7 @@ pCode: 'TECH_STD', //璺宠浆鍒伴珮绾ц〃鍗曠殑鍏抽敭瀛楁鍚� mCode: 'STD_CODE', //璺宠浆鍒伴珮绾ц〃鍗曠殑鍏抽敭瀛楁鍚嶆槧灏勫瓧娈� IsID: false, - drawers: [{ name: 'QMS_INS_ITEM', code: 'STD_CODE' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 + drawers: [{ name: 'QMS_INS_ITEM', code: 'STD_CODE', type: 'one' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃 }; // 灏嗗璞¤浆鎹负JSON瀛楃涓插苟淇濆瓨鍒皊essionStorage sessionStorage.removeItem(`${param.SessionName}_params`); diff --git a/src/views/tigerprojects/system/lowcode/entityts/V_BAS_PROD.ts b/src/views/tigerprojects/system/lowcode/entityts/V_BAS_PROD.ts index 3e2448f..ec88e63 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/V_BAS_PROD.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/V_BAS_PROD.ts @@ -45,7 +45,7 @@ }, ]; }, - OthersValues: (val: string, id: string) => { + KeyFieldValues: (val: string, id: string) => { return { RSNG_CODE: val }; }, }; diff --git a/src/views/tigerprojects/system/lowcode/high/dtl.vue b/src/views/tigerprojects/system/lowcode/high/dtl.vue index 389a2b9..27ee060 100644 --- a/src/views/tigerprojects/system/lowcode/high/dtl.vue +++ b/src/views/tigerprojects/system/lowcode/high/dtl.vue @@ -16,7 +16,6 @@ <TableAction :actions="createActions(record, index, item.name)" /> </template> <template #[item]="{ field }" v-for="item in colSlots" :key="item"> - <!-- <template #form-BAS_REASON3aadd="{ field }"> --> <a-button v-if="field" class="mt-1 ml-1" @@ -38,9 +37,9 @@ </div> </template> <script lang="ts" setup> - import { Ref, inject, nextTick, onMounted, ref, watch } from 'vue'; - import { BasicTable, useTable, TableAction } from '/@/components/Table'; - import { BasicForm, useForm } from '/@/components/Form/index'; + import { Ref, inject, onMounted, ref, watch } from 'vue'; + import { BasicTable, TableAction } from '/@/components/Table'; + import { useForm } from '/@/components/Form/index'; import GeneralModal from '/@/views/components/GeneralModal.vue'; import normalDrawer from '../normalDrawer.vue'; import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; @@ -60,27 +59,25 @@ entityName: { type: String }, crudColSlots: { type: Object as PropType<any> }, }); + /* 涓婚〉闈㈡敞鍏ョ殑鍙橀噺 */ const objParams = inject('objParams') as Ref<any>; const data = inject('data') as Ref<any>; const _useTables = inject('useTables') as Ref<any>; const useFormData = inject('useFormData') as Ref<{}>; - const others = inject('others') as Ref<Recordable[]>; + const keyFieldValues = inject('keyFieldValues') as Ref<Recordable[]>; + const go = useGo(); const [registerItemAdd, { openModal: openItemModal }] = useModal(); const cType = ref(''); const dtlSlots = ref([] as any[]); - const selectVals = ref({}); - const baseCards = ref([] as any[]); const useModalData = ref({}); //琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶 const custImport = ref<any[]>([]); const EntityCustFunction = ref([ { ActionItem(params, data, ...args) {}, EditOperation(data, d, u, item) {}, - GetBaseColumns(type: string | undefined) {}, - GetSearchForm(type: string | undefined) {}, GetCrudForm(type: string | undefined, ...args) {}, - OthersValues(val, id) {}, + KeyFieldValues(val, id) {}, GetTitle(type: string | undefined) {}, GetUseTables(data: Ref<Recordable[]>, ...args) {}, GetUseDrawers() {}, @@ -94,10 +91,8 @@ { ActionItem: nActionItem, EditOperation, - GetBaseColumns, - GetSearchForm, GetCrudForm, - OthersValues, + KeyFieldValues, GetTitle, GetUseTables, GetUseDrawers, @@ -105,11 +100,11 @@ ] = isNullOrUnDef(custImport.value['default']) ? EntityCustFunction.value : custImport.value['default'](); - others.value = OthersValues(objParams.value['CODE'], objParams.value['ID']); - const drawers = ref<any[]>(objParams.value['drawers']); - const useTables = GetUseTables(data, emit); - const useDrawers = GetUseDrawers(); - _useTables.value = useTables; + keyFieldValues.value = KeyFieldValues(objParams.value['CODE'], objParams.value['ID']); //鑾峰彇涓�浜涘叾浠栨湁闇�瑕佹彁渚涚殑鍊硷紝杩欓噷鏄富椤甸潰璺宠浆杩囨潵鏃跺甫鐨勫叧閿瓧娈靛�� + const drawers = ref<any[]>(objParams.value['drawers']); //鏄彸渚ц竟妗嗗垪琛紝閲岄潰鐨刵ame琛ㄧず鏄摢涓�涓疄浣擄紝涔熷氨鏄珮绾ц〃鍗曚腑琛ㄦ牸鐨勫悕瀛楋紝寰堝鏂规硶闇�瑕佷互杩欎釜鍚嶅瓧涓簁ey + const useTables = GetUseTables(data, emit); //楂樼骇琛ㄥ崟涓悇涓〃鏍�(Table)鐨剈seTable鏂规硶瀹炵幇鍒楄〃 + const useDrawers = GetUseDrawers(); //楂樼骇琛ㄥ崟涓悇涓〃鏍�(Table)鐨勫彸渚ц竟妗�(Drawer)鐨剈seDrawer鏂规硶瀹炵幇鍒楄〃 + _useTables.value = useTables; //鎶妘seTable鐨勫垪琛ㄥ搷搴斿埌浠庝富椤甸潰娉ㄥ叆鐨刜useTables锛岃繖鏍蜂富椤甸潰鑳芥嬁鍒皍seTable鐨勭粨鏋滐紝浠庤�屽彲浠ヤ娇鐢ㄥ悇涓〃鏍肩殑鍐呯疆鏂规硶 // watch( // () => props.dataSource, // (newVal, oldVal) => { @@ -126,11 +121,15 @@ // { deep: true, immediate: true }, // ); + /** + * @description: 鎸傝浇缁勪欢瀹屾垚鏃� + * @return {*} + */ onMounted(async () => { for (const i in drawers.value) { let sqlcmd = ' 1 =1 '; - if (!isNullOrEmpty(others.value[drawers.value[i].code])) { - sqlcmd += ` And ${drawers.value[i].code} = '${others.value[drawers.value[i].code]}'`; + if (!isNullOrEmpty(keyFieldValues.value[drawers.value[i].code])) { + sqlcmd += ` And ${drawers.value[i].code} = '${keyFieldValues.value[drawers.value[i].code]}'`; } const list = await getEntity({ sqlcmd: sqlcmd, @@ -154,7 +153,7 @@ * @param {*} record * @return {*} */ - function createActions(record,index, item) { + function createActions(record, index, item) { const params = { record, isUpdate: true, @@ -167,6 +166,7 @@ useFormData, crudColSlots: props.crudColSlots, data, + name: item, //drawers鍒楄〃閲岄潰鐨刵ame锛岃〃绀烘槸鍝竴涓疄浣擄紝涔熷氨鏄珮绾ц〃鍗曚腑琛ㄦ牸鐨勫悕瀛� }; const actionItem = [ { @@ -239,12 +239,18 @@ return validates; } + /** + * @description: 鏂板鎸夐挳鏂规硶 + * @param {*} index + * @param {*} item + * @return {*} + */ function handleCreate(index, item) { validate().then((res) => { const Keys = Object.getOwnPropertyNames(useFormData.value); let i; for (i = 0; i < Keys.length; i++) { - others.value[objParams.value['pCode']] = objParams.value['IsID'] + keyFieldValues.value[objParams.value['pCode']] = objParams.value['IsID'] ? res[Keys[i]]['ID'] : res[Keys[i]][objParams.value['pCode']] == '0' || isNullOrUnDef(res[Keys[i]][objParams.value['pCode']]) @@ -255,9 +261,9 @@ isUpdate: false, ifSave: true, entityName: props.entityName, - formJson: GetCrudForm(item, data), //getFormSchema(`${entityName.value}_Crud`), + formJson: GetCrudForm(item, data), //鑾峰彇澧炲垹鏀硅〃鍗曞瓧娈� crudColSlots: props.crudColSlots, - others: others.value, + keyFieldValues: keyFieldValues.value, }); }); } @@ -266,8 +272,9 @@ * @description: 鏂板缂栬緫杩斿洖鎴愬姛鏂规硶 * @param {*} d * @param {*} u + * @param {*} item 椤甸潰涓婂惊鐜娊灞夊垪琛ㄤ紶鍏ョ殑瀹炰綋鍚嶅瓧锛屼綔涓哄悇琛ㄦ牸鐩稿叧鏂规硶鐨刱ey锛屼粠鑰岃皟鐢ㄥ悇琛ㄦ牸鐩稿叧鐨勬柟娉曪紝濡傦細useTables[item][1].setProps * @return {*} - */ + */ function handleSuccess(d, u, item) { if (!isNullOrUnDef(custImport.value)) { /* 鑷畾涔夌紪杈戞柟娉曪紝鏍规嵁瀹炰綋鍚嶅幓璋冪敤 */ @@ -286,7 +293,7 @@ * @description: 寮瑰嚭閫夋嫨妗嗛�夋嫨鎴愬姛鍚庝簨浠� * @param {*} d * @param {*} u - * @param {*} item + * @param {*} item 椤甸潰涓婂惊鐜娊灞夊垪琛ㄤ紶鍏ョ殑瀹炰綋鍚嶅瓧锛屼綔涓哄悇琛ㄦ牸鐩稿叧鏂规硶鐨刱ey锛屼粠鑰岃皟鐢ㄥ悇琛ㄦ牸鐩稿叧鐨勬柟娉曪紝濡傦細useTables[item][1].getForm() * @return {*} */ function handleItemSuccess(d, u, item) { diff --git a/src/views/tigerprojects/system/lowcode/high/index.vue b/src/views/tigerprojects/system/lowcode/high/index.vue index 2fc2b7a..a45dc38 100644 --- a/src/views/tigerprojects/system/lowcode/high/index.vue +++ b/src/views/tigerprojects/system/lowcode/high/index.vue @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-18 15:09:48 * @LastEditors: Ben Lin - * @LastEditTime: 2024-07-02 22:51:31 + * @LastEditTime: 2024-07-03 14:36:19 --> <!-- * _oo0oo_ @@ -125,6 +125,7 @@ import { buildUUID } from '/@/utils/uuid'; import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; import { useI18n } from '/@/hooks/web/useI18n'; + import { isFunction } from 'xe-utils'; const { t } = useI18n(); @@ -159,7 +160,7 @@ const otherCards = ref([] as any[]); const isMounted = ref(false); const custImport = ref<any[]>([]); - const others = ref<any>(null); + const keyFieldValues = ref<any>(null); const data = ref<any>({}); const useTables = ref<any>({}); for (const i in objParams.value['drawers']) { @@ -167,7 +168,7 @@ } provide<Ref<any>>('objParams', objParams); provide<Ref<any>>('data', data); - provide<Ref<any>>('others', others); + provide<Ref<any>>('keyFieldValues', keyFieldValues); provide<Ref<{}>>('useFormData', useFormData); provide<Ref<any>>('baseCards', baseCards); provide<Ref<any>>('useTables', useTables); @@ -200,38 +201,35 @@ * @description: 寮傛鍏ㄩ儴鎻愪氦鏂规硶 * @return {*} */ - function submitAll() { + async function submitAll() { try { - validate().then((res) => { - const Keys = Object.getOwnPropertyNames(useFormData.value); - let i; - let p = [] as Promise<any>[]; - for (i = 0; i < Keys.length; i++) { - p.push(SaveEntity(res[Keys[i]], unref(isAllUpdate), baseCards.value[i]['entityName'])); - } - Promise.all(p).then((action) => { - // DeleteWhere( - // ` ${objParams.value.pCode} = '${others.value[objParams.value.pCode]}'`, - // entityName.value, - // ).then((res) => { - // if (res.IsSuccessed) { - // data.value.forEach((item) => { - // item.ID = buildUUID(); - // }); - // AddListEntity(data.value, entityName.value).then((action) => { - // if (action.IsSuccessed) { - // cancel(); - // } - // }); - // } - // }); - let where = `${objParams.value['drawers'][0]['code']} = '${others.value[objParams.value['drawers'][0]['code']]}'`; - data.value[objParams.value['drawers'][0]['name']].forEach((item) => { + const validates = await validate(); + const Keys = Object.getOwnPropertyNames(useFormData.value); + let i; + let p = [] as Promise<any>[]; + for (i = 0; i < Keys.length; i++) { + p.push( + SaveEntity(validates[Keys[i]], unref(isAllUpdate), baseCards.value[i]['entityName']), + ); + } + await Promise.all(p); + if ( + !custImport.value['default']()[0].SubmitAll && + !isFunction(custImport.value['default']()[0].SubmitAll) + ) { + /* 榛樿鎻愪氦 */ + objParams.value['drawers'].forEach((d) => { + let where = `${d['code']} = '${keyFieldValues.value[d['code']]}'`; + /* type: all-琛ㄧず闇�瑕乧ode鐨勬墍鏈夌殑鍊� */ + if(d['type'] == 'all'){ + where = `${d['code']} in (${data.value[d['keyName']].map(value => `'${value[d['code']]}'`).join(',')})`; + } + data.value[d['name']].map((item) => { item.ID = buildUUID(); }); AddAfterDelete( - objParams.value['drawers'][0]['name'], - data.value[objParams.value['drawers'][0]['name']], + d['name'], + data.value[d['name']], where, ).then((action) => { if (action.IsSuccessed) { @@ -239,16 +237,10 @@ } }); }); - }); - // values.ID = params.RULE_ID; - // const action = await SaveRule({ ...values, ...testValues }); - // if (action.IsSuccessed) { - // await DeleteRuleDtl(params.RULE_ID); - // const dtlAction = await SaveRuleDtl(data.value); - // if (dtlAction.IsSuccessed) { - // cancel(); - // } - // } + } else { + /* 濡傛灉鑷畾涔夋彁浜ゆ柟娉曞瓨鍦ㄥ氨鐢ㄨ嚜瀹氫箟鎻愪氦 */ + custImport.value['default']()[0].SubmitAll(data); + } } catch (error) {} } async function cancel() { diff --git a/src/views/tigerprojects/system/lowcode/normal/index.vue b/src/views/tigerprojects/system/lowcode/normal/index.vue index 46b91f0..6b80bfd 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-06-24 18:49:29 + * @LastEditTime: 2024-07-03 08:52:44 --> <template> <div> @@ -75,13 +75,13 @@ const custImport = ref<any>(null); const isMounted = ref(false); const buttons = ref([]); - const others = ref<any>(null); + const keyFieldValues = ref<any>(null); provide<Ref<any>>('objParams', objParams.value); provide<Ref<any[]>>('_columns', _columns); provide<Ref<any[]>>('_searchFormSchema', _searchFormSchema); provide<Ref<any[]>>('_crudFormSchema', _crudFormSchema); provide<Ref<string>>('isExistSql', isExistSql); - provide<Ref<any>>('others', others); + provide<Ref<any>>('keyFieldValues', keyFieldValues); const [registerCust, { openModal: openCustomModal, closeModal }] = useModal(); diff --git a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue index 22e76eb..7a81b7c 100644 --- a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue +++ b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue @@ -70,7 +70,7 @@ const _crudFormSchema = inject('_crudFormSchema') as Ref<any[]>; const buttons = ref<[]>(await getRoleButtons(currentRoute.value.meta.menuCode as string)); const isExistSql = inject('isExistSql') as Ref<string>; - const others = inject('others') as Ref<Recordable[]>; + const keyFieldValues = inject('keyFieldValues') as Ref<Recordable[]>; const entityName = ref(objParams['ID']); const go = useGo(); const [registerDrawer, { openDrawer }] = useDrawer(); @@ -84,11 +84,7 @@ const EntityCustFunction = ref([ { ActionItem(params, data, ...args) {}, - EditOperation(data, d, u) {}, - GetBaseColumns(type: string | undefined) {}, - GetSearchForm(type: string | undefined) {}, - GetCrudForm(type: string | undefined, ...args) {}, - OthersValues(val, id) {}, + KeyFieldValues(val, id) {}, } as EntityCustFunctionType, ]); /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ @@ -98,18 +94,14 @@ const [ { ActionItem: nActionItem, - EditOperation, - GetBaseColumns, - GetSearchForm, - GetCrudForm, - OthersValues, + KeyFieldValues, }, ] = isNullOrUnDef(custImport.value['default']) ? EntityCustFunction.value : custImport.value['default'](); - others.value = isNullOrUnDef(OthersValues) + keyFieldValues.value = isNullOrUnDef(KeyFieldValues) ? {} - : OthersValues(objParams['CODE'], objParams['ID']); + : KeyFieldValues(objParams['CODE'], objParams['ID']); const [registerTable, { getForm, reload, setProps }] = useTable({ title: '鍒楄〃淇℃伅', api: getListByPage, diff --git a/src/views/tigerprojects/system/lowcode/normalDrawer.vue b/src/views/tigerprojects/system/lowcode/normalDrawer.vue index 7e6f330..d21e398 100644 --- a/src/views/tigerprojects/system/lowcode/normalDrawer.vue +++ b/src/views/tigerprojects/system/lowcode/normalDrawer.vue @@ -108,8 +108,8 @@ ...data.record, }); } else { - if (!isNullOrUnDef(data?.others)) { - setFieldsValue(data?.others); + if (!isNullOrUnDef(data?.keyFieldValues)) { + setFieldsValue(data?.keyFieldValues); } } }); -- Gitblit v1.9.3