修改发起流程弹窗界面与bgpartymatter保持一致

This commit is contained in:
wsm
2026-05-14 11:38:07 +08:00
parent c1d5d239ba
commit d1bc4f2b78
+59 -35
View File
@@ -127,6 +127,7 @@
getChildList,
getChildListBatch,
updateLaunchType,
saveOrUpdateDict,
bgXiSpeakFeedbackList,
} from './BgXiSpeak.api';
@@ -491,10 +492,47 @@
return dropDownAction;
}
function splitDeptValue(value) {
if (Array.isArray(value)) {
return value.map((item) => String(item || '').trim()).filter(Boolean);
}
return String(value || '')
.split(/[,\uFF0C]/)
.map((item) => item.trim())
.filter(Boolean);
}
function getImplDeptOptions(record) {
const deptIds = splitDeptValue(record?.implDept);
const deptNames = splitDeptValue(record?.implDept_dictText);
return deptIds.map((deptId, index) => ({
value: deptId,
label: deptNames[index] || deptId,
}));
}
function getLeadDeptOptions(record) {
const deptIds = splitDeptValue(record?.leadDepartment);
const deptNames = splitDeptValue(record?.leadDepartment_dictText);
return deptIds.map((deptId, index) => ({
value: deptId,
label: deptNames[index] || deptId,
}));
}
function getNextSuperviseCount(value) {
const count = Number(value || 0);
return Number.isFinite(count) ? count + 1 : 1;
}
function handleProcess(record) {
flowScheduleModalRef.value?.open({
title: '发起督办计划收集流程',
payload: { record },
deptOptions: getLeadDeptOptions(record),
showSuoleaderFields: true,
isNeedAppro: record?.needSdwApproval,
supDeptleaderid: record?.sdwLeaderList,
});
}
@@ -502,6 +540,10 @@
flowScheduleModalRef.value?.open({
title: '发起落实部门经办人执行反馈流程',
payload: { record, flowCode: FLOW_CODE_JBR },
deptOptions: getImplDeptOptions(record),
showSuoleaderFields: true,
isNeedAppro: record?.needSdwApproval,
supDeptleaderid: record?.sdwLeaderList,
});
}
@@ -520,46 +562,32 @@
return value ? dateUtil(value).format(format) : undefined;
};
// triggerType: 1=立即发起, 2=重复发起; launchType: 0=收集后直接发起, 1=收集后周期性发起
const launchType = options.triggerType === 2 ? 1 : 0;
// 先保存 launchType 到主表
if (flowCode === FLOW_CODE) {
await updateLaunchType({ id: record.id, launchType });
}
// 合并选中的DW领导列表到record中
const recordWithSdwLeader = {
const nextSuperviseCount = getNextSuperviseCount(record.supervisionCount);
const flowJsonData = {
...record,
sdwLeaderList: queryParam.value.sdwLeaderList || '',
needSdwApproval: queryParam.value.needSdwApproval || '',
isNeedAppro: options.isNeedAppro ?? record.needSdwApproval ?? '',
supDeptleaderid: options.supDeptleaderid ?? record.sdwLeaderList ?? '',
supervisionCount: nextSuperviseCount,
};
// 如果是经办人执行反馈流程,需要遍历每个部门单独发起
if (flowCode === FLOW_CODE_JBR) {
let approveInfo = {};
if (record.approveInfo) {
try {
approveInfo = typeof record.approveInfo === 'string' ? JSON.parse(record.approveInfo) : record.approveInfo;
} catch (e) {
createMessage.error('审批信息解析失败');
return;
}
}
const deptKeys = Object.keys(approveInfo);
if (deptKeys.length === 0) {
createMessage.warning('没有可用的部门审批信息');
const selectedDeptIds = options.deptIds || [];
if (selectedDeptIds.length === 0) {
createMessage.warning('请选择落实部门');
return;
}
let successCount = 0;
const total = deptKeys.length;
for (const deptId of deptKeys) {
const deptApproveDetail = approveInfo[deptId];
const implUserIdList = deptApproveDetail.implUserIdList || [];
const implUserNameList = deptApproveDetail.implUserNameList || [];
const total = selectedDeptIds.length;
for (const deptId of selectedDeptIds) {
const params = {
intervalType: options.intervalType,
startCount: options.startCount,
@@ -570,21 +598,16 @@
formUrl: FORM_URL,
flowName: '落实部门经办人执行反馈流程',
jsonData: {
...recordWithSdwLeader,
...flowJsonData,
currentDeptId: deptId,
currentApproverId: deptApproveDetail.approverId,
currentApproverName: deptApproveDetail.approverName,
implUserIdList: implUserIdList.join(','),
implUserNameList: implUserNameList.join(','),
},
businessTablename: BUSINESS_TABLE_NAME,
businessId: record.id,
deptHandlerName: deptApproveDetail.implUserNameList.join(','),
title: record.speakStatus,
content: record.implStatus,
urgencyLevel: record.completionStatus,
deptId: deptId,
deptLeaderId: deptApproveDetail.approverId,
deptLeaderId: deptId,
requireFinishDate: formatDate(record.time, 'YYYY-MM-DD'),
deadline: formatDate(record.time, 'YYYY-MM-DD HH:mm:ss'),
},
@@ -594,6 +617,7 @@
await startProcessSchedules(params);
successCount++;
if (successCount === total) {
await saveOrUpdateDict({ id: record.id, bpmStatus: '2', supervisionCount: nextSuperviseCount }, true);
createMessage.success(`成功发起 ${total} 个经办人执行反馈流程`);
reload();
}
@@ -604,7 +628,6 @@
return;
}
// 原有的督办计划收集流程逻辑
const params = {
intervalType: options.intervalType,
startCount: options.startCount,
@@ -614,13 +637,13 @@
flowCode: flowCode,
formUrl: FORM_URL,
flowName: FLOW_NAME,
jsonData: recordWithSdwLeader,
jsonData: flowJsonData,
businessTablename: BUSINESS_TABLE_NAME,
businessId: record.id,
title: record.speakStatus,
content: record.implStatus,
urgencyLevel: record.completionStatus,
deptId: record.leadDepartment,
deptId: options.deptId || record.leadDepartment,
deptLeaderId: record.responsiblePerson,
requireFinishDate: formatDate(record.time, 'YYYY-MM-DD'),
deadline: formatDate(record.time, 'YYYY-MM-DD HH:mm:ss'),
@@ -628,6 +651,7 @@
};
await startProcessSchedules(params);
await saveOrUpdateDict({ id: record.id, bpmStatus: '2', supervisionCount: nextSuperviseCount }, true);
createMessage.success('发起成功');
reload();
}