fuliqi
2024-11-06 23abf3c8d6ca9577608a3d5ab207d0da67e6e752
src/views/system/work-order/index.vue
@@ -1,7 +1,20 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
      <el-form-item label="关键词" prop="keyword">
  <div style=" padding: 0 20px;">
    <el-row type="flex" justify="left" v-if="this.$store.state.user.roles.some(role => ['admin', 'zg_city', 'city_leader'].includes(role))">
      <el-col :span="24" style="position: relative">
        <el-menu :default-active="activeIndex" class="el-menu" mode="horizontal">
          <el-menu-item index="0" @click="changeUnit(null, '全部')">
            全部单位({{ totalWorkOrders }})
          </el-menu-item>
          <el-menu-item :index="index + 1" v-for="(item, index) in unitList" :key="index" @click="changeUnit(item.id, item.value)">
            {{ item.unitName }}({{ item.workOrderCount }})
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" style="margin-top: 10px;">
      <el-form-item label="关键字" prop="keyword">
        <el-input
          v-model="queryParams.keyword"
          placeholder="工单号/点位名称搜索"
@@ -42,7 +55,6 @@
        <el-button icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
@@ -121,10 +133,13 @@
                    <el-col :span="24" class="time">故障时间:{{ item.createTime }}</el-col>
                  </el-row>
                  <el-row class="work-order-item">
                    <el-col class="time" :span="24"><div>国标码:{{ item.serialNumber }}</div>
                    <el-col class="time" :span="24">
                      <div>国标码:{{ item.serialNumber }}</div>
                      <el-tooltip effect="dark" :content="item.source" placement="top-start">
                        <div>{{ item.source }}</div>
                      </el-tooltip></el-col>
                      </el-tooltip>
                      <div>IP:{{ item.ip }}</div>
                    </el-col>
                  </el-row>
                  <el-row style="position: absolute;bottom: 10px">
                    <el-button
@@ -488,6 +503,7 @@
  getYwCondition,
  process
} from '@/api/platform/work-order'
import {workList} from "@/api/platform/unit";
import { addReport } from '@/api/platform/report'
import WorkOrderAuditing from "@/components/WorkOrder/WorkOrderAuditing";
@@ -497,10 +513,12 @@
  components: {WorkOrderAuditing},
  data() {
    return {
      activeIndex: '0',
      drawer: false,
      empty: false,
      openShowCurrent: null,
      ywConditions: [],
      unitList: [],
      batchAuditingVisible: false,
      batchAuditingWorkOrder: {
        errorTypes: [],
@@ -570,6 +588,7 @@
        keyword: null,
        status: ''
      },
      // 表单参数
      form: {},
      // 审核表单
@@ -651,6 +670,12 @@
      this.ywData.content = item.ywCondition
      this.ywData.fileList = item.ywProofMaterials
      this.drawer = true
    },
    changeUnit(unitId, unitName) {
      this.unitId = unitId;
      this.queryParams.unitId = unitId;
      this.unitName = unitName;
      this.getList()
    },
    // 批量审核
    batchAuditing(result) {
@@ -817,22 +842,28 @@
      if (this.queryParams.timeRange && this.queryParams.timeRange.length > 0) {
        this.queryParams.start = this.queryParams.timeRange[0]
        this.queryParams.end = this.queryParams.timeRange[1]
      }else {
        this.queryParams.start = null
        this.queryParams.end = null
      }
      this.queryParams.isNotDistribute = true;
      listWorkOrder(this.queryParams).then(response => {
        response.data.forEach(item => {
          if (item.imgList) {
            item.imgList = item.imgList.map(img => {
              return this.$img + img
            })
        workList(this.queryParams).then(res => {
          this.unitList = res.data;
          response.data.forEach(item => {
            if (item.imgList) {
              item.imgList = item.imgList.map(img => {
                return this.$img + img
              })
            }
          })
          this.workOrderList = response.data
          this.total = response.total
          this.loading = false
          if (this.total === 0) {
            this.empty = true
          }
        })
        this.workOrderList = response.data
        this.total = response.total
        this.loading = false
        if (this.total === 0) {
          this.empty = true
        }
      })
      //   .catch(error => {
      //   //避免防重提卡在加载
@@ -945,7 +976,12 @@
        ...this.queryParams
      }, `work-order_${new Date().getTime()}.xlsx`)
    }
  }
  },
  computed: {
    totalWorkOrders() {
      return this.unitList.reduce((total, item) => total + item.workOrderCount, 0);
    },
  },
}
</script>
@@ -1015,4 +1051,5 @@
::v-deep el-step__description.is-finish {
  color: gray;
}
</style>