70 lines
2.2 KiB
JavaScript
70 lines
2.2 KiB
JavaScript
import { getProcessNodeList } from '../api/workCenter'
|
|
import Vue from 'vue'
|
|
import { USER_INFO } from '../store/mutation-types'
|
|
|
|
export const WorkCenterMixin = {
|
|
data () {
|
|
return {
|
|
personnelInfoData: [] // 需要传给PersonnelInfo的数据
|
|
}
|
|
},
|
|
methods: {
|
|
// 查询人员信息结构数据,callback用于获取完流程才可以初始化人员信息
|
|
getPersonInfoStructure (key, callback) {
|
|
const param = {}
|
|
param.processDefinitionKey = key
|
|
if (this.$route.query.processInstanceId) {
|
|
param.processInstanceId = this.$route.query.processInstanceId
|
|
}
|
|
getProcessNodeList(param).then(res => {
|
|
if (res.success) {
|
|
console.log(res.result)
|
|
// 处理人员信息数据,判断每个节点是否能选人
|
|
this.personnelInfoData = res.result.map(item => {
|
|
return {
|
|
...item,
|
|
chooseType: item.variableType === 'string' ? 'radio' : 'checkbox'
|
|
}
|
|
})
|
|
if (!this.$route.query.processInstanceId) {
|
|
// 说明是在新发起一个节点,初始化发起人员信息
|
|
this.personnelInfoData[0].linkUserIds = Vue.ls.get(USER_INFO).id
|
|
this.personnelInfoData[0].userList = Vue.ls.get(USER_INFO).realname + '(' + Vue.ls.get(USER_INFO).username + ')'
|
|
}
|
|
if (callback) {
|
|
callback()
|
|
}
|
|
}
|
|
})
|
|
},
|
|
// 待办中进入时需要初始化人员信息数据
|
|
initPersonInfoData (isFirstNode) {
|
|
console.log('-----------isFirstNode------------', isFirstNode)
|
|
if (isFirstNode) {
|
|
// 是第一个节点,回显数据
|
|
this.personnelInfoData = this.personnelInfoData.map(item => {
|
|
return {
|
|
...item,
|
|
userList: item.linkUserIds_dictText
|
|
}
|
|
})
|
|
} else {
|
|
// 不是第一个节点,回显数据,都不可选人
|
|
this.personnelInfoData = this.personnelInfoData.map(item => {
|
|
return {
|
|
...item,
|
|
userList: item.linkUserIds_dictText,
|
|
canChoose: 0
|
|
}
|
|
})
|
|
}
|
|
},
|
|
// 操作完成返回
|
|
goBack () {
|
|
setTimeout(() => {
|
|
this.$router.go(-1)
|
|
}, 700)
|
|
}
|
|
}
|
|
}
|