From 323df6a80616eec19125feba8bdb47adb25334a0 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期四, 12 十二月 2024 00:59:09 +0800
Subject: [PATCH] 一机一档OSD

---
 src/views/system/data-manage/data-detail/index.vue |  283 +++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 187 insertions(+), 96 deletions(-)

diff --git a/src/views/system/data-manage/data-detail/index.vue b/src/views/system/data-manage/data-detail/index.vue
index 0f60c0a..99220e2 100644
--- a/src/views/system/data-manage/data-detail/index.vue
+++ b/src/views/system/data-manage/data-detail/index.vue
@@ -1,14 +1,31 @@
 <template>
   <div class="app-container">
+    <div
+      style="display: flex;flex-direction: row;min-width: 400px;max-width: 400px;margin-bottom: 5px;border-radius: 1px; user-select: none"
+      v-show="index !== 'image_resource_security'">
+      <div @click="clickTab(0)" class="tab"
+           :class="{tabActive: 0 === queryParams.dataType, tabInactive: 0 !== queryParams.dataType}">鍏ㄩ儴
+      </div>
+      <div @click="clickTab(1)" class="tab"
+           :class="{tabActive: 1 === queryParams.dataType, tabInactive: 1 !== queryParams.dataType}">鐪佸巺鑰冩牳
+      </div>
+      <div @click="clickTab(2)" class="tab"
+           :class="{tabActive: 2 === queryParams.dataType, tabInactive: 2 !== queryParams.dataType}">鍏畨閮ㄨ�冩牳
+      </div>
+    </div>
     <el-card class="box-card" v-show="index !== 'image_resource_security'">
       <el-row style="display: flex; flex-direction: row; align-items: center" justify="space-between">
-        <div v-for="card in cardList" style="display: flex;flex-direction: row; margin-right: 50px" :key="card.label">
+        <div style="font-size: 18px;min-width: 200px;height: 80px;display: flex;align-items: center">{{ ruleName }}
+        </div>
+        <div v-if="cardList && cardList.length > 0" v-for="card in cardList"
+             style="display: flex;flex-direction: row; margin-right: 50px;margin-left: 20px;align-items: center"
+             :key="card.label">
           <div>
             <div class="icon-container">
               <i :class="card.icon"></i>
             </div>
           </div>
-          <div v-if="card.dataList && card.dataList.length > 0">
+          <div v-if="card.dataList && card.dataList.length > 0" style="display: flex; flex-direction: row">
             <div v-if="data" v-for="(data, index) in card.dataList" class="dashboard-item" :key="data.label">
               <div style="color: #5C9BF8;margin-bottom: 20px;font-size: 20px">{{ tableData.count[index] }}</div>
               <div>{{ data.label }}</div>
@@ -24,34 +41,15 @@
         <el-col :span="8"></el-col>
       </el-row>
     </el-card>
-
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="鍏抽敭璇�" prop="bayonetNumber">
-        <el-input v-model="queryParams.keyword" placeholder="鍏抽敭璇嶆悳绱�" clearable
-          @keyup.enter.native="handleQuery" />
-      </el-form-item>
-      <el-form-item label="鏃堕棿鑼冨洿" prop="timeRange">
-        <el-date-picker
-          v-model="queryParams.timeRange"
-          type="daterange"
-          range-separator="鑷�"
-          start-placeholder="寮�濮嬫棩鏈�"
-          end-placeholder="缁撴潫鏃ユ湡">
-        </el-date-picker>
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">鎼滅储</el-button>
-        <el-button icon="el-icon-refresh" size="small" @click="resetQuery">閲嶇疆</el-button>
-      </el-form-item>
-    </el-form>
-
     <el-row :gutter="10" class="mb8" v-show="index === 'image_resource_security'">
       <el-container>
         <el-main>
           <h2>瑙嗛鍥惧儚璧勬簮瀹夊叏绠$悊</h2>
           <el-row :gutter="20">
-            <el-col :xl="3" :lg="3" :md="6" :sm="6" :xs="12" v-if="imageResourceSecurity && imageResourceSecurity.length > 0" v-for="(item, index) in imageResourceSecurity" :key="index"
-              class="col-margin">
+            <el-col :xl="3" :lg="3" :md="6" :sm="6" :xs="12"
+                    v-if="imageResourceSecurity && imageResourceSecurity.length > 0"
+                    v-for="(item, index) in imageResourceSecurity" :key="index"
+                    class="col-margin">
               <el-card style="
                 min-width: 150px;
                 width: 100%;
