| | |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import { Ref, inject, onMounted, ref } from 'vue'; |
| | | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| | | import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table'; |
| | | import { BasicForm, useForm } from '/@/components/Form/index'; |
| | | import { useDrawer } from '/@/components/Drawer'; |
| | | import GeneralModal from '/@/views/components/GeneralModal.vue'; |
| | |
| | | GetUseForm, |
| | | GetUseModals, |
| | | }, |
| | | ActionColumn, |
| | | ] = isNullOrUnDef(custImport.value['default']) |
| | | ? EntityCustFunction.value |
| | | : custImport.value['default'](); |
| | |
| | | /* 表单中插槽渲染按钮打开模态框useModal方法 */ |
| | | const modals = GetUseModals && isFunction(GetUseModals) ? GetUseModals() : { useModalData: {} }; |
| | | const useModalData = ref(modals['useModalData']); |
| | | /* 页签信息,表格需要根据页签信息中对应的实体名来查询对应表的数据 */ |
| | | const CurrTabInfo = objParams['Tabs'].filter((q) => q.entityName == props.entityName)[0]; |
| | | const [registerTable, { getForm, reload, setProps }] = useTable({ |
| | | title: `${objParams['firstTitle']}列表`, |
| | | api: getListByPage, |
| | | searchInfo: { TABLE_NAME: objParams['Name'], ...objParams['keyFieldValues'] }, |
| | | columns: GetBaseColumns(), |
| | | title: `${CurrTabInfo.tableTitle}列表`, |
| | | api: getListByPage, //通用查询方法 |
| | | searchInfo: { |
| | | TABLE_NAME: CurrTabInfo.entityName, |
| | | NeedInclude: CurrTabInfo.NeedInclude, |
| | | ...objParams['keyFieldValues'], |
| | | }, //查询条件中的TABLE_NAME传入页签信息中对应的实体名CurrTabInfo.entityName |
| | | columns: GetBaseColumns(CurrTabInfo.entityName), //传入页签信息中对应的实体名CurrTabInfo.entityName获取表格字段信息 |
| | | formConfig: { |
| | | labelWidth: 140, |
| | | schemas: GetSearchForm(), |
| | | schemas: GetSearchForm(CurrTabInfo.entityName), //传入页签信息中对应的实体名CurrTabInfo.entityName获取查询表单的字段信息 |
| | | }, |
| | | useSearchForm: true, |
| | | showTableSetting: true, |
| | | bordered: true, |
| | | canResize: true, |
| | | showIndexColumn: false, |
| | | actionColumn: { |
| | | width: 130, |
| | | title: '操作', |
| | | dataIndex: 'action', |
| | | slots: { customRender: 'action' }, |
| | | fixed: undefined, |
| | | }, //自定义操作列 |
| | | actionColumn: ActionColumn |
| | | ? ActionColumn |
| | | : { |
| | | width: 120, |
| | | title: '操作', |
| | | dataIndex: 'action', |
| | | slots: { customRender: 'action' }, |
| | | fixed: 'right', |
| | | }, //自定义操作列 |
| | | }); |
| | | |
| | | onMounted(() => {}); |
| | |
| | | const params = { |
| | | record, |
| | | isUpdate: true, |
| | | ifSave: false, |
| | | ifSave: objParams['ifSave'], |
| | | entityName: props.entityName, |
| | | formJson: GetCrudForm(), //getFormSchema(`${entityName.value}_Crud`), |
| | | cType, |
| | |
| | | selectVals, |
| | | colSlots, |
| | | }; |
| | | const actionItem = GenerateActionButton(params, buttons, openDrawer, reload); |
| | | const _actionItem: ActionItem[] = []; |
| | | const actionItem = GenerateActionButton(params, buttons, openDrawer, reload, _actionItem); |
| | | if (isNullOrUnDef(custImport.value['default'])) { |
| | | return actionItem; |
| | | } |
| | |
| | | if (isNullOrUnDef(custImport.value['default'])) { |
| | | openDrawer(true, { |
| | | isUpdate: false, |
| | | ifSave: false, |
| | | ifSave: objParams.value['ifSave'], |
| | | entityName: props.entityName, |
| | | formJson: _cruds, //getFormSchema(`${entityName.value}_Crud`), |
| | | crudColSlots: colSlots.value, |
| | |
| | | }); |
| | | } else { |
| | | const [{ CreateAction }] = custImport.value['default'](); |
| | | const result = CreateAction(fnName); |
| | | const result = CreateAction(props.entityName); |
| | | switch (result.action) { |
| | | case 'go': |
| | | sessionStorage.removeItem(`${result.params.Name}_update_params`); |
| | | // 将对象转换为JSON字符串并保存到sessionStorage |
| | | sessionStorage.setItem( |
| | | `${result.params.Name}_params`, |
| | | `${result.params.Name}_update_params`, |
| | | encodeURI(JSON.stringify(result.params)), |
| | | ); |
| | | go( |
| | | `/${result.url}/${encodeURI(JSON.stringify({ sName: result.params.Name, Name: result.params.Name }))}`, |
| | | `/${result.url}/${encodeURI(JSON.stringify({ sName: `${result.params.Name}_update`, Name: result.params.Name }))}`, |
| | | ); |
| | | break; |
| | | case 'drawer': |
| | | openDrawer(true, { |
| | | isUpdate: false, |
| | | ifSave: false, |
| | | ifSave: objParams.value['ifSave'], |
| | | entityName: props.entityName, |
| | | formJson: _cruds, //getFormSchema(`${entityName.value}_Crud`), |
| | | crudColSlots: colSlots.value, |