将数据存入业务表单json字段,并适配后端修改
This commit is contained in:
@@ -173,10 +173,25 @@ export const saveBpmForm = (params) => {
|
|||||||
return defHttp.post({ url: '/bg/xispeak/bgXiSpeak/saveBpmForm', params }, { isTransformResponse: false });
|
return defHttp.post({ url: '/bg/xispeak/bgXiSpeak/saveBpmForm', params }, { isTransformResponse: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存部门审批信息(isEnd、部门经办人)到业务表单 approveInfo JSON
|
||||||
|
* @param params { mainId, deptId, isEnd, implWorker }
|
||||||
|
*/
|
||||||
|
export const saveSubApprove = (params) => {
|
||||||
|
return defHttp.post({ url: '/bg/xispeak/bgXiSpeak/saveSubApprove', params }, { isTransformResponse: false });
|
||||||
|
};
|
||||||
|
|
||||||
export const setProcessVariable = (params) => {
|
export const setProcessVariable = (params) => {
|
||||||
return defHttp.post({ url: '/act/process/setProcessVariable', params }, { isTransformResponse: false });
|
return defHttp.post({ url: '/act/process/setProcessVariable', params }, { isTransformResponse: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将BPM流程变量存入向上追溯2层的父级执行实例(与 AfterImplWorkerTemStoreListener 一致)
|
||||||
|
*/
|
||||||
|
export const setBpmVariableLocal = (params) => {
|
||||||
|
return defHttp.post({ url: '/act/process/setBpmVariableLocal', params }, { isTransformResponse: false });
|
||||||
|
};
|
||||||
|
|
||||||
export const updateLaunchType = (params) => {
|
export const updateLaunchType = (params) => {
|
||||||
return defHttp.post({ url: '/bg/xispeak/bgXiSpeak/edit', params }, { isTransformResponse: false });
|
return defHttp.post({ url: '/bg/xispeak/bgXiSpeak/edit', params }, { isTransformResponse: false });
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -244,7 +244,7 @@
|
|||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col v-if="showSubApproveUser" :span="12">
|
<a-col v-if="showSubApproveUserSelector" :span="12">
|
||||||
<a-form-item label="部门经办人" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
|
<a-form-item label="部门经办人" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
|
||||||
<j-select-user v-model:value="subApproveUser" :disabled="savingSubApproveUser" allow-clear />
|
<j-select-user v-model:value="subApproveUser" :disabled="savingSubApproveUser" allow-clear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -278,8 +278,7 @@
|
|||||||
bgXiSpeakFeedbackListWithDept,
|
bgXiSpeakFeedbackListWithDept,
|
||||||
bgXiSpeakFeedbackDelete,
|
bgXiSpeakFeedbackDelete,
|
||||||
saveBpmForm,
|
saveBpmForm,
|
||||||
setProcessVariable,
|
saveSubApprove,
|
||||||
updateDeptHandlerName,
|
|
||||||
} from '../BgXiSpeak.api';
|
} from '../BgXiSpeak.api';
|
||||||
import { usePermission } from '/@/hooks/web/usePermission';
|
import { usePermission } from '/@/hooks/web/usePermission';
|
||||||
import TaskHandleInnerContent from '/@/views/super/bpm/process/personalOffice/myHandleTask/content/TaskHandleInnerContent.vue';
|
import TaskHandleInnerContent from '/@/views/super/bpm/process/personalOffice/myHandleTask/content/TaskHandleInnerContent.vue';
|
||||||
@@ -469,6 +468,14 @@
|
|||||||
Object.keys(mainForm).forEach((key) => {
|
Object.keys(mainForm).forEach((key) => {
|
||||||
mainForm[key] = record[key] ?? '';
|
mainForm[key] = record[key] ?? '';
|
||||||
});
|
});
|
||||||
|
// 从 approveInfo JSON 初始化当前部门的 isEnd 和 subApproveUser
|
||||||
|
const approveInfo = record.approveInfo;
|
||||||
|
const deptId = getCurrentUserDeptId();
|
||||||
|
if (approveInfo && deptId && approveInfo[deptId]) {
|
||||||
|
const detail = approveInfo[deptId];
|
||||||
|
isEnd.value = detail.isEnd ?? 0;
|
||||||
|
subApproveUser.value = detail.implWorker ?? '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentUserDeptId() {
|
function getCurrentUserDeptId() {
|
||||||
@@ -482,6 +489,11 @@
|
|||||||
return departs.length === 1 ? departs[0]?.id || '' : '';
|
return departs.length === 1 ? departs[0]?.id || '' : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCurrentAssignee() {
|
||||||
|
const userInfo = (userStore.getUserInfo || {}) as Record<string, any>;
|
||||||
|
return userInfo.username || '';
|
||||||
|
}
|
||||||
|
|
||||||
async function loadFeedbackList() {
|
async function loadFeedbackList() {
|
||||||
const bpmProcessId = processInfo.value.processInstanceId;
|
const bpmProcessId = processInfo.value.processInstanceId;
|
||||||
if (!mainForm.id || !bpmProcessId) {
|
if (!mainForm.id || !bpmProcessId) {
|
||||||
@@ -577,11 +589,15 @@
|
|||||||
|
|
||||||
async function saveSubApproveUserVariable(options: { showSuccessMessage?: boolean } = {}) {
|
async function saveSubApproveUserVariable(options: { showSuccessMessage?: boolean } = {}) {
|
||||||
const { showSuccessMessage = true } = options;
|
const { showSuccessMessage = true } = options;
|
||||||
const processInstanceId = processInfo.value.processInstanceId;
|
|
||||||
const isEndValue = String(isEnd.value);
|
const isEndValue = String(isEnd.value);
|
||||||
const usernameValue = normalizeUsernameList(subApproveUser.value);
|
const usernameValue = normalizeUsernameList(subApproveUser.value);
|
||||||
if (!processInstanceId) {
|
const deptId = getCurrentUserDeptId();
|
||||||
createMessage.warning('流程实例ID不能为空');
|
if (!mainForm.id) {
|
||||||
|
createMessage.warning('主表ID不能为空');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!deptId) {
|
||||||
|
createMessage.warning('无法获取当前用户部门');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isEndValue !== '1' && !usernameValue) {
|
if (isEndValue !== '1' && !usernameValue) {
|
||||||
@@ -591,21 +607,21 @@
|
|||||||
|
|
||||||
savingSubApproveUser.value = true;
|
savingSubApproveUser.value = true;
|
||||||
try {
|
try {
|
||||||
const isEndResult = await saveProcessVariable('isEnd', isEndValue);
|
const params: Record<string, any> = {
|
||||||
if (!isEndResult?.success) {
|
mainId: mainForm.id,
|
||||||
createMessage.warning(isEndResult.message || '保存失败');
|
deptId,
|
||||||
return false;
|
isEnd: Number(isEndValue),
|
||||||
|
};
|
||||||
|
if (isEndValue === '1') {
|
||||||
|
params.implWorker = getCurrentAssignee();
|
||||||
|
} else {
|
||||||
|
params.implUserNameList = usernameValue.split(',').filter(Boolean);
|
||||||
}
|
}
|
||||||
|
const res = await saveSubApprove(params);
|
||||||
if (isEndValue !== '1') {
|
if (!res?.success) {
|
||||||
const subApproveUserResult = await saveProcessVariable('subApproveUser', usernameValue);
|
createMessage.warning(res?.message || '保存失败');
|
||||||
if (!subApproveUserResult?.success) {
|
|
||||||
createMessage.warning(subApproveUserResult.message || '保存失败');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 同步更新 task_task 表的 deptHandlerName,供 XiSpeakFeedbackFlow.getImplDeptWorker 使用
|
|
||||||
updateDeptHandlerName({ processInstanceId, deptHandlerName: usernameValue }).catch(() => {});
|
|
||||||
}
|
|
||||||
if (showSuccessMessage) {
|
if (showSuccessMessage) {
|
||||||
createMessage.success('保存成功');
|
createMessage.success('保存成功');
|
||||||
}
|
}
|
||||||
@@ -618,16 +634,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveProcessVariable(varField: string, varVal: any) {
|
|
||||||
return setProcessVariable({
|
|
||||||
processInstanceId: processInfo.value.processInstanceId,
|
|
||||||
taskId: processInfo.value.taskId,
|
|
||||||
local: true,
|
|
||||||
varField,
|
|
||||||
varVal,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeUsernameList(value: string) {
|
function normalizeUsernameList(value: string) {
|
||||||
return String(value || '')
|
return String(value || '')
|
||||||
.split(',')
|
.split(',')
|
||||||
|
|||||||
Reference in New Issue
Block a user