| | |
| | | <div> |
| | | <BasicTable @register="registerTable"> |
| | | <template #toolbar> |
| | | <!-- 根据菜单设置的按钮,自动生成 --> |
| | | <a-button |
| | | type="primary" |
| | | v-for="item in buttons.filter((m) => m['BUTTON_TYPE'] == 0)" |
| | | @click="handleCreate(item['DO_METHOD'])" |
| | | :preIcon="item['ICON_URL']" |
| | | v-for="item in buttons.filter((m) => m['BUTTON_TYPE'] == 0)" |
| | | :key="item" |
| | | > |
| | | {{ item['FUNC_NAME'] }} |
| | |
| | | preIcon="search|svg" |
| | | /> |
| | | <GeneralModal |
| | | @register="registerItemAdd" |
| | | @register="useModalInTableForm[item]" |
| | | @success="(d, u) => handleItemSuccess(d, u, item)" |
| | | /> |
| | | </template> |
| | |
| | | <CustModal |
| | | @register="registerCust" |
| | | @success="custSuccess" |
| | | @cancel="custCancel" |
| | | :type="cType" |
| | | :entityName="entityName" |
| | | @modalInner="getdtlSlots" |
| | |
| | | import { GenerateActionButton, initRoute, OpenCustModal } from '../data'; |
| | | import LogicFlow from '@logicflow/core'; |
| | | import { isFunction } from 'xe-utils'; |
| | | import { CustModalParams } from '/@/api/tigerapi/model/systemModel'; |
| | | |
| | | const { t } = useI18n(); |
| | | const { currentRoute } = useRouter(); |
| | |
| | | const entityName = ref(objParams.value['ID']); |
| | | const go = useGo(); |
| | | const [registerDrawer, { openDrawer }] = useDrawer(); |
| | | const [registerItemAdd, { openModal: openItemModal }] = useModal(); |
| | | 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({ |
| | |
| | | OpenSelectItem(openItemModal: Fn, ...args) {}, |
| | | GetSelectSuccess(d, u, ...args) {}, |
| | | GetUseForm(...args) {}, |
| | | CustFunc(param: CustModalParams) {}, |
| | | } as EntityCustFunctionType, |
| | | ]); |
| | | /* 动态import实体名.ts的自定义方法 */ |
| | |
| | | GetCustData, |
| | | OpenSelectItem: OpenSelectCust, |
| | | GetSelectSuccess, |
| | | CustFunc, |
| | | }, |
| | | ActionColumn, |
| | | ] = isNullOrUnDef(custImport.value['default']) |
| | |
| | | const dtlSlots = ref<any[]>([]); |
| | | const useformdata = GetUseForm && isFunction(GetUseForm) ? GetUseForm() : {}; |
| | | const useFormData = ref<any>(useformdata); |
| | | /* 表单中插槽渲染按钮打开模态框useModal方法 */ |
| | | /* 自定义模态窗口中表单中插槽渲染按钮打开模态框useModal方法 */ |
| | | const modals = GetUseModals && isFunction(GetUseModals) ? GetUseModals() : { useModalData: {} }; |
| | | const useModalData = ref(modals['useModalData']); |
| | | /* 表格内的插槽渲染的弹出选择框列表 */ |
| | | const useModalInTableForm = ref<any>({}); |
| | | colSlots.value.map((x) => { |
| | | useModalInTableForm.value[x] = useModal(); |
| | | }); |
| | | /* 获取自定义数据 */ |
| | | const custData = GetCustData && isFunction(GetCustData) ? GetCustData() : { isCustEl: {} }; |
| | | const isCustEl = ref(custData['isCustEl']); |
| | |
| | | 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(fnName); |
| | | 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; |
| | | } |
| | |
| | | * @return {*} |
| | | */ |
| | | function handleSuccess(d, u) { |
| | | if (CustFunc && isFunction(CustFunc)) { |
| | | CustFunc({ |
| | | values: d, |
| | | }); |
| | | } |
| | | reload(); |
| | | } |
| | | |
| | |
| | | ) |
| | | .then((m) => { |
| | | const [{ GetSelectSuccess: GetSelectSuccess2 }] = m.default(); |
| | | getForm().setFieldsValue(GetSelectSuccess2(d, u)); |
| | | getForm().setFieldsValue(GetSelectSuccess2(d, u, objParams.value['ID'])); |
| | | }) |
| | | .catch(() => { |
| | | getForm().setFieldsValue({ |
| | |
| | | ) |
| | | .then((m) => { |
| | | const [{ OpenSelectItem }] = m.default(); |
| | | OpenSelectItem(openItemModal); |
| | | OpenSelectItem(useModalInTableForm.value[item][1].openModal); |
| | | }) |
| | | .catch(() => { |
| | | openItemModal(true, { |
| | | useModalInTableForm.value[item][1].openModal(true, { |
| | | title: '物料列表', |
| | | schemas: [ |
| | | { |
| | |
| | | }); |
| | | } catch (e) {} |
| | | } |
| | | //弹出框确定返回 |
| | | |
| | | /** |
| | | * @description: 弹出框确定返回 |
| | | * @param {*} d |
| | | * @return {*} |
| | | */ |
| | | function custSuccess(d) { |
| | | // reload(); |
| | | reload(); |
| | | } |
| | | |
| | | /** |
| | | * @description: 弹出框取消返回 |
| | | * @param {*} reload |
| | | * @return {*} |
| | | */ |
| | | function custCancel() { |
| | | reload(); |
| | | } |
| | | |
| | | /** |
| | |
| | | selectVals.value = values; //保存弹出框选择的结果 |
| | | let _val = {}; |
| | | d.returnFieldName.map((x) => { |
| | | _val[x] = values[x]; |
| | | }); |
| | | _val[x] = values[x]; |
| | | }); |
| | | useFormData.value[item][1].setFieldsValue(_val); |
| | | /* 针对工单的方法 */ |
| | | if (d.returnFieldName.filter((x) => x == 'ROUTE_CODE') && item == 'prodinfo' ) { |
| | | if (d.returnFieldName.filter((x) => x == 'ROUTE_CODE') && item == 'prodinfo') { |
| | | routeData.value = { |
| | | nodes: [], |
| | | edges: [], |