From b3be6406c8105376eef209af3bd6635cb95fa81d Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期二, 24 九月 2024 12:15:22 +0800
Subject: [PATCH] 增加部级考核标签

---
 src/views/system/monitor/car/index.vue |  150 +++++++++++++++++++++++++++++--------------------
 1 files changed, 89 insertions(+), 61 deletions(-)

diff --git a/src/views/system/monitor/car/index.vue b/src/views/system/monitor/car/index.vue
index 09caedc..d5fe796 100644
--- a/src/views/system/monitor/car/index.vue
+++ b/src/views/system/monitor/car/index.vue
@@ -1,16 +1,19 @@
 <template>
   <div class="app-container">
     <div
-      style="display: flex;flex-direction: row;min-width: 158px;max-width: 158px;margin-bottom: 5px;border-radius: 1px; user-select: none"
+      style="display: flex;flex-direction: row;min-width: 300px;max-width: 300px;margin-bottom: 5px;border-radius: 1px; user-select: none"
     >
       <div @click="clickTab(null)" class="tab"
-           :class="{tabActive: null == queryParams.provinceTag, tabInactive: null != queryParams.provinceTag}">鍏ㄩ儴
+           :class="{tabActive: !queryParams.provinceTag && !queryParams.deptTag, tabInactive: queryParams.provinceTag || queryParams.deptTag}">鍏ㄩ儴
       </div>
       <div @click="clickTab(0)" class="tab"
-           :class="{tabActive: 0 === queryParams.provinceTag, tabInactive: 0 !== queryParams.provinceTag}">鐪佸巺鑰冩牳
+           :class="{tabActive: queryParams.provinceTag, tabInactive: !queryParams.provinceTag}">鐪佸巺鑰冩牳
+      </div>
+      <div @click="clickTab(1)" class="tab"
+           :class="{tabActive: queryParams.deptTag, tabInactive: !queryParams.deptTag}">鍏畨閮ㄨ�冩牳
       </div>
     </div>
-    <el-card class="box-card" >
+    <el-card class="box-card">
       <el-row type="flex" align="middle" justify="space-between">
         <el-col :span="4">
           <div class="icon-container" style="background-color: #1890FF">
@@ -21,19 +24,19 @@
           <div class="dashboard">
             <div class="dashboard-item">
               <h3 style="color: #5C9BF8">{{ count.totalPosts }}</h3>
-              <p>璁惧鎬绘暟</p >
+              <p>璁惧鎬绘暟</p>
             </div>
             <div class="dashboard-item">
               <h3 style="color: #3eba45">{{ count.totalMembers }}</h3>
-              <p>姝e父鏁�</p >
+              <p>姝e父鏁�</p>
             </div>
             <div class="dashboard-item">
               <h3 style="color: #fe640d">{{ count.postsPercentage }}</h3>
-              <p>寮傚父鏁�</p >
+              <p>寮傚父鏁�</p>
             </div>
             <div class="dashboard-item">
               <h3>{{ count.viewsPercentage }}%</h3>
-              <p>璁惧杩愯鐜�</p >
+              <p>璁惧杩愯鐜�</p>
             </div>
           </div>
         </el-col>
@@ -56,7 +59,7 @@
           clearable
           @change="handleQuery"
         >
-        <el-option
+          <el-option
             v-for="dept in deptList"
             :key="dept.deptId"
             :label="dept.area"
@@ -71,12 +74,12 @@
           clearable
           style="width: 100px"
         >
-        <el-option
-          v-for="dict in dict.type.camera_state"
-          :key="dict.value"
-          :label="dict.label"
-          :value="dict.value"
-        />
+          <el-option
+            v-for="dict in dict.type.camera_state"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
         </el-select>
       </el-form-item>
 
@@ -93,16 +96,22 @@
       <el-table-column label="ip" align="center" prop="ip" width="180"/>
       <el-table-column label="鏍囩" align="center" width="180" v-if="columns[0].visible">
         <template slot-scope="scope">
-          <div>{{ scope.row.provinceTag == 0 ? "鐪佸巺" : "甯傚眬" }}</div>
+          <div>
+            {{
+              (
+                (scope.row.provinceTag ? '鐪佸巺銆�' : '') +
+                (scope.row.deptTag ? '鍏畨閮ㄣ��' : '')).replace(/銆�$/, '')
+            }}
+          </div>
         </template>
       </el-table-column>
-      <el-table-column label="鍖哄煙" align="center" prop="area" width="180" v-if="columns[1].visible" />
+      <el-table-column label="鍖哄煙" align="center" prop="area" width="180" v-if="columns[1].visible"/>
       <el-table-column label="璁惧鐘舵��" align="center" prop="onState" v-if="columns[2].visible">
-      <template slot-scope="scope">
-        <dict-tag :options="dict.type.camera_state" :value="scope.row.onState"/>
-      </template>
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.camera_state" :value="scope.row.onState"/>
+        </template>
       </el-table-column>
