提示审批人账号禁用

This commit is contained in:
ChenXinXin committed 2024-05-14 16:42:50 +08:00
1 parent c06d8f1fff
commit 8f918fcdaa
1 file changed
+57 -17
+57 -17
View File
@@ -39,17 +39,25 @@
</v-chip>
</div>
<div class="d-flex align-center">
<template v-for="(userId, userIndex) in node.properties.userIdList">
<div class="item-user-box d-flex justify-space-between px-2 mr-2">
<span class="omit">{{ constantObj.userList.find(u => u.userId == userId)?.username || userId }}</span>
<v-icon class="ml-1" color="#a4a7aa" @click="doUiAction('deleteNodeUser', {nodeIndex ,userIndex})">mdi-close</v-icon>
<template v-for="(user, userIndex) in node.properties.userIdList">
<div :class="`item-user-box d-flex justify-space-between px-2 mr-2 ${ user.username.includes('(账号被禁用)') && 'item-user-box-error'} `">
<span class="omit">{{ user.username }}</span>
<v-icon v-if="( node.properties?.approverType == '申请人自选' || node.properties?.noticerType == '申请人自选' ) || taskData.workflowInfo.modifyAuthority == false"
class="ml-1" color="#a4a7aa" @click="doUiAction('deleteNodeUser', {nodeIndex ,userIndex})">
mdi-close
</v-icon>
</div>
<v-icon v-if="userIndex != node.properties.userIdList.length && node.properties.approvalType == '依次审批'"
<v-icon v-if="userIndex < node.properties.userIdList.length - 1 && node.properties.approvalType == '依次审批'"
class="mr-2" color="#afb1b4" small>
mdi-arrow-right-thin
</v-icon>
</template>
<template>
<template v-if=" node.properties.userIdList <= 0 && ( node.properties?.approverType != '申请人自选' && node.properties?.noticerType != '申请人自选' )">
<div class="item-user-box d-flex justify-space-between px-2 mr-2">
<span class="red--text">审批人为空</span>
</div>
</template>
<template v-if="( node.properties?.approverType == '申请人自选' || node.properties?.noticerType == '申请人自选' ) || taskData.workflowInfo.modifyAuthority == false">
<div class="abb-user d-flex justify-center align-center" @click="doUiAction('startAddNodeUser', nodeIndex)">
<v-icon color="#4caf50">mdi-plus</v-icon>
</div>
@@ -67,8 +75,8 @@
<v-row class="justify-end mx-0 my-8 px-4">
<!-- 抽屉操作按钮 -->
<div class="d-flex justify-end pr-4">
<v-btn color="success" @click="doUiAction('createTask')" small>提交</v-btn>
<v-btn class="elevation-0 ml-2" @click="isDrawerShown = false" small>取消</v-btn>
<v-btn color="success" @click="doUiAction('createTask')" small :loading="isCreateWorkLoading">提交</v-btn>
<v-btn class="elevation-0 ml-2" @click="isDrawerShown = false" small :loading="isCreateWorkLoading">取消</v-btn>
</div>
</v-row>
@@ -92,7 +100,7 @@
<v-autocomplete
class="jh-v-input mr-2"
dense filled single-line clearable
:items="constantObj.userList"
:items="curUserList"
item-text="username"
item-value="userId"
v-model="addNodeUserId">
@@ -149,7 +157,9 @@ Vue.component("create-task-drawer", {
taskSubmitData: null,
isAddNodeUserDialogShown: false,
addNodeUserIndex: -1,
addNodeUserId: null
addNodeUserId: null,
selectedUser: [],
isCreateWorkLoading: false
}
},
computed: {
@@ -158,6 +168,9 @@ Vue.component("create-task-drawer", {
},
curWorkflow(){
return this.taskData.workflowConfig.nodeList.filter(node => !['start', 'end', 'conditionTask'].includes(node.properties.type))
},
curUserList(){
return this.constantObj.userList.filter(u => !this.selectedUser.includes(u.userId))
}
},
watch: {
@@ -325,6 +338,7 @@ Vue.component("create-task-drawer", {
num = u == '直属上级' ? 1 : u[1]
userList = userList.concat(this.getDirectSupervisor([`<$ ctx.userInfo.userId $>`], num))
})
userList = userList.map(id => { return { userId: id, username: this.constantObj.userList.find(u => u.userId == id)?.username || id + '(账号被禁用)'}})
break;
case '指定部门负责人':
var num = 0
@@ -333,15 +347,18 @@ Vue.component("create-task-drawer", {
var groupId = this.constantObj.userList.find(u => u.userId == `<$ ctx.userInfo.userId $>`)?.group.find(g => g.isMainGroup == '是')?.groupId
userList = userList.concat(this.getHeadId(groupId, num))
})
userList = userList.map(id => { return { userId: id, username: this.constantObj.userList.find(u => u.userId == id)?.username || id + '(账号被禁用)'}})
break;
case '指定标签':
node.properties.user.forEach(u =>{
let userIdList = this.constantObj.labelList.find(l => l.labelId == u)?.user.split(',')
if(userIdList && userIdList.length > 0) userList = userList.concat(userIdList)
})
userList = userList.map(id => { return { userId: id, username: this.constantObj.userList.find(u => u.userId == id)?.username || id + '(账号被禁用)'}})
break;
case '指定人员':
userList = node.properties.user
userList = userList.map(id => { return { userId: id, username: this.constantObj.userList.find(u => u.userId == id)?.username || id + '(账号被禁用)'}})
break;
case '申请人自选':
@@ -514,12 +531,16 @@ Vue.component("create-task-drawer", {
startAddNodeUser(nodeIndex){
this.addNodeUserIndex = nodeIndex
this.selectedUser = this.curWorkflow[nodeIndex].properties.userIdList.map(u => u.userId)
this.isAddNodeUserDialogShown = true
},
addNodeUser(){
if(!this.addNodeUserId) return window.vtoast.fail('保存用户失败!')
this.curWorkflow[this.addNodeUserIndex].properties.userIdList.push(this.addNodeUserId)
this.curWorkflow[this.addNodeUserIndex].properties.userIdList.push({
userId: this.addNodeUserId,
username: this.constantObj.userList.find(u => u.userId == this.addNodeUserId)?.username || id + '(账号被禁用)'
})
window.vtoast.success('保存用户成功!')
},
@@ -544,8 +565,12 @@ Vue.component("create-task-drawer", {
if(!n.properties.userIdList.length){
window.vtoast.fail("存在节点没有设置人员!")
throw new Error("存在节点没有设置人员!")
}else{
if(_.some(n.properties.userIdList, (user) => user.username.includes('(账号被禁用)'))){
window.vtoast.fail("存在节点中账号被禁用,请联系管理员修改!")
throw new Error("存在节点中账号被禁用,请联系管理员修改!")
}
}
})
this.taskData.workflowForm.forEach(f => {
if(f.type == 'time' && !this.isValidDateTime(f.answer)){
@@ -569,20 +594,27 @@ Vue.component("create-task-drawer", {
},
prepareDoWorkItem() {
console.log();
const { workflowInfo, workflowForm, workflowConfig, workflowName, taskTemplateGroup, } = this.taskData
var curNode = this.curWorkflow[0]
var taskLineType = this.taskData.workflowConfig.lineList.filter(line => line.sourceNodeId == curNode.id)[0]?.properties.type
var startNode = this.curWorkflow[0]
workflowConfig.nodeList.forEach(node => {
if(node.properties.userIdList){
node.properties.userIdList = node.properties.userIdList.map(u => u.userId)
}
})
var taskLineType = workflowConfig.lineList.filter(line => line.sourceNodeId == startNode.id)[0]?.properties.type
var taskViewUserList = this.curWorkflow.reduce((acc, cur) => acc.concat(cur.properties.userIdList), [] )
this.taskSubmitData = {
taskTitle: `<$ ctx.userInfo.username $>` + '的' + workflowName,
taskStatus: 'running',
taskInfo: JSON.stringify(workflowInfo),
taskFormInput: JSON.stringify(workflowForm),
taskDefaultForm: JSON.stringify(this.defaultWorkflowForm),
taskWorkflow: JSON.stringify(workflowConfig),
taskDefaultWorkflow: JSON.stringify(this.defaultWorkflowConfig),
taskConfigId: curNode.id,
taskConfigId: startNode.id,
taskLineType: taskLineType,
taskEditUserList: curNode.properties.userIdList.join(','),
taskEditUserList: startNode.properties.userIdList.join(','),
taskViewUserList: _.uniq(taskViewUserList).join(','),
taskCreateAt: dayjs().format('YYYY-MM-DD HH:mm:ss'),
taskInitUser: `<$ ctx.userInfo.userId $>`,
@@ -591,6 +623,7 @@ Vue.component("create-task-drawer", {
},
async doCreateWork() {
this.isCreateWorkLoading = true
await window.jhMask.show();
await window.jianghuAxios({
data: {
@@ -609,6 +642,7 @@ Vue.component("create-task-drawer", {
})
await window.jhMask.hide();
await window.vtoast.success("申请成功");
this.isCreateWorkLoading = false
},
// -- <<<<<<<<<<<<< 新建任务 --------------------
}
@@ -621,6 +655,7 @@ Vue.component("create-task-drawer", {
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
}
.node-box {
@@ -643,13 +678,18 @@ Vue.component("create-task-drawer", {
}
.node-box .node-box-item .item-user-box {
width: 84px;
min-width: 60px;
height: 40px;
line-height: 40px;
background-color: rgb(242 243 243);
border-radius: 2px;
}
.item-user-box-error{
background-color: rgb(231, 75, 75) !important;
color: white;
}
.node-box-item .abb-user {
height: 40px;
width: 40px;