| | |
| | | <!--表单信息--> |
| | | <el-tab-pane label="表单信息" name="1"> |
| | | <!--初始化流程加载表单信息--> |
| | | <el-col :span="16" :offset="4"> |
| | | <v-form-render :form-data="formRenderData" ref="vFormRef"/> |
| | | <div style="margin-left:15%;margin-bottom: 20px;font-size: 14px;"> |
| | | <el-button type="primary" @click="submitForm">提 交</el-button> |
| | | <el-button type="primary" @click="resetForm">重 置</el-button> |
| | | <el-col :span="16" :offset="4" v-if="formDataList && formDataList.length > 0"> |
| | | <div v-for="(formDataObj, index) in formDataList" :key="index" class="form-warp" style="position: relative"> |
| | | <div v-if="!formDataObj.current" style="position: absolute; top: 2px; right: 2px"> |
| | | <el-button type="danger" @click="openRejectTask(formDataObj.beforeNodeDefId)">驳回</el-button> |
| | | </div> |
| | | <div v-if="formDataObj.current" style="margin-bottom: 15px;color: #409eff">当前阶段:<span style="color: red">{{formDataObj.beforeNodeName}}</span></div> |
| | | <div v-else style="margin-bottom: 15px;color: #409eff">前置阶段:<span style="color: #d5904b">{{formDataObj.beforeNodeName}}</span></div> |
| | | <v-form-render :form-data="formDataObj.formJson" :ref="'form' + index"/> |
| | | </div> |
| | | |
| | | <!-- <v-form-render :form-data="formRenderData" ref="vFormRef"/>--> |
| | | <div style="display: flex;justify-content: center; align-items: center; margin: 20px 0"> |
| | | <el-button type="primary" @click="submitForm">确认并提交</el-button> |
| | | <el-button type="primary" disabled @click="submitForm">协同办理(功能开发中)</el-button> |
| | | <el-button type="primary" @click="openDelegation(formDataList[0].beforeNodeName)">转办</el-button> |
| | | <!-- <el-button type="primary" @click="resetForm">重 置</el-button>--> |
| | | </div> |
| | | </el-col> |
| | | </el-tab-pane> |
| | |
| | | </span> |
| | | </el-dialog> |
| | | </el-card> |
| | | |
| | | |
| | | <el-dialog |
| | | :title="`驳回:` + rejectForm.projectName" |
| | | :visible.sync="rejectShow" |
| | | width="950px" |
| | | :destroy-on-close="true" |
| | | :close-on-click-modal="false" |
| | | > |
| | | <div> |
| | | <el-input |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="审核建议" |
| | | v-model="rejectForm.comment"> |
| | | </el-input> |
| | | </div> |
| | | <div class="opBut"> |
| | | <el-button type="danger" size="small" @click="rejectTask">驳回</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <el-dialog |
| | | :title="`转办:` + delegationForm.taskName" |
| | | :visible.sync="delegationShow" |
| | | width="950px" |
| | | :destroy-on-close="true" |
| | | :close-on-click-modal="false" |
| | | > |
| | | <div> |
| | | <el-form :model="delegationForm" :rules="delegationFormRules" ref="delegationForm" label-width="100px" class="demo-ruleForm"> |
| | | <el-alert |
| | | title="请选择要转办的用户对象,用户类型不同处理人不同" |
| | | type="info" |
| | | :closable="false" |
| | | style="margin-bottom: 8px" |
| | | show-icon> |
| | | </el-alert> |
| | | <el-form-item label="用户类型" prop="peopleType"> |
| | | <el-select v-model="delegationForm.peopleType" @change="peopleTypeChange" placeholder="请选择用户类型"> |
| | | <el-option label="指定人员" value="FIX_USER"></el-option> |
| | | <el-option label="候选用户" value="USER"></el-option> |
| | | <el-option label="候选部门" value="DEPT"></el-option> |
| | | <el-option label="候选角色" value="ROLE"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item v-if="delegationForm.peopleType === 'DEPT'" label="候选部门" prop="targetId"> |
| | | <Dept ref="dept" :checkeds="delegationDeptSelect" :show="deptShow" @close="closeDept" @submit="getDeptSelect"/> |
| | | <div style="display: flex;align-items: center"> |
| | | <div>{{deptNames}}</div> |
| | | <el-button style="margin-left: 8px" type="text" @click="editDept">编辑</el-button> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="opBut"> |
| | | <el-button type="danger" size="small" @click="delegation">转办</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import {definitionStart, flowXmlAndNode} from "@/api/flowable/definition"; |
| | | import BpmnViewer from '@/components/Process/viewer'; |
| | | import Dept from '@/components/flow/Dept' |
| | | import {completeSubmitFormTask} from "@/api/flowable/process"; |
| | | import { flowTaskForm } from "@/api/flowable/todo"; |
| | | import {getNextFlowNodeByStart} from "@/api/flowable/todo"; |
| | | import FlowUser from '@/components/flow/User' |
| | | import FlowRole from '@/components/flow/Role' |
| | | import {rejectTask} from "@/api/flowable/process"; |
| | | import {taskDelegation} from "@/api/projectProcess/projectProcess"; |
| | | |
| | | export default { |
| | | name: "Record", |
| | |
| | | BpmnViewer, |
| | | FlowUser, |
| | | FlowRole, |
| | | Dept, |
| | | }, |
| | | props: {}, |
| | | data() { |
| | | return { |
| | | deptShow: false, // 部门显示 |
| | | deptNames: '', // 选中的部门名称 |
| | | delegationDeptSelect: [], // 选中部门 |
| | | delegationFormRules: { |
| | | peopleType: [ |
| | | { required: true, message: '请选择用户类型', trigger: 'change' } |
| | | ], |
| | | targetId: [ |
| | | { required: true, message: '请选择转办对象', trigger: 'blur' } |
| | | ], |
| | | }, |
| | | delegationForm: { // 转办表单 |
| | | taskId: '', |
| | | peopleType: '', |
| | | targetId: '', |
| | | taskName: '' |
| | | }, |
| | | delegationShow: false, // 转办显示 |
| | | rejectShow: false, // 驳回显示 |
| | | goBackParams: {}, |
| | | formDataList: [], // 表单列表 |
| | | taskId: '', |
| | | processName: '', |
| | | // 模型xml数据 |
| | |
| | | deployId: "", // 流程定义编号 |
| | | procDefId: "", // 流程实例编号 |
| | | formRenderData: {}, |
| | | formRenderDataList: [], |
| | | variables: [], // 流程变量数据 |
| | | taskTitle: null, |
| | | taskOpen: false, |
| | |
| | | checkValues: null, // 选中任务接收人员数据 |
| | | formData: {}, // 填写的表单数据, |
| | | multiInstanceVars: '', // 会签节点 |
| | | formJson: {} // 表单json |
| | | formJson: {}, // 表单json |
| | | rejectForm: { |
| | | comment: '', // 审核意见 |
| | | taskId: '', |
| | | // rejectedTaskDefKey: '' // 被驳回的任务key |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | mounted() { |
| | | this.processName = this.$route.query && this.$route.query.processName; |
| | | this.deployId = this.$route.query && this.$route.query.deployId; |
| | | this.taskId = this.$route.query && this.$route.query.taskId; |
| | | // 初始化表单 |
| | | this.procDefId = this.$route.query && this.$route.query.procDefId; |
| | | this.goBackParams = this.$route.query && this.$route.query.goBackParams; |
| | | // this.getNextFlowNodeByStart(this.deployId); |
| | | this.getFlowFormData(this.taskId); |
| | | }, |
| | | methods: { |
| | | delegation() { |
| | | this.$confirm(`确定要将此任务交由【${this.deptNames}】处理吗?`, '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | taskDelegation(this.delegationForm).then(res => { |
| | | this.$message.success("已发起转办申请") |
| | | }) |
| | | }).catch(() => { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已取消转办操作' |
| | | }); |
| | | }); |
| | | }, |
| | | peopleTypeChange(val) { |
| | | if (val === 'DEPT') { |
| | | this.$nextTick(() => { |
| | | this.$refs.dept.setCheckList(this.delegationDeptSelect) |
| | | }) |
| | | this.deptShow = true |
| | | } |
| | | }, |
| | | editDept() { |
| | | this.$nextTick(() => { |
| | | this.$refs.dept.setCheckList(this.delegationDeptSelect) |
| | | }) |
| | | this.deptShow = true |
| | | }, |
| | | getDeptSelect(list, names) { |
| | | console.log(list, names) |
| | | if (list) { |
| | | this.delegationForm.targetId = list |
| | | this.delegationDeptSelect = list.split(",") |
| | | this.deptNames = names |
| | | } |
| | | this.deptShow = false |
| | | }, |
| | | closeDept() { |
| | | console.log(this.deptNames) |
| | | this.deptShow = false |
| | | }, |
| | | openDelegation(taskName) { |
| | | this.delegationForm.taskName = taskName |
| | | this.delegationForm.taskId = this.taskId |
| | | this.delegationShow = true |
| | | }, |
| | | rejectTask() { |
| | | rejectTask(this.rejectForm).then(res => { |
| | | this.rejectShow = false |
| | | this.$message.success("驳回成功") |
| | | }) |
| | | }, |
| | | openRejectTask(rejectedTaskDefKey) { |
| | | // this.rejectForm.rejectedTaskDefKey = rejectedTaskDefKey; |
| | | this.rejectForm.taskId = this.taskId; |
| | | this.rejectShow = true |
| | | }, |
| | | handleClick(tab, event) { |
| | | if (tab.name === '2'){ |
| | | flowXmlAndNode({deployId:this.deployId}).then(res => { |
| | |
| | | getFlowFormData(taskId) { |
| | | const params = {taskId: taskId} |
| | | flowTaskForm(params).then(res => { |
| | | if (res.data.formJson) { |
| | | // 回显表单 |
| | | this.$refs.vFormRef.setFormJson(res.data.formJson); |
| | | this.formJson = res.data.formJson; |
| | | this.formDataList = res.data |
| | | if (this.formDataList && this.formDataList.length > 0) { |
| | | this.$nextTick(() => { |
| | | // 加载表单填写的数据 |
| | | this.$refs.vFormRef.setFormData(res.data); |
| | | // this.$nextTick(() => { |
| | | // // 表单禁用 |
| | | // this.$refs.vFormRef.disableForm(); |
| | | // }) |
| | | this.formDataList.forEach((formDataObj, index) => { |
| | | console.log("表单数据列表", formDataObj.formJson) |
| | | let that = this |
| | | console.log(eval("that.$refs.form" +index)[0]) |
| | | eval("that.$refs.form" +index)[0].setFormJson(formDataObj.formJsonObj.formJson); |
| | | |
| | | eval("that.$refs.form" +index)[0].setFormData(formDataObj.formJsonObj); |
| | | }) |
| | | this.formJson = this.formDataList[0].formJsonObj.formJson |
| | | }) |
| | | } else { |
| | | this.$nextTick(() => { |
| | | // 回显数据 |
| | | this.$refs.vFormRef.setFormJson(res.data); |
| | | this.formJson = res.data; |
| | | }) |
| | | |
| | | } |
| | | // if (res.data.formJson) { |
| | | // // 回显表单 |
| | | // this.$refs.vFormRef.setFormJson(res.data.formJson); |
| | | // this.formJson = res.data.formJson; |
| | | // this.$nextTick(() => { |
| | | // // 加载表单填写的数据 |
| | | // this.$refs.vFormRef.setFormData(res.data); |
| | | // // this.$nextTick(() => { |
| | | // // // 表单禁用 |
| | | // // this.$refs.vFormRef.disableForm(); |
| | | // // }) |
| | | // }) |
| | | // } else { |
| | | // this.$nextTick(() => { |
| | | // // 回显数据 |
| | | // this.$refs.vFormRef.setFormJson(res.data); |
| | | // this.formJson = res.data; |
| | | // }) |
| | | // } |
| | | }).catch(res => { |
| | | console.log("报错了:", res) |
| | | this.goBack(); |
| | | }) |
| | | }, |
| | | /** 返回页面 */ |
| | | goBack() { |
| | | // // 关闭当前标签页并返回上个页面 |
| | | // const obj = { path: "/task/process", query: { t: Date.now()} }; |
| | | // this.$tab.closeOpenPage(obj); |
| | | this.$tab.closePage() |
| | | this.$router.push({ |
| | | path: '/projectFlow/detail', |
| | | query: { |
| | | projectId: this.goBackParams.projectId, |
| | | processDefId: this.goBackParams.processDefId |
| | | } |
| | | }) |
| | | }, |
| | | /** 申请流程表单数据提交 */ |
| | | submitForm() { |
| | | this.$refs.vFormRef.getFormData().then(formData => { |
| | | let that = this |
| | | eval("that.$refs.form" +0)[0].getFormData().then(formData => { |
| | | // 根据当前任务或者流程设计配置的下一步节点 todo 暂时未涉及到考虑网关、表达式和多节点情况 |
| | | getNextFlowNodeByStart({deploymentId: this.deployId, variables: formData}).then(res => { |
| | | const data = res.data; |
| | |
| | | }; |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .opBut { |
| | | display: flex;justify-content: center;align-items: center;width: 100%; margin-top: 8px |
| | | } |
| | | .test-form { |
| | | margin: 15px auto; |
| | | width: 800px; |
| | |
| | | .my-label { |
| | | background: #E1F3D8; |
| | | } |
| | | |
| | | .form-warp { |
| | | padding: 20px; |
| | | margin-bottom: 20px; |
| | | box-shadow: |
| | | inset 0 -3em 3em rgba(0, 0, 0, 0.1), |
| | | 0 0 0 2px rgb(239, 239, 239), |
| | | 0.3em 0.3em 1em rgba(0, 0, 0, 0.3); |
| | | } |
| | | </style> |