流程办理回显逻辑变更:处理当前节点只拉取上一个节点及本节点的表单数据,且无论提交数据还是审核都用一个页面
5个文件已修改
177 ■■■■ 已修改文件
src/api/projectProcess/projectProcess.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Process/designer.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Process/panel/PropertiesPanel.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/flowable/task/myProcess/send/index.vue 84 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/projectProcess/detail/index.vue 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/projectProcess/projectProcess.js
@@ -59,3 +59,13 @@
    params: query
  })
}
// 获取任务是否是审批节点
export function getTaskIsAuditing(query) {
  return request({
    url: '/project-process/detail/task/is/auditing',
    method: 'get',
    params: query
  })
}
src/components/Process/designer.vue
@@ -133,6 +133,7 @@
    getActiveElement() {
      // 初始第一个选中元素 bpmn:Process
      this.initFormOnChanged(null);
      // see https://bpmn.io/toolkit/bpmn-js/walkthrough/
      this.modelerStore.modeler.on("import.done", e => {
        this.initFormOnChanged(null);
      });
src/components/Process/panel/PropertiesPanel.vue
@@ -107,7 +107,7 @@
    },
    saveAttribute() {
      const { name, value } = this.propertyForm;
      console.log(this.bpmnElementPropertyList);
      console.log(this.bpmnElementPropertyList, "属性列表");
      if (this.editingPropertyIndex !== -1) {
        this.modelerStore.modeling.updateModdleProperties(this.bpmnElement, this.bpmnElementPropertyList[this.editingPropertyIndex], {
          name,
src/views/flowable/task/myProcess/send/index.vue
@@ -9,11 +9,19 @@
        <!--表单信息-->
        <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">
              <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" @click="submitForm">协同办理</el-button>
              <el-button type="primary" @click="submitForm">转交他人办理</el-button>
<!--              <el-button type="primary" @click="resetForm">重 置</el-button>-->
            </div>
          </el-col>
        </el-tab-pane>
@@ -54,6 +62,7 @@
  props: {},
  data() {
    return {
      formDataList: [],
      taskId: '',
      processName: '',
      // 模型xml数据
@@ -68,6 +77,7 @@
      deployId: "",  // 流程定义编号
      procDefId: "",  // 流程实例编号
      formRenderData: {},
      formRenderDataList: [],
      variables: [], // 流程变量数据
      taskTitle: null,
      taskOpen: false,
@@ -80,7 +90,7 @@
      formJson: {} // 表单json
    };
  },
  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;
@@ -101,26 +111,44 @@
    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
        // this.formRenderDataList = res.data.map(item => item.formJson)
        // console.log("表单数据列表", this.formRenderDataList)
        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();
      })
    },
@@ -133,7 +161,8 @@
    },
    /** 申请流程表单数据提交 */
    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;
@@ -275,4 +304,13 @@
.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>
src/views/projectProcess/detail/index.vue
@@ -82,26 +82,32 @@
          width="100">
          <template slot-scope="scope">
            <el-button v-if="scope.row.taskStatus !== '未开始'" @click="goToProcessDetail(scope.row)" type="text" size="small">查看</el-button>
            <el-button v-if="scope.row.taskStatus === '待办'" @click="goToDo(scope.row)" type="text" size="small">办理</el-button>
            <el-button v-if="showHandle(scope.row)" @click="goToDo(scope.row)" type="text" size="small">办理</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div>
        <el-pagination
          v-if="total > queryParams.pageSize"
          :page-size="queryParams.pageSize"
          :current-page="queryParams.currentPage"
          :total="total"
          layout="total, prev, pager, next"
          @current-change="getList"
        ></el-pagination>
      </div>
    </div>
    <div class="table" style="margin-top: 15px">
      <el-pagination
        v-if="total > queryParams.pageSize"
        @size-change="getList"
        @current-change="getList"
        :current-page.sync="queryParams.currentPage"
        :page-sizes="[5, 10, 20]"
        :page-size="100"
        layout="sizes, prev, pager, next"
        :total="total">
      </el-pagination>
    </div>
  </div>
</template>
<script>
import {getProjectProcessDetail, getProjectProcessDetailTaskList} from "@/api/projectProcess/projectProcess";
import {
  getProjectProcessDetail,
  getProjectProcessDetailTaskList,
  getTaskIsAuditing
} from "@/api/projectProcess/projectProcess";
export default {
  name: "index",
@@ -130,22 +136,31 @@
    this.getProjectProcessInfo()
  },
  methods: {
    showHandle(row) {
      console.log(this.$store.state.user, "用户信息")
      if (row.taskStatus === '待办') {
        if (row.handlerType === "USER") {
          return this.$store.state.user.id === row.handlerId
        } else if (row.handlerType === "DEPT") {
          return this.$store.state.user.id === row.handlerId
        } else if (row.handlerType === "ROLE") {
          return this.$auth.hasRole(row.handlerUnitName)
        }
      } else {
        return false
      }
    },
    goToDo(row) {
      // TODO 这里的判断条件根据实际情况设置
      if (this.$auth.hasRole('admin')) {
      // let params = {
      //   processDefId: row.processDefId,
      //   taskId: row.taskId
      // }
      // getTaskIsAuditing(params).then(res => {
      //
      // })
      // if (this.showHandle(row)) {
        console.log("zhe")
        this.$router.push({
          path: '/flowable/task/todo/detail/index',
          query: {
            taskName: row.taskName,
            startUser: row.promoterName,
            deployId: row.deployId,
            taskId: row.taskId,
            procInsId: row.processInsId,
            executionId: row.executionId
          }
        })
      } else {
        this.$router.push({
          path: '/flowable/task/myProcess/send/index',
          query: {
@@ -155,7 +170,19 @@
            taskId: row.taskId
          }
        })
      }
      // } else {
      //   this.$router.push({
      //     path: '/flowable/task/todo/detail/index',
      //     query: {
      //       taskName: row.taskName,
      //       startUser: row.promoterName,
      //       deployId: row.deployId,
      //       taskId: row.taskId,
      //       procInsId: row.processInsId,
      //       executionId: row.executionId
      //     }
      //   })
      // }
    },
    goToProcessDetail(row) {
      this.$router.push({ path: '/flowable/task/myProcess/detail/index',
@@ -178,6 +205,7 @@
      getProjectProcessDetail(this.queryParams.projectId, this.queryParams.processDefId).then(res => {
        this.detailData = res.data
        this.taskList = res.taskList
        this.total = res.total
        this.loading = false
      })
    },