From 426d30df38b128a8943b627e118e95d8e16cf923 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 18 七月 2024 15:20:36 +0800 Subject: [PATCH] 组织工厂权限更新 --- src/views/tigerprojects/system/lowcode/normal/mainTable.vue | 73 ++++++++++++++++++++++++++---------- 1 files changed, 53 insertions(+), 20 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue index 988a7d1..06aff8c 100644 --- a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue +++ b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue @@ -55,6 +55,7 @@ import { useI18n } from '/@/hooks/web/useI18n'; import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel'; import { getRoleButtons } from '/@/api/sys/menu'; + import { useUserStore } from '/@/store/modules/user'; import { useRouter } from 'vue-router'; const { t } = useI18n(); @@ -70,7 +71,8 @@ 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 AuthOption = inject('AuthOption') as Ref<{}>; const entityName = ref(objParams['ID']); const go = useGo(); const [registerDrawer, { openDrawer }] = useDrawer(); @@ -84,36 +86,34 @@ const EntityCustFunction = ref([ { ActionItem(params, data, ...args) {}, - EditOperation(data, d, u) {}, - GetBaseColumns() {}, - GetSearchForm() {}, - GetCrudForm() {}, - OthersValues(val, id) {}, + KeyFieldValues(val, id) {}, } as EntityCustFunctionType, ]); /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ try { custImport.value = await import(`../entityts/${objParams['ID']}.ts`); } catch (e) {} - const [ - { - ActionItem: nActionItem, - EditOperation, - GetBaseColumns, - GetSearchForm, - GetCrudForm, - OthersValues, - }, - ] = isNullOrUnDef(custImport.value['default']) + const [{ ActionItem: nActionItem, 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, - searchInfo: { TABLE_NAME: objParams['ID'] }, + searchInfo: { + TABLE_NAME: objParams['ID'], + option: + AuthOption.value['BY_ORG'] == 'Y' + ? { + //鏍规嵁鎹偣鏌ヨ锛屽繀闇�甯﹁繖涓弬鏁� + UserId: useUserStore().getUserInfo.userId, + ByOrg: true, + CurOrg: useUserStore().getUserInfo.orgCode, + } + : '', + }, columns: _columns as unknown as BasicColumn[], formConfig: { labelWidth: 140, @@ -132,6 +132,32 @@ fixed: undefined, }, //鑷畾涔夋搷浣滃垪 }); + + watch( + () => AuthOption.value, + (newVal, oldVal) => { + nextTick(() => { + if (!isNullOrEmpty(newVal.BY_ORG)) { + setProps({ + searchInfo: { + TABLE_NAME: objParams['ID'], + option: + AuthOption.value['BY_ORG'] == 'Y' + ? { + //鏍规嵁鎹偣鏌ヨ锛屽繀闇�甯﹁繖涓弬鏁� + UserId: useUserStore().getUserInfo.userId, + ByOrg: true, + CurOrg: useUserStore().getUserInfo.orgCode, + } + : '', + }, + }); + reload(); + } + }); + }, + { deep: true, immediate: true }, + ); onMounted(() => {}); @@ -254,7 +280,14 @@ const result = CreateAction(fnName); switch (result.action) { case 'go': - go(`/${result.url}/${encodeURI(JSON.stringify(result.params))}`); + // 灏嗗璞¤浆鎹负JSON瀛楃涓插苟淇濆瓨鍒皊essionStorage + sessionStorage.setItem( + `${result.params.Name}_params`, + encodeURI(JSON.stringify(result.params)), + ); + go( + `/${result.url}/${encodeURI(JSON.stringify({ sName: result.params.Name, Name: result.params.Name }))}`, + ); break; case 'drawer': openDrawer(true, { -- Gitblit v1.9.3