-      <el-table-column label="鏄惁鐢熸垚寮傚父宸ュ崟" align="center" prop="error" width="180" v-if="columns[3].visible" />
+      <el-table-column label="鏄惁鐢熸垚寮傚父宸ュ崟" align="center" prop="error" width="180" v-if="columns[3].visible"/>
       <el-table-column label="绠$悊鍗曚綅" align="center" prop="unitName" width="180" v-if="columns[4].visible"/>
       <el-table-column label="鏁版嵁鏃堕棿" align="center" prop="mongoCreateTime" width="180" v-if="columns[5].visible"/>
       <el-table-column label="涓�鏈轰竴妗g姸鎬�" align="center" prop="monitorQualify" width="180" v-if="columns[6].visible">
@@ -125,19 +134,21 @@
       <el-table-column label="褰撴棩鎶撴媿閲�" align="center" prop="snapCount" width="180" v-if="columns[9].visible"/>
       <el-table-column label="鏃堕挓鍑嗙‘鐜�" align="center" prop="clockPercent" width="180" v-if="columns[10].visible"/>
       <el-table-column label="涓婁紶鍙婃椂鐜�" align="center" prop="uploadPercent" width="180" v-if="columns[11].visible"/>
-      <el-table-column label="涓昏灞炴�т竴鑷寸巼" align="center" prop="importantConPercent" width="180" v-if="columns[12].visible"/>
+      <el-table-column label="涓昏灞炴�т竴鑷寸巼" align="center" prop="importantConPercent" width="180"
+                       v-if="columns[12].visible"/>
       <el-table-column label="鍏ㄩ噺灞炴�т竴鑷寸巼" align="center" prop="majorConPercent" width="180" v-if="columns[13].visible"/>
       <el-table-column label="澶у浘鍙敤鐜�" align="center" prop="bigUsefulPercent" width="180" v-if="columns[14].visible"/>
       <el-table-column label="url鍙敤鐜�" align="center" prop="urlPercent" width="180" v-if="columns[15].visible"/>
-      <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"  fixed="right">
-          <template slot-scope="scope">
-            <el-button
-              size="mini"
-              type="text"
-              icon="el-icon-view"
-              @click="handleView(scope.row,scope.index)"
-            >璇︾粏</el-button>
-          </template>
+      <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width" fixed="right">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-view"
+            @click="handleView(scope.row,scope.index)"
+          >璇︾粏
+          </el-button>
+        </template>
       </el-table-column>
     </el-table>
 
@@ -156,7 +167,12 @@
           <el-form-item label="璁惧鍚嶇О锛�">{{ form.name }}</el-form-item>
           <el-col :span="12">
             <el-form-item label="璁惧缂栫爜锛�">{{ form.serialNumber }}</el-form-item>
-            <el-form-item label="鏍囩锛�">{{ form.provinceTag == 0 ? '鐪佸巺' : '甯傚眬' }}</el-form-item>
+            <el-form-item label="鏍囩锛�">
+              {{
+                ((form.provinceTag ? '鐪佸巺銆�' : '') +
+                  (form.deptTag ? '鍏畨閮ㄣ��' : '')).replace(/銆�$/, '')
+              }}
+            </el-form-item>
             <el-form-item label="璁惧鐘舵�侊細">
               <div v-if="form.onState === 0">绂荤嚎</div>
               <div v-else-if="form.onState === 1">鍦ㄧ嚎</div>
@@ -216,32 +232,33 @@
 </template>
 
 <script>
