From 23abf3c8d6ca9577608a3d5ab207d0da67e6e752 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期三, 06 十一月 2024 16:47:58 +0800
Subject: [PATCH] 搜索样式功能统一、一些搜索bug

---
 src/views/system/work-order/index.vue |   75 ++++++++++++++++++++++++++++---------
 1 files changed, 56 insertions(+), 19 deletions(-)

diff --git a/src/views/system/work-order/index.vue b/src/views/system/work-order/index.vue
index 0cd1e06..5c47a9e 100644
--- a/src/views/system/work-order/index.vue
+++ b/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>

--
Gitblit v1.8.0