zzw
2023-11-28 b40478cb59e8874d0e683950f2347f5e45a5d80d
web/src/views/modules/sys/task/already-task.vue
@@ -1,17 +1,18 @@
<template>
    <zt-table-wraper ref="tableObj" query-url="/task/taskCenter/pageDone" :paging="false" :lazy="true" v-slot="{ table }"
                     paging-layout="total, prev, pager, next">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()">
  <div>
    <!--    <zt-table-wraper ref="tableObj" query-url="/newPlan/taskCenter/pageDone" :paging="false" :lazy="true" v-slot="{ table }"-->
    <!--                     paging-layout="total, prev, pager, next">-->
    <el-form :inline="true" :model="dataForm">
        <el-input type="text" v-model="dataForm.djxlSystem" v-if="false" />
      </el-form>
      <el-table ref="table"
                :height="getTransformHeight(transformHeight)"
                v-loading="table.dataLoading"
                :data="table.dataList"
              class="pushtable  table-is__left-tz"
              v-loading="dataLoading"
              :data="dataList"
                style='margin-top:10px;transition: .5s;'
                @selection-change="table.selectionChangeHandle"
                border highlight-current-row>
        <el-table-column align="center" prop="index" width="60" label="序号">
      <el-table-column align="center" prop="index" width="80" label="序号">
          <template slot-scope="scope">
            <span v-html="indexFormat(scope.$index)"></span>
          </template>
@@ -26,7 +27,7 @@
        <el-table-column align="center" prop="stepName" label="当前状态" width="240px"/>
        <el-table-column align="center" prop="receiveName" label="办理人"  width="120px"/>
        <!--        <el-table-column align="center" prop="statusName" label="我的意见" />-->
        <zt-table-column-handle  fixed="right" :table="table" :has-edit="false" :has-delete="false" :has-view="false" width="220px">
      <el-table-column label="操作" width="220px">
          <template v-slot="{ row }">
            <zt-table-button v-show="row.canRecall == 1 && !$store.state.user.isAdmin" @click="reCall(row)">撤回</zt-table-button>
            <zt-table-button @click="check(row,'')" v-if="row.flowCode !== 'yearPlanFlow'">查看</zt-table-button>
@@ -34,21 +35,36 @@
            <zt-table-button @click="flowChart(row)">流程图</zt-table-button>
            <zt-table-button v-if="row.flowCode != 'yearPlan2'" @click="getFlowTrack(row)">办理轨迹</zt-table-button>
          </template>
        </zt-table-column-handle>
      </el-table-column>
      <infinite-loading
        spinner="bubbles"
        distance="200"
        slot="append"
        identifier="infiniteId"
        @infinite="infiniteHandler"
        ref="infiniteLoading"
        force-use-infinite-wrapper=".pushtable .el-table__body-wrapper">
        <div slot="no-more" style="margin-top: 10px;margin-bottom: 10px;"><span v-if="dataListAll.length > pageSize">没有更多了</span></div>
      </infinite-loading>
      </el-table>
      <!-- 弹窗, 新增 / 修改 -->
<!--      <el-dialog  title="项目进度图" top="10vh" width='85%' :visible.sync="dialogVisible">-->
<!--        <processTimeline ref="processTimeline"></processTimeline>-->
<!--      </el-dialog>-->
</zt-table-wraper>
    <!-- 已办任务弹窗 -->
    <ItemCirculatOrder ref="itemCirculatOrder" @refreshDataList="getQuery()"></ItemCirculatOrder>
    <!--    </zt-table-wraper>-->
  </div>
</template>
<script>
// import processTimeline from '../../../../map/processTimeline'
import Cookies from "js-cookie";
  import InfiniteLoading from 'vue-infinite-loading'
  import ItemCirculatOrder from '@/views/modules/itemCirculatOrder/ItemCirculatOrder-AddOrUpdate'
