fix: 1.修复表单发布的功能提交流程审批有流程为最新发起流程2.表单设计下生成代码,添加带类型

This commit is contained in:
825299534@qq.com
2025-03-26 11:05:01 +08:00
parent adb81b53cb
commit 9f432e2b33
2 changed files with 161 additions and 86 deletions

View File

@ -161,6 +161,7 @@
generatorConfig.tableStructureConfigs = formJson.tableStructureConfigs; generatorConfig.tableStructureConfigs = formJson.tableStructureConfigs;
generatorConfig.formEventConfig = formJson.formEventConfig; generatorConfig.formEventConfig = formJson.formEventConfig;
generatorConfig.outputConfig.dataAuthList = formJson.dataAuthList; generatorConfig.outputConfig.dataAuthList = formJson.dataAuthList;
generatorConfig.outputConfig.type =res.formDesignType
generatorConfig.outputConfig.isDataAuth = formJson.isDataAuth; generatorConfig.outputConfig.isDataAuth = formJson.isDataAuth;
isGetInfo.value = true; isGetInfo.value = true;
}); });
@ -200,7 +201,6 @@
tableInfo.value, tableInfo.value,
buildOption(generatorConfig.formJson) as FormProps, buildOption(generatorConfig.formJson) as FormProps,
); );
await dataFirstGeneratorCode(data); await dataFirstGeneratorCode(data);
closeModal(); closeModal();
emits('success'); emits('success');

View File