@@ -64,7 +62,7 @@
                   </el-button>
                 </div>
                 <div style="font-size: 14px;height: 50px; font-weight: bold;">{{ item.deptName }}</div>
-                <div style="font-size: 14px;">璧勬簮锛歿{ item.imageResourceSecurity }}</div>
+                <div style="font-size: 14px;">寰楀垎锛歿{ item.imageResourceSecurity }}</div>
                 <!-- <div style="font-size: 14px;">瑙嗛浼犺緭缃戣祫浜у噯纭巼锛歿{ item.propertyAccuracy }}</div>
                 <div style="font-size: 14px;">寮卞彛浠ゅ緱鍒嗭細{{ item.weakPassword }}</div>
                 <div style="font-size: 14px;">瑙嗛浼犺緭缃戝嵄闄╄祫浜ф瘮渚嬶細{{ item.riskProperty }}</div>
@@ -74,45 +72,84 @@
           </el-row>
         </el-main>
       </el-container>
-      <el-col :span="1.5">
-        <el-button type="primary" plain icon="el-icon-upload" size="mini" @click="handleExport"
-          v-hasPermi="['platform:platform:export']">瀵煎叆
-        </el-button>
-      </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
 
-    <div v-if="tableData.list && tableData.list.length >0">
+    </el-row>
+    <div style="display: flex;position: relative">
+      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
+        <el-form-item label="鍏抽敭瀛�" prop="bayonetNumber">
+          <el-input v-model="queryParams.keyword" placeholder="鍥芥爣鐮�/璁惧鍚�/ip鎼滅储" clearable @keyup.enter.native="handleQuery" @clear="handleQuery"/>
+        </el-form-item>
+        <el-form-item :label="this.optionsName" prop="option" v-show = "this.optionsStatus">
+          <el-select  v-model="queryParams.option" size="small" clearable @change="handleQuery">
+            <el-option v-for="option in options" :key="option.value" :label="option.label" :value="option.value"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="鏃堕棿" prop="date">
+            <el-date-picker
+              v-model="queryParams.date"
+              type="date"
+              placeholder="閫夋嫨鏃ユ湡"
+              value-format="yyyy-MM-dd"
+              @change="handleQuery">
+            </el-date-picker>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">鎼滅储</el-button>
+          <el-button icon="el-icon-refresh" size="small" @click="resetQuery">閲嶇疆</el-button>
+        </el-form-item>
+      </el-form>
+      <right-toolbar style="position: absolute;right: 0px" v-show="index !== 'image_resource_security'"  :showSearch.sync="showSearch" @queryTable="handleQuery"
+                     :columns="showList"></right-toolbar>
+    </div>
+
+    <div v-show="index === 'image_resource_security'" style="margin-bottom: 5px">
+        <el-button type="primary" plain icon="el-icon-upload" size="mini" @click="handleExport"
+                   v-hasPermi="['platform:platform:export']">瀵煎叆
+        </el-button>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </div>
+
+    <div>
       <el-table v-loading="loading" :data="tableData.list">
-        <el-table-column :prop="item.prop" :label="item.label" :width="item.width" v-for="(item, index) in tableHead" :key="index" v-if="item"/>
+<!--        <el-table-column :prop="item.prop" :label="item.label" :width="item.width" v-for="(item, index) in tableHead"-->
+<!--                         :key="index" v-if="showListPD(item)">-->
+        <el-table-column :prop="item.prop" :label="item.label" v-for="(item, index) in tableHead"
+                         :key="index" v-if="showListPD(item)">
+          <template slot-scope="scope">
+            <span :class="{'error-text': scope.row[item.error]}"> {{ scope.row[item.prop] }} </span>
+          </template>
+        </el-table-column>
       </el-table>
     </div>
-    <el-empty v-else description="鏆傛棤鏁版嵁"></el-empty>
 
     <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
-      @pagination="getList" />
+                @pagination="getList"/>
 
     <!-- 淇敼瑙嗛鍥惧儚璧勬簮瀹夊叏绠$悊瀵硅瘽妗� -->
     <el-dialog title="淇敼瑙嗛鍥惧儚璧勬簮瀹夊叏绠$悊" :visible.sync="resourceOpen" width="600px" append-to-body>
       <el-form ref="form" :model="resourceForm" :rules="rules" label-width="250px">
         <el-form-item label="閮ㄩ棬鍚嶇О" prop="deptName">
