流程退回可选审批人
流程图显示更多流程信息(节点审批人/当前审批节点) 流程配置过滤不存在的元素的配置 支持子流程多实例的审批(传参isEnd)
This commit is contained in:
@ -24,6 +24,16 @@
|
|||||||
<a-select-option v-for="(item, index) in rejectNodeList" :key="index" :value="item.activityId">{{ item.activityName }}</a-select-option>
|
<a-select-option v-for="(item, index) in rejectNodeList" :key="index" :value="item.activityId">{{ item.activityName }}</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<template v-for="node in rejectNodeList">
|
||||||
|
<a-form-item v-if="_action === 'reject'&&rejectNodeId===node.activityId" label="审批人">
|
||||||
|
<a-select v-show="node.chooseAssign" v-model:value="node.assignees" :options="node.nextAssignees"
|
||||||
|
:placeholder="'请选择' + node.activityName + '的审批人'" max-tag-count="responsive" mode="multiple"
|
||||||
|
:filterOption="search"
|
||||||
|
></a-select>
|
||||||
|
<span v-show="!node.chooseAssign">{{ getAssigneeText(node) }}</span>
|
||||||
|
</a-form-item>
|
||||||
|
</template>
|
||||||
|
|
||||||
<a-form-item label="审批意见" name="opinion">
|
<a-form-item label="审批意见" name="opinion">
|
||||||
<a-textarea v-model:value="formState.opinion" :maxlength="200" :rows="3" placeholder="请输入审批意见,不超过200字" />
|
<a-textarea v-model:value="formState.opinion" :maxlength="200" :rows="3" placeholder="请输入审批意见,不超过200字" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@ -123,9 +133,36 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadRejectNodeList() {
|
async function loadRejectNodeList() {
|
||||||
|
rejectNodeId.value='';
|
||||||
let res = await getRejectNodeList(_processId, _taskId);
|
let res = await getRejectNodeList(_processId, _taskId);
|
||||||
if (res && Array.isArray(res) && res.length > 0) {
|
if (res && Array.isArray(res) && res.length > 0) {
|
||||||
rejectNodeList.value = res;
|
rejectNodeList.value = res;
|
||||||
|
dialogTitle.value = `退回`;
|
||||||
|
if (res?.length) {
|
||||||
|
res.forEach((nNode) => {
|
||||||
|
if (!nNode.userList?.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const selected = [];
|
||||||
|
nNode.nextAssignees = nNode.userList.map((item) => {
|
||||||
|
if (item.checked || nNode.userList.length === 1) {
|
||||||
|
// 只有一个人的时候必须选他
|
||||||
|
selected.push(item['F_UserId']);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
value: item['F_UserId'],
|
||||||
|
label: item['F_RealName']+(item.remarks?"("+item.remarks+")":""),
|
||||||
|
item:item
|
||||||
|
};
|
||||||
|
});
|
||||||
|
nNode.assignees = selected;
|
||||||
|
if (!nNode.chooseAssign) {
|
||||||
|
// 不需要选审批人的时候 所有备选人都要放到下个节点
|
||||||
|
nNode.assignees = nNode.userList.map((item) => item['F_UserId']);
|
||||||
|
}
|
||||||
|
nNode.chooseAssign = nNode.chooseAssign;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,12 +177,24 @@
|
|||||||
nextTaskUser[nNode.activityId] = isEnd.value ? '' : nNode.assignees.join(',');
|
nextTaskUser[nNode.activityId] = isEnd.value ? '' : nNode.assignees.join(',');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (_action.value === 'reject') {
|
||||||
|
const isChoose = rejectNodeList.value.find((node) => node.activityId==rejectNodeId.value&&node.assignees?.length);
|
||||||
|
if (!isChoose) {
|
||||||
|
return message.error('请选择审批人');
|
||||||
|
}
|
||||||
|
rejectNodeList.value.forEach((nNode) => {
|
||||||
|
if(nNode.activityId==rejectNodeId.value){
|
||||||
|
nextTaskUser[nNode.activityId] = isEnd.value ? '' : nNode.assignees.join(',');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
if (_callback && typeof _callback === 'function') {
|
if (_callback && typeof _callback === 'function') {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
_callback({
|
_callback({
|
||||||
opinion: formState.opinion,
|
opinion: formState.opinion,
|
||||||
rejectNodeId: rejectNodeId.value,
|
rejectNodeId: rejectNodeId.value,
|
||||||
nextTaskUser
|
nextTaskUser,
|
||||||
|
isEnd
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
isOpen.value = false;
|
isOpen.value = false;
|
||||||
|
|||||||
@ -51,6 +51,8 @@ export interface FormInfoItem {
|
|||||||
}
|
}
|
||||||
export interface FlowInfo {
|
export interface FlowInfo {
|
||||||
currentTaskAssigneeNames: string;
|
currentTaskAssigneeNames: string;
|
||||||
|
currentTaskAssignees:{};
|
||||||
|
taskInfo:{};
|
||||||
isCountersign: boolean;
|
isCountersign: boolean;
|
||||||
isAddOrSubSign: boolean;
|
isAddOrSubSign: boolean;
|
||||||
schemaInfo: {
|
schemaInfo: {
|
||||||
@ -98,7 +100,9 @@ export interface TaskApproveOpinion {
|
|||||||
}
|
}
|
||||||
export interface BpmnFlowForm {
|
export interface BpmnFlowForm {
|
||||||
// schemaId: string;
|
// schemaId: string;
|
||||||
currentTaskAssignee: string;
|
currentTaskAssigneeNames:string;
|
||||||
|
currentTaskAssignees: any;
|
||||||
|
currentTaskInfo:any;
|
||||||
item: BpmnFlowFormItem;
|
item: BpmnFlowFormItem;
|
||||||
xml: string;
|
xml: string;
|
||||||
formInfos: Array<FormInfoItem>;
|
formInfos: Array<FormInfoItem>;
|
||||||
|
|||||||
@ -52,7 +52,10 @@
|
|||||||
<opinion-dialog ref="opinionDlg" />
|
<opinion-dialog ref="opinionDlg" />
|
||||||
<transfer-dialog ref="transferDlg" />
|
<transfer-dialog ref="transferDlg" />
|
||||||
<a-modal :closable="false" :visible="showFlowChart" centered class="geg" title="流程图" width="1200px" @cancel="closeFlowChart">
|
<a-modal :closable="false" :visible="showFlowChart" centered class="geg" title="流程图" width="1200px" @cancel="closeFlowChart">
|
||||||
<process-information :process-id="processId" :xml="data.xml" :currentTaskAssignee="data.currentTaskAssignee"/>
|
<process-information :process-id="processId" :xml="data.xml"
|
||||||
|
:currentTaskInfo="data.currentTaskInfo"
|
||||||
|
:currentTaskAssigneeNames="data.currentTaskAssigneeNames"
|
||||||
|
:currentTaskAssignees="data.currentTaskAssignees"/>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<a-button type="primary" @click="closeFlowChart">关闭</a-button>
|
<a-button type="primary" @click="closeFlowChart">关闭</a-button>
|
||||||
</template>
|
</template>
|
||||||
@ -112,6 +115,7 @@
|
|||||||
let approvalData = reactive({
|
let approvalData = reactive({
|
||||||
isCountersign: false,
|
isCountersign: false,
|
||||||
isAddOrSubSign: false,
|
isAddOrSubSign: false,
|
||||||
|
isEnd: false,
|
||||||
stampInfo: {
|
stampInfo: {
|
||||||
stampId: '',
|
stampId: '',
|
||||||
password: ''
|
password: ''
|
||||||
@ -198,6 +202,7 @@
|
|||||||
callback: (args) => {
|
callback: (args) => {
|
||||||
approvalData.approvedContent = args.opinion;
|
approvalData.approvedContent = args.opinion;
|
||||||
approvalData.nextTaskUser = args.nextTaskUser;
|
approvalData.nextTaskUser = args.nextTaskUser;
|
||||||
|
approvalData.isEnd=args.isEnd;
|
||||||
onFinish('approve');
|
onFinish('approve');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -408,6 +413,7 @@
|
|||||||
/*stampId: values.stampId,
|
/*stampId: values.stampId,
|
||||||
stampPassword: values.password,*/
|
stampPassword: values.password,*/
|
||||||
isOldSystem: system,
|
isOldSystem: system,
|
||||||
|
isEnd:approvalData.isEnd,
|
||||||
nextTaskUser: approvalData.nextTaskUser
|
nextTaskUser: approvalData.nextTaskUser
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -482,6 +482,11 @@
|
|||||||
const rootElementsJson = bpmnModeler.getDefinitions().rootElements;
|
const rootElementsJson = bpmnModeler.getDefinitions().rootElements;
|
||||||
const rootElementsFlowElementsArr = rootElementsJson[0].flowElements;
|
const rootElementsFlowElementsArr = rootElementsJson[0].flowElements;
|
||||||
|
|
||||||
|
//过滤不存在元素的配置
|
||||||
|
const exitsElements=bpmnModeler.get('elementRegistry').getAll();
|
||||||
|
const exitsElementIds=exitsElements.map(x=>x.id);
|
||||||
|
json.childNodeConfig=json.childNodeConfig.filter(x=>exitsElementIds.indexOf(x.id)>-1);
|
||||||
|
|
||||||
if (validateProcessConfig(rootElementsFlowElementsArr, json)) {
|
if (validateProcessConfig(rootElementsFlowElementsArr, json)) {
|
||||||
try {
|
try {
|
||||||
const { svg } = await bpmnModeler.saveSVG({ format: true });
|
const { svg } = await bpmnModeler.saveSVG({ format: true });
|
||||||
|
|||||||
@ -1,6 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="margin:20px;">
|
<div style="margin:20px;">
|
||||||
当前流程审批人:{{currentTaskAssignee.replaceAll(",","、")}}
|
当前流程审批人:{{currentTaskAssigneeNames.replaceAll(",","、")}}
|
||||||
|
</div>
|
||||||
|
<div style="margin:20px;">
|
||||||
|
节点审批人:
|
||||||
|
<div v-for="(assignees,taskKey) in currentTaskAssignees" :key="taskKey">
|
||||||
|
<span>{{assignees[0].taskName}}{{currentTaskInfo?.taskDefinitionKey==taskKey?'(当前审批节点)':''}}:</span>
|
||||||
|
<span v-for="(assignee,index) in assignees" :key="index">
|
||||||
|
{{assignee.assigneeNameStr?(assignee.assigneeNameStr?.replaceAll(",","/") + (index<assignees.length-1?'、':'')):('')}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 流程信息 -->
|
<!-- 流程信息 -->
|
||||||
<div class="flow-record-box">
|
<div class="flow-record-box">
|
||||||
@ -21,12 +30,16 @@
|
|||||||
defineProps<{
|
defineProps<{
|
||||||
xml: string;
|
xml: string;
|
||||||
processId: string;
|
processId: string;
|
||||||
currentTaskAssignee: string;
|
currentTaskAssignees: any;
|
||||||
|
currentTaskAssigneeNames: string;
|
||||||
|
currentTaskInfo:any;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
xml: '',
|
xml: '',
|
||||||
processId: '',
|
processId: '',
|
||||||
currentTaskAssignee:'无'
|
currentTaskAssigneeNames:'无',
|
||||||
|
currentTaskAssignees: {},
|
||||||
|
currentTaskInfo:{}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const bpmnCanvas = ref();
|
const bpmnCanvas = ref();
|
||||||
|
|||||||
@ -31,7 +31,9 @@ export default function () {
|
|||||||
hasStampPassword: false,
|
hasStampPassword: false,
|
||||||
submitLoading: false,
|
submitLoading: false,
|
||||||
formAssignmentData: null,
|
formAssignmentData: null,
|
||||||
currentTaskAssignee: '',
|
currentTaskAssigneeNames: '',
|
||||||
|
currentTaskAssignees:{},
|
||||||
|
currentTaskInfo:{}
|
||||||
});
|
});
|
||||||
function initProcessData(res: FlowInfo) {
|
function initProcessData(res: FlowInfo) {
|
||||||
data.item.id = res.schemaInfo.id;
|
data.item.id = res.schemaInfo.id;
|
||||||
@ -45,10 +47,12 @@ export default function () {
|
|||||||
data.hasStamp = false;
|
data.hasStamp = false;
|
||||||
data.hasStampPassword = false;
|
data.hasStampPassword = false;
|
||||||
data.submitLoading = false;
|
data.submitLoading = false;
|
||||||
data.currentTaskAssignee = '无';
|
data.currentTaskAssigneeNames = '无';
|
||||||
if (res.currentTaskAssigneeNames) {
|
if (res.currentTaskAssigneeNames) {
|
||||||
data.currentTaskAssignee = res.currentTaskAssigneeNames;
|
data.currentTaskAssigneeNames = res.currentTaskAssigneeNames;
|
||||||
}
|
}
|
||||||
|
data.currentTaskAssignees=res.currentTaskAssignees;
|
||||||
|
data.currentTaskInfo=res.taskInfo;
|
||||||
data.xml = '';
|
data.xml = '';
|
||||||
if (res.schemaInfo.xmlContent) {
|
if (res.schemaInfo.xmlContent) {
|
||||||
data.xml = res.schemaInfo.xmlContent;
|
data.xml = res.schemaInfo.xmlContent;
|
||||||
|
|||||||
Reference in New Issue
Block a user