Commit 15ac0e30 authored by xioln's avatar xioln

任务详情处理

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