<template>
|
<div>
|
<el-dialog
|
:title="'修改任务:' + currentTask.beforeNodeName"
|
:visible.sync="open"
|
:destroy-on-close="true"
|
:fullscreen="true"
|
:before-close="close">
|
<el-row>
|
<el-col :span="16">
|
<div v-if="currentTask != null && currentTask.formJsonObj != null">
|
<v-form-render :form-data="currentTask.formJsonObj.formJson" ref="form"/>
|
</div>
|
</el-col>
|
<el-col :span="8">
|
<div style="padding-left: 40px;min-height: 200px">
|
<div style="position: relative">
|
<div v-if="currentTask.taskStatus == '已完成'">当前状态:{{currentTask.taskStatus}}<span v-show="editForm.nowStatus">--->{{editForm.nowStatus}}</span>,
|
<el-button type="primary" size="small" @click="openJump">改为跳过</el-button>
|
<el-button type="primary" size="small" @click="openWait">改为容缺</el-button>
|
<el-button type="text" size="small" @click="cancelStatus" v-show="editForm.nowStatus">取消状态更改</el-button>
|
</div>
|
<div v-else-if="currentTask.taskStatus == '跳过'">当前状态:{{currentTask.taskStatus}}<span v-show="editForm.nowStatus">--->{{editForm.nowStatus}}</span>,
|
<el-button type="primary" size="small" @click="openWait">改为容缺</el-button>
|
<el-button type="text" size="small" @click="cancelStatus" v-show="editForm.nowStatus">取消状态更改</el-button>
|
</div>
|
<div v-else-if="currentTask.taskStatus == '容缺'">当前状态:{{currentTask.taskStatus}}<span v-show="editForm.nowStatus">--->{{editForm.nowStatus}}</span>,
|
<el-button type="primary" size="small" @click="openJump">改为跳过</el-button>
|
<el-button type="text" size="small" @click="cancelStatus" v-show="editForm.nowStatus">取消状态更改</el-button>
|
</div>
|
<el-button style="position: absolute;right: 0px; top: 0px" type="primary" size="small" @click="save">保 存</el-button>
|
</div>
|
<div style="margin-top: 15px">
|
<el-form v-show="showJumpForm" :model="taskJumpForm" :rules="jumpRules" ref="jumpForm" label-position="left">
|
<el-form-item label="跳过说明" prop="desc">
|
<el-input v-model="taskJumpForm.desc"></el-input>
|
</el-form-item>
|
</el-form>
|
<el-form v-show="showWaitForm" :model="taskWaitForm" :rules="waitRules" ref="waitForm" label-position="left">
|
<el-form-item label="容缺说明" prop="desc">
|
<el-input v-model="taskWaitForm.desc"></el-input>
|
</el-form-item>
|
</el-form>
|
</div>
|
</div>
|
<div>
|
<log-time-line v-if="currentTask.events && currentTask.events.length > 0" :log-list="currentTask.events"/>
|
</div>
|
</el-col>
|
</el-row>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import {currentFlowTaskForm} from "@/api/flowable/todo";
|
import LogTimeLine from "@/views/projectProcess/components/LogTimeLine";
|
import {editTask} from "@/api/projectProcess/projectProcess";
|
|
export default {
|
name: "EditTask",
|
components: {LogTimeLine},
|
props: {
|
taskId: {
|
type: String,
|
required: true
|
},
|
open: {
|
type: Boolean,
|
default: false
|
}
|
},
|
watch: {
|
taskId: {
|
handler(newV) {
|
if (newV) {
|
currentFlowTaskForm({taskId: newV}).then(res => {
|
this.currentTask = res.data
|
this.editForm.originalStatus = res.data.taskStatus
|
this.editForm.taskId = newV
|
this.formJson = this.currentTask.formJsonObj.formJson
|
this.$nextTick(() => {
|
this.$refs.form.setFormJson(this.currentTask.formJsonObj.formJson);
|
this.$refs.form.setFormData(this.currentTask.formJsonObj);
|
})
|
})
|
}
|
}
|
}
|
},
|
data() {
|
return {
|
showJumpForm: false,
|
showWaitForm: false,
|
jumpRules: {
|
desc: [
|
{ required: true, message: '请输入跳过说明', trigger: 'blur' },
|
]
|
},
|
waitRules: {
|
desc: [
|
{ required: true, message: '请输入容缺说明', trigger: 'blur' },
|
]
|
},
|
currentTask: {
|
|
},
|
taskJumpForm: {
|
desc: ''
|
},
|
taskWaitForm: {
|
desc: ''
|
},
|
formJson: {}, // 表单json
|
formData: {}, // 填写的表单数据,
|
editForm: {
|
taskId: '',
|
variables: null,
|
originalStatus: '',
|
nowStatus: '',
|
taskJumpForm: null,
|
taskWaitForm: null
|
}
|
}
|
},
|
methods: {
|
cancelStatus() {
|
this.editForm.nowStatus = ''
|
this.showWaitForm = false
|
this.showJumpForm = false
|
this.editForm.taskWaitForm = {}
|
this.editForm.taskJumpForm = {}
|
},
|
openJump() {
|
this.showWaitForm = false
|
this.editForm.taskWaitForm = {}
|
this.editForm.nowStatus = '跳过'
|
this.showJumpForm = true
|
},
|
openWait() {
|
this.showJumpForm = false
|
this.editForm.taskJumpForm = {}
|
this.editForm.nowStatus = '容缺'
|
this.showWaitForm = true
|
},
|
save() {
|
this.$refs.form.getFormData().then(formData => {
|
this.formData = formData
|
const param = {
|
formJson: this.formJson,
|
}
|
// 复制对象的属性值给新的对象
|
Object.assign(param, formData);
|
this.editForm.variables = param
|
if (this.editForm.nowStatus) {
|
if (this.editForm.nowStatus == '跳过') {
|
this.$refs['jumpForm'].validate((valid) => {
|
if (valid) {
|
this.editForm.taskJumpForm = this.taskJumpForm
|
editTask(this.editForm).then(res => {
|
this.$message.success("修改成功")
|
this.close()
|
})
|
}
|
})
|
} else if (this.editForm.nowStatus == '容缺') {
|
this.$refs['waitForm'].validate((valid) => {
|
if (valid) {
|
this.editForm.taskWaitForm = this.taskWaitForm
|
editTask(this.editForm).then(res => {
|
this.$message.success("修改成功")
|
this.close()
|
})
|
}
|
})
|
}
|
} else {
|
this.editForm.nowStatus = this.editForm.originalStatus
|
editTask(this.editForm).then(res => {
|
this.$message.success("修改成功")
|
this.close()
|
})
|
}
|
})
|
},
|
close() {
|
this.$emit("close")
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
</style>
|