-          <el-input v-model="resourceForm.deptName" disabled />
+          <el-input v-model="resourceForm.deptName" disabled/>
         </el-form-item>
         <el-form-item label="骞冲彴杩愯鐜�" prop="platformOnline">
-          <el-input-number v-model="resourceForm.platformOnline" />
+          <el-input-number v-model="resourceForm.platformOnline" :precision="2" :step="0.1" :min="0" :max="1"/>
         </el-form-item>
         <el-form-item label="瑙嗛浼犺緭缃戣祫浜у噯纭巼" prop="propertyAccuracy">
-          <el-input-number v-model="resourceForm.propertyAccuracy" />
+          <el-input-number v-model="resourceForm.propertyAccuracy" :precision="2" :step="0.1" :min="0" :max="1"/>
         </el-form-item>
         <el-form-item label="寮卞彛浠ゅ緱鍒�" prop="weakPassword">
-          <el-input-number v-model="resourceForm.weakPassword" />
+          <el-input-number v-model="resourceForm.weakPassword" :precision="2" :step="0.1" :min="0" :max="1"/>
         </el-form-item>
         <el-form-item label="瑙嗛浼犺緭缃戝嵄闄╄祫浜ф瘮渚�" prop="riskProperty">
-          <el-input-number v-model="resourceForm.riskProperty" />
+          <el-input-number v-model="resourceForm.riskProperty" :precision="2" :step="0.1" :min="0" :max="1"/>
         </el-form-item>
-        <el-form-item label="瑙嗛浼犺緭缃戣竟鐣屽畬鏁存�ф娴嬫墸鍒嗛」" prop="boundaryIntegrity">
-          <el-input-number v-model="resourceForm.boundaryIntegrity" />
-        </el-form-item>
+        <el-tooltip class="item" effect="dark" content="杩濊杩炴帴浜掕仈缃戞墸鍑�20涓櫨鍒嗙偣/娆★紝杩濊鏃犵嚎AP鎺ュ叆銆侀殢韬玾ifi鎺ュ叆銆佸叡浜綉缁滃悇鎵e噺5涓櫨鍒嗙偣/娆★紝鐩磋嚦姝ら」鎸囨爣鎵e畬涓烘銆�"
+                    placement="top-start">
+          <el-form-item label="瑙嗛浼犺緭缃戣竟鐣屽畬鏁存�ф娴嬫墸鍒嗛」" prop="boundaryIntegrity">
+            <el-input-number v-model="resourceForm.boundaryIntegrity" :precision="2" :step="0.1" :min="0" :max="1"/>
+          </el-form-item>
+        </el-tooltip>
+
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button @click="cancelR">鍙� 娑�</el-button>
@@ -123,14 +160,15 @@
     <!-- 瀵煎叆瀵硅瘽妗� -->
     <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
       <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url"
-        :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess"
-        :auto-upload="false" drag>
+                 :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess"
+                 :auto-upload="false" drag>
         <i class="el-icon-upload"></i>
         <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
         <div class="el-upload__tip text-center" slot="tip">
           <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span>
           <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
-            @click="importTemplate">涓嬭浇妯℃澘</el-link>
+                   @click="importTemplate">涓嬭浇妯℃澘
+          </el-link>
         </div>
       </el-upload>
       <div slot="footer" class="dialog-footer">
@@ -143,33 +181,20 @@
 </template>
 
 <script>
