| | |
| | | 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(); |
| | |
| | | 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(); |
| | |
| | | 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, |
| | | ]); |
| | | /* 动态import实体名.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, |
| | |
| | | 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(() => {}); |
| | | |
| | |
| | | const result = CreateAction(fnName); |
| | | switch (result.action) { |
| | | case 'go': |
| | | go(`/${result.url}/${encodeURI(JSON.stringify(result.params))}`); |
| | | // 将对象转换为JSON字符串并保存到sessionStorage |
| | | 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, { |