| | |
| | | <div> |
| | | <BasicTable @register="registerTable"> |
| | | <template #toolbar> |
| | | <!-- 根据菜单设置的按钮,自动生成 --> |
| | | <a-button |
| | | type="primary" |
| | | v-for="item in buttons.filter((m) => m['BUTTON_TYPE'] == 0)" |
| | |
| | | const [registerDrawer, { openDrawer }] = useDrawer(); |
| | | const [registerRv, { openModal: openRvModal, closeModal: RvcloseModal }] = useModal(); |
| | | const [registerCust, { openModal: openCustModal }] = useModal(); |
| | | const [registerCrud, { openModal: openCrudModal }] = useModal(); |
| | | const cType = ref(''); |
| | | const formSchemas = ref({}); //弹出框多表单结构 |
| | | const routeData = ref({ |
| | |
| | | bordered: true, |
| | | canResize: true, |
| | | showIndexColumn: false, |
| | | actionColumn: ActionColumn, //自定义操作列 |
| | | actionColumn: ActionColumn |
| | | ? ActionColumn |
| | | : { |
| | | width: 120, |
| | | title: '操作', |
| | | dataIndex: 'action', |
| | | slots: { customRender: 'action' }, |
| | | fixed: 'right', |
| | | }, //自定义操作列 |
| | | }); |
| | | |
| | | watch( |
| | |
| | | * @return {*} |
| | | */ |
| | | async function init(lf, rotId) { |
| | | initRoute(lf, rotId, routeData, currlf); |
| | | initRoute(lf, rotId, routeData, currlf, null); |
| | | } |
| | | |
| | | /** |
| | |
| | | currlf, |
| | | selectVals, |
| | | colSlots, |
| | | ifSave: true, |
| | | }; |
| | | |
| | | /* 根据菜单设置的按钮自动生成操作列中的按钮 */ |
| | | const actionItem = GenerateActionButton(params, buttons, openDrawer, reload); |
| | | if (isNullOrUnDef(custImport.value['default'])) { |
| | | return actionItem; |
| | | } |
| | | /* 根据动态加载的实体类名.ts中的ActionItem方法,渲染操作列中的按钮方法 */ |
| | | return nActionItem( |
| | | params, |
| | | actionItem, |
| | |
| | | go, |
| | | setProps, |
| | | openCustModal, |
| | | openCrudModal, |
| | | ); |
| | | } |
| | | |
| | |
| | | */ |
| | | function handleCreate(fnName: string) { |
| | | if (isNullOrUnDef(custImport.value['default'])) { |
| | | /* 如果动态加载的实体类.ts不存在,则直接打开侧边框 */ |
| | | openDrawer(true, { |
| | | isUpdate: false, |
| | | entityName: entityName.value, |
| | | formJson: _crudFormSchema.value, |
| | | crudColSlots: objParams.value['crudColSlots'], |
| | | isExistSql: isExistSql.value, |
| | | isUpdate: false, //是新增还是编辑,false-新增|true-编辑 |
| | | entityName: entityName.value, //实体类名 |
| | | formJson: _crudFormSchema.value, //新增编辑的表单结构 |
| | | crudColSlots: objParams.value['crudColSlots'], //新增编辑的表单中的插槽列表 |
| | | isExistSql: isExistSql.value, //是否存在检查sql,比如: XXX_CODE = '12345' |
| | | ifSave: true, //是否提交表单时保存到数据库,否-暂存|是-保存 |
| | | }); |
| | | } else { |
| | | /* 如果动态加载的实体类.ts存在,根据.ts文件中的方法来执行操作 */ |
| | | const [{ CreateAction }] = custImport.value['default'](); |
| | | const result = CreateAction(entityName.value, colSlots.value); |
| | | switch (result.action) { |
| | | case 'go': |
| | | case 'go' /* 跳转页面 */: |
| | | // 将对象转换为JSON字符串并保存到sessionStorage |
| | | sessionStorage.setItem( |
| | | `${result.params.Name}_params`, |
| | |
| | | `/${result.url}/${encodeURI(JSON.stringify({ sName: result.params.Name, Name: result.params.Name }))}`, |
| | | ); |
| | | break; |
| | | case 'drawer': |
| | | case 'drawer' /* 打开侧边框 */: |
| | | openDrawer(true, { |
| | | isUpdate: false, |
| | | entityName: entityName.value, |
| | | formJson: _crudFormSchema.value, |
| | | crudColSlots: objParams.value['crudColSlots'], |
| | | isExistSql: isExistSql.value, |
| | | isUpdate: false, //是新增还是编辑,false-新增|true-编辑 |
| | | entityName: entityName.value, //实体类名 |
| | | formJson: _crudFormSchema.value, //新增编辑的表单结构 |
| | | crudColSlots: objParams.value['crudColSlots'], //新增编辑的表单中的插槽列表 |
| | | isExistSql: isExistSql.value, //是否存在检查sql,比如: XXX_CODE = '12345' |
| | | ifSave: true, //是否提交表单时保存到数据库,否-暂存|是-保存 |
| | | }); |
| | | break; |
| | | } |