-import { dataCenter } from "@/api/platform/data-center";
-import { videoData, carData, faceData, equipment } from "./list";
-import { listSecurity, updateSecurity } from '@/api/platform/resource-security';
-import { getToken } from "@/utils/auth";
+import {dataCenter} from "@/api/platform/data-center";
+import {carData, equipment, faceData, videoData} from "./list";
+import {listSecurity, updateSecurity} from '@/api/platform/resource-security';
+import {getToken} from "@/utils/auth";
+
 export default {
   name: "Platform",
-  // watch: {
-  //   tableData: {
-  //     immediate: true,
-  //     deep: true,
-  //     handler(newVal) {
-  //       if(newVal && newVal.list) {
-  //         this.list = newVal.detail;
-  //       }
-  //     }
-  //   }
-  // },
-  // computed: {
-  //   startTime() {
-  //     var date = new Date();
-  //     var s1 = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + (date.getDate()-1);
-  //     return s1;
-  //   }
-  // },
+  computed: {
+    ruleName() {
+      return this.$route.query.ruleName
+    }
+  },
   data() {
     return {
-      list: [],
       // 瀵煎叆鍙傛暟
       upload: {
         // 鏄惁鏄剧ず寮瑰嚭灞�
@@ -179,11 +204,12 @@
         // 鏄惁绂佺敤涓婁紶
         isUploading: false,
         // 璁剧疆涓婁紶鐨勮姹傚ご閮�
-        headers: { Authorization: "Bearer " + getToken() },
+        headers: {Authorization: "Bearer " + getToken()},
         // 涓婁紶鐨勫湴鍧�
         url: process.env.VUE_APP_BASE_API + "/platform/resourceSecurity/importData"
       },
       imageResourceSecurity: [],
+      options: [],
       resourceForm: {},
       resourceOpen: false,
       totalKiosks: 1157,
@@ -214,76 +240,117 @@
         pageNum: 1,
         pageSize: 10,
         keyword: '',
-        timeRange: [],
+        date: '',
+        dataType: 0,
+        option: null,
       },
       // 琛ㄥ崟鍙傛暟
       form: {},
       // 琛ㄥ崟鏍¢獙
       rules: {
         platformOnline: [
-          { required: true, message: "璇疯緭鍏ュ钩鍙拌繍琛岀巼", trigger: "blur" },
-          { type: "number", message: "骞冲彴杩愯鐜囧繀椤讳负鏁板瓧", trigger: "blur" }
+          {required: true, message: "璇疯緭鍏ュ钩鍙拌繍琛岀巼", trigger: "blur"},
+          {type: "number", message: "骞冲彴杩愯鐜囧繀椤讳负鏁板瓧", trigger: "blur"}
         ],
         propertyAccuracy: [
-          { required: true, message: "璇疯緭鍏ヨ棰戜紶杈撶綉璧勪骇鍑嗙‘鐜�", trigger: "blur" },
-          { type: "number", message: "瑙嗛浼犺緭缃戣祫浜у噯纭巼蹇呴』涓烘暟瀛�", trigger: "blur" }
+          {required: true, message: "璇疯緭鍏ヨ棰戜紶杈撶綉璧勪骇鍑嗙‘鐜�", trigger: "blur"},
+          {type: "number", message: "瑙嗛浼犺緭缃戣祫浜у噯纭巼蹇呴』涓烘暟瀛�", trigger: "blur"}
         ],
         riskProperty: [
-          { required: true, message: "璇疯緭鍏ュ急鍙d护寰楀垎", trigger: "blur" },
-          { type: "number", message: "寮卞彛浠ゅ緱鍒嗗繀椤讳负鏁板瓧", trigger: "blur" }
+          {required: true, message: "璇疯緭鍏ュ急鍙d护寰楀垎", trigger: "blur"},
+          {type: "number", message: "寮卞彛浠ゅ緱鍒嗗繀椤讳负鏁板瓧", trigger: "blur"}
         ],
         boundaryIntegrity: [
-          { required: true, message: "璇疯緭鍏ヨ棰戜紶杈撶綉鍗遍櫓璧勪骇姣斾緥", trigger: "blur" },
-          { type: "number", message: "瑙嗛浼犺緭缃戝嵄闄╄祫浜ф瘮渚嬪繀椤讳负鏁板瓧", trigger: "blur" }
+          {required: true, message: "璇疯緭鍏ヨ棰戜紶杈撶綉鍗遍櫓璧勪骇姣斾緥", trigger: "blur"},
+          {type: "number", message: "瑙嗛浼犺緭缃戝嵄闄╄祫浜ф瘮渚嬪繀椤讳负鏁板瓧", trigger: "blur"}
         ],
 
       },
+      showList: [],
       tableHead: [],
       cardList: [],
       index: null
     };
   },
+
   mounted() {
+    //淇敼椤电鍚�
+    const obj = Object.assign({},this.$route,{title: this.$route.query.ruleName})
+    this.$tab.updatePage(obj);
     // 鑾峰彇褰撳墠鏃ユ湡
     const today = new Date();
 
-    // 灏嗘棩鏈熷噺鍘讳竴澶�
-    const yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1000);
-
     // 鑾峰彇骞淬�佹湀銆佹棩
