修改发起流程弹窗界面与bgpartymatter保持一致
This commit is contained in:
@@ -127,6 +127,7 @@
|
|||||||
getChildList,
|
getChildList,
|
||||||
getChildListBatch,
|
getChildListBatch,
|
||||||
updateLaunchType,
|
updateLaunchType,
|
||||||
|
saveOrUpdateDict,
|
||||||
bgXiSpeakFeedbackList,
|
bgXiSpeakFeedbackList,
|
||||||
} from './BgXiSpeak.api';
|
} from './BgXiSpeak.api';
|
||||||
|
|
||||||
@@ -491,10 +492,47 @@
|
|||||||
return dropDownAction;
|
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) {
|
function handleProcess(record) {
|
||||||
flowScheduleModalRef.value?.open({
|
flowScheduleModalRef.value?.open({
|
||||||
title: '发起督办计划收集流程',
|
title: '发起督办计划收集流程',
|
||||||
payload: { record },
|
payload: { record },
|
||||||
|
deptOptions: getLeadDeptOptions(record),
|
||||||
|
showSuoleaderFields: true,
|
||||||
|
isNeedAppro: record?.needSdwApproval,
|
||||||
|
supDeptleaderid: record?.sdwLeaderList,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -502,6 +540,10 @@
|
|||||||
flowScheduleModalRef.value?.open({
|
flowScheduleModalRef.value?.open({
|
||||||
title: '发起落实部门经办人执行反馈流程',
|
title: '发起落实部门经办人执行反馈流程',
|
||||||
payload: { record, flowCode: FLOW_CODE_JBR },
|
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;
|
return value ? dateUtil(value).format(format) : undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
// triggerType: 1=立即发起, 2=重复发起; launchType: 0=收集后直接发起, 1=收集后周期性发起
|
|
||||||
const launchType = options.triggerType === 2 ? 1 : 0;
|
const launchType = options.triggerType === 2 ? 1 : 0;
|
||||||
|
|
||||||
// 先保存 launchType 到主表
|
|
||||||
if (flowCode === FLOW_CODE) {
|
if (flowCode === FLOW_CODE) {
|
||||||
await updateLaunchType({ id: record.id, launchType });
|
await updateLaunchType({ id: record.id, launchType });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 合并选中的DW领导列表到record中
|
const nextSuperviseCount = getNextSuperviseCount(record.supervisionCount);
|
||||||
const recordWithSdwLeader = {
|
|
||||||
|
const flowJsonData = {
|
||||||
...record,
|
...record,
|
||||||
sdwLeaderList: queryParam.value.sdwLeaderList || '',
|
isNeedAppro: options.isNeedAppro ?? record.needSdwApproval ?? '',
|
||||||
needSdwApproval: queryParam.value.needSdwApproval || '',
|
supDeptleaderid: options.supDeptleaderid ?? record.sdwLeaderList ?? '',
|
||||||
|
supervisionCount: nextSuperviseCount,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 如果是经办人执行反馈流程,需要遍历每个部门单独发起
|
|
||||||
if (flowCode === FLOW_CODE_JBR) {
|
if (flowCode === FLOW_CODE_JBR) {
|
||||||
let approveInfo = {};
|
const selectedDeptIds = options.deptIds || [];
|
||||||
if (record.approveInfo) {
|
if (selectedDeptIds.length === 0) {
|
||||||
try {
|
createMessage.warning('请选择落实部门');
|
||||||
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('没有可用的部门审批信息');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let successCount = 0;
|
let successCount = 0;
|
||||||
const total = deptKeys.length;
|
const total = selectedDeptIds.length;
|
||||||
|
|
||||||
for (const deptId of deptKeys) {
|
|
||||||
const deptApproveDetail = approveInfo[deptId];
|
|
||||||
const implUserIdList = deptApproveDetail.implUserIdList || [];
|
|
||||||
const implUserNameList = deptApproveDetail.implUserNameList || [];
|
|
||||||
|
|
||||||
|
for (const deptId of selectedDeptIds) {
|
||||||
const params = {
|
const params = {
|
||||||
intervalType: options.intervalType,
|
intervalType: options.intervalType,
|
||||||
startCount: options.startCount,
|
startCount: options.startCount,
|
||||||
@@ -570,21 +598,16 @@
|
|||||||
formUrl: FORM_URL,
|
formUrl: FORM_URL,
|
||||||
flowName: '落实部门经办人执行反馈流程',
|
flowName: '落实部门经办人执行反馈流程',
|
||||||
jsonData: {
|
jsonData: {
|
||||||
...recordWithSdwLeader,
|
...flowJsonData,
|
||||||
currentDeptId: deptId,
|
currentDeptId: deptId,
|
||||||
currentApproverId: deptApproveDetail.approverId,
|
|
||||||
currentApproverName: deptApproveDetail.approverName,
|
|
||||||
implUserIdList: implUserIdList.join(','),
|
|
||||||
implUserNameList: implUserNameList.join(','),
|
|
||||||
},
|
},
|
||||||
businessTablename: BUSINESS_TABLE_NAME,
|
businessTablename: BUSINESS_TABLE_NAME,
|
||||||
businessId: record.id,
|
businessId: record.id,
|
||||||
deptHandlerName: deptApproveDetail.implUserNameList.join(','),
|
|
||||||
title: record.speakStatus,
|
title: record.speakStatus,
|
||||||
content: record.implStatus,
|
content: record.implStatus,
|
||||||
urgencyLevel: record.completionStatus,
|
urgencyLevel: record.completionStatus,
|
||||||
deptId: deptId,
|
deptId: deptId,
|
||||||
deptLeaderId: deptApproveDetail.approverId,
|
deptLeaderId: deptId,
|
||||||
requireFinishDate: formatDate(record.time, 'YYYY-MM-DD'),
|
requireFinishDate: formatDate(record.time, 'YYYY-MM-DD'),
|
||||||
deadline: formatDate(record.time, 'YYYY-MM-DD HH:mm:ss'),
|
deadline: formatDate(record.time, 'YYYY-MM-DD HH:mm:ss'),
|
||||||
},
|
},
|
||||||
@@ -594,6 +617,7 @@
|
|||||||
await startProcessSchedules(params);
|
await startProcessSchedules(params);
|
||||||
successCount++;
|
successCount++;
|
||||||
if (successCount === total) {
|
if (successCount === total) {
|
||||||
|
await saveOrUpdateDict({ id: record.id, bpmStatus: '2', supervisionCount: nextSuperviseCount }, true);
|
||||||
createMessage.success(`成功发起 ${total} 个经办人执行反馈流程`);
|
createMessage.success(`成功发起 ${total} 个经办人执行反馈流程`);
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
@@ -604,7 +628,6 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 原有的督办计划收集流程逻辑
|
|
||||||
const params = {
|
const params = {
|
||||||
intervalType: options.intervalType,
|
intervalType: options.intervalType,
|
||||||
startCount: options.startCount,
|
startCount: options.startCount,
|
||||||
@@ -614,13 +637,13 @@
|
|||||||
flowCode: flowCode,
|
flowCode: flowCode,
|
||||||
formUrl: FORM_URL,
|
formUrl: FORM_URL,
|
||||||
flowName: FLOW_NAME,
|
flowName: FLOW_NAME,
|
||||||
jsonData: recordWithSdwLeader,
|
jsonData: flowJsonData,
|
||||||
businessTablename: BUSINESS_TABLE_NAME,
|
businessTablename: BUSINESS_TABLE_NAME,
|
||||||
businessId: record.id,
|
businessId: record.id,
|
||||||
title: record.speakStatus,
|
title: record.speakStatus,
|
||||||
content: record.implStatus,
|
content: record.implStatus,
|
||||||
urgencyLevel: record.completionStatus,
|
urgencyLevel: record.completionStatus,
|
||||||
deptId: record.leadDepartment,
|
deptId: options.deptId || record.leadDepartment,
|
||||||
deptLeaderId: record.responsiblePerson,
|
deptLeaderId: record.responsiblePerson,
|
||||||
requireFinishDate: formatDate(record.time, 'YYYY-MM-DD'),
|
requireFinishDate: formatDate(record.time, 'YYYY-MM-DD'),
|
||||||
deadline: formatDate(record.time, 'YYYY-MM-DD HH:mm:ss'),
|
deadline: formatDate(record.time, 'YYYY-MM-DD HH:mm:ss'),
|
||||||
@@ -628,6 +651,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
await startProcessSchedules(params);
|
await startProcessSchedules(params);
|
||||||
|
await saveOrUpdateDict({ id: record.id, bpmStatus: '2', supervisionCount: nextSuperviseCount }, true);
|
||||||
createMessage.success('发起成功');
|
createMessage.success('发起成功');
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user