diff --git a/src/components/SecondDev/OpinionDialog.vue b/src/components/SecondDev/OpinionDialog.vue
index 1ea4027..80a71a4 100644
--- a/src/components/SecondDev/OpinionDialog.vue
+++ b/src/components/SecondDev/OpinionDialog.vue
@@ -5,14 +5,17 @@
确定
-
+
- {{ formState.nextNodeName }}
-
-
-
- {{ getAssigneeText() }}
+ {{ getNextNodesName() }}
+
+
+
+ {{ getAssigneeText(node) }}
+
+
+
{{ item.activityName }}
@@ -35,34 +38,33 @@
const isOpen = ref(false);
const rejectNodeList = ref([]);
const rejectNodeId = ref('');
- const nextAssigneeName = ref(''); // 不可选审批人
- const nextAssignees = ref([]);
const loading = ref(false);
const isEnd = ref(false);
- const chooseAssign = ref(true);
let _action = ref('agree');
let _processId = '';
let _taskId = '';
- let _nextNodes = [];
+ let flowNextNodes = ref([]);
let _callback = null;
let _onCancel = null;
const formState = reactive({
- nextNodeName: '',
opinion: '',
- assignees: [],
opinionList: ['同意。', '请领导审批。']
});
- function getAssigneeText() {
+ function getAssigneeText(node) {
// 注意这里用的是下拉框的数据结构 所以字段是value和label
- return (nextAssignees.value || [])
- .filter((item) => formState.assignees.includes(item.value))
+ return (node.nextAssignees || [])
+ .filter((item) => node.assignees.includes(item.value))
.map((item) => item.label)
.join('、');
}
+ function getNextNodesName() {
+ return flowNextNodes.value.length > 1 ? '多个并行节点' : flowNextNodes.value[0].activityName;
+ }
+
function toggleDialog({ isClose, action, callback, rejectCancel, processId, taskId, nextNodes } = {}) {
if (isClose) {
isOpen.value = false;
@@ -75,17 +77,20 @@
_onCancel = rejectCancel;
_processId = processId;
_taskId = taskId;
- _nextNodes = nextNodes;
+ flowNextNodes.value = nextNodes;
formState.opinion = '';
dialogTitle.value = `审批`;
- if (nextNodes && nextNodes.length === 1) {
+ if (nextNodes && nextNodes.length) {
// 下一个节点唯一时(可能有并行节点)
const nNode = nextNodes[0];
- formState.nextNodeName = nNode.activityName;
+ //formState.nextNodeName = nNode.activityName;
isEnd.value = nNode.isEnd;
- if (nNode.userList?.length) {
+ nextNodes.forEach((nNode) => {
+ if (!nNode.userList?.length) {
+ return;
+ }
const selected = [];
- nextAssignees.value = nNode.userList.map((item) => {
+ nNode.nextAssignees = nNode.userList.map((item) => {
if (item.checked || nNode.userList.length === 1) {
// 只有一个人的时候必须选他
selected.push(item['F_UserId']);
@@ -95,13 +100,14 @@
label: item['F_RealName']
};
});
- formState.assignees = selected;
+ nNode.assignees = selected;
if (!nNode.chooseAssign) {
// 不需要选审批人的时候 所有备选人都要放到下个节点
- formState.assignees = nNode.userList.map((item) => item['F_UserId']);
+ nNode.assignees = nNode.userList.map((item) => item['F_UserId']);
}
- }
- chooseAssign.value = nNode.chooseAssign;
+ nNode.chooseAssign = nNode.chooseAssign;
+ });
+ flowNextNodes.value = nextNodes;
}
if (action === 'reject') {
loadRejectNodeList();
@@ -116,13 +122,14 @@
}
function onClickOK() {
- if (!isEnd.value && _action.value === 'agree' && !formState.assignees.length) {
+ const isEmpty = flowNextNodes.value.find((node) => !node.assignees?.length);
+ if (!isEnd.value && _action.value === 'agree' && isEmpty) {
return message.error('请选择审批人');
}
const nextTaskUser = {};
- if (_nextNodes && _nextNodes.length === 1) {
- nextTaskUser[_nextNodes[0].activityId] = isEnd.value ? '' : formState.assignees.join(',');
- }
+ flowNextNodes.value.forEach((nNode) => {
+ nextTaskUser[nNode.activityId] = isEnd.value ? '' : nNode.assignees.join(',');
+ });
if (_callback && typeof _callback === 'function') {
loading.value = true;
_callback({