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

View File

@ -8,7 +8,8 @@
:clickRowToExpand="true"
:treeData="treeData"
:fieldNames="fieldNames"
@select="handleSelect"
@row-dbClick="dbClickRow"
:row-selection="rowSelection"
>
<template #title="item">
<template v-if="item.renderIcon === 'parentIcon'">
@ -210,6 +211,9 @@
const { currentRoute } = useRouter();
const { path } = unref(currentRoute);
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();
let columns: BasicColumn[] = [], //列表配置
@ -321,6 +325,7 @@
view: handleView,
add: handleAdd,
edit: handleEdit,
startwork : handleStartwork,
delete: handleDelete,
batchdelete: handleBatchdelete,
batchSetUserId: handleBatchSetUserId,
@ -544,14 +549,20 @@
}
function handleAdd() {
const info = {
isUpdate: false,
releaseId: menuId.value,
pkField: pkField.value,
formEventConfig,
formProps,
};
formType.value === 'modal' ? openModal(true, info) : openDrawer(true, info);
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
});
} else {
const info = {
isUpdate: false,
releaseId: menuId.value,
pkField: pkField.value,
formEventConfig,
formProps,
};
formType.value === 'modal' ? openModal(true, info) : openDrawer(true, info);
}
}
function handleEdit(record: Recordable) {
@ -567,15 +578,36 @@
}
function handleView(record: Recordable) {
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);
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 = {
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) {
@ -841,78 +873,121 @@
reload();
});
function getActions(record: Recordable): ActionItem[] {
const hasStartWorkButton = buttonConfigs.value?.some((x) => x.code === 'startwork');
let actionsList: ActionItem[] = [];
let editAndDelBtn: ActionItem[] = [];
let hasFlowRecord = false;
actionButtonConfig.value?.map((button) => {
if (button.code === 'view') {
actionsList.push({
icon: button?.icon,
tooltip: button?.name,
onClick: handleView.bind(null, record),
});
}
if (['edit', 'copyData', 'delete'].includes(button.code)) {
editAndDelBtn.push({
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (button.code === 'flowRecord') hasFlowRecord = true;
});
if (record.workflowData?.enabled) {
if (!hasStartWorkButton) return actionsList;
//与工作流有关联的表单
if (record.workflowData.status) {
//如果是本人需要审批的数据 就会有taskIds 所以需要修改绑定事件
const act: ActionItem = {};
if (record.workflowData.taskIds) {
act.tooltip = t('查看流程(待审批)');
act.icon = 'daishenpi|svg';
act.onClick = handleApproveProcess.bind(null, record);
} else {
act.tooltip =
t('查看流程') +
(record.workflowData.status === 'ACTIVE' ? t('(审批中)') : t('(已完成)'));
act.icon =
record.workflowData.status === 'ACTIVE' ? 'jinshenpi|svg' : 'shenpiwancheng|svg';
act.onClick = handleViewWorkflow.bind(null, record);
}
actionsList.unshift(act);
if (hasFlowRecord) {
actionsList.splice(1, 0, {
tooltip: '查看流转记录',
icon: 'liuzhuanxinxi|svg',
onClick: handleFlowRecord.bind(null, record),
});
}
function getActions(record: Recordable):ActionItem[] {
let actionsList: ActionItem[] = [];
let editAndDelBtn: ActionItem[] = [];
let hasFlowRecord = false;
actionButtonConfig.value?.map((button) => {
if (button.code === 'view') {
actionsList.push({
icon: button?.icon,
tooltip: button?.name,
onClick: handleView.bind(null, record),
});
}
if (['edit', 'copyData', 'delete'].includes(button.code)) {
editAndDelBtn.push({
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (button.code === 'flowRecord') hasFlowRecord = true;
});
if (record.workflowData.enabled) {
//与工作流有关联的表单
if (record.workflowData.status) {
//如果是本人需要审批的数据 就会有taskIds 所以需要修改绑定事件
const act: ActionItem = {};
if (record.workflowData.taskIds) {
act.tooltip = '查看流程(待审批)';
act.icon = 'daishenpi|svg';
act.onClick = handleApproveProcess.bind(null, record);
} else {
act.tooltip =
'查看流程' + (record.workflowData.status === 'ACTIVE' ? '(审批中)' : '(已完成)');
act.icon =
record.workflowData.status === 'ACTIVE' ? 'jinshenpi|svg' : 'shenpiwancheng|svg';
act.onClick = handleStartwork.bind(null, record);
}
actionsList.unshift(act);
if (hasFlowRecord) {
actionsList.splice(1, 0, {
tooltip: '查看流转记录',
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 {
actionsList.unshift({
icon: 'faqishenpi|svg',
tooltip: record.workflowData.draftId ? t('编辑草稿') : t('发起审批'),
onClick: handleLaunchProcess.bind(null, record),
});
actionsList = actionsList.concat(editAndDelBtn);
if (!record.workflowData.processId) {
//与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
actionsList = actionsList.concat(editAndDelBtn);
}
}
} else {
if (!record.workflowData?.processId) {
//与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
actionsList = actionsList.concat(editAndDelBtn);
}
}
return actionsList;
return actionsList;
}
function handleSelect(selectIds) {
selectId.value = selectIds[0];
reload({
searchInfo: { [listConfig.value.leftMenuConfig?.listFieldName as string]: selectId.value },
});
function handleStartwork(record: Recordable) {
const { processId, schemaId } = record.workflowData;
router.push({
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() {
//如果是数据字典