luohairen
2024-12-05 a0cc8e02560f7e72e2efb3d4540ddcd5f82aca6e
src/views/projectProcess/detail/index.vue
@@ -1,5 +1,5 @@
<template>
  <div class="app-container">
  <div class="app-container" v-loading.fullscreen.lock="loading">
    <div class="top">
      <div class="project-title">
        <h2>项目名称:{{detailData.projectName}}</h2>
@@ -16,10 +16,10 @@
      </div>
    </div>
    <div class="search-warp">
      <div @click="changeTab(1, 'all')" :class="{'item-warm': true, 'all-color': true, 'active': 1 === selectTabId}">全部事项({{detailData.statistics.totalTaskNum}})</div>
      <div @click="changeTab(2, 'todo')" :class="{'item-warm': true, 'all-color': true, 'active': 2 === selectTabId}">代办事项({{detailData.statistics.todoTaskNum}})</div>
      <div @click="changeTab(3, 'current')" :class="{'item-warm': true, 'current-color': true, 'active': 3 === selectTabId}">当前环节</div>
      <div @click="changeTab(4, 'remaining')" :class="{'item-warm': true, 'remaining-color': true, 'active': 4 === selectTabId}">剩余事项({{detailData.statistics.totalTaskNum}})</div>
      <div @click="changeTab(1, 'all')" :class="{'item-warm': true, 'all-color': true, 'active': 1 === selectTabId}">全部事项<span v-if="detailData && detailData.statistics">({{detailData.statistics.totalTaskNum}})</span></div>
      <div @click="changeTab(2, 'todo')" :class="{'item-warm': true, 'all-color': true, 'active': 2 === selectTabId}">代办事项<span v-if="detailData && detailData.statistics">({{detailData.statistics.todoTaskNum}})</span></div>
      <div @click="changeTab(3, 'todo')" :class="{'item-warm': true, 'current-color': true, 'active': 3 === selectTabId}">当前环节</div>
      <div @click="changeTab(4, 'remaining')" :class="{'item-warm': true, 'remaining-color': true, 'active': 4 === selectTabId}">剩余事项<span v-if="detailData && detailData.statistics">({{detailData.statistics.remainingTaskNum}})</span></div>
      <div @click="changeTab(5, 'timely')" :class="{'item-warm': true, 'timely-color': true, 'active': 5 === selectTabId}">按时完成(0)</div>
      <div @click="changeTab(6, 'overtime')" :class="{'item-warm': true, 'overtime-color': true, 'active': 6 === selectTabId}">超时事项(0)</div>
      <div @click="changeTab(7, 'willOvertime')" :class="{'item-warm': true, 'willOvertime-color': true, 'active': 7 === selectTabId}">临期事项(0)</div>
@@ -37,6 +37,7 @@
    </div>
    <div class="table">
      <el-table
        v-loading="tableLoading"
        :data="taskList"
        border
        style="width: 100%">
@@ -81,31 +82,39 @@
          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",
  data() {
    return {
      loading: false,
      tableLoading: false,
      detailData: {},
      taskList: [],
      total: 0,
@@ -123,25 +132,35 @@
  mounted() {
    this.queryParams.projectId = this.$route.query.projectId
    this.queryParams.processDefId = this.$route.query.processDefId
    this.loading = true
    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: {
@@ -151,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',
@@ -166,6 +197,7 @@
      getProjectProcessDetailTaskList(this.queryParams).then(res => {
        this.taskList = res.data
        this.total = res.total
        this.tableLoading =false
      })
    },
    // 查询详情
@@ -173,9 +205,12 @@
      getProjectProcessDetail(this.queryParams.projectId, this.queryParams.processDefId).then(res => {
        this.detailData = res.data
        this.taskList = res.taskList
        this.total = res.total
        this.loading = false
      })
    },
    changeTab(id, event) {
      this.tableLoading = true
      let beforeId = this.selectTabId
      this.selectTabId = id
      this.queryParams.taskType = event