-    const year = yesterday.getFullYear();
-    let month = (yesterday.getMonth() + 1).toString().padStart(2, '0'); // 鏈堜唤鏄粠0寮�濮嬬殑锛屾墍浠ュ姞1
-    let day = yesterday.getDate().toString().padStart(2, '0');
+    const year = today.getFullYear();
+    let month = (today.getMonth() + 1).toString().padStart(2, '0'); // 鏈堜唤鏄粠0寮�濮嬬殑锛屾墍浠ュ姞1
+    let day = today.getDate().toString().padStart(2, '0');
 
     // 鎷兼帴鎴� yyyy-MM-dd 鏍煎紡
-    let yesterday1 =  `${year}-${month}-${day}`;
-    this.queryParams.timeRange = [yesterday1, yesterday1]
+    this.queryParams.date = `${year}-${month}-${day}`;
     this.index = this.$route.query.index;
     if (this.$route.query.type === '1') {
       let data = videoData.table.filter(item => item.index === this.$route.query.index)[0]
-
+      // if(this.index = 'monitor_qualification'){
+      //
+      // }
       this.tableHead = data.columns;
       this.cardList = data.card;
-      console.log(this.cardList, "wcnm")
+      this.showList = data.showList;
+      this.optionsStatus = data.optionsStatus;
+      this.options = data.options;
+      this.optionsName = data.optionsName;
     }
     if (this.$route.query.type === '2') {
       let data = carData.table.filter(item => item.index === this.$route.query.index)[0]
       this.tableHead = data.columns;
       this.cardList = data.card;
+      this.showList = data.showList;
+      this.optionsStatus = data.optionsStatus;
+      this.options = data.options;
+      this.optionsName = data.optionsName;
     }
     if (this.$route.query.type === '3') {
       let data = faceData.table.filter(item => item.index === this.$route.query.index)[0]
       this.tableHead = data.columns;
       this.cardList = data.card;
+      this.showList = data.showList;
+      this.optionsStatus = data.optionsStatus;
+      this.options = data.options;
+      this.optionsName = data.optionsName;
     }
     if (this.$route.query.type === '4') {
       let data = equipment.table.filter(item => item.index === this.$route.query.index)[0]
       this.tableHead = data.columns;
       this.cardList = data.card;
+      this.showList = data.showList;
+      this.optionsStatus = data.optionsStatus;
+      this.options = data.options;
+      this.optionsName = data.optionsName;
     }
     this.getList();
   },
   methods: {
+    getColor(value, prop) {
+
+      // 榛樿棰滆壊
+      return 'red';
+    },
+    clickTab(active) {
+      this.queryParams.dataType = active
+      this.getList()
+    },
+    showListPD(item) {
+      if (!this.showList) {
+        return true
+      }
+      let arr = this.showList.filter(d => d.label === item.label)
+      if (item && (!arr || arr.length < 1)) {
+        return true;
+      } else {
+        return item && arr && arr.length > 0 && arr[0].visible
+      }
+
+    },
     /** 淇敼鎸夐挳鎿嶄綔 */
     handleResourceUpdate(row) {
       this.reset("resourceForm");
@@ -322,12 +389,8 @@
       if (this.index === 'image_resource_security') {
         this.getSecurityCard()
       }
-      if (this.queryParams.timeRange && this.queryParams.timeRange.length > 0) {
-        this.queryParams.startTime = this.queryParams.timeRange[0]
-        this.queryParams.endTime = this.queryParams.timeRange[1]
-      }
       dataCenter(url, this.queryParams).then(response => {
-        response.data.list = response.data.list && response.data.list.length >0 ? response.data.list : []
+        response.data.list = response.data.list && response.data.list.length > 0 ? response.data.list : []
         this.tableData = response.data;
         this.total = response.total;
         this.loading = false;
@@ -394,6 +457,33 @@
 };
 </script>
 <style scoped>
+.tab {
+  padding: 5px 15px;
+}
+.error-text {
+  color: red;
+}
+.tab:hover {
+  cursor: pointer;
+  user-select: none;
+}
+
+.tabActive {
+  color: white;
+  background-color: #409eff;
+  border: none;
+  border-radius: 1px;
+}
+
+.tabInactive {
+  background-color: #edf2f6;
+  color: #409eff;
+}
+
+.tabInactive:hover {
+  background-color: #edf2f6;
+}
+
 .box-card {
   background-color: #F5F9FE;
   width: 100%;
@@ -427,5 +517,6 @@
   justify-content: center;
   align-items: center;
   width: 150px;
+  margin: 0 30px;
 }
 </style>

--
Gitblit v1.8.0