From 4cb674c3e4323140506bdd744f1a4b7b8bc64715 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期六, 24 八月 2024 14:14:21 +0800
Subject: [PATCH] refactor:大屏样式

---
 src/views/system/data-manage/data-detail/index.vue |  137 +++++++++++++++++++++++----------------------
 1 files changed, 69 insertions(+), 68 deletions(-)

diff --git a/src/views/system/data-manage/data-detail/index.vue b/src/views/system/data-manage/data-detail/index.vue
index e48a562..50bffa7 100644
--- a/src/views/system/data-manage/data-detail/index.vue
+++ b/src/views/system/data-manage/data-detail/index.vue
@@ -1,48 +1,23 @@
 <template>
   <div class="app-container">
     <el-card class="box-card">
-      <el-row type="flex" align="middle" justify="space-between">
-        <el-col :span="2">
-          <div class="icon-container">
-            <i class="el-icon-wind-power"></i>
-          </div>
-        </el-col>
-        <el-col :span="2">
+      <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>
-            <div class="dashboard-item">
-              <h3 style="color: #5C9BF8">{{ totalKiosks }}</h3>
-              <p>鍗″彛鎬绘暟</p>
+            <div class="icon-container">
+              <i :class="card.icon"></i>
             </div>
           </div>
-        </el-col>
-        <el-col :span="2">
-          <div class="dashboard-item">
-            <h3>{{ uniqueKiosks }}</h3>
-            <p>涓嶅敮涓�鍗″彛鏁�</p>
+          <div v-for="data in card.dataList" class="dashboard-item" :key="data.label">
+            <div style="color: #5C9BF8;margin-bottom: 20px;font-size: 20px">{{ data.value }}</div>
+            <div>{{ data.label }}</div>
           </div>
-        </el-col>
-        <el-col :span="1">
-          <div class="dashboard-item">
-            <div style="width: 1px;height: 55px;border: 1px solid #D7EBFA;margin: 20px;"></div>
-          </div>
-        </el-col>
-        <el-col :span="2">
-          <div class="icon-container">
-            <i class="el-icon-truck"></i>
-          </div>
-        </el-col>
-        <el-col :span="2">
-          <div class="dashboard-item">
-            <h3 style="color: #5C9BF8">{{ totalCarData }}</h3>
-            <p>杩囪溅鏁版嵁鎬婚噺</p>
-          </div>
-        </el-col>
-        <el-col :span="2">
-          <div class="dashboard-item">
-            <h3>{{ uniqueCarData }}</h3>
-            <p>涓嶅敮涓�鏁版嵁閲�</p>
-          </div>
-        </el-col>
+        </div>
+        <!--        <el-col :span="1">-->
+        <!--          <div class="dashboard-item">-->
+        <!--            <div style="width: 1px;height: 55px;border: 1px solid #D7EBFA;margin: 20px;"></div>-->
+        <!--          </div>-->
+        <!--        </el-col>-->
         <el-col :span="8"></el-col>
       </el-row>
     </el-card>
@@ -61,31 +36,32 @@
       </el-form-item>
     </el-form>
 
-    <el-row :gutter="10" class="mb8">
+    <el-row :gutter="10" class="mb8" v-show = "index === 'platform_online'">
+<!--      <el-col :span="1.5">-->
+<!--        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"-->
+<!--          v-hasPermi="['platform:platform:add']">鏂板</el-button>-->
+<!--      </el-col>-->
+<!--      <el-col :span="1.5">-->
+<!--        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"-->
+<!--          v-hasPermi="['platform:platform:edit']">淇敼</el-button>-->
+<!--      </el-col>-->
+<!--      <el-col :span="1.5">-->
+<!--        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"-->
+<!--          v-hasPermi="['platform:platform:remove']">鍒犻櫎</el-button>-->
+<!--      </el-col>-->
+<!--      <el-col :span="1.5">-->
+<!--        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"-->
+<!--          v-hasPermi="['platform:platform:export']">瀵煎嚭</el-button>-->
+<!--      </el-col>-->
       <el-col :span="1.5">
-        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
-          v-hasPermi="['platform:platform:add']">鏂板</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
-          v-hasPermi="['platform:platform:edit']">淇敼</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
-          v-hasPermi="['platform:platform:remove']">鍒犻櫎</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
-          v-hasPermi="['platform:platform:export']">瀵煎嚭</el-button>
+        <el-button  type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
+                   v-hasPermi="['platform:platform:export']">瀵煎叆</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
     <el-table v-loading="loading" :data="platformList" @selection-change="handleSelectionChange">
-      <template v-for="(item, index) in tableHead">
-        <el-table-column :key="item.name" :prop="item.prop" :label="item.label">
-        </el-table-column>
-      </template>
+      <el-table-column :prop="item.prop" :label="item.label" v-for="(item, index) in tableHead" :key="index" />
 
       <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
@@ -120,15 +96,15 @@
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
         <el-button @click="cancel">鍙� 娑�</el-button>
+        <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
       </div>
     </el-dialog>
   </div>
 </template>
 
 <script>
-import { listPlatform, getPlatform, delPlatform, addPlatform, updatePlatform } from "@/api/platform/vehicle-data-monitor";
+import { dataCenter } from "@/api/platform/data-center";
 import { videoData, carData, faceData, equipment } from "./list";
 import store from '@/store';
 
@@ -177,7 +153,9 @@
           { required: true, message: "鍗″彛缂栧彿涓嶈兘涓虹┖", trigger: "blur" }
         ],
       },
-      tableHead: []
+      tableHead: [],
+      cardList: [],
+      index: null
     };
   },
   beforeRouteEnter(to, from, next) {
@@ -185,18 +163,36 @@
     next();
   },
   created() {
-    if (this.$route.query.type === '1') this.tableHead = videoData[this.$route.query.index].columns;
-    if (this.$route.query.type === '2') this.tableHead = carData[this.$route.query.index].columns;
-    if (this.$route.query.type === '3') this.tableHead = faceData[this.$route.query.index].columns;
-    if (this.$route.query.type === '4') this.tableHead = equipment[this.$route.query.index].columns;
+    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]
+      this.tableHead = data.columns;
+      this.cardList = data.card;
+    }
+    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;
+    }
+    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;
+    }
+    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.getList();
   },
   methods: {
     /** 鏌ヨ鍗″彛杩囪溅鏁版嵁涓�鑷存�у垪琛� */
     getList() {
+      let url = this.$route.query.url;
       this.loading = true;
-      listPlatform(this.queryParams).then(response => {
-        this.platformList = response.rows;
+      dataCenter(url, this.queryParams).then(response => {
+        this.platformList = response.data;
         this.total = response.total;
         this.loading = false;
       });
@@ -303,9 +299,10 @@
 
 .icon-container {
   display: flex;
+  flex-direction: row;
   justify-content: center;
   align-items: center;
-  border-radius: 20px;
+  border-radius: 10px;
   width: 20%;
   height: 80px;
   margin-left: 5%;
@@ -321,6 +318,10 @@
 }
 
 .dashboard-item {
-  text-align: center;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+  width: 150px;
 }
 </style>

--
Gitblit v1.8.0