export default {
  data() {
    return {
        page: 1,
        pageSize: 30,
        dataLoading: false,
        dataList:[],
        dataListAll:[],
      dataForm: {
        djxlSystem:''
      },
@@ -63,6 +79,8 @@
    }
  },
  components: {
      InfiniteLoading,
      ItemCirculatOrder
  },
  watch:{
  },
@@ -78,10 +96,55 @@
    this.dataForm.djxlSystem = Cookies.get('djxlSystem')
    this.getQuery()
    this.$EventBus.$on('newProject',()=>{
      this.$refs.tableObj.query()
        // this.$refs.tableObj.query()
        this.getQuery()
    })
  },
  methods: {
      async infiniteHandler($state) {
        console.log('in infiniteHandler--------')
        if ((this.page * this.pageSize) < this.dataListAll.length) {
          this.page++
          // let begin = (this.page - 1) * this.pageSize
          let end = this.page * this.pageSize
          if (end > this.dataListAll.length) {
            end = this.dataListAll.length
          }
          this.dataList = this.dataListAll.slice(0, end)
          console.log(this.dataList.length, 'infiniteHandler:this.dataList.length')
          console.log(this.page, 'infiniteHandler:this.page')
          setTimeout(() => {
            $state.loaded()
          }, 100)
        } else {
          $state.loaded()
          console.log("$state.complete()", this.page)
          this.page = 1;
          $state.complete()
          console.log(this.page, 'infiniteHandler:this.page')
        }
      },
      handleInfiniteLoadingBeforeGet() {
        this.page = 1;
        this.dataListAll = []
        this.dataList = []
      },
      handleInfiniteLoadingAfterGet(res) {
        this.dataListAll = res.data
        console.log(this.dataListAll.length, 'handleInfiniteLoadingAfterGet:this.dataListAll.length')
        // let begin = (this.page - 1) * this.pageSize
        let end = this.page * this.pageSize
        if (end > this.dataListAll.length) {
          end = this.dataListAll.length
        }
        this.dataList = this.dataListAll.slice(0, end)
        console.log(this.dataList.length, 'handleInfiniteLoadingAfterGet:this.dataList.length')
        console.log(this.page, 'handleInfiniteLoadingAfterGet:this.page')
        this.$nextTick(() => {
          this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset');
        });
      },
    getTransformHeight(transformHeight){
      let Height=document.documentElement.clientHeight
      if(transformHeight){
@@ -90,15 +153,29 @@
        return  Height-650
      }
    },
    getQuery(){
      this.$refs.tableObj.query()
      this.$emit('getQuery')
      async getQuery(){
        this.handleInfiniteLoadingBeforeGet()
        this.dataLoading = true
        let params = {
          djxlSystem: this.dataForm.djxlSystem,
        }
        let res = await this.$http.get(`/task/taskCenter/pageDone`,{
          params: params
        })
        if (res.success) {
          this.dataLoading = false
          this.handleInfiniteLoadingAfterGet(res)
          console.log(this.dataList, 'getQuery:this.dataList')
        } else {
          this.dataLoading = true
        }
    },
    async reCall(row) {
      if (await this.$tip.confirm('确定要进行撤回吗?')) {
        this.$http.get(`/wf/reCallFlow`, {params: row}).then(res => {
          if (res.data == 'OK') {
            this.$refs.tableObj.query();
              // this.$refs.tableObj.query();
              this.getQuery()
          }
          else {
            this.$tip.alert(res.data)
@@ -107,42 +184,11 @@
      }
    },
    check(row) {
      // if(row.stepMarker === 'jsfa_sc' || row.stepMarker === 'jsfa_sp'){
      //   this.$refs.repairSkillScheme.$refs.dialog.init(row)
      // }
      // else
      if (row.title === '年度修理计划') {
        this.$refs.annualRepairPlanAdd.$refs.dialog2.init(row,'readOnly')
      } else if (row.flowCode === 'NewProjectFlow') {
        let id = row.bizId
        this.$refs.projectUpdate.$refs.dialog.init(id, 'view')
      }
      else if (row.flowCode==='monthPlanFlow'){
        this.$refs.monthlyPlan.$refs.dialog.init('yb', row)
      }
      else if (row.flowCode==='weekPlanFlow'){
        this.$refs.weeklyPlan.$refs.dialog.init('yb', row)
      }
      else if (row.flowCode==='rjhFlow') {
          this.$refs.dailyPlan.$refs.dialog.init('yb', row)
      }
      else if (row.flowCode==='wlt3Flow'){
        this.$refs.networkdiagram3.$refs.dialog.init('yb', row)
      }
      else if (row.flowCode==='cjjdrwFlow'){
        this.$refs.partsInspectionHandle.$refs.dialog.init(row,'yb')
      }
      else if (row.flowCode==='zjbyFlow' || row.flowCode==='jjbyFlow'){
        this.$refs.inspectionCheckHandle.$refs.dialog.init(row,'yb')
      }
      else if (row.flowCode==='jzjysFlow'){
        this.$refs.inspectionCheckZcHandle.$refs.dialog.init(row,'yb')
      }
      else if (row.flowCode==='jjysFlow'){
        this.$refs.inspectionCheckDbsHandle.$refs.dialog.init(row,'yb')
      }
      else if (row.flowCode==='cjjdFlow'){
        this.$refs.partsInspectionJdHandle.$refs.dialog.init(row,'yb')
        console.log(row, "task row");
        if (row.flowCode === 'wplz') {
          this.$refs.itemCirculatOrder.$refs.dialog.init(row)
        } else if (row.flowCode === 'aaa') {
          //this.$refs.itemCirculatOrder.$refs.dialog.init(row)
      }
      else {
        if (row.stepReadRouterId === null){
@@ -191,9 +237,10 @@
      }
    },
    indexFormat(index) {
      let page = this.$refs.tableObj.page
      let limit = this.$refs.tableObj.limit
      let indexs = limit * (page - 1) + index + 1
        // let page = this.page
        // let limit = this.pageSize
        // let indexs = limit * (page - 1) + index + 1
        let indexs = index + 1
      return '<span>' + indexs + '</span>'
    },
  },