feat:【antd】【bpm】model/form/ 代码评审
This commit is contained in:
@@ -12,7 +12,6 @@ import { Button, Tooltip } from 'ant-design-vue';
|
|||||||
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { getProcessDefinitionPage } from '#/api/bpm/definition';
|
import { getProcessDefinitionPage } from '#/api/bpm/definition';
|
||||||
|
|
||||||
// 导入 FormCreate 表单详情
|
|
||||||
import FormCreateDetail from '../../form/modules/detail.vue';
|
import FormCreateDetail from '../../form/modules/detail.vue';
|
||||||
import { useGridColumns } from './data';
|
import { useGridColumns } from './data';
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import ProcessDesign from './modules/process-design.vue';
|
|||||||
|
|
||||||
defineOptions({ name: 'BpmModelCreate' });
|
defineOptions({ name: 'BpmModelCreate' });
|
||||||
|
|
||||||
// 流程定义类型
|
|
||||||
type BpmProcessDefinitionType = Omit<
|
type BpmProcessDefinitionType = Omit<
|
||||||
BpmProcessDefinitionApi.ProcessDefinition,
|
BpmProcessDefinitionApi.ProcessDefinition,
|
||||||
'modelId' | 'modelType'
|
'modelId' | 'modelType'
|
||||||
@@ -49,42 +48,17 @@ type BpmProcessDefinitionType = Omit<
|
|||||||
};
|
};
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
const tabs = useTabs();
|
||||||
|
|
||||||
// 基础信息组件引用
|
const basicInfoRef = ref<InstanceType<typeof BasicInfo>>(); // 基础信息组件引用
|
||||||
const basicInfoRef = ref<InstanceType<typeof BasicInfo>>();
|
const formDesignRef = ref<InstanceType<typeof FormDesign>>(); // 表单设计组件引用
|
||||||
// 表单设计组件引用
|
const processDesignRef = ref<InstanceType<typeof ProcessDesign>>(); // 流程设计组件引用
|
||||||
const formDesignRef = ref<InstanceType<typeof FormDesign>>();
|
const extraSettingRef = ref<InstanceType<typeof ExtraSetting>>(); // 更多设置组件引用
|
||||||
// 流程设计组件引用
|
|
||||||
const processDesignRef = ref<InstanceType<typeof ProcessDesign>>();
|
|
||||||
// 更多设置组件引用
|
|
||||||
const extraSettingRef = ref<InstanceType<typeof ExtraSetting>>();
|
|
||||||
|
|
||||||
/** 步骤校验函数 */
|
|
||||||
async function validateBasic() {
|
|
||||||
await basicInfoRef.value?.validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 表单设计校验 */
|
|
||||||
async function validateForm() {
|
|
||||||
await formDesignRef.value?.validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 流程设计校验 */
|
|
||||||
async function validateProcess() {
|
|
||||||
await processDesignRef.value?.validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 更多设置校验 */
|
|
||||||
async function validateExtra() {
|
|
||||||
await extraSettingRef.value?.validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const actionType = route.params.type as string; // 操作类型:create、copy、update
|
||||||
const currentStep = ref(-1); // 步骤控制。-1 用于,一开始全部不展示等当前页面数据初始化完成
|
const currentStep = ref(-1); // 步骤控制。-1 用于,一开始全部不展示等当前页面数据初始化完成
|
||||||
|
|
||||||
const steps = [
|
const steps = [
|
||||||
{ title: '基本信息', validator: validateBasic },
|
{ title: '基本信息', validator: validateBasic },
|
||||||
{ title: '表单设计', validator: validateForm },
|
{ title: '表单设计', validator: validateForm },
|
||||||
@@ -92,7 +66,6 @@ const steps = [
|
|||||||
{ title: '更多设置', validator: validateExtra },
|
{ title: '更多设置', validator: validateExtra },
|
||||||
];
|
];
|
||||||
|
|
||||||
// 表单数据
|
|
||||||
const formData: any = ref({
|
const formData: any = ref({
|
||||||
id: undefined,
|
id: undefined,
|
||||||
name: '',
|
name: '',
|
||||||
@@ -128,22 +101,38 @@ const formData: any = ref({
|
|||||||
summary: [],
|
summary: [],
|
||||||
},
|
},
|
||||||
allowWithdrawTask: false,
|
allowWithdrawTask: false,
|
||||||
});
|
}); // 表单数据
|
||||||
|
const processData = ref<any>(); // 流程数据
|
||||||
|
|
||||||
// 流程数据
|
|
||||||
const processData = ref<any>();
|
|
||||||
|
|
||||||
provide('processData', processData);
|
|
||||||
provide('modelData', formData);
|
|
||||||
|
|
||||||
// 数据列表
|
|
||||||
const formList = ref<BpmFormApi.Form[]>([]);
|
const formList = ref<BpmFormApi.Form[]>([]);
|
||||||
const categoryList = ref<BpmCategoryApi.Category[]>([]);
|
const categoryList = ref<BpmCategoryApi.Category[]>([]);
|
||||||
const userList = ref<SystemUserApi.User[]>([]);
|
const userList = ref<SystemUserApi.User[]>([]);
|
||||||
const deptList = ref<SystemDeptApi.Dept[]>([]);
|
const deptList = ref<SystemDeptApi.Dept[]>([]);
|
||||||
|
|
||||||
|
provide('processData', processData);
|
||||||
|
provide('modelData', formData);
|
||||||
|
|
||||||
|
/** 步骤校验函数 */
|
||||||
|
async function validateBasic() {
|
||||||
|
await basicInfoRef.value?.validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 表单设计校验 */
|
||||||
|
async function validateForm() {
|
||||||
|
await formDesignRef.value?.validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 流程设计校验 */
|
||||||
|
async function validateProcess() {
|
||||||
|
await processDesignRef.value?.validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 更多设置校验 */
|
||||||
|
async function validateExtra() {
|
||||||
|
await extraSettingRef.value?.validate();
|
||||||
|
}
|
||||||
|
|
||||||
/** 初始化数据 */
|
/** 初始化数据 */
|
||||||
const actionType = route.params.type as string;
|
|
||||||
async function initData() {
|
async function initData() {
|
||||||
if (actionType === 'definition') {
|
if (actionType === 'definition') {
|
||||||
// 情况一:流程定义场景(恢复)
|
// 情况一:流程定义场景(恢复)
|
||||||
@@ -212,7 +201,6 @@ async function initData() {
|
|||||||
|
|
||||||
// 最终,设置 currentStep 切换到第一步
|
// 最终,设置 currentStep 切换到第一步
|
||||||
currentStep.value = 0;
|
currentStep.value = 0;
|
||||||
|
|
||||||
// 以前未配置更多设置的流程
|
// 以前未配置更多设置的流程
|
||||||
extraSettingRef.value?.initData();
|
extraSettingRef.value?.initData();
|
||||||
}
|
}
|
||||||
@@ -291,7 +279,6 @@ async function handleSave() {
|
|||||||
formData.value.id = await createModel(modelData);
|
formData.value.id = await createModel(modelData);
|
||||||
// 提示成功
|
// 提示成功
|
||||||
message.success('复制成功,可点击【发布】按钮,进行发布模型');
|
message.success('复制成功,可点击【发布】按钮,进行发布模型');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'definition': {
|
case 'definition': {
|
||||||
@@ -299,15 +286,13 @@ async function handleSave() {
|
|||||||
await updateModel(modelData);
|
await updateModel(modelData);
|
||||||
// 提示成功
|
// 提示成功
|
||||||
message.success('恢复成功,可点击【发布】按钮,进行发布模型');
|
message.success('恢复成功,可点击【发布】按钮,进行发布模型');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'update': {
|
case 'update': {
|
||||||
// 修改场景
|
// 情况二:修改场景
|
||||||
await updateModel(modelData);
|
await updateModel(modelData);
|
||||||
// 提示成功
|
// 提示成功
|
||||||
message.success('修改成功,可点击【发布】按钮,进行发布模型');
|
message.success('修改成功,可点击【发布】按钮,进行发布模型');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@@ -324,6 +309,7 @@ async function handleSave() {
|
|||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error('保存失败:', error);
|
console.error('保存失败:', error);
|
||||||
|
// TODO @jason:这个提示,还要么???
|
||||||
// message.warning(error.msg || '请完善所有步骤的必填信息');
|
// message.warning(error.msg || '请完善所有步骤的必填信息');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -331,28 +317,28 @@ async function handleSave() {
|
|||||||
/** 发布操作 */
|
/** 发布操作 */
|
||||||
async function handleDeploy() {
|
async function handleDeploy() {
|
||||||
try {
|
try {
|
||||||
// 修改场景下直接发布,新增场景下需要先确认
|
// 1.1 修改场景下直接发布,新增场景下需要先确认
|
||||||
if (!formData.value.id) {
|
if (!formData.value.id) {
|
||||||
await confirm('是否确认发布该流程?');
|
await confirm('是否确认发布该流程?');
|
||||||
}
|
}
|
||||||
// 校验所有步骤
|
// 1.2 校验所有步骤
|
||||||
await validateAllSteps();
|
await validateAllSteps();
|
||||||
|
|
||||||
// 更新表单数据
|
// 2.1 更新表单数据
|
||||||
const modelData = {
|
const modelData = {
|
||||||
...formData.value,
|
...formData.value,
|
||||||
};
|
};
|
||||||
|
// 2.2 先保存所有数据
|
||||||
// 先保存所有数据
|
|
||||||
if (formData.value.id) {
|
if (formData.value.id) {
|
||||||
await updateModel(modelData);
|
await updateModel(modelData);
|
||||||
} else {
|
} else {
|
||||||
const result = await createModel(modelData);
|
const result = await createModel(modelData);
|
||||||
formData.value.id = result.id;
|
formData.value.id = result.id;
|
||||||
}
|
}
|
||||||
|
// 2.3 发布
|
||||||
// 发布
|
|
||||||
await deployModel(formData.value.id);
|
await deployModel(formData.value.id);
|
||||||
|
|
||||||
|
// 3. 路由并提示
|
||||||
message.success('发布成功');
|
message.success('发布成功');
|
||||||
await router.push({ name: 'BpmModel' });
|
await router.push({ name: 'BpmModel' });
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
@@ -386,13 +372,9 @@ async function handleStepClick(index: number) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const tabs = useTabs();
|
|
||||||
|
|
||||||
/** 返回列表页 */
|
/** 返回列表页 */
|
||||||
function handleBack() {
|
function handleBack() {
|
||||||
// 关闭当前页签
|
|
||||||
tabs.closeCurrentTab();
|
tabs.closeCurrentTab();
|
||||||
// 跳转到列表页
|
|
||||||
router.push({ name: 'BpmModel' });
|
router.push({ name: 'BpmModel' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,21 +53,15 @@ const [DeptSelectModalComp, deptSelectModalApi] = useVbenModal({
|
|||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 表单引用
|
const formRef = ref(); // 表单引用
|
||||||
const formRef = ref();
|
const modelData = defineModel<any>(); // 创建本地数据副本
|
||||||
|
|
||||||
// 选中的发起人
|
const selectedStartUsers = ref<SystemUserApi.User[]>([]); // 选中的发起人
|
||||||
const selectedStartUsers = ref<SystemUserApi.User[]>([]);
|
const selectedStartDepts = ref<SystemDeptApi.Dept[]>([]); // 选中的发起部门
|
||||||
|
|
||||||
// 选中的发起部门
|
const selectedManagerUsers = ref<SystemUserApi.User[]>([]); // 选中的流程管理员
|
||||||
const selectedStartDepts = ref<SystemDeptApi.Dept[]>([]);
|
|
||||||
|
|
||||||
// 选中的流程管理员
|
|
||||||
const selectedManagerUsers = ref<SystemUserApi.User[]>([]);
|
|
||||||
const currentSelectType = ref<'manager' | 'start'>('start');
|
const currentSelectType = ref<'manager' | 'start'>('start');
|
||||||
// 选中的用户
|
const selectedUsers = ref<number[]>(); // 选中的用户
|
||||||
const selectedUsers = ref<number[]>();
|
|
||||||
|
|
||||||
const rules: Record<string, Rule[]> = {
|
const rules: Record<string, Rule[]> = {
|
||||||
name: [{ required: true, message: '流程名称不能为空', trigger: 'blur' }],
|
name: [{ required: true, message: '流程名称不能为空', trigger: 'blur' }],
|
||||||
key: [
|
key: [
|
||||||
@@ -99,10 +93,7 @@ const rules: Record<string, Rule[]> = {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
// 创建本地数据副本
|
/** 初始化选中的用户 */
|
||||||
const modelData = defineModel<any>();
|
|
||||||
|
|
||||||
// 初始化选中的用户
|
|
||||||
watch(
|
watch(
|
||||||
() => modelData.value,
|
() => modelData.value,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
@@ -140,6 +131,7 @@ function openStartUserSelect() {
|
|||||||
function openStartDeptSelect() {
|
function openStartDeptSelect() {
|
||||||
deptSelectModalApi.setData({ selectedList: selectedStartDepts.value }).open();
|
deptSelectModalApi.setData({ selectedList: selectedStartDepts.value }).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 处理部门选择确认 */
|
/** 处理部门选择确认 */
|
||||||
function handleDeptSelectConfirm(depts: SystemDeptApi.Dept[]) {
|
function handleDeptSelectConfirm(depts: SystemDeptApi.Dept[]) {
|
||||||
modelData.value = {
|
modelData.value = {
|
||||||
@@ -191,7 +183,6 @@ function handleStartUserTypeChange(value: SelectValue) {
|
|||||||
startUserIds: [],
|
startUserIds: [],
|
||||||
startDeptIds: [],
|
startDeptIds: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: {
|
case 1: {
|
||||||
@@ -199,7 +190,6 @@ function handleStartUserTypeChange(value: SelectValue) {
|
|||||||
...modelData.value,
|
...modelData.value,
|
||||||
startDeptIds: [],
|
startDeptIds: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
@@ -207,7 +197,6 @@ function handleStartUserTypeChange(value: SelectValue) {
|
|||||||
...modelData.value,
|
...modelData.value,
|
||||||
startUserIds: [],
|
startUserIds: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,17 +31,13 @@ defineProps<{
|
|||||||
|
|
||||||
const emit = defineEmits(['success', 'init-finished']);
|
const emit = defineEmits(['success', 'init-finished']);
|
||||||
|
|
||||||
// 表单信息
|
const formFields = ref<string[]>([]); // 表单信息
|
||||||
const formFields = ref<string[]>([]);
|
const formType = ref(BpmModelFormType.NORMAL); // 表单类型,暂仅限流程表单 TODO @jason:是不是已经支持 业务表单 了?
|
||||||
// 表单类型,暂仅限流程表单
|
|
||||||
const formType = ref(BpmModelFormType.NORMAL);
|
|
||||||
provide('formFields', formFields);
|
provide('formFields', formFields);
|
||||||
provide('formType', formType);
|
provide('formType', formType);
|
||||||
|
|
||||||
// 注入流程数据
|
const xmlString = inject('processData') as Ref; // 注入流程数据
|
||||||
const xmlString = inject('processData') as Ref;
|
const modelData = inject('modelData') as Ref; // 注入模型数据
|
||||||
// 注入模型数据
|
|
||||||
const modelData = inject('modelData') as Ref;
|
|
||||||
|
|
||||||
const modeler = shallowRef(); // BPMN Modeler
|
const modeler = shallowRef(); // BPMN Modeler
|
||||||
const processDesigner = ref();
|
const processDesigner = ref();
|
||||||
@@ -57,7 +53,6 @@ const model = ref<BpmModelApi.Model>(); // 流程模型的信息
|
|||||||
|
|
||||||
/** 初始化 modeler */
|
/** 初始化 modeler */
|
||||||
const initModeler = async (item: any) => {
|
const initModeler = async (item: any) => {
|
||||||
// 先初始化模型数据
|
|
||||||
model.value = modelData.value;
|
model.value = modelData.value;
|
||||||
modeler.value = item;
|
modeler.value = item;
|
||||||
};
|
};
|
||||||
@@ -87,7 +82,7 @@ watch(
|
|||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
// 在组件卸载时清理
|
/** 在组件卸载时清理 */
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
modeler.value = null;
|
modeler.value = null;
|
||||||
// 清理全局实例
|
// 清理全局实例
|
||||||
@@ -127,6 +122,7 @@ onBeforeUnmount(() => {
|
|||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
// TODO @jason:tailwind?
|
||||||
.process-panel__container {
|
.process-panel__container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 172px;
|
top: 172px;
|
||||||
|
|||||||
@@ -179,8 +179,7 @@ const formFieldOptions4Summary = computed(() => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
const unParsedFormFields = ref<string[]>([]); // 未解析的表单字段
|
const unParsedFormFields = ref<string[]>([]); // 未解析的表单字段
|
||||||
// 暴露给子组件 HttpRequestSetting 使用
|
provide('formFields', unParsedFormFields); // 暴露给子组件 HttpRequestSetting 使用
|
||||||
provide('formFields', unParsedFormFields);
|
|
||||||
|
|
||||||
/** 兼容以前未配置更多设置的流程 */
|
/** 兼容以前未配置更多设置的流程 */
|
||||||
function initData() {
|
function initData() {
|
||||||
@@ -246,8 +245,8 @@ watch(
|
|||||||
},
|
},
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
// 表单引用
|
const formRef = ref(); // 表单引用
|
||||||
const formRef = ref();
|
|
||||||
/** 表单校验 */
|
/** 表单校验 */
|
||||||
async function validate() {
|
async function validate() {
|
||||||
await formRef.value?.validate();
|
await formRef.value?.validate();
|
||||||
|
|||||||
@@ -33,10 +33,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
|
|
||||||
// 创建本地数据副本
|
const modelData = defineModel<any>(); // 创建本地数据副本
|
||||||
const modelData = defineModel<any>();
|
|
||||||
|
|
||||||
// 表单预览数据
|
|
||||||
const formPreview = ref({
|
const formPreview = ref({
|
||||||
formData: {} as any,
|
formData: {} as any,
|
||||||
rule: [],
|
rule: [],
|
||||||
@@ -45,9 +42,20 @@ const formPreview = ref({
|
|||||||
resetBtn: false,
|
resetBtn: false,
|
||||||
formData: {},
|
formData: {},
|
||||||
},
|
},
|
||||||
});
|
}); // 表单预览数据
|
||||||
|
|
||||||
/** 监听表单ID变化,加载表单数据 */
|
const rules: Record<string, Rule[]> = {
|
||||||
|
formType: [{ required: true, message: '表单类型不能为空', trigger: 'blur' }],
|
||||||
|
formId: [{ required: true, message: '流程表单不能为空', trigger: 'blur' }],
|
||||||
|
formCustomCreatePath: [
|
||||||
|
{ required: true, message: '表单提交路由不能为空', trigger: 'blur' },
|
||||||
|
],
|
||||||
|
formCustomViewPath: [
|
||||||
|
{ required: true, message: '表单查看地址不能为空', trigger: 'blur' },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 监听表单 ID 变化,加载表单数据 */
|
||||||
watch(
|
watch(
|
||||||
() => modelData.value.formId,
|
() => modelData.value.formId,
|
||||||
async (newFormId) => {
|
async (newFormId) => {
|
||||||
@@ -65,17 +73,6 @@ watch(
|
|||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
const rules: Record<string, Rule[]> = {
|
|
||||||
formType: [{ required: true, message: '表单类型不能为空', trigger: 'blur' }],
|
|
||||||
formId: [{ required: true, message: '流程表单不能为空', trigger: 'blur' }],
|
|
||||||
formCustomCreatePath: [
|
|
||||||
{ required: true, message: '表单提交路由不能为空', trigger: 'blur' },
|
|
||||||
],
|
|
||||||
formCustomViewPath: [
|
|
||||||
{ required: true, message: '表单查看地址不能为空', trigger: 'blur' },
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 表单校验 */
|
/** 表单校验 */
|
||||||
async function validate() {
|
async function validate() {
|
||||||
await formRef.value?.validate();
|
await formRef.value?.validate();
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ import { BpmModelType } from '@vben/constants';
|
|||||||
import BpmModelEditor from './bpm-model-editor.vue';
|
import BpmModelEditor from './bpm-model-editor.vue';
|
||||||
import SimpleModelDesign from './simple-model-design.vue';
|
import SimpleModelDesign from './simple-model-design.vue';
|
||||||
|
|
||||||
// 创建本地数据副本
|
const modelData = defineModel<any>(); // 创建本地数据副本
|
||||||
const modelData = defineModel<any>();
|
|
||||||
|
|
||||||
const processData = inject('processData') as Ref;
|
const processData = inject('processData') as Ref;
|
||||||
|
|
||||||
const simpleDesign = ref();
|
const simpleDesign = ref();
|
||||||
@@ -30,6 +28,7 @@ async function validate() {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 处理设计器保存成功 */
|
/** 处理设计器保存成功 */
|
||||||
async function handleDesignSuccess(data?: any) {
|
async function handleDesignSuccess(data?: any) {
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -39,7 +38,7 @@ async function handleDesignSuccess(data?: any) {
|
|||||||
bpmnXml: modelData.value.type === BpmModelType.BPMN ? data : null,
|
bpmnXml: modelData.value.type === BpmModelType.BPMN ? data : null,
|
||||||
simpleModel: modelData.value.type === BpmModelType.BPMN ? null : data,
|
simpleModel: modelData.value.type === BpmModelType.BPMN ? null : data,
|
||||||
};
|
};
|
||||||
// 使用emit更新父组件的数据
|
// 使用 emit 更新父组件的数据
|
||||||
await nextTick();
|
await nextTick();
|
||||||
// 更新表单的模型数据部分
|
// 更新表单的模型数据部分
|
||||||
modelData.value = newModelData;
|
modelData.value = newModelData;
|
||||||
@@ -50,6 +49,7 @@ async function handleDesignSuccess(data?: any) {
|
|||||||
const showDesigner = computed(() => {
|
const showDesigner = computed(() => {
|
||||||
return Boolean(modelData.value?.key && modelData.value?.name);
|
return Boolean(modelData.value?.key && modelData.value?.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
defineExpose({ validate });
|
defineExpose({ validate });
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
|
|
||||||
const designerRef = ref();
|
const designerRef = ref();
|
||||||
|
|
||||||
/** 保存成功回调 */
|
/** 保存成功回调 */
|
||||||
@@ -24,10 +25,12 @@ function handleSuccess(data?: any) {
|
|||||||
emit('success', data);
|
emit('success', data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 设计器配置校验 */
|
/** 设计器配置校验 */
|
||||||
async function validateConfig() {
|
async function validateConfig() {
|
||||||
return await designerRef.value.validate();
|
return await designerRef.value.validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ validateConfig });
|
defineExpose({ validateConfig });
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -17,11 +17,9 @@ import {
|
|||||||
import { getModelList } from '#/api/bpm/model';
|
import { getModelList } from '#/api/bpm/model';
|
||||||
import { router } from '#/router';
|
import { router } from '#/router';
|
||||||
|
|
||||||
// 流程分类对话框
|
|
||||||
import CategoryForm from '../category/modules/form.vue';
|
import CategoryForm from '../category/modules/form.vue';
|
||||||
import CategoryDraggableModel from './modules/category-draggable-model.vue';
|
import CategoryDraggableModel from './modules/category-draggable-model.vue';
|
||||||
|
|
||||||
// 新建流程分类对话框
|
|
||||||
const [CategoryFormModal, categoryFormModalApi] = useVbenModal({
|
const [CategoryFormModal, categoryFormModalApi] = useVbenModal({
|
||||||
connectedComponent: CategoryForm,
|
connectedComponent: CategoryForm,
|
||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user