-import { videoCount, listMonitor, getMonitor, delMonitor, addMonitor, updateMonitor } from "@/api/platform/monitor";
-import { listDept } from "@/api/system/dept";
+import {videoCount, listMonitor, getMonitor, delMonitor, addMonitor, updateMonitor} from "@/api/platform/monitor";
+import {listDept} from "@/api/system/dept";
+
 export default {
   name: "Monitor",
-  dicts: ['sys_normal_disable','platform_yes_no','camera_state'],
+  dicts: ['sys_normal_disable', 'platform_yes_no', 'camera_state'],
   data() {
     return {
       deptList: [],
       // 鍒椾俊鎭�
       columns: [
-        { key: 0, label: `鏍囩`, visible: true },
-        { key: 1, label: `鍖哄煙`, visible: true },
-        { key: 2, label: `璁惧鐘舵�乣, visible: true },
-        { key: 3, label: `鏄惁鐢熸垚寮傚父宸ュ崟`, visible: true },
-        { key: 4, label: `绠$悊鍗曚綅`, visible: true },
-        { key: 5, label: `鏁版嵁鏃堕棿`, visible: false },
-        { key: 6, label: `涓�鏈轰竴妗g姸鎬乣, visible: false },
-        { key: 7, label: `鏄惁涓烘湭娉ㄥ唽璁惧`, visible: false },
-        { key: 8, label: `鎶撴媿鏁版嵁閲忕洃娴媊, visible: false },
-        { key: 9, label: `褰撴棩鎶撴媿閲廯, visible: false },
-        { key: 10, label: `鏃堕挓鍑嗙‘鐜嘸, visible: false },
-        { key: 11, label: `涓婁紶鍙婃椂鐜嘸, visible: false },
-        { key: 12, label: `涓昏灞炴�т竴鑷寸巼`, visible: false },
-        { key: 13, label: `鍏ㄩ噺灞炴�т竴鑷寸巼`, visible: false },
-        { key: 14, label: `鍥剧墖璁块棶寮傚父閲廯, visible: false },
-        { key: 15, label: `澶у浘涓嶅彲鐢ㄩ噺`, visible: false }
+        {key: 0, label: `鏍囩`, visible: true},
+        {key: 1, label: `鍖哄煙`, visible: true},
+        {key: 2, label: `璁惧鐘舵�乣, visible: true},
+        {key: 3, label: `鏄惁鐢熸垚寮傚父宸ュ崟`, visible: true},
+        {key: 4, label: `绠$悊鍗曚綅`, visible: true},
+        {key: 5, label: `鏁版嵁鏃堕棿`, visible: false},
+        {key: 6, label: `涓�鏈轰竴妗g姸鎬乣, visible: false},
+        {key: 7, label: `鏄惁涓烘湭娉ㄥ唽璁惧`, visible: false},
+        {key: 8, label: `鎶撴媿鏁版嵁閲忕洃娴媊, visible: false},
+        {key: 9, label: `褰撴棩鎶撴媿閲廯, visible: false},
+        {key: 10, label: `鏃堕挓鍑嗙‘鐜嘸, visible: false},
+        {key: 11, label: `涓婁紶鍙婃椂鐜嘸, visible: false},
+        {key: 12, label: `涓昏灞炴�т竴鑷寸巼`, visible: false},
+        {key: 13, label: `鍏ㄩ噺灞炴�т竴鑷寸巼`, visible: false},
+        {key: 14, label: `鍥剧墖璁块棶寮傚父閲廯, visible: false},
+        {key: 15, label: `澶у浘涓嶅彲鐢ㄩ噺`, visible: false}
       ],
       count: {
         totalPosts: 0,
@@ -287,16 +304,16 @@
       // 琛ㄥ崟鏍¢獙
       rules: {
         serialNumber: [
-          { required: true, message: "璁惧缂栫爜涓嶈兘涓虹┖", trigger: "blur" }
+          {required: true, message: "璁惧缂栫爜涓嶈兘涓虹┖", trigger: "blur"}
         ],
         name: [
-          { required: true, message: "璁惧鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }
+          {required: true, message: "璁惧鍚嶇О涓嶈兘涓虹┖", trigger: "blur"}
         ],
         onState: [
-          { required: true, message: "璁惧鐘舵��", trigger: "blur" }
+          {required: true, message: "璁惧鐘舵��", trigger: "blur"}
         ],
         address: [
-          { required: true, message: "鍦板潃涓嶈兘涓虹┖", trigger: "blur" }
+          {required: true, message: "鍦板潃涓嶈兘涓虹┖", trigger: "blur"}
         ],
       }
     };
@@ -304,13 +321,22 @@
   created() {
     this.getVideoCount();
     this.getList();
-    listDept({ status: 0 }).then(response => {
+    listDept({status: 0}).then(response => {
       this.deptList = response.data.filter(item => item.area);
     });
   },
   methods: {
     clickTab(active) {
-      this.queryParams.provinceTag = active
+      if (active === 0) {
+        this.queryParams.provinceTag = true
+        this.queryParams.deptTag =null
+      } else if (active === 1) {
+        this.queryParams.provinceTag = null
+        this.queryParams.deptTag = true
+      }else {
+        this.queryParams.provinceTag = null
+        this.queryParams.deptTag = null
+      }
       this.getList()
       this.getVideoCount()
     },
@@ -368,7 +394,7 @@
     // 澶氶�夋閫変腑鏁版嵁
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
+      this.single = selection.length !== 1
       this.multiple = !selection.length
     },
     /** 鏂板鎸夐挳鎿嶄綔 */
@@ -410,12 +436,13 @@
     /** 鍒犻櫎鎸夐挳鎿嶄綔 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      this.$modal.confirm('鏄惁纭鍒犻櫎璁惧璧勪骇缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function() {
+      this.$modal.confirm('鏄惁纭鍒犻櫎璁惧璧勪骇缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function () {
         return delMonitor(ids);
       }).then(() => {
         this.getList();
         this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-      }).catch(() => {});
+      }).catch(() => {
+      });
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
@@ -454,13 +481,13 @@
 }
 
 
-
 .box-card {
   background-color: #ffffff;
   width: 100%;
   margin-bottom: 20px;
   height: 120px
 }
+
 .icon-container {
   display: flex;
   justify-content: center;
@@ -470,6 +497,7 @@
   height: 80px;
   margin-left: 5%;
 }
+
 .el-icon-truck {
   font-size: 50px;
   color: #FFFFFF;

--
Gitblit v1.8.0