@ -8,7 +8,8 @@
:clickRowToExpand="true" :clickRowToExpand="true"
:treeData="treeData" :treeData="treeData"
:fieldNames="fieldNames" :fieldNames="fieldNames"
@select="handleSelect" @row-dbClick="dbClickRow"
:row-selection="rowSelection"
> >
<template #title="item"> <template #title="item">
<template v-if="item.renderIcon === 'parentIcon'"> <template v-if="item.renderIcon === 'parentIcon'">
@ -210,6 +211,9 @@
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
const { path } = unref(currentRoute); const { path } = unref(currentRoute);
const printMenuId = computed(() => currentRoute.value.meta.menuId as string); const printMenuId = computed(() => currentRoute.value.meta.menuId as string);
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const router = useRouter();
const { filterColumnAuth, filterButtonAuth } = usePermission(); const { filterColumnAuth, filterButtonAuth } = usePermission();
let columns: BasicColumn[] = [], //列表配置 let columns: BasicColumn[] = [], //列表配置
@ -321,6 +325,7 @@
view: handleView, view: handleView,
add: handleAdd, add: handleAdd,
edit: handleEdit, edit: handleEdit,
startwork : handleStartwork,
delete: handleDelete, delete: handleDelete,
batchdelete: handleBatchdelete, batchdelete: handleBatchdelete,
batchSetUserId: handleBatchSetUserId, batchSetUserId: handleBatchSetUserId,
@ -544,6 +549,11 @@
} }
function handleAdd() { function handleAdd() {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
});
} else {
const info = { const info = {
isUpdate: false, isUpdate: false,
releaseId: menuId.value, releaseId: menuId.value,
@ -553,6 +563,7 @@
}; };
formType.value === 'modal' ? openModal(true, info) : openDrawer(true, info); formType.value === 'modal' ? openModal(true, info) : openDrawer(true, info);
} }
}
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
const info = { const info = {
@ -567,6 +578,26 @@
} }
function handleView(record: Recordable) { function handleView(record: Recordable) {
if (record.workflowData?.taskIds && record.workflowData.taskIds.length) {
const { processId, taskIds, schemaId } = record.workflowData;
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
taskId: taskIds[0],
rtId: currentRoute.value.query.rtId
}
});
} else if (record.workflowData?.schemaId && !record.workflowData.taskIds) {
const { processId, schemaId } = record.workflowData;
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
readonly: 1,
taskId: '',
rtId: currentRoute.value.query.rtId
}
});
} else {
const info = { const info = {
id: record[pkField.value], id: record[pkField.value],
releaseId: menuId.value, releaseId: menuId.value,
@ -577,6 +608,7 @@
}; };
formType.value === 'modal' ? openModal(true, info) : openDrawer(true, info); formType.value === 'modal' ? openModal(true, info) : openDrawer(true, info);
} }
}
function handleCopyData(record: Recordable) { function handleCopyData(record: Recordable) {
const info = { const info = {
@ -842,7 +874,7 @@
}); });
function getActions(record: Recordable):ActionItem[] { function getActions(record: Recordable):ActionItem[] {
const hasStartWorkButton = buttonConfigs.value?.some((x) => x.code === 'startwork');
let actionsList: ActionItem[] = []; let actionsList: ActionItem[] = [];
let editAndDelBtn: ActionItem[] = []; let editAndDelBtn: ActionItem[] = [];
let hasFlowRecord = false; let hasFlowRecord = false;
@ -864,23 +896,21 @@
} }
if (button.code === 'flowRecord') hasFlowRecord = true; if (button.code === 'flowRecord') hasFlowRecord = true;
}); });
if (record.workflowData?.enabled) { if (record.workflowData.enabled) {
if (!hasStartWorkButton) return actionsList;
//与工作流有关联的表单 //与工作流有关联的表单
if (record.workflowData.status) { if (record.workflowData.status) {
//如果是本人需要审批的数据 就会有taskIds 所以需要修改绑定事件 //如果是本人需要审批的数据 就会有taskIds 所以需要修改绑定事件
const act: ActionItem = {}; const act: ActionItem = {};
if (record.workflowData.taskIds) { if (record.workflowData.taskIds) {
act.tooltip = t('查看流程(待审批)'); act.tooltip = '查看流程(待审批)';
act.icon = 'daishenpi|svg'; act.icon = 'daishenpi|svg';
act.onClick = handleApproveProcess.bind(null, record); act.onClick = handleApproveProcess.bind(null, record);
} else { } else {
act.tooltip = act.tooltip =
t('查看流程') + '查看流程' + (record.workflowData.status === 'ACTIVE' ? '(审批中)' : '(已完成)');
(record.workflowData.status === 'ACTIVE' ? t('(审批中)') : t('(已完成)'));
act.icon = act.icon =
record.workflowData.status === 'ACTIVE' ? 'jinshenpi|svg' : 'shenpiwancheng|svg'; record.workflowData.status === 'ACTIVE' ? 'jinshenpi|svg' : 'shenpiwancheng|svg';
act.onClick = handleViewWorkflow.bind(null, record); act.onClick = handleStartwork.bind(null, record);
} }
actionsList.unshift(act); actionsList.unshift(act);
if (hasFlowRecord) { if (hasFlowRecord) {
@ -890,16 +920,17 @@
onClick: handleFlowRecord.bind(null, record), onClick: handleFlowRecord.bind(null, record),
}); });
} }
} else { } else {
actionsList.unshift({ actionsList.unshift({
icon: 'faqishenpi|svg', icon: 'faqishenpi|svg',
tooltip: record.workflowData.draftId ? t('编辑草稿') : t('发起审批'), tooltip: record.workflowData.draftId ? '编辑草稿' : '发起审批' ,
onClick: handleLaunchProcess.bind(null, record), onClick: handleLaunchProcess.bind(null, record),
}); });
actionsList = actionsList.concat(editAndDelBtn); actionsList = actionsList.concat(editAndDelBtn);
} }
} else { } else {
if (!record.workflowData?.processId) { if (!record.workflowData.processId) {
//与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上 //与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
actionsList = actionsList.concat(editAndDelBtn); actionsList = actionsList.concat(editAndDelBtn);
} }
@ -907,12 +938,56 @@
return actionsList; return actionsList;
} }
function handleSelect(selectIds) { function handleStartwork(record: Recordable) {
selectId.value = selectIds[0]; const { processId, schemaId } = record.workflowData;
reload({ router.push({
searchInfo: { [listConfig.value.leftMenuConfig?.listFieldName as string]: selectId.value }, path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
readonly: 1,
taskId: '',
}
}); });
} }
function dbClickRow(record) {
if (record.workflowData?.taskIds && record.workflowData.taskIds.length) {
const { processId, taskIds, schemaId } = record.workflowData;
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
taskId: taskIds[0],
rtId: currentRoute.value.query.rtId
}
});
} else if (record.workflowData?.schemaId && !record.workflowData.taskIds) {
const { processId, schemaId } = record.workflowData;
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
readonly: 1,
taskId: '',
rtId: currentRoute.value.query.rtId
}
});
} else {
router.push({
path: '/form/infoTaskManageItem/' + record.id + '/viewForm',
query: {
formPath: 'infoManage/infoTaskManageItem'
}
});
}
}
const rowSelection: TableProps['rowSelection'] = {
onChange: (selectedRowKeys: string[], selectedRows: DataType[]) => {
selectedKeys.value = selectedRowKeys;
selectedRowsData.value = selectedRows;
},
getCheckboxProps: (record: DataType) => ({
disabled: record.workflowData.taskIds === null, // Column configuration not to be checked
name: record.workflowData.taskIds,
}),
};
async function fetchLeftData() { async function fetchLeftData() {
//如果是数据字典 //如果是数据字典