Commit 15ac0e30 authored by xioln's avatar xioln

任务详情处理

parent 8aeea739
...@@ -844,3 +844,8 @@ export function getInstTaskHisTory(instId, page, size) { ...@@ -844,3 +844,8 @@ export function getInstTaskHisTory(instId, page, size) {
}) })
} }
} }
// 获取流程实例详情-PBO信息
export function getInstancePbo(params) {
return get(`/workflow/inst/${params}/bizPBO`)
}
<template> <template>
<div class="form"> <div class="form">
<van-form <van-form v-model="form" ref="form" :rules="rules">
v-model="form"
ref="form"
v-on="$listeners"
:rules="rules"
@submit="onSubmit"
>
<template v-if="formData.length"> <template v-if="formData.length">
<div <div v-for="(item, index) in formData" :key="index">
v-for="(item, index) in formData" <div v-if="item.title" class="van-cell van-field sub-title">
:key="index"
>
<div
v-if="item.title"
class="van-cell van-field sub-title"
>
{{ item.title }} {{ item.title }}
</div> </div>
<!-- <div v-if="item?.component && item?.component?.name === 'vanTitle'" class="sub-title">{{item?.component.label}}</div> --> <!-- <div v-if="item?.component && item?.component?.name === 'vanTitle'" class="sub-title">{{item?.component.label}}</div> -->
<template v-if="item.data && item.data.length"> <template v-if="item.data && item.data.length">
<div <div v-for="(formItem, itemIndex) in item.data" :key="itemIndex">
v-for="(formItem, itemIndex) in item.data"
:key="itemIndex"
>
<van-field <van-field
v-if=" v-if="
formItem.component && formItem.component.name === 'custom' formItem.component && formItem.component.name === 'custom'
...@@ -47,7 +32,6 @@ ...@@ -47,7 +32,6 @@
:name="formItem.key || ''" :name="formItem.key || ''"
:label="formItem.title || ''" :label="formItem.title || ''"
:rules="rules" :rules="rules"
v-on="$listeners"
@handleSubmit="handleSubmit" @handleSubmit="handleSubmit"
/> />
</div> </div>
...@@ -79,26 +63,26 @@ export default { ...@@ -79,26 +63,26 @@ export default {
}, },
components: {}, components: {},
// 数据源 给组件分发数据用 // 数据源 给组件分发数据用
data() { data () {
return {} return {}
}, },
created() { created () {
}, },
mounted() { }, mounted () { },
watch: { watch: {
formData: { formData: {
deep: true, deep: true,
immediate: true, immediate: true,
handler(oldVal, newVal) { handler (oldVal, newVal) {
this.init() this.init()
} }
} }
}, },
methods: { methods: {
handleSubmit(params) { handleSubmit (params) {
this.$emit('handleSubmit', params) this.$emit('handleSubmit', params)
}, },
init() { init () {
if (this.formData.length) { if (this.formData.length) {
// 获取表单 // 获取表单
let formItemData = [] let formItemData = []
...@@ -161,15 +145,12 @@ export default { ...@@ -161,15 +145,12 @@ export default {
} }
}, },
// 表单校验 // 表单校验
validate() { validate () {
return this.$refs.form.validate() return this.$refs.form.validate()
}, },
// 提交表单 // 提交表单
submit() { submit () {
this.$refs.form.submit() this.$refs.form.submit()
},
onSubmit(values) {
console.log('submit', values)
} }
} }
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
:placeholder="itemObj.placeholder" :placeholder="itemObj.placeholder"
@click="inputClick" @click="inputClick"
> >
<template v-if="multichoice" #input> <template #input>
<van-tag <van-tag
v-for="item in tags" v-for="item in tags"
:key="item.value" :key="item.value"
...@@ -25,22 +25,9 @@ ...@@ -25,22 +25,9 @@
{{ item.label }} {{ item.label }}
</van-tag> </van-tag>
</template> </template>
<template v-else #input>
<van-tag
v-if="tags.label"
style="margin: 2px"
closeable
size="mini"
plain
type="primary"
@close="close(tags)"
>
{{tags.label}}
</van-tag>
</template>
</van-field> </van-field>
</div> </div>
<van-popup v-model="showPicker" position="bottom"> <van-popup v-model="showPicker" closeable position="bottom">
<van-dropdown-menu active-color="#1989fa" v-if="teamData"> <van-dropdown-menu active-color="#1989fa" v-if="teamData">
<van-dropdown-item <van-dropdown-item
v-model="switchRole" v-model="switchRole"
...@@ -57,22 +44,22 @@ ...@@ -57,22 +44,22 @@
ref="vanSearch" ref="vanSearch"
v-if="itemObj.filterable" v-if="itemObj.filterable"
v-model="searchVal" v-model="searchVal"
placeholder="请输入关键词"
@input="onSearch" @input="onSearch"
/> />
<div class="van-picker__toolbar"> <!-- <div class="van-picker__toolbar">
<button type="button" class="van-picker__cancel" @click="cancel"> <button type="button" class="van-picker__cancel" @click="cancel">
取消 取消
</button> </button>
<button type="button" class="van-picker__confirm" @click="onConfirm"> <button type="button" class="van-picker__confirm" @click="cancel">
确认 确认
</button> </button>
</div> </div> -->
<div class="checkbox-con" style="height: 264px; overflow-y: auto"> <div class="checkbox-con" style="height: 264px; overflow-y: auto">
<van-checkbox-group v-if="multichoice" v-model="checkboxValue" @change="change"> <van-checkbox-group v-model="checkboxValue">
<van-cell-group> <van-cell-group>
<van-cell <van-cell
v-for="(item, index) in itemObj.options" v-for="(item, index) in options"
clickable
:key="item.value" :key="item.value"
:title="item.label" :title="item.label"
@click="toggle(index)" @click="toggle(index)"
...@@ -83,29 +70,12 @@ ...@@ -83,29 +70,12 @@
</van-cell> </van-cell>
</van-cell-group> </van-cell-group>
</van-checkbox-group> </van-checkbox-group>
<van-radio-group v-else v-model="radioValue" @change="change">
<van-cell-group>
<van-cell
v-for="(item, index) in itemObj.options"
clickable
:key="item.value"
:title="item.label"
@click="toggle(index)"
>
<template #right-icon>
<van-radio :name="item" ref="checkboxes" />
</template>
</van-cell>
</van-cell-group>
</van-radio-group>
</div> </div>
</van-popup> </van-popup>
</template> </template>
</div> </div>
</template> </template>
<script> <script>
import { Notify } from 'vant'
export default { export default {
props: { props: {
itemObj: { itemObj: {
...@@ -136,15 +106,13 @@ export default { ...@@ -136,15 +106,13 @@ export default {
showPicker: false, showPicker: false,
searchVal: '', searchVal: '',
checkboxValue: [], checkboxValue: [],
radioValue: {},
options: null,
// tags: [], // tags: [],
teamData: false, teamData: false,
switchRole: 0, switchRole: 0,
switchTeam: false, switchTeam: false,
roleOption: [], roleOption: [],
teamOption: [], teamOption: [],
timer: null tempCheckedList: []
} }
}, },
created () { created () {
...@@ -158,8 +126,8 @@ export default { ...@@ -158,8 +126,8 @@ export default {
}, },
watch: { watch: {
tags: { tags: {
handler(newVal, oldVal) { handler (newVal, oldVal) {
this.$emit('inputChange', newVal) this.$store.state.user.participant[this.name] = newVal.map(user => user.value)
}, },
deep: true deep: true
} }
...@@ -167,79 +135,39 @@ export default { ...@@ -167,79 +135,39 @@ export default {
computed: { computed: {
tags: { tags: {
get () { get () {
if (this.multichoice) { return this.checkboxValue
return this.unique(this.checkboxValue)
}
return this.radioValue
} }
}, },
multichoice() { multichoice () {
return this.label.includes('会签') return this.label.includes('会签')
},
options () {
return this.itemObj.options
} }
}, },
methods: { methods: {
cancel () {
this.showPicker = false
},
onConfirm (value) {
this.showPicker = false
},
onSearch (val) { onSearch (val) {
this.itemObj.remoteMethod(val) this.itemObj.remoteMethod(val)
this.searchVal = val this.searchVal = val
if (this.timer) {
return
}
this.timer = setTimeout(() => {
if (this.teamData) {
this.teamSearch()
}
this.timer = null
}, 1000)
}, },
inputClick (Event) { inputClick (Event) {
this.showPicker = true this.showPicker = true
}, },
// 多选触发选择 checkboxChange (item) {
change (val) { // this.$bus.$emit('participantBus', item, this.name)
// this.tags = this.unique(this.checkboxValue)
}, },
// 多选选中切换事件 // 多选选中切换事件
toggle (index) { toggle (index) {
if (this.multichoice) { if (this.multichoice) {
this.$refs.checkboxes[index].toggle() this.$refs.checkboxes[index].toggle()
} else {
const checkData = this.$refs.checkboxes[index]
this.checkboxValue = checkData.checked ? [] : [checkData.name] // 实现单选效果
} }
}, },
// 标签删除 // 标签删除
close (val) { close (val) {
if (this.multichoice) {
this.checkboxValue = this.checkboxValue.filter((x) => x.value !== val.value) this.checkboxValue = this.checkboxValue.filter((x) => x.value !== val.value)
} else {
this.radioValue = {}
}
},
packageOptionsData (res) {
const arr = []
// eslint-disable-next-line no-unused-vars
for (const item of res) {
arr.push({
label: item.fullName + '(' + item.name + ')',
value: item.id
})
}
return arr
},
unique (arr) {
for (var i = 0; i < arr.length; i++) {
for (var j = i + 1; j < arr.length; j++) {
if (arr[i].value === arr[j].value) { // 第一个等同于第二个,splice方法删除第二个
Notify({ type: 'warning', message: '该用户已选择' })
arr.splice(j, 1)
j--
}
}
}
return arr
} }
} }
} }
...@@ -253,5 +181,8 @@ export default { ...@@ -253,5 +181,8 @@ export default {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
.van-popup {
padding-top: 40px;
}
} }
</style> </style>
...@@ -6,7 +6,8 @@ import router, { resetRouter } from '../../router' ...@@ -6,7 +6,8 @@ import router, { resetRouter } from '../../router'
const state = { const state = {
token: getToken(), token: getToken(),
urlBaseApi: 'Windchill' urlBaseApi: 'Windchill',
participant: {}
} }
const mutations = { const mutations = {
SET_TOKEN: (state, token) => { SET_TOKEN: (state, token) => {
......
<template> <template>
<div class='dee-FlowDxDocumentAttrsEdit'> <div class="dee-FlowDxDocumentAttrsEdit">
<dee-form <dee-form
ref="taskForm" ref="taskForm"
:form="form" :form="form"
...@@ -14,6 +14,16 @@ ...@@ -14,6 +14,16 @@
import DeeForm from '@/components/form/form' import DeeForm from '@/components/form/form'
export default { export default {
props: {
basicData: {
type: Object,
require: true
},
flowData: {
type: Object,
require: true
}
},
components: { components: {
DeeForm DeeForm
}, },
...@@ -25,17 +35,17 @@ export default { ...@@ -25,17 +35,17 @@ export default {
data: [ data: [
{ {
title: '是否归档', title: '是否归档',
key: 'radio', key: 'whetherArchive',
component: { component: {
name: 'el-radio', name: 'el-radio',
disabled: false, disabled: false,
options: [ options: [
{ {
value: '1', value: 'true',
label: '是' label: '是'
}, },
{ {
value: '0', value: 'false',
label: '否' label: '否'
} }
] ]
...@@ -45,28 +55,44 @@ export default { ...@@ -45,28 +55,44 @@ export default {
} }
], ],
rules: { rules: {
radio: [{ required: true, message: '请选择', trigger: 'blur' }] whetherArchive: [{ required: true, message: '请选择!', trigger: 'blur' }]
}, },
selectRadio: null selectRadio: null
} }
}, },
created() { created () { },
mounted () { },
},
mounted() {
},
methods: { methods: {
checkData(val, name) { checkData (val, name) {
this.$set(this, 'selectRadio', val) this.$set(this, 'selectRadio', val)
this.$emit('selectRadio', val) this.$emit('selectRadio', val)
},
validate () {
return new Promise((resolve, reject) => {
this.$refs.taskForm.$refs.form.validate().then(() => {
const form = { ...this.flowData, ...this.form, operator: 'MODIFY' }
this.$api
.recursion('DxDocument', form)
.then((res) => {
if (res) {
resolve(true)
}
})
.catch(() => {
resolve(false)
})
}).catch(() => {
this.$utils.showMessage('请选择是否归档!', 'warning')
resolve(false)
})
})
} }
} }
} }
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
.dee-FlowDxDocumentAttrsEdit{ .dee-FlowDxDocumentAttrsEdit {
margin: 0 10px; margin: 0 10px;
.custom-image .van-empty__image { .custom-image .van-empty__image {
width: 90px; width: 90px;
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<div class="set-ParticiPant"> <div class="set-ParticiPant">
<van-loading v-if="showLoading" type="spinner" size="24px" vertical /> <van-loading v-if="showLoading" type="spinner" size="24px" vertical />
<dee-form <dee-form
v-if="taskParticipationData[0].data.length > 0"
ref="form" ref="form"
:split="3" :split="3"
label-width="140px" label-width="140px"
...@@ -39,7 +38,7 @@ export default { ...@@ -39,7 +38,7 @@ export default {
}, },
components: { DeeForm }, components: { DeeForm },
name: 'GetParticipant', name: 'GetParticipant',
data() { data () {
return { return {
taskParticipationData: [ taskParticipationData: [
{ {
...@@ -59,24 +58,21 @@ export default { ...@@ -59,24 +58,21 @@ export default {
showLoading: true showLoading: true
} }
}, },
computed: {}, computed: {
},
watch: { watch: {
selectRoute: { selectRoute: {
handler(val) { handler (val) {
this.getParticipant() this.getParticipant()
}, },
immediate: true, immediate: true,
deep: true deep: true
},
form: {
handler(val) {
this.$emit('getSelectUsers', val)
},
deep: true
} }
}, },
mounted () {
},
methods: { methods: {
getUser(item, index, query) { getUser (item, index, query) {
if (item.scope === 'ALL') { if (item.scope === 'ALL') {
this.remoteMethod(index, query) this.remoteMethod(index, query)
} else if (item.scope === 'PBO_CONTEXT_TEAM') { } else if (item.scope === 'PBO_CONTEXT_TEAM') {
...@@ -102,7 +98,7 @@ export default { ...@@ -102,7 +98,7 @@ export default {
} }
} }
}, },
async getParticipant() { async getParticipant () {
const params = { const params = {
procDefId: this.$route.query.procDefId, procDefId: this.$route.query.procDefId,
procInstId: this.$route.query.procInstId, procInstId: this.$route.query.procInstId,
...@@ -146,7 +142,7 @@ export default { ...@@ -146,7 +142,7 @@ export default {
} }
}) })
}, },
remoteMethod(index, query) { remoteMethod (index, query) {
// const params = { // const params = {
// userAccount: (query || '').trim() // userAccount: (query || '').trim()
// } // }
...@@ -190,7 +186,7 @@ export default { ...@@ -190,7 +186,7 @@ export default {
} }
}) })
}, },
remoteSameIndependentOrgMethod(index, query, includeChildOrg) { remoteSameIndependentOrgMethod (index, query, includeChildOrg) {
findInUserSameIndependentOrg(includeChildOrg, (query || '').trim()) findInUserSameIndependentOrg(includeChildOrg, (query || '').trim())
.then(res => { .then(res => {
if (Array.isArray(res.items)) { if (Array.isArray(res.items)) {
...@@ -214,7 +210,7 @@ export default { ...@@ -214,7 +210,7 @@ export default {
} }
}) })
}, },
filterData(index, userNameList) { filterData (index, userNameList) {
const arr = this.taskParticipationData[0].data[index].component.options || [] const arr = this.taskParticipationData[0].data[index].component.options || []
arr.length && arr.forEach(user => { arr.length && arr.forEach(user => {
const isInclud = userNameList.find((item, index) => { const isInclud = userNameList.find((item, index) => {
...@@ -235,7 +231,7 @@ export default { ...@@ -235,7 +231,7 @@ export default {
this.$set(this.taskParticipationData[0].data[index].component, 'options', arr) this.$set(this.taskParticipationData[0].data[index].component, 'options', arr)
}, },
// 获取上下文角色下的用户 // 获取上下文角色下的用户
getContextUser(index, query, item) { getContextUser (index, query, item) {
if (this.basicData && this.basicData.businessObject && this.basicData.businessObject.dxContextId) { if (this.basicData && this.basicData.businessObject && this.basicData.businessObject.dxContextId) {
const params = { const params = {
contextId: this.basicData.businessObject.dxContextId, contextId: this.basicData.businessObject.dxContextId,
...@@ -249,7 +245,7 @@ export default { ...@@ -249,7 +245,7 @@ export default {
} }
}, },
// 获取pbo属性下的用户 // 获取pbo属性下的用户
getPboVariableUser(index, query, item) { getPboVariableUser (index, query, item) {
if (this.basicData && this.basicData.instanceData) { if (this.basicData && this.basicData.instanceData) {
const params = { const params = {
proceInstId: this.basicData.instanceData.id, proceInstId: this.basicData.instanceData.id,
...@@ -263,7 +259,7 @@ export default { ...@@ -263,7 +259,7 @@ export default {
} }
}, },
// 获取群组下的用户 // 获取群组下的用户
getGroupUser(index, group) { getGroupUser (index, group) {
this.userListOptions = [] this.userListOptions = []
const params = { const params = {
pageFrom: 1, pageFrom: 1,
...@@ -307,7 +303,7 @@ export default { ...@@ -307,7 +303,7 @@ export default {
}) })
}, },
// 获取组织下的用户 // 获取组织下的用户
getOrgUser(index, org, item) { getOrgUser (index, org, item) {
this.userListOptions = [] this.userListOptions = []
const includeCurrentUser = item.includeCurrentUser const includeCurrentUser = item.includeCurrentUser
// 是否包含子组织 // 是否包含子组织
...@@ -333,7 +329,7 @@ export default { ...@@ -333,7 +329,7 @@ export default {
}) })
}, },
// 用户所在的独立组织下的所有用户,以及该独立组织下自组织下的所有用户 // 用户所在的独立组织下的所有用户,以及该独立组织下自组织下的所有用户
getUserOptions(index, item) { getUserOptions (index, item) {
getUserOrganizations({ userId: localStorage.getItem('userId') }).then(res => { getUserOrganizations({ userId: localStorage.getItem('userId') }).then(res => {
if (res.items && res.items.length) { if (res.items && res.items.length) {
const org = res.items.map(r => r.id) const org = res.items.map(r => r.id)
...@@ -341,13 +337,13 @@ export default { ...@@ -341,13 +337,13 @@ export default {
} }
}) })
}, },
getSelectedSameIndependentOrgUsers(index, item) { getSelectedSameIndependentOrgUsers (index, item) {
const userIds = this.form[item.routerVariableName] const userIds = this.form[item.routerVariableName]
if (Array.isArray(userIds) && userIds.length > 0) { if (Array.isArray(userIds) && userIds.length > 0) {
this.getUserByIds(userIds, item, index) this.getUserByIds(userIds, item, index)
} }
}, },
getUserByIds(userIds, item, index) { getUserByIds (userIds, item, index) {
const params = { const params = {
indices: [ indices: [
'USERS' 'USERS'
...@@ -398,7 +394,7 @@ export default { ...@@ -398,7 +394,7 @@ export default {
}) })
}) })
}, },
packageOptionsData(res, flag) { packageOptionsData (res, flag) {
const arr1 = [] const arr1 = []
for (const item of res) { for (const item of res) {
const obj = {} const obj = {}
...@@ -408,15 +404,15 @@ export default { ...@@ -408,15 +404,15 @@ export default {
} }
return arr1 return arr1
}, },
getArrDifference(arr1, arr2) { getArrDifference (arr1, arr2) {
return arr1.concat(arr2).filter(function(v, i, arr) { return arr1.concat(arr2).filter(function (v, i, arr) {
return arr.indexOf(v) === arr.lastIndexOf(v) return arr.indexOf(v) === arr.lastIndexOf(v)
}) })
}, },
validate() { validate () {
return this.$refs.form.validate() return this.$refs.form.validate()
}, },
getTextWidth(str) { getTextWidth (str) {
let width = 0 let width = 0
const html = document.createElement('span') const html = document.createElement('span')
html.innerText = str html.innerText = str
...@@ -426,7 +422,7 @@ export default { ...@@ -426,7 +422,7 @@ export default {
document.querySelector('.getTextWidth').remove() document.querySelector('.getTextWidth').remove()
return width return width
}, },
uniq(array) { uniq (array) {
var temp = [] var temp = []
var l = array.length var l = array.length
for (var i = 0; i < l; i++) { for (var i = 0; i < l; i++) {
...@@ -441,7 +437,7 @@ export default { ...@@ -441,7 +437,7 @@ export default {
return temp return temp
}, },
// 获取当前用户所在组织 // 获取当前用户所在组织
getCurrentUserOrgIds() { getCurrentUserOrgIds () {
let currUserOrgIds = null let currUserOrgIds = null
try { try {
currUserOrgIds = [[localStorage.getItem('org')]] currUserOrgIds = [[localStorage.getItem('org')]]
...@@ -451,7 +447,7 @@ export default { ...@@ -451,7 +447,7 @@ export default {
return currUserOrgIds return currUserOrgIds
}, },
// 回显的人员不在下拉列表中则移除该人 // 回显的人员不在下拉列表中则移除该人
removeNoneUser(options, index) { removeNoneUser (options, index) {
const usersId = [] const usersId = []
let removeIds = [] let removeIds = []
const formItemKey = this.taskParticipationData[0].data[index].key const formItemKey = this.taskParticipationData[0].data[index].key
...@@ -467,17 +463,6 @@ export default { ...@@ -467,17 +463,6 @@ export default {
if (removeIds.length > 0) { if (removeIds.length > 0) {
this.$set(this.form, formItemKey, usersId.filter(id => !removeIds.includes(id))) this.$set(this.form, formItemKey, usersId.filter(id => !removeIds.includes(id)))
} }
},
inputChange(users) {
console.log('inputChange', users)
if (!users) return
if (Array.isArray(users)) {
users.forEach(user => {
this.$set(this.form, user.label, [user.value])
})
return
}
this.$set(this.form, users.label, [users.value])
} }
} }
} }
...@@ -486,6 +471,10 @@ export default { ...@@ -486,6 +471,10 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.set-ParticiPant { .set-ParticiPant {
margin: 0 10px; margin: 0 10px;
height: 100%;
.van-loading {
margin-top: 30%;
}
.custom-image .van-empty__image { .custom-image .van-empty__image {
width: 90px; width: 90px;
height: 90px; height: 90px;
......
...@@ -13,26 +13,18 @@ ...@@ -13,26 +13,18 @@
['已办任务', '我发起的任务'].includes($route.query.taskType) && ['已办任务', '我发起的任务'].includes($route.query.taskType) &&
item.title !== '签署文档' item.title !== '签署文档'
? 'form-onlyRead' ? 'form-onlyRead'
: '', : ''
]" ]"
:is="item.key" :is="item.key"
:ref=" :ref="item.key"
item.key === 'taskDetailHandle' ? 'taskDetailHandle' : item.key :flowData="form"
"
:flowData="taskDetailFlowData"
:flowType="flowType" :flowType="flowType"
:basic-data="basicData" :basic-data="basicData"
:selectRoute="selectRoute" :selectRoute="selectRoute"
@transmit="transmit" @transmit="transmit"
@modifyTop="modifyTop" @modifyTop="modifyTop"
@selectRoute="function (v) { @selectRoute="getSelectRoute"
selectRoute = v; @getSelectUsers="getParticipants"
}
"
@getSelectUsers="function (v) {
participants = v;
}
"
/> />
</van-tab> </van-tab>
</van-tabs> </van-tabs>
...@@ -58,7 +50,7 @@ import TaskBtn from './components/taskBtn/index.vue' ...@@ -58,7 +50,7 @@ import TaskBtn from './components/taskBtn/index.vue'
import { Notify } from 'vant' import { Notify } from 'vant'
import { import {
completeTask, completeTask,
getBizForm, getInstancePbo,
getTaskDetail, getTaskDetail,
getParticipant getParticipant
} from '@/api/taskDetail' } from '@/api/taskDetail'
...@@ -77,7 +69,7 @@ export default { ...@@ -77,7 +69,7 @@ export default {
TaskHistory, TaskHistory,
TaskBtn TaskBtn
}, },
data() { data () {
return { return {
basicData: {}, basicData: {},
documentId: '', documentId: '',
...@@ -90,39 +82,51 @@ export default { ...@@ -90,39 +82,51 @@ export default {
formTask: {}, formTask: {},
active: '', active: '',
selectRoute: null, selectRoute: null,
participants: {} form: {}
} }
}, },
created() { created () {
this.initData() this.initData()
}, },
mounted() {}, mounted () { },
computed: { computed: {
id() { id () {
return this.$route.query.id || '' return this.$route.query.id || ''
}, },
tabs() { tabs () {
const tabs = this.$store.state.tabs.tabs const tabs = this.$store.state.tabs.tabs
return tabs.filter((item) => this.dynamicComponents.includes(item.key)) return tabs.filter((item) => this.dynamicComponents.includes(item.key))
// return tabs // return tabs
},
participant: {
get () {
return this.$store.state.user.participant
}
} }
}, },
watch: { watch: {
'$route.query.time': (val) => { '$route.query.time': (val) => {
if (val !== moment().valueOf()) this.$forceUpdate() if (val !== moment().valueOf()) this.$forceUpdate()
}, },
configKey(v) { configKey (v) {
this.configKey = v this.configKey = v
}, },
active(v) {} active (v) { }
}, },
methods: { methods: {
onClickLeft() { getSelectRoute (v) {
this.$set(this, 'selectRoute', v)
},
getParticipants (v) {
this.$set(this, 'participants', v)
},
onClickLeft () {
history.back(-1) history.back(-1)
}, },
goHome() {}, goHome () { },
async initData() { async initData () {
this.componentsShow = true this.componentsShow = true
this.getForm()
await getTaskDetail(this.$route.query.id).then((res) => { await getTaskDetail(this.$route.query.id).then((res) => {
this.$set(this, 'basicData', res.items) this.$set(this, 'basicData', res.items)
res.items.formInfo && res.items.formInfo &&
...@@ -145,23 +149,61 @@ export default { ...@@ -145,23 +149,61 @@ export default {
}) })
this.registerComponent() this.registerComponent()
}, },
modifyTop(val) { getForm () {
getInstancePbo(this.$route.query.procInstId).then((res) => {
this.$set(this, 'form', res.items)
})
},
modifyTop (val) {
this.$set(this.formTask, 'modifyTop', val) this.$set(this.formTask, 'modifyTop', val)
}, },
transmit(data) { transmit (data) {
// data.data 存在时赋值 修改子ECN赋值 // data.data 存在时赋值 修改子ECN赋值
data.data && (this.formDatas = data.data) data.data && (this.formDatas = data.data)
this.datatype = data this.datatype = data
}, },
registerComponent() { registerComponent () {
this.dynamicComponents.forEach((x, i) => { this.dynamicComponents.forEach((x, i) => {
Vue.component(x, (resolve) => { Vue.component(x, (resolve) => {
require([`./components/${x}/index.vue`], resolve) require([`./components/${x}/index.vue`], resolve)
}) })
}) })
}, },
finishTask() { finishTask () {
this.$nextTick(() => {}) const validateArray = []
let vlot = false
this.dynamicComponents.forEach(item => {
const refCom = this.$refs[item]
this.basicData.formInfo.forEach(x => {
if (x.configName.includes(item) && x.comType === 'privateComponent' && (!refCom || !refCom[0])) {
vlot = true
}
})
if (!refCom || !refCom[0] || vlot) return
const vm = refCom[0]
if ('validate' in vm) {
validateArray.push(vm.validate())
}
})
if (vlot) {
this.$utils.showMessage('请填写必填项', 'warning')
return
}
if (this.dynamicComponents.includes('GetParticipant') && !this.participants) {
this.$utils.showMessage('请设置参与者', 'warning')
return
}
Promise.all(validateArray).then(asd => {
// this.completeTask()
})
},
completeTask () {
const participants = { ...this.participant }
Object.keys(participants).forEach(key => {
if (participants[key].length === 0) {
delete participants[key]
}
})
const taskDetailHandleFrom = this.$refs.taskDetailHandle[0].form const taskDetailHandleFrom = this.$refs.taskDetailHandle[0].form
const vote = [] const vote = []
let desc = '' let desc = ''
...@@ -174,7 +216,7 @@ export default { ...@@ -174,7 +216,7 @@ export default {
id: this.basicData.id, id: this.basicData.id,
operationName: 'completeTask', operationName: 'completeTask',
operator: this.basicData.assignee, operator: this.basicData.assignee,
participants: this.participants, participants: this.participant,
processDefinitionId: this.basicData.processDefinitionId, processDefinitionId: this.basicData.processDefinitionId,
processInstId: this.basicData.processInstanceId, processInstId: this.basicData.processInstanceId,
routerSelect: taskDetailHandleFrom.radio, routerSelect: taskDetailHandleFrom.radio,
...@@ -202,7 +244,7 @@ export default { ...@@ -202,7 +244,7 @@ export default {
} }
}) })
}) })
.catch((e) => {}) .catch((e) => { })
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment