|
|
@@ -1,13 +1,13 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-form ref="flowForm" :model="formData" :rules="rules" label-width="100px">
|
|
|
-
|
|
|
- <el-form-item v-if="actionVisible" label="处理动作" prop="actionId">
|
|
|
- <el-radio-group v-if="flowData.curActivityIns" v-model="actionId">
|
|
|
- <el-radio v-for="(item, index) in flowData.curActivityIns.actionList" :key="index" :label="item.actionId">{{ item.actionTitle }}</el-radio>
|
|
|
+ <el-form ref="flowForm" :model="formData" :rules="rules" label-width="130px">
|
|
|
+ <el-form-item v-if="actionVisible" label="处理动作" prop="actionDefId">
|
|
|
+ <el-radio-group v-if="flowData.actionDefList" v-model="actionDefId">
|
|
|
+ <el-radio v-for="(item, index) in flowData.actionDefList" :key="index" :label="item.actionDefId" @change="changeAction(item)">{{ item.actionTitle }}</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
- <el-form-item v-if="remarkVisible" label="处理说明" prop="actionRemark">
|
|
|
+
|
|
|
+ <el-form-item v-if="remarkVisible" label="处理意见" prop="actionRemark">
|
|
|
<el-input v-model="formData.actionRemark" type="textarea" :rows="5" placeholder="说明" />
|
|
|
</el-form-item>
|
|
|
|
|
|
@@ -22,7 +22,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { startWorkflow, getWorkflowById, handleWorkflow } from '@/api/system/wfApi'
|
|
|
+import { startWorkflow, getWorkflowById, getWorkflowById2, getWorkflowById3, handleWorkflow } from '@/api/system/wfApi'
|
|
|
import UserSelector from '../UserSelector/index'
|
|
|
import FileUpload from '@/components/FileUpload/multiUpload'
|
|
|
import { getUserData } from '@/utils/auth'
|
|
|
@@ -46,7 +46,7 @@ export default {
|
|
|
title: '',
|
|
|
listLoading: false,
|
|
|
conditions: {},
|
|
|
- actionId: 0,
|
|
|
+ actionDefId: 0,
|
|
|
actionVisible: false,
|
|
|
remarkVisible: true,
|
|
|
handlerVisible: true,
|
|
|
@@ -57,12 +57,16 @@ export default {
|
|
|
activityDefId: undefined,
|
|
|
activityInsId: undefined,
|
|
|
activityCode: '',
|
|
|
- actionId: 0,
|
|
|
+ actionDefId: 0,
|
|
|
+ actionInsId: undefined,
|
|
|
actionCode: '',
|
|
|
actionRemark: '', // 说明
|
|
|
groupIdTo: undefined,
|
|
|
positionIdTo: undefined,
|
|
|
accountIdTo: undefined, // 执行人
|
|
|
+ groupNameTo: undefined,
|
|
|
+ positionNameTo: undefined,
|
|
|
+ accountNameTo: undefined,
|
|
|
attachList: []
|
|
|
},
|
|
|
rules: {
|
|
|
@@ -73,19 +77,22 @@ export default {
|
|
|
{ required: true, message: '请选择执行人', trigger: 'change' }
|
|
|
]
|
|
|
},
|
|
|
+
|
|
|
flowData: {
|
|
|
wfDefId: this.wfDefId,
|
|
|
wfInsId: this.wfInsId,
|
|
|
wfInsTitle: '',
|
|
|
- wfStatus: undefined,
|
|
|
- curActivityIns: {
|
|
|
- actionList: [],
|
|
|
- activityInsId: undefined,
|
|
|
- activityInsTitle: '',
|
|
|
- activityDefId: undefined,
|
|
|
- activityCode: ''
|
|
|
- },
|
|
|
- activityInsRecordList: []
|
|
|
+
|
|
|
+ activityInsId: undefined,
|
|
|
+ activityDefId: undefined,
|
|
|
+ activityCode: undefined,
|
|
|
+ activityInsTitle: '',
|
|
|
+ formCode: '',
|
|
|
+ actionInsId: undefined,
|
|
|
+ actionDefInd: undefined,
|
|
|
+ actionTitle: undefined,
|
|
|
+ actionCode: undefined,
|
|
|
+ actionDefList: []
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -95,7 +102,7 @@ export default {
|
|
|
])
|
|
|
},
|
|
|
watch: {
|
|
|
- actionId(val) {
|
|
|
+ actionDefId(val) {
|
|
|
if (val > 0) {
|
|
|
this.getActionCode(val)
|
|
|
}
|
|
|
@@ -106,39 +113,36 @@ export default {
|
|
|
// 启动流程
|
|
|
async start(wfDefId) {
|
|
|
this.resetFormData()
|
|
|
- const { code, data, msg } = await startWorkflow(wfDefId)
|
|
|
- if (code === 200) {
|
|
|
- this.flowData = data
|
|
|
- this.formData.wfDefId = data.wfDefId
|
|
|
- this.formData.wfInsId = data.wfInsId
|
|
|
- this.formData.activityDefId = data.curActivityIns.activityDefId
|
|
|
- this.formData.activityInsId = data.curActivityIns.activityInsId
|
|
|
- this.formData.activityCode = data.curActivityIns.activityCode
|
|
|
- this.renderAction()
|
|
|
- return data.wfInsId
|
|
|
- } else {
|
|
|
- this.$message.error(msg)
|
|
|
- return 0
|
|
|
- }
|
|
|
+ const { data } = await startWorkflow(wfDefId)
|
|
|
+ this.flowData = data
|
|
|
+ this.formData.wfDefId = data.wfDefId
|
|
|
+ this.formData.wfInsId = data.wfInsId
|
|
|
+ this.formData.activityDefId = data.activityDefId
|
|
|
+ this.formData.activityInsId = data.activityInsId
|
|
|
+ this.formData.activityCode = data.activityCode
|
|
|
+ this.formData.actionInsId = data.actionInsId
|
|
|
+ this.renderAction()
|
|
|
+ return data.wfInsId
|
|
|
},
|
|
|
|
|
|
// 渲染功能操作按钮
|
|
|
renderAction() {
|
|
|
- if (this.flowData && this.flowData.curActivityIns && this.flowData.curActivityIns.actionList) {
|
|
|
- const arr = this.flowData.curActivityIns.actionList
|
|
|
+ if (this.flowData.actionDefList) {
|
|
|
+ const arr = this.flowData.actionDefList
|
|
|
if (arr.length > 1) {
|
|
|
this.actionVisible = true
|
|
|
const item = arr[0]
|
|
|
- this.formData.actionId = item.actionId
|
|
|
+ this.formData.actionDefId = item.actionDefId
|
|
|
this.formData.actionCode = item.actionCode
|
|
|
- this.actionId = item.actionId
|
|
|
+ this.formData.actionDefId = item.actionDefId
|
|
|
} else if (arr.length === 1) {
|
|
|
const item = arr[0]
|
|
|
- this.formData.actionId = item.actionId
|
|
|
+ this.actionVisible = false
|
|
|
+ this.formData.actionDefId = item.actionDefId
|
|
|
this.formData.actionCode = item.actionCode
|
|
|
- this.actionId = item.actionId
|
|
|
+ this.formData.actionDefId = item.actionDefId
|
|
|
} else {
|
|
|
- this.$message.error('数据配置有误!请联系管理员')
|
|
|
+ this.$message.error('数据配置有误!请联系管理员!')
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -146,32 +150,83 @@ export default {
|
|
|
// 获取流程
|
|
|
get(wfInsId) {
|
|
|
this.resetFormData()
|
|
|
- getWorkflowById(wfInsId).then((resp) => {
|
|
|
- const { code, data, msg } = resp
|
|
|
- if (code === 200) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ getWorkflowById(wfInsId).then((resp) => {
|
|
|
+ const { data } = resp
|
|
|
this.flowData = data
|
|
|
this.formData.wfDefId = data.wfDefId
|
|
|
this.formData.wfInsId = data.wfInsId
|
|
|
- this.formData.activityDefId = data.curActivityIns.activityDefId
|
|
|
- this.formData.activityInsId = data.curActivityIns.activityInsId
|
|
|
- this.formData.activityCode = data.curActivityIns.activityCode
|
|
|
+ this.formData.activityDefId = data.activityDefId
|
|
|
+ this.formData.activityInsId = data.activityInsId
|
|
|
+ this.formData.activityCode = data.activityCode
|
|
|
+ this.formData.actionInsId = data.actionInsId
|
|
|
this.renderAction()
|
|
|
- } else {
|
|
|
- this.$message.error(msg)
|
|
|
- }
|
|
|
+ resolve(this.formData.activityCode)
|
|
|
+ return this.formData.activityCode
|
|
|
+ }).catch((error) => {
|
|
|
+ reject(error)
|
|
|
+ console.log(error)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取流程
|
|
|
+ get2(wfInsId, activityInsId) {
|
|
|
+ this.resetFormData()
|
|
|
+ getWorkflowById2(wfInsId, activityInsId).then((resp) => {
|
|
|
+ const { data } = resp
|
|
|
+ this.flowData = data
|
|
|
+ this.formData.wfDefId = data.wfDefId
|
|
|
+ this.formData.wfInsId = data.wfInsId
|
|
|
+ this.formData.activityDefId = data.activityDefId
|
|
|
+ this.formData.activityInsId = data.activityInsId
|
|
|
+ this.formData.activityCode = data.activityCode
|
|
|
+ this.formData.actionInsId = data.actionInsId
|
|
|
+ this.renderAction()
|
|
|
}).catch((error) => {
|
|
|
console.log(error)
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- getActionCode(actionId) {
|
|
|
+ // 获取流程
|
|
|
+ get3(wfInsId, activityInsId, actionInsId) {
|
|
|
+ this.resetFormData()
|
|
|
+ getWorkflowById3(wfInsId, activityInsId, actionInsId).then((resp) => {
|
|
|
+ const { data } = resp
|
|
|
+ this.flowData = data
|
|
|
+ this.formData.wfDefId = data.wfDefId
|
|
|
+ this.formData.wfInsId = data.wfInsId
|
|
|
+ this.formData.activityDefId = data.activityDefId
|
|
|
+ this.formData.activityInsId = data.activityInsId
|
|
|
+ this.formData.activityCode = data.activityCode
|
|
|
+ this.formData.actionInsId = data.actionInsId
|
|
|
+ this.renderAction()
|
|
|
+ }).catch((error) => {
|
|
|
+ console.log(error)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ changeAction(data) {
|
|
|
+ this.formData.actionDefId = data.actionDefId
|
|
|
+ this.formData.actionCode = data.actionCode
|
|
|
+ this.formData.actionTitle = data.actionTitle
|
|
|
+ this.getActionCode(data.actionDefId)
|
|
|
+ },
|
|
|
+
|
|
|
+ getActionCode(actionDefId) {
|
|
|
+ console.log(actionDefId)
|
|
|
+
|
|
|
let remarkVisible = true
|
|
|
let handlerVisible = true
|
|
|
let attachVisible = true
|
|
|
- const actionList = this.flowData.curActivityIns.actionList
|
|
|
- const pass = actionList && Array.isArray(actionList) && this.flowData && this.flowData.curActivityIns
|
|
|
+ const actionDefList = this.flowData.actionDefList
|
|
|
+ console.log(actionDefList)
|
|
|
+ const pass = actionDefList && Array.isArray(actionDefList) && this.flowData
|
|
|
if (!pass) return
|
|
|
- const actionCode = actionList.filter(item => item.actionId === actionId)[0].actionCode
|
|
|
+ const actionCode = actionDefList.filter(item => item.actionDefId === actionDefId)[0].actionCode
|
|
|
+ console.log(actionCode)
|
|
|
+ console.log('-----')
|
|
|
+
|
|
|
if (actionCode === 'complete') {
|
|
|
remarkVisible = true
|
|
|
handlerVisible = false
|
|
|
@@ -188,13 +243,11 @@ export default {
|
|
|
this.remarkVisible = remarkVisible
|
|
|
this.handlerVisible = handlerVisible
|
|
|
this.attachVisible = attachVisible
|
|
|
- this.formData.actionId = actionId
|
|
|
- this.formData.actionCode = actionCode
|
|
|
},
|
|
|
|
|
|
// handleIns 自定义校验灵活度高
|
|
|
verify() {
|
|
|
- let bRet = false
|
|
|
+ let bRet = true
|
|
|
// 需要校验备注
|
|
|
if (this.remarkVisible) {
|
|
|
bRet = this.isNotNull(this.formData.actionRemark)
|
|
|
@@ -205,6 +258,7 @@ export default {
|
|
|
}
|
|
|
return bRet
|
|
|
},
|
|
|
+
|
|
|
verifyForm() {
|
|
|
return new Promise((reslove, reject) => {
|
|
|
this.$refs['flowForm'].validate((valid) => {
|
|
|
@@ -219,23 +273,18 @@ export default {
|
|
|
|
|
|
// 处理流程
|
|
|
async handle(param2) {
|
|
|
- await this.verifyForm()
|
|
|
const param1 = JSON.parse(JSON.stringify(this.formData))
|
|
|
const params = { ...param1, ...param2 }
|
|
|
- const { code, msg, data } = await handleWorkflow(params)
|
|
|
- if (code === 200) {
|
|
|
- const flowData = {
|
|
|
- activityCode: this.formData.activityCode,
|
|
|
- actionId: this.formData.actionId,
|
|
|
- actionCode: this.formData.actionCode,
|
|
|
- actionRemark: this.formData.actionRemark,
|
|
|
- attachList: this.formData.attachList
|
|
|
- }
|
|
|
- return { ...data, data: flowData }
|
|
|
- } else {
|
|
|
- this.$message.error(msg)
|
|
|
- return false
|
|
|
+ const { data } = await handleWorkflow(params)
|
|
|
+ console.log('.........................')
|
|
|
+ console.log(data)
|
|
|
+ console.log('.........................')
|
|
|
+ const formData = {
|
|
|
+ actionCode: this.formData.actionCode,
|
|
|
+ actionRemark: this.formData.actionRemark,
|
|
|
+ attachList: JSON.parse(JSON.stringify(this.formData.attachList))
|
|
|
}
|
|
|
+ return { ...data, data: formData }
|
|
|
},
|
|
|
|
|
|
// 用户选择
|
|
|
@@ -243,6 +292,9 @@ export default {
|
|
|
this.formData.accountIdTo = item.accountId
|
|
|
this.formData.groupIdTo = item.groupId
|
|
|
this.formData.positionIdTo = item.positionId
|
|
|
+ this.formData.accountNameTo = item.accountName
|
|
|
+ this.formData.groupNameTo = item.groupName
|
|
|
+ this.formData.positionNameTo = item.positionName
|
|
|
},
|
|
|
|
|
|
// 重置
|
|
|
@@ -267,8 +319,12 @@ export default {
|
|
|
this.formData.accountIdTo = userData.userId
|
|
|
this.formData.groupIdTo = userData.groupId
|
|
|
this.formData.positionId = userData.positionId
|
|
|
+ this.formData.groupNameTo = userData.groupName
|
|
|
+ this.formData.positionNameTo = userData.positionName
|
|
|
+ this.formData.accountNameTo = userData.userName
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
isNotNull(val) {
|
|
|
if (val !== undefined && val !== 'undefined' && val !== null && val !== '' && val !== ' ') { return true } else {
|
|
|
return false
|