yxk-20260611-自动生成审批意见
部门负责人接受任务并分配节点自动生成审批意见
This commit is contained in:
@@ -216,7 +216,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onMounted, reactive, ref, watch } from 'vue';
|
import { computed, onMounted, reactive, ref, watch } from 'vue';
|
||||||
import { defHttp } from '/@/utils/http/axios';
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
import { queryDepartTreeSync } from '/@/api/common/api';
|
import { getUserList, queryDepartTreeSync } from '/@/api/common/api';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import JSelectDept from '/@/components/Form/src/jeecg/components/JSelectDept.vue';
|
import JSelectDept from '/@/components/Form/src/jeecg/components/JSelectDept.vue';
|
||||||
import Icon from '/@/components/Icon/index';
|
import Icon from '/@/components/Icon/index';
|
||||||
@@ -269,6 +269,8 @@
|
|||||||
});
|
});
|
||||||
const deptResolveVersion = ref(0);
|
const deptResolveVersion = ref(0);
|
||||||
const subApproveUser = ref('');
|
const subApproveUser = ref('');
|
||||||
|
const subApproveUserNameText = ref('');
|
||||||
|
const userResolveVersion = ref(0);
|
||||||
const isEnd = ref(0);
|
const isEnd = ref(0);
|
||||||
const lastGeneratedNumber = ref('');
|
const lastGeneratedNumber = ref('');
|
||||||
|
|
||||||
@@ -347,6 +349,7 @@
|
|||||||
}));
|
}));
|
||||||
const handleReasonTemplateMap: Record<string, () => string> = {
|
const handleReasonTemplateMap: Record<string, () => string> = {
|
||||||
Task_137y5vq: buildLeaderDeptReason,
|
Task_137y5vq: buildLeaderDeptReason,
|
||||||
|
Task_0d4iflp: buildDeptLeaderAssignReason,
|
||||||
};
|
};
|
||||||
const defaultHandleReason = computed(() => {
|
const defaultHandleReason = computed(() => {
|
||||||
const builder = handleReasonTemplateMap[String(processInfo.value.taskDefKey || '')];
|
const builder = handleReasonTemplateMap[String(processInfo.value.taskDefKey || '')];
|
||||||
@@ -370,6 +373,14 @@
|
|||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
subApproveUser,
|
||||||
|
(value) => {
|
||||||
|
resolveSubApproveUserName(value);
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
// 根据会议时间和议题序号自动生成业务序号,例如:2026-05-20 + 2 => 20260520-2。
|
// 根据会议时间和议题序号自动生成业务序号,例如:2026-05-20 + 2 => 20260520-2。
|
||||||
watch(
|
watch(
|
||||||
() => [mainForm.matterTime, mainForm.itemNumber],
|
() => [mainForm.matterTime, mainForm.itemNumber],
|
||||||
@@ -484,6 +495,14 @@
|
|||||||
return assistDeptName ? `请${responDeptName}牵头办理,请${assistDeptName}协办;` : `请${responDeptName}牵头办理;`;
|
return assistDeptName ? `请${responDeptName}牵头办理,请${assistDeptName}协办;` : `请${responDeptName}牵头办理;`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function buildDeptLeaderAssignReason() {
|
||||||
|
if (String(isEnd.value) === '1') {
|
||||||
|
return '已反馈完成情况,请确认。';
|
||||||
|
}
|
||||||
|
const userNameText = normalizeDeptNames(subApproveUserNameText.value || subApproveUser.value);
|
||||||
|
return userNameText ? `请${userNameText}办理。` : '';
|
||||||
|
}
|
||||||
|
|
||||||
function normalizeDeptNames(value: any) {
|
function normalizeDeptNames(value: any) {
|
||||||
return splitDeptNames(value).join('、');
|
return splitDeptNames(value).join('、');
|
||||||
}
|
}
|
||||||
@@ -527,6 +546,44 @@
|
|||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function resolveSubApproveUserName(value: any) {
|
||||||
|
const resolveVersion = ++userResolveVersion.value;
|
||||||
|
const usernames = normalizeUsernameList(value);
|
||||||
|
if (!usernames) {
|
||||||
|
subApproveUserNameText.value = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// JSelectUser 的 v-model 存 username,办理意见展示需要尽量翻译为真实姓名。
|
||||||
|
subApproveUserNameText.value = normalizeDeptNames(usernames);
|
||||||
|
try {
|
||||||
|
const res = await getUserList({ username: usernames, isMultiTranslate: 'true', pageNo: 1, pageSize: 999 });
|
||||||
|
if (resolveVersion !== userResolveVersion.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const records = res?.records || res?.result?.records || res || [];
|
||||||
|
const userNameMap = Array.isArray(records)
|
||||||
|
? records.reduce((cache: Record<string, string>, item: any) => {
|
||||||
|
const username = String(item?.username || '').trim();
|
||||||
|
const realname = String(item?.realname || item?.name || '').trim();
|
||||||
|
if (username && realname) {
|
||||||
|
cache[username] = realname;
|
||||||
|
}
|
||||||
|
return cache;
|
||||||
|
}, {})
|
||||||
|
: {};
|
||||||
|
const names = usernames
|
||||||
|
.split(',')
|
||||||
|
.map((username) => userNameMap[username] || username)
|
||||||
|
.filter(Boolean);
|
||||||
|
subApproveUserNameText.value = normalizeDeptNames(names.join(','));
|
||||||
|
} catch {
|
||||||
|
if (resolveVersion === userResolveVersion.value) {
|
||||||
|
subApproveUserNameText.value = normalizeDeptNames(usernames);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function syncGeneratedNumber() {
|
function syncGeneratedNumber() {
|
||||||
const generatedNumber = buildGeneratedNumber(mainForm.matterTime, mainForm.itemNumber);
|
const generatedNumber = buildGeneratedNumber(mainForm.matterTime, mainForm.itemNumber);
|
||||||
if (generatedNumber) {
|
if (generatedNumber) {
|
||||||
|
|||||||
Reference in New Issue
Block a user