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,14 +549,20 @@
} }
function handleAdd() { function handleAdd() {
const info = { if (schemaIdComputedRef.value) {
isUpdate: false, router.push({
releaseId: menuId.value, path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
pkField: pkField.value, });
formEventConfig, } else {
formProps, const info = {
}; isUpdate: false,
formType.value === 'modal' ? openModal(true, info) : openDrawer(true, info); releaseId: menuId.value,
pkField: pkField.value,
formEventConfig,
formProps,
};
formType.value === 'modal' ? openModal(true, info) : openDrawer(true, info);
}
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
@ -567,15 +578,36 @@
} }
function handleView(record: Recordable) { function handleView(record: Recordable) {
const info = { if (record.workflowData?.taskIds && record.workflowData.taskIds.length) {
id: record[pkField.value], const { processId, taskIds, schemaId } = record.workflowData;
releaseId: menuId.value, router.push({
pkField: pkField.value, path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
isView: true, query: {
formEventConfig, taskId: taskIds[0],
formProps, rtId: currentRoute.value.query.rtId
}; }
formType.value === 'modal' ? openModal(true, info) : openDrawer(true, info); });
} 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 = {
id: record[pkField.value],
releaseId: menuId.value,
pkField: pkField.value,
isView: true,
formEventConfig,
formProps,
};
formType.value === 'modal' ? openModal(true, info) : openDrawer(true, info);
}
} }
function handleCopyData(record: Recordable) { function handleCopyData(record: Recordable) {
@ -841,78 +873,121 @@
reload(); reload();
}); });
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;
actionButtonConfig.value?.map((button) => { actionButtonConfig.value?.map((button) => {
if (button.code === 'view') { if (button.code === 'view') {
actionsList.push({ actionsList.push({
icon: button?.icon, icon: button?.icon,
tooltip: button?.name, tooltip: button?.name,
onClick: handleView.bind(null, record), onClick: handleView.bind(null, record),
}); });
} }
if (['edit', 'copyData', 'delete'].includes(button.code)) { if (['edit', 'copyData', 'delete'].includes(button.code)) {
editAndDelBtn.push({ editAndDelBtn.push({
icon: button?.icon, icon: button?.icon,
tooltip: button?.name, tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined, color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record), onClick: btnEvent[button.code].bind(null, record),
}); });
} }
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 = '查看流程(待审批)';
act.tooltip = t('查看流程(待审批)'); 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 = '查看流程' + (record.workflowData.status === 'ACTIVE' ? '(审批中)' : '(已完成)');
t('查看流程') + act.icon =
(record.workflowData.status === 'ACTIVE' ? t('(审批中)') : t('(已完成)')); record.workflowData.status === 'ACTIVE' ? 'jinshenpi|svg' : 'shenpiwancheng|svg';
act.icon = act.onClick = handleStartwork.bind(null, record);
record.workflowData.status === 'ACTIVE' ? 'jinshenpi|svg' : 'shenpiwancheng|svg'; }
act.onClick = handleViewWorkflow.bind(null, record); actionsList.unshift(act);
} if (hasFlowRecord) {
actionsList.unshift(act); actionsList.splice(1, 0, {
if (hasFlowRecord) { tooltip: '查看流转记录',
actionsList.splice(1, 0, { icon: 'liuzhuanxinxi|svg',
tooltip: '查看流转记录', onClick: handleFlowRecord.bind(null, record),
icon: 'liuzhuanxinxi|svg', });
onClick: handleFlowRecord.bind(null, record), }
});
} } else {
actionsList.unshift({
icon: 'faqishenpi|svg',
tooltip: record.workflowData.draftId ? '编辑草稿' : '发起审批' ,
onClick: handleLaunchProcess.bind(null, record),
});
actionsList = actionsList.concat(editAndDelBtn);
}
} else { } else {
actionsList.unshift({ if (!record.workflowData.processId) {
icon: 'faqishenpi|svg', //与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
tooltip: record.workflowData.draftId ? t('编辑草稿') : t('发起审批'), actionsList = actionsList.concat(editAndDelBtn);
onClick: handleLaunchProcess.bind(null, record), }
});
actionsList = actionsList.concat(editAndDelBtn);
} }
} else { return actionsList;
if (!record.workflowData?.processId) {
//与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
actionsList = actionsList.concat(editAndDelBtn);
}
}
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() {
//如果是数据字典 //如果是数据字典