diff --git a/src/views/workflow/extension/formJson/FormJsonModal.vue b/src/views/workflow/extension/formJson/FormJsonModal.vue index 0f220c5..b54f1a8 100644 --- a/src/views/workflow/extension/formJson/FormJsonModal.vue +++ b/src/views/workflow/extension/formJson/FormJsonModal.vue @@ -48,7 +48,7 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data mountApp: FORM_DESIGN_APP_COMPONENTS.PREVIEW } }), { sandbox: { experimentalStyleIsolation: true }}); - data?.json && (formPreviewProps.options = data?.json); + data?.json && (formPreviewProps.options = eval('(' + data.json + ')') ); const props: Partial = { confirmLoading: false }; props.title = '预览流程表单'; setModalProps(props); diff --git a/src/views/workflow/extension/formJson/index.vue b/src/views/workflow/extension/formJson/index.vue index 6ecd6f3..d32848c 100644 --- a/src/views/workflow/extension/formJson/index.vue +++ b/src/views/workflow/extension/formJson/index.vue @@ -6,7 +6,6 @@ > + @@ -50,12 +46,14 @@ * Copyright © 2020-2022 entfrm All rights reserved. * author entfrm开发团队-王翔 */ - import { reactive, toRaw } from 'vue'; + import { reactive, toRaw, unref } from 'vue'; import { BasicTable, useTable, TableAction } from '/@/components/Table'; - import { listClient, delClient } from '/@/api/platform/system/controller/client'; + import { listFormDefinitionJson, delFormDefinitionJson, setPrimaryVersion } from '/@/api/platform/workflow/extension/controller/formDefinitionJson'; import { useModal } from '/@/components/Modal'; import { columns, searchFormSchema } from './formJson.data'; import { useMessage } from '/@/hooks/web/useMessage'; + import FormJsonModal from './FormJsonModal.vue'; + import { useRouter } from 'vue-router'; /** 类型规范统一声明定义区域 */ interface TableState { @@ -70,12 +68,13 @@ // 非多个禁用 multiple: true }); + const { currentRoute } = useRouter(); const { createConfirm, createMessage } = useMessage(); const [registerModal, { openModal }] = useModal(); const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ - title: '列表', - api: listClient, - rowKey: 'clientId', + title: '表单版本管理列表', + api: listFormDefinitionJson, + rowKey: 'id', columns, formConfig: { compact: true, @@ -84,7 +83,6 @@ autoSubmitOnEnter: true, showAdvancedButton: true, autoAdvancedLine: 3, - fieldMapToTime: [['dateRange', ['beginTime', 'endTime'], 'YYYY-MM-DD']] }, rowSelection: { type: 'checkbox' }, useSearchForm: true, @@ -98,43 +96,49 @@ dataIndex: 'action', fixed: false }, + searchInfo: { + formDefinitionId: unref(currentRoute).params.id + }, handleSearchInfoFn: () => clearSelectedRowKeys() }); - /** 处理多选框选中数据 */ function handleSelectionChange(selection?: Recordable) { const rowSelection = toRaw(selection?.keys) || []; state.single = rowSelection.length != 1; state.multiple = !rowSelection.length; } - /** 新增按钮操作,行内新增与工具栏局域新增通用 */ - function handleAdd() { - openModal(true,{ _tag: 'add' }); + function handleSetFormPrimaryVersion(record: Recordable) { + createConfirm({ + iconType: 'warning', + title: '警告', + content: '确定设置表单该版本为主版本吗?', + onOk: async () => { + await setPrimaryVersion(record.id); + createMessage.success('设置成功!'); + handleRefreshTable(); + } + }); } - /** 编辑按钮操作,行内编辑 */ - function handleEdit(record?: Recordable) { - record = record || { clientId: getSelectRowKeys() }; - openModal(true, { _tag: 'edit', record }); + function handleFormPreview(record: Recordable) { + openModal(true,{ json: record.json }); } - /** 删除按钮操作,行内删除 */ async function handleDel(record?: Recordable) { - const clientIds = record?.clientId || getSelectRowKeys(); + const ids = record?.id || getSelectRowKeys(); createConfirm({ iconType: 'warning', title: '警告', - content: `是否确认删除客户端编号为${clientIds}客户端吗?`, + content: `是否确认删除表单版本编号为${ids}表单吗?`, onOk: async () => { - await delClient(clientIds); + await delFormDefinitionJson(ids); createMessage.success('删除成功!'); handleRefreshTable(); } }); } - /** 处理表格刷新 */ function handleRefreshTable() { clearSelectedRowKeys(); reload();