luohairen
2024-11-28 46e29a50eccda9f92fb2feeb18fa8a0ea4092587
src/views/flowable/task/myProcess/send/index.vue
@@ -2,7 +2,7 @@
  <div class="app-container">
    <el-card class="box-card" >
      <div slot="header" class="clearfix">
        <span class="el-icon-document">发起任务</span>
        <span class="el-icon-document">{{`流程处理:` + processName}}</span>
        <el-button style="float: right;" size="mini" type="danger" @click="goBack">关闭</el-button>
      </div>
      <el-tabs  tab-position="top" v-model="activeName"  @tab-click="handleClick">
@@ -38,7 +38,8 @@
<script>
import {definitionStart, flowXmlAndNode} from "@/api/flowable/definition";
import BpmnViewer from '@/components/Process/viewer';
import {flowFormData} from "@/api/flowable/process";
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'
@@ -53,6 +54,8 @@
  props: {},
  data() {
    return {
      taskId: '',
      processName: '',
      // 模型xml数据
      flowData: {},
      activeName: '1', // 切换tab标签
@@ -78,11 +81,13 @@
    };
  },
  created() {
    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.getNextFlowNodeByStart(this.deployId);
    this.getFlowFormData(this.deployId);
    this.getFlowFormData(this.taskId);
  },
  methods: {
    handleClick(tab, event) {
@@ -93,24 +98,38 @@
      }
    },
    /** 流程表单数据 */
    getFlowFormData(deployId) {
      const params = {deployId: deployId}
      flowFormData(params).then(res => {
        // 流程过程中不存在初始化表单 直接读取的流程变量中存储的表单值
        this.$nextTick(() => {
          // 回显数据
          this.$refs.vFormRef.setFormJson(res.data);
          this.formJson = res.data;
        })
    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.$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 => {
        this.goBack();
      })
    },
    /** 返回页面 */
    goBack() {
      // 关闭当前标签页并返回上个页面
      const obj = { path: "/task/process", query: { t: Date.now()} };
      this.$tab.closeOpenPage(obj);
      // // 关闭当前标签页并返回上个页面
      // const obj = { path: "/task/process", query: { t: Date.now()} };
      // this.$tab.closeOpenPage(obj);
      this.$tab.closePage()
    },
    /** 申请流程表单数据提交 */
    submitForm() {
@@ -144,11 +163,16 @@
                }
                // 复制对象的属性值给新的对象
                Object.assign(param, formData);
                // 启动流程并将表单数据加入流程变量
                definitionStart(this.procDefId, param).then(res => {
                // 完成任务
                completeSubmitFormTask(this.taskId, param).then(res => {
                  this.$modal.msgSuccess(res.msg);
                  this.goBack();
                })
                // // 启动流程并将表单数据加入流程变量
                // definitionStart(this.procDefId, param).then(res => {
                //   this.$modal.msgSuccess(res.msg);
                //   this.goBack();
                // })
              }
            }
          }
@@ -182,11 +206,16 @@
        } else {
          this.$set(param, "approval", this.checkValues);
        }
        // 启动流程并将表单数据加入流程变量
        definitionStart(this.procDefId, param).then(res => {
        // 完成任务
        completeSubmitFormTask(this.taskId, param).then(res => {
          this.$modal.msgSuccess(res.msg);
          this.goBack();
        })
        // // 启动流程并将表单数据加入流程变量
        // definitionStart(this.procDefId, param).then(res => {
        //   this.$modal.msgSuccess(res.msg);
        //   this.goBack();
        // })
      }
    },
    // 用户信息选中数据