zhiyong.zhou
2024-03-04 b22f3e37bdfd0c72c699894f19e2c2728182107f
src/views/workspace/process/ProcessInstanceTabs.vue
@@ -2,17 +2,15 @@
  <div class="process-view">
    <div class="process-view__tabs" v-loading="loading">
      <el-tabs type="border-card">
        <el-tab-pane label="流程图">
          <process-diagram-viewer />
        </el-tab-pane>
      </el-tabs>
    <process-diagram-viewer />
    </div>
  </div>
</template>
<script>
import { getProcessInstanceInfo,getFlowDetail } from "@/api/design";
import {getFlowDetail, getWorkSetpsByBusinessId} from "@/api/design";
import ProcessDiagramViewer from "@/views/admin/layout/ProcessDiagramViewer";
export default {
@@ -65,6 +63,46 @@
    getProcessInfo() {
      this.loading = true;
      let param = {"id": this.processInstanceId}
      //let param = {"id": "74d84fb9188f4ce4b93e95f301ebbc1b"}
      //根据业务id获取当前审批流步骤
      getWorkSetpsByBusinessId(param).then(rsp => {
        let workSetps=rsp.data.data
        console.log("workSetps", workSetps)
        if(workSetps.length>0){
          let index=-1;
          let resultProcess;
          debugger
          let noApprovalArr=workSetps.filter(item=>item.end_time===null);
          ////如果所有节点都没审批 那么就取index_no=1的id为当前运行的节点
          if(noApprovalArr.length===workSetps.length){
            resultProcess=workSetps.find(item=>item.index_no===1)
          }else{
            //否则就取遍历查询 审批节点不为空 index_no最大的
            workSetps.forEach(item => {
              console.log("indexno",item.index_no)
              if (item.index_no > index && item.end_time!==null) {
                index = item.index_no;
                resultProcess = item;
              }
            })
          }
          console.log("resultProcess", resultProcess)
          this.$store.state.runningList .push(resultProcess.approve_step_id)
          param.id=resultProcess.approve_id
          this.getFlowDetail(param)
        }else{
          this.$message.error("未查询到审批流数据!")
        }
        console.log("workSetps", workSetps)
      }).catch(err => {
        this.$message.error(err)
      })
    },
    getFlowDetail(param){
      getFlowDetail(param).then(rsp => {
        let form = rsp.data.data;
@@ -92,8 +130,6 @@
            "formPerms": []
          },
        },1,form.id)
        this.$store.state.runningList .push(form.id)
        form.name=this.$Utils.decode(form.name);
        form.templateName = form.name
@@ -102,11 +138,6 @@
        form.notify = "";
        form.remark = "备注说明";
        form.isStop = false
        form.whoCommit = "[]"
        form.whoEdit = "[]"
        form.whoExport = "[]"
        form.templateId = "Steps-B-Director"
        form.formId = "Steps-B-Director"
        form.processDefinitionId = null
        this.$store.state.design = form;
        console.log("this.$store.state.design",this.$store.state.design)
@@ -115,30 +146,9 @@
      }).catch(err => {
        this.$message.error(err)
      }) .finally(() => {
            this.loading = false;
          });
      // getProcessInstanceInfo(this.processInstanceId, this.taskId)
      //   .then((rsp) => {
      //     console.log("流程详情", rsp.data);
      //     const form = { ...rsp.data.result.processTemplates };
      //     const currentNode = { ...rsp.data.result?.currentNode };
      //
      //     form.logo = JSON.parse(form.logo);
      //     form.settings = JSON.parse(form.settings);
      //     form.process = JSON.parse(form.process);
      //     this.$store.state.design = form;
      //     this.$store.state.endList = rsp.data.result.endList;
      //     this.$store.state.runningList = rsp.data.result.runningList;
      //     this.$store.state.noTakeList = rsp.data.result.noTakeList;
      //     this.$store.state.detailVOList = rsp.data.result.detailVOList;
      //
      //     this.currentNode = currentNode;
      //     this.form = form;
      //   })
      //   .finally(() => {
      //     this.loading = false;
      //   });
    },
        this.loading = false;
      });
    }
  },
  beforeMount() {
    this.processInstanceId = this.$route.query.processInstanceId;
@@ -154,8 +164,8 @@
.process-view {
  padding: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
  //display: flex;
  //flex-direction: column;
  box-sizing: border-box;
  &__header {