feat:【antd】bpm form 的迁移
This commit is contained in:
@@ -5,7 +5,7 @@ import { requestClient } from '#/api/request';
|
|||||||
export namespace BpmFormApi {
|
export namespace BpmFormApi {
|
||||||
/** 流程表单 */
|
/** 流程表单 */
|
||||||
export interface Form {
|
export interface Form {
|
||||||
id?: number | undefined;
|
id?: number;
|
||||||
name: string;
|
name: string;
|
||||||
conf: string;
|
conf: string;
|
||||||
fields: string[];
|
fields: string[];
|
||||||
@@ -23,7 +23,7 @@ export async function getFormPage(params: PageParam) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 获取表单详情 */
|
/** 获取表单详情 */
|
||||||
export async function getFormDetail(id: number) {
|
export async function getForm(id: number) {
|
||||||
return requestClient.get<BpmFormApi.Form>(`/bpm/form/get?id=${id}`);
|
return requestClient.get<BpmFormApi.Form>(`/bpm/form/get?id=${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export interface ModelCategoryInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 获取流程模型列表 */
|
/** 获取流程模型列表 */
|
||||||
export async function getModelList(name: string | undefined) {
|
export async function getModelList(name?: string) {
|
||||||
return requestClient.get<BpmModelApi.Model[]>('/bpm/model/list', {
|
return requestClient.get<BpmModelApi.Model[]>('/bpm/model/list', {
|
||||||
params: { name },
|
params: { name },
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import {
|
|||||||
Switch,
|
Switch,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
|
|
||||||
import { getFormDetail } from '#/api/bpm/form';
|
import { getForm } from '#/api/bpm/form';
|
||||||
import { getModelList } from '#/api/bpm/model';
|
import { getModelList } from '#/api/bpm/model';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -354,7 +354,7 @@ const loadFormInfo = async () => {
|
|||||||
);
|
);
|
||||||
if (!childInfo) return;
|
if (!childInfo) return;
|
||||||
|
|
||||||
const formInfo = await getFormDetail(childInfo.formId);
|
const formInfo = await getForm(childInfo.formId);
|
||||||
childFormFieldOptions.value = [];
|
childFormFieldOptions.value = [];
|
||||||
if (formInfo.fields) {
|
if (formInfo.fields) {
|
||||||
formInfo.fields.forEach((fieldStr: string) => {
|
formInfo.fields.forEach((fieldStr: string) => {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { handleTree } from '@vben/utils';
|
|||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
import { Button } from 'ant-design-vue';
|
||||||
|
|
||||||
import { getFormDetail } from '#/api/bpm/form';
|
import { getForm } from '#/api/bpm/form';
|
||||||
import { getUserGroupSimpleList } from '#/api/bpm/userGroup';
|
import { getUserGroupSimpleList } from '#/api/bpm/userGroup';
|
||||||
import { getSimpleDeptList } from '#/api/system/dept';
|
import { getSimpleDeptList } from '#/api/system/dept';
|
||||||
import { getSimplePostList } from '#/api/system/post';
|
import { getSimplePostList } from '#/api/system/post';
|
||||||
@@ -82,7 +82,7 @@ watch(
|
|||||||
() => props.modelFormId,
|
() => props.modelFormId,
|
||||||
async (newVal) => {
|
async (newVal) => {
|
||||||
if (newVal) {
|
if (newVal) {
|
||||||
const form = await getFormDetail(newVal);
|
const form = await getForm(newVal);
|
||||||
formFields.value = form?.fields;
|
formFields.value = form?.fields;
|
||||||
} else {
|
} else {
|
||||||
// 如果 modelFormId 为空,清空表单字段
|
// 如果 modelFormId 为空,清空表单字段
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const routes: RouteRecordRaw[] = [
|
|||||||
name: 'BpmFormEditor',
|
name: 'BpmFormEditor',
|
||||||
component: () => import('#/views/bpm/form/designer/index.vue'),
|
component: () => import('#/views/bpm/form/designer/index.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '编辑流程表单',
|
title: '设计流程表单',
|
||||||
activePath: '/bpm/manager/form',
|
activePath: '/bpm/manager/form',
|
||||||
},
|
},
|
||||||
props: (route) => {
|
props: (route) => {
|
||||||
|
|||||||
@@ -1,52 +1,7 @@
|
|||||||
import type { VbenFormSchema } from '#/adapter/form';
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
import { CommonStatusEnum, DICT_TYPE } from '@vben/constants';
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
import { getDictOptions } from '@vben/hooks';
|
|
||||||
|
|
||||||
import { z } from '#/adapter/form';
|
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
dependencies: {
|
|
||||||
triggerFields: [''],
|
|
||||||
show: () => false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'name',
|
|
||||||
label: '表单名称',
|
|
||||||
component: 'Input',
|
|
||||||
componentProps: {
|
|
||||||
placeholder: '请输入表单名称',
|
|
||||||
},
|
|
||||||
rules: 'required',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'status',
|
|
||||||
label: '状态',
|
|
||||||
component: 'RadioGroup',
|
|
||||||
componentProps: {
|
|
||||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
|
||||||
buttonStyle: 'solid',
|
|
||||||
optionType: 'button',
|
|
||||||
},
|
|
||||||
rules: z.number().default(CommonStatusEnum.ENABLE),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'remark',
|
|
||||||
label: '备注',
|
|
||||||
component: 'Textarea',
|
|
||||||
componentProps: {
|
|
||||||
placeholder: '请输入备注',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列表的搜索表单 */
|
/** 列表的搜索表单 */
|
||||||
export function useGridFormSchema(): VbenFormSchema[] {
|
export function useGridFormSchema(): VbenFormSchema[] {
|
||||||
|
|||||||
48
apps/web-antd/src/views/bpm/form/designer/data.ts
Normal file
48
apps/web-antd/src/views/bpm/form/designer/data.ts
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
|
|
||||||
|
import { CommonStatusEnum, DICT_TYPE } from '@vben/constants';
|
||||||
|
import { getDictOptions } from '@vben/hooks';
|
||||||
|
|
||||||
|
import { z } from '#/adapter/form';
|
||||||
|
|
||||||
|
/** 新增/修改的表单 */
|
||||||
|
export function useFormSchema(): VbenFormSchema[] {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
fieldName: 'id',
|
||||||
|
component: 'Input',
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: [''],
|
||||||
|
show: () => false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'name',
|
||||||
|
label: '表单名称',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入表单名称',
|
||||||
|
},
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'status',
|
||||||
|
label: '状态',
|
||||||
|
component: 'RadioGroup',
|
||||||
|
componentProps: {
|
||||||
|
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||||
|
buttonStyle: 'solid',
|
||||||
|
optionType: 'button',
|
||||||
|
},
|
||||||
|
rules: z.number().default(CommonStatusEnum.ENABLE),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'remark',
|
||||||
|
label: '备注',
|
||||||
|
component: 'Textarea',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -2,18 +2,20 @@
|
|||||||
import { computed, onMounted, ref } from 'vue';
|
import { computed, onMounted, ref } from 'vue';
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
import { Page, useVbenModal } from '@vben/common-ui';
|
||||||
|
import { useTabs } from '@vben/hooks';
|
||||||
import { IconifyIcon } from '@vben/icons';
|
import { IconifyIcon } from '@vben/icons';
|
||||||
|
|
||||||
import FcDesigner from '@form-create/antd-designer';
|
import FcDesigner from '@form-create/antd-designer';
|
||||||
import { Button, message } from 'ant-design-vue';
|
import { Button, message, Spin } from 'ant-design-vue';
|
||||||
|
|
||||||
import { getFormDetail } from '#/api/bpm/form';
|
import { getForm } from '#/api/bpm/form';
|
||||||
import {
|
import {
|
||||||
setConfAndFields,
|
setConfAndFields,
|
||||||
useFormCreateDesigner,
|
useFormCreateDesigner,
|
||||||
} from '#/components/form-create';
|
} from '#/components/form-create';
|
||||||
import { router } from '#/router';
|
import { router } from '#/router';
|
||||||
import Form from '#/views/bpm/form/modules/form.vue';
|
|
||||||
|
import Form from './modules/form.vue';
|
||||||
|
|
||||||
defineOptions({ name: 'BpmFormEditor' });
|
defineOptions({ name: 'BpmFormEditor' });
|
||||||
|
|
||||||
@@ -23,17 +25,16 @@ const props = defineProps<{
|
|||||||
type: 'copy' | 'create' | 'edit';
|
type: 'copy' | 'create' | 'edit';
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
/** 流程表单详情 */
|
const loading = ref(false);
|
||||||
|
const tabs = useTabs();
|
||||||
const flowFormConfig = ref();
|
const flowFormConfig = ref();
|
||||||
|
const designerRef = ref<InstanceType<typeof FcDesigner>>();
|
||||||
|
|
||||||
const [FormModal, formModalApi] = useVbenModal({
|
const [FormModal, formModalApi] = useVbenModal({
|
||||||
connectedComponent: Form,
|
connectedComponent: Form,
|
||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const designerRef = ref<InstanceType<typeof FcDesigner>>();
|
|
||||||
|
|
||||||
/** 表单设计器配置 */
|
|
||||||
const designerConfig = ref({
|
const designerConfig = ref({
|
||||||
switchType: [], // 是否可以切换组件类型,或者可以相互切换的字段
|
switchType: [], // 是否可以切换组件类型,或者可以相互切换的字段
|
||||||
autoActive: true, // 是否自动选中拖入的组件
|
autoActive: true, // 是否自动选中拖入的组件
|
||||||
@@ -61,11 +62,11 @@ const designerConfig = ref({
|
|||||||
showInputData: true, // 是否显示录入按钮
|
showInputData: true, // 是否显示录入按钮
|
||||||
showDevice: true, // 是否显示多端适配选项
|
showDevice: true, // 是否显示多端适配选项
|
||||||
appendConfigData: [], // 定义渲染规则所需的formData
|
appendConfigData: [], // 定义渲染规则所需的formData
|
||||||
});
|
}); // 表单设计器配置
|
||||||
|
|
||||||
useFormCreateDesigner(designerRef); // 表单设计器增强
|
useFormCreateDesigner(designerRef); // 表单设计器增强
|
||||||
|
|
||||||
// 计算属性:获取当前需要加载的表单ID
|
/** 计算属性:获取当前需要加载的表单 ID */
|
||||||
const currentFormId = computed(() => {
|
const currentFormId = computed(() => {
|
||||||
switch (props.type) {
|
switch (props.type) {
|
||||||
case 'copy': {
|
case 'copy': {
|
||||||
@@ -81,28 +82,27 @@ const currentFormId = computed(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 加载表单配置
|
/** 加载表单配置 */
|
||||||
async function loadFormConfig(id: number) {
|
async function loadFormConfig(id: number) {
|
||||||
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
const formDetail = await getFormDetail(id);
|
const formDetail = await getForm(id);
|
||||||
flowFormConfig.value = formDetail;
|
flowFormConfig.value = formDetail;
|
||||||
if (designerRef.value) {
|
if (designerRef.value) {
|
||||||
setConfAndFields(designerRef, formDetail.conf, formDetail.fields);
|
setConfAndFields(designerRef, formDetail.conf, formDetail.fields);
|
||||||
}
|
}
|
||||||
} catch {
|
} finally {
|
||||||
message.error('加载表单配置失败');
|
loading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化设计器
|
/** 初始化设计器 */
|
||||||
async function initializeDesigner() {
|
async function initializeDesigner() {
|
||||||
const id = currentFormId.value;
|
const id = currentFormId.value;
|
||||||
|
|
||||||
if (props.type === 'copy' && !id) {
|
if (props.type === 'copy' && !id) {
|
||||||
message.error('复制 ID 不能为空');
|
message.error('复制 ID 不能为空');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
await loadFormConfig(Number(id));
|
await loadFormConfig(Number(id));
|
||||||
}
|
}
|
||||||
@@ -120,15 +120,14 @@ function handleSave() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 返回列表页 */
|
/** 返回列表页 */
|
||||||
function onBack() {
|
function handleBack() {
|
||||||
|
tabs.closeCurrentTab();
|
||||||
router.push({
|
router.push({
|
||||||
path: '/bpm/manager/form',
|
name: 'BpmForm',
|
||||||
query: {
|
|
||||||
refresh: '1',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 初始化 */
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
initializeDesigner();
|
initializeDesigner();
|
||||||
});
|
});
|
||||||
@@ -136,8 +135,9 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page auto-content-height>
|
||||||
<FormModal @success="onBack" />
|
<FormModal @success="handleBack" />
|
||||||
|
|
||||||
|
<Spin :spinning="loading">
|
||||||
<FcDesigner
|
<FcDesigner
|
||||||
class="h-full min-h-[500px]"
|
class="h-full min-h-[500px]"
|
||||||
ref="designerRef"
|
ref="designerRef"
|
||||||
@@ -150,5 +150,6 @@ onMounted(() => {
|
|||||||
</Button>
|
</Button>
|
||||||
</template>
|
</template>
|
||||||
</FcDesigner>
|
</FcDesigner>
|
||||||
|
</Spin>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -39,20 +39,18 @@ const [Form, formApi] = useVbenForm({
|
|||||||
|
|
||||||
const [Modal, modalApi] = useVbenModal({
|
const [Modal, modalApi] = useVbenModal({
|
||||||
async onConfirm() {
|
async onConfirm() {
|
||||||
// 表单验证
|
|
||||||
const { valid } = await formApi.validate();
|
const { valid } = await formApi.validate();
|
||||||
if (!valid) return;
|
if (!valid) {
|
||||||
|
return;
|
||||||
// 锁定模态框
|
}
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
|
// 提交表单
|
||||||
try {
|
try {
|
||||||
// 获取表单数据
|
// 获取表单数据
|
||||||
const data = (await formApi.getValues()) as BpmFormApi.Form;
|
const data = (await formApi.getValues()) as BpmFormApi.Form;
|
||||||
|
|
||||||
// 编码表单配置和表单字段
|
// 编码表单配置和表单字段
|
||||||
data.conf = encodeConf(designerComponent);
|
data.conf = encodeConf(designerComponent);
|
||||||
data.fields = encodeFields(designerComponent);
|
data.fields = encodeFields(designerComponent);
|
||||||
|
|
||||||
// 保存表单数据
|
// 保存表单数据
|
||||||
if (formData.value?.id) {
|
if (formData.value?.id) {
|
||||||
await (editorAction.value === 'copy'
|
await (editorAction.value === 'copy'
|
||||||
@@ -61,7 +59,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
} else {
|
} else {
|
||||||
await createForm(data);
|
await createForm(data);
|
||||||
}
|
}
|
||||||
|
// 关闭并提示
|
||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
message.success($t('ui.actionMessage.operationSuccess'));
|
message.success($t('ui.actionMessage.operationSuccess'));
|
||||||
@@ -76,15 +74,16 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
designerComponent.value = undefined;
|
designerComponent.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 加载数据
|
||||||
const data = modalApi.getData<any>();
|
const data = modalApi.getData<any>();
|
||||||
if (!data) return;
|
if (!data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
modalApi.lock();
|
||||||
// 设置表单设计器组件
|
// 设置表单设计器组件
|
||||||
designerComponent.value = data.designer;
|
designerComponent.value = data.designer;
|
||||||
formData.value = data.formConfig;
|
formData.value = data.formConfig;
|
||||||
editorAction.value = data.action;
|
editorAction.value = data.action;
|
||||||
|
|
||||||
// 如果是复制,表单名称后缀添加 _copy ,id 置空
|
// 如果是复制,表单名称后缀添加 _copy ,id 置空
|
||||||
if (editorAction.value === 'copy' && formData.value) {
|
if (editorAction.value === 'copy' && formData.value) {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
@@ -93,8 +92,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
id: undefined,
|
id: undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// 设置到 values
|
||||||
if (formData.value) {
|
if (formData.value) {
|
||||||
await formApi.setValues(formData.value);
|
await formApi.setValues(formData.value);
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,7 @@
|
|||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { BpmFormApi } from '#/api/bpm/form';
|
import type { BpmFormApi } from '#/api/bpm/form';
|
||||||
|
|
||||||
import { watch } from 'vue';
|
import { onActivated } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
|
|
||||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
@@ -24,7 +23,7 @@ function handleRefresh() {
|
|||||||
gridApi.query();
|
gridApi.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增 */
|
/** 新增表单 */
|
||||||
function handleCreate() {
|
function handleCreate() {
|
||||||
router.push({
|
router.push({
|
||||||
name: 'BpmFormEditor',
|
name: 'BpmFormEditor',
|
||||||
@@ -34,7 +33,7 @@ function handleCreate() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 编辑 */
|
/** 编辑表单 */
|
||||||
function handleEdit(row: BpmFormApi.Form) {
|
function handleEdit(row: BpmFormApi.Form) {
|
||||||
router.push({
|
router.push({
|
||||||
name: 'BpmFormEditor',
|
name: 'BpmFormEditor',
|
||||||
@@ -45,7 +44,7 @@ function handleEdit(row: BpmFormApi.Form) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 复制 */
|
/** 复制表单 */
|
||||||
function handleCopy(row: BpmFormApi.Form) {
|
function handleCopy(row: BpmFormApi.Form) {
|
||||||
router.push({
|
router.push({
|
||||||
name: 'BpmFormEditor',
|
name: 'BpmFormEditor',
|
||||||
@@ -56,35 +55,31 @@ function handleCopy(row: BpmFormApi.Form) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除 */
|
/** 删除表单 */
|
||||||
async function handleDelete(row: BpmFormApi.Form) {
|
async function handleDelete(row: BpmFormApi.Form) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
duration: 0,
|
duration: 0,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteForm(row.id as number);
|
await deleteForm(row.id!);
|
||||||
message.success({
|
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
|
||||||
});
|
|
||||||
handleRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 查看表单详情 */
|
||||||
async function handleDetail(row: BpmFormApi.Form) {
|
async function handleDetail(row: BpmFormApi.Form) {
|
||||||
detailModalApi.setData(row).open();
|
detailModalApi.setData(row).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 详情弹窗 */
|
|
||||||
const [DetailModal, detailModalApi] = useVbenModal({
|
const [DetailModal, detailModalApi] = useVbenModal({
|
||||||
connectedComponent: Detail,
|
connectedComponent: Detail,
|
||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 检测路由参数 */
|
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
formOptions: {
|
formOptions: {
|
||||||
schema: useGridFormSchema(),
|
schema: useGridFormSchema(),
|
||||||
@@ -106,26 +101,19 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
},
|
},
|
||||||
rowConfig: {
|
rowConfig: {
|
||||||
keyField: 'id',
|
keyField: 'id',
|
||||||
|
isHover: true,
|
||||||
},
|
},
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: true,
|
refresh: true,
|
||||||
search: true,
|
search: true,
|
||||||
},
|
},
|
||||||
cellConfig: {
|
|
||||||
height: 64,
|
|
||||||
},
|
|
||||||
} as VxeTableGridOptions<BpmFormApi.Form>,
|
} as VxeTableGridOptions<BpmFormApi.Form>,
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
/** 激活时 */
|
||||||
() => route.query.refresh,
|
onActivated(() => {
|
||||||
(val) => {
|
|
||||||
if (val === '1') {
|
|
||||||
handleRefresh();
|
handleRefresh();
|
||||||
}
|
});
|
||||||
},
|
|
||||||
{ immediate: true },
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -5,10 +5,9 @@ import { useVbenModal } from '@vben/common-ui';
|
|||||||
|
|
||||||
import FormCreate from '@form-create/ant-design-vue';
|
import FormCreate from '@form-create/ant-design-vue';
|
||||||
|
|
||||||
import { getFormDetail } from '#/api/bpm/form';
|
import { getForm } from '#/api/bpm/form';
|
||||||
import { setConfAndFields2 } from '#/components/form-create';
|
import { setConfAndFields2 } from '#/components/form-create';
|
||||||
|
|
||||||
/** 详情 */
|
|
||||||
const formConfig = ref<any>({});
|
const formConfig = ref<any>({});
|
||||||
|
|
||||||
const [Modal, modalApi] = useVbenModal({
|
const [Modal, modalApi] = useVbenModal({
|
||||||
@@ -24,7 +23,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
}
|
}
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
try {
|
try {
|
||||||
formConfig.value = await getFormDetail(data.id);
|
formConfig.value = await getForm(data.id);
|
||||||
setConfAndFields2(
|
setConfAndFields2(
|
||||||
formConfig.value,
|
formConfig.value,
|
||||||
formConfig.value.conf,
|
formConfig.value.conf,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { BpmModelFormType } from '@vben/constants';
|
|||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
import { getFormDetail } from '#/api/bpm/form';
|
import { getForm } from '#/api/bpm/form';
|
||||||
import {
|
import {
|
||||||
MyProcessDesigner,
|
MyProcessDesigner,
|
||||||
MyProcessPenal,
|
MyProcessPenal,
|
||||||
@@ -78,7 +78,7 @@ watch(
|
|||||||
() => modelData.value.formId,
|
() => modelData.value.formId,
|
||||||
async (newFormId) => {
|
async (newFormId) => {
|
||||||
if (newFormId && modelData.value.formType === BpmModelFormType.NORMAL) {
|
if (newFormId && modelData.value.formType === BpmModelFormType.NORMAL) {
|
||||||
const data = await getFormDetail(newFormId);
|
const data = await getForm(newFormId);
|
||||||
formFields.value = data.fields;
|
formFields.value = data.fields;
|
||||||
} else {
|
} else {
|
||||||
formFields.value = [];
|
formFields.value = [];
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ watch(
|
|||||||
() => modelData.value.formId,
|
() => modelData.value.formId,
|
||||||
async (newFormId) => {
|
async (newFormId) => {
|
||||||
if (newFormId && modelData.value.formType === BpmModelFormType.NORMAL) {
|
if (newFormId && modelData.value.formType === BpmModelFormType.NORMAL) {
|
||||||
const data = await FormApi.getFormDetail(newFormId);
|
const data = await FormApi.getForm(newFormId);
|
||||||
const result: Array<{ field: string; title: string }> = [];
|
const result: Array<{ field: string; title: string }> = [];
|
||||||
if (data.fields) {
|
if (data.fields) {
|
||||||
unParsedFormFields.value = data.fields;
|
unParsedFormFields.value = data.fields;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
|
|
||||||
import { getFormDetail } from '#/api/bpm/form';
|
import { getForm } from '#/api/bpm/form';
|
||||||
import { setConfAndFields2 } from '#/components/form-create';
|
import { setConfAndFields2 } from '#/components/form-create';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -52,7 +52,7 @@ watch(
|
|||||||
() => modelData.value.formId,
|
() => modelData.value.formId,
|
||||||
async (newFormId) => {
|
async (newFormId) => {
|
||||||
if (newFormId && modelData.value.formType === BpmModelFormType.NORMAL) {
|
if (newFormId && modelData.value.formType === BpmModelFormType.NORMAL) {
|
||||||
const data = await getFormDetail(newFormId);
|
const data = await getForm(newFormId);
|
||||||
setConfAndFields2(formPreview.value, data.conf, data.fields);
|
setConfAndFields2(formPreview.value, data.conf, data.fields);
|
||||||
// 设置只读
|
// 设置只读
|
||||||
formPreview.value.rule.forEach((item: any) => {
|
formPreview.value.rule.forEach((item: any) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user