xiangpei
2024-11-29 69b01c1de544bdaedfa12aaf13600239dabbcb3c
src/views/projectProcess/components/RunProcess.vue
@@ -10,7 +10,7 @@
      <div>
        <div style="display: flex; flex-direction: row; justify-content: center; align-items: center;font-size: 24px">
          <div>当前流程:</div>
          <div v-if="nowProcessId">{{selectProcessName}}</div>
          <div v-if="nowProcessDefId">{{selectProcessName}}</div>
          <div v-else>未绑定流程</div>
        </div>
      </div>
@@ -74,7 +74,7 @@
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="danger" @click="startProcess" :disable="!this.selectProcessId">启动流程</el-button>
        <el-button type="danger" @click="startProcess" :disable="!this.selectProcessDefId">启动流程</el-button>
        <el-button type="primary" @click="changeProcess">变更</el-button>
      </span>
    </el-dialog>
@@ -100,7 +100,7 @@
      required: true,
      type: Array
    },
    nowProcessId: {  // 当前项目绑定的流程id
    nowProcessDefId: {  // 当前项目绑定的流程id
      required: true,
      type: String
    }
@@ -110,14 +110,14 @@
    projectInfo: {
      handler(newVal, oldVal) {
        console.log("传入值:", newVal, this.processList)
        this.setSelect(this.nowProcessId)
        this.setSelect(this.nowProcessDefId)
      },
      deep: true
    }
  },
  data() {
    return {
      selectProcessId: '',  // 组件内部选中的流程id
      selectProcessDefId: '',  // 组件内部选中的流程id
      selectProcessName: '',  // 组件内部选中的流程id
    }
  },
@@ -142,25 +142,25 @@
        this.$refs.myTable.toggleRowSelection(val[val.length - 1]);
      }
      if(val.length != 0){
        this.selectProcessId = val[val.length - 1].id;
        console.log("选中id:", this.selectProcessId)
        this.selectProcessDefId = val[val.length - 1].id;
        console.log("选中id:", this.selectProcessDefId)
      }
    },
    // 启动流程
    startProcess() {
      startProcess(this.projectInfo.projectId, this.selectProcessId).then(res => {
      startProcess(this.projectInfo.projectId, this.selectProcessDefId).then(res => {
        this.$message.success(res.msg);
      })
    },
    // 变更流程
    changeProcess() {
      if (!this.selectProcessId) {
      if (!this.selectProcessDefId) {
        this.$message.error("选则一个流程后才能变更")
        return
      }
      const data = {
        projectId: this.projectInfo.projectId,
        flowableProcessId: this.selectProcessId
        processDefId: this.selectProcessDefId
      }
      projectSetProcess(data).then(res => {
        this.$message.success("变更成功")
@@ -168,7 +168,7 @@
      })
    },
    handleClose() {
      this.selectProcessId = ""
      this.selectProcessDefId = ""
      this.selectProcessName = ""
      this.$emit("close")
    }