From d99bccb76958bd1fdda7485b7662a52e8608f9e6 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期一, 26 八月 2024 18:29:31 +0800
Subject: [PATCH] 图像资源

---
 src/views/system/data-manage/data-detail/index.vue |  214 +++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 158 insertions(+), 56 deletions(-)

diff --git a/src/views/system/data-manage/data-detail/index.vue b/src/views/system/data-manage/data-detail/index.vue
index 7db03b7..c26388a 100644
--- a/src/views/system/data-manage/data-detail/index.vue
+++ b/src/views/system/data-manage/data-detail/index.vue
@@ -37,65 +37,69 @@
     <!--    </el-form>-->
 
     <el-row :gutter="10" class="mb8" v-show="index === 'image_resource_security'">
-      <!--      <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-container>
+        <el-main>
+          <h2>瑙嗛鍥惧儚璧勬簮瀹夊叏绠$悊</h2>
+          <el-row :gutter="20">
+            <el-col :xl="3" :lg="3" :md="6" :sm="6" :xs="12" v-for="(item, index) in imageResourceSecurity" :key="index"
+              class="col-margin">
+              <el-card style="
+                min-width: 150px;
+                width: 100%;
+                height: 150px;
+                text-align: center;
+                margin-bottom: 20px;
+              ">
+                <div style="display: flex; flex-direction: row-reverse">
+                  <el-button size="mini" type="text" icon="el-icon-edit" @click="handleResourceUpdate(item)">淇敼
+                  </el-button>
+                </div>
+                <div style="font-size: 14px;height: 50px; font-weight: bold;">閮ㄩ棬鍚嶇О锛歿{ 0 }}</div>
+                <div style="font-size: 14px;">骞冲彴杩愯鐜囷細{{ 1 }}</div>
+                <div style="font-size: 14px;">瑙嗛浼犺緭缃戣祫浜у噯纭巼锛歿{ 1 }}</div>
+                <div style="font-size: 14px;">寮卞彛浠ゅ緱鍒嗭細{{ 1 }}</div>
+                <div style="font-size: 14px;">瑙嗛浼犺緭缃戝嵄闄╄祫浜ф瘮渚嬶細{{ 1 }}</div>
+                <div style="font-size: 14px;">瑙嗛浼犺緭缃戣竟鐣屽畬鏁存�ф娴嬫墸鍒嗛」锛歿{ 1 }}</div>
+              </el-card>
+            </el-col>
+          </el-row>
+        </el-main>
+      </el-container>
       <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 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>
 
     <el-table v-loading="loading" :data="platformList" @selection-change="handleSelectionChange">
-      <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">
-          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
-                     v-hasPermi="['platform:platform:edit']">淇敼
-          </el-button>
-          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
-                     v-hasPermi="['platform:platform:remove']">鍒犻櫎
-          </el-button>
-        </template>
-      </el-table-column>
+      <el-table-column :prop="item.prop" :label="item.label" v-for="(item, index) in tableHead" :key="index" />
     </el-table>
 
     <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
-                @pagination="getList"/>
+      @pagination="getList" />
 
-    <!-- 娣诲姞鎴栦慨鏀瑰崱鍙h繃杞︽暟鎹竴鑷存�у璇濇 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="鍗″彛鍚嶇О" prop="bayonetName">
-          <el-input v-model="form.bayonetName" placeholder="璇疯緭鍏ュ崱鍙e悕绉�"/>
+    <!-- 淇敼瑙嗛鍥惧儚璧勬簮瀹夊叏绠$悊瀵硅瘽妗� -->
+    <el-dialog title="淇敼瑙嗛鍥惧儚璧勬簮瀹夊叏绠$悊" :visible.sync="resourceOpen" width="600px" append-to-body>
+      <el-form ref="form" :model="resourceForm" :rules="rules" label-width="80px">
+        <el-form-item label="閮ㄩ棬鍚嶇О" prop="deptName">
+          <el-input v-model="resourceForm.deptName" disabled />
         </el-form-item>
-        <el-form-item label="鍗″彛缂栧彿" prop="bayonetNumber">
-          <el-input v-model="form.bayonetNumber" placeholder="璇疯緭鍏ュ崱鍙g紪鍙�"/>
+        <el-form-item label="瑙勫垯鏉冮噸" prop="platformOnline">
+          <el-input-number v-model="resourceForm.platformOnline" />
         </el-form-item>
-        <el-form-item label="杩囪溅鏁版嵁閲�" prop="vehicleDataNumber">
-          <el-input v-model="form.vehicleDataNumber" placeholder="璇疯緭鍏ヨ繃杞︽暟鎹噺"/>
+        <el-form-item label="瑙嗛浼犺緭缃戣祫浜у噯纭巼" prop="propertyAccuracy">
+          <el-input-number v-model="resourceForm.propertyAccuracy" />
         </el-form-item>
-        <el-form-item label="涓嶅敮涓�鏁版嵁 " prop="notUniqueData">
-          <el-input v-model="form.notUniqueData" placeholder="璇疯緭鍏ヤ笉鍞竴鏁版嵁 "/>
+        <el-form-item label="寮卞彛浠ゅ緱鍒�" prop="riskProperty">
+          <el-input-number v-model="resourceForm.riskProperty" />
         </el-form-item>
-        <el-form-item label="涓嶅敮涓�鏁版嵁閲�" prop="notUniqueDataNumber">
-          <el-input v-model="form.notUniqueDataNumber" placeholder="璇疯緭鍏ヤ笉鍞竴鏁版嵁閲�"/>
+        <el-form-item label="瑙嗛浼犺緭缃戝嵄闄╄祫浜ф瘮渚�" prop="boundaryIntegrity">
+          <el-input-number v-model="resourceForm.boundaryIntegrity" />
+        </el-form-item>
+        <el-form-item label="瑙嗛浼犺緭缃戣竟鐣屽畬鏁存�ф娴嬫墸鍒嗛」" prop="boundaryIntegrity">
+          <el-input-number v-model="resourceForm.boundaryIntegrity" />
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -103,18 +107,54 @@
         <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
       </div>
     </el-dialog>
+
+    <!-- 瀵煎叆瀵硅瘽妗� -->
+    <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>
+        <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>
+        </div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="upload.open = false">鍙� 娑�</el-button>
+        <el-button type="primary" @click="submitFileForm">纭� 瀹�</el-button>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 
 <script>
-import {dataCenter} from "@/api/platform/data-center";
-import {videoData, carData, faceData, equipment} from "./list";
-import store from '@/store';
-
+import { dataCenter } from "@/api/platform/data-center";
+import { videoData, carData, faceData, equipment } from "./list";
+import { listSecurity } from '@/api/platform/resource-security';
+import { getToken } from "@/utils/auth";
 export default {
   name: "Platform",
   data() {
     return {
+      // 瀵煎叆鍙傛暟
+      upload: {
+        // 鏄惁鏄剧ず寮瑰嚭灞�
+        open: false,
+        // 寮瑰嚭灞傛爣棰�
+        title: "",
+        // 鏄惁绂佺敤涓婁紶
+        isUploading: false,
+        // 璁剧疆涓婁紶鐨勮姹傚ご閮�
+        headers: { Authorization: "Bearer " + getToken() },
+        // 涓婁紶鐨勫湴鍧�
+        url: process.env.VUE_APP_BASE_API + "/platform/resourceSecurity/importData"
+      },
+      imageResourceSecurity: [],
+      resourceForm: {},
+      resourceOpen: false,
       totalKiosks: 1157,
       uniqueKiosks: 580,
       totalCarData: 1477422,
@@ -149,12 +189,26 @@
       form: {},
       // 琛ㄥ崟鏍¢獙
       rules: {
-        bayonetName: [
-          {required: true, message: "鍗″彛鍚嶇О涓嶈兘涓虹┖", trigger: "blur"}
+        platformOnline: [
+          { required: true, message: "璇疯緭鍏ュ钩鍙拌繍琛岀巼", trigger: "blur" },
+          { type: "number", message: "骞冲彴杩愯鐜囧繀椤讳负鏁板瓧", trigger: "blur" }
         ],
-        bayonetNumber: [
-          {required: true, message: "鍗″彛缂栧彿涓嶈兘涓虹┖", trigger: "blur"}
+        propertyAccuracy: [
+          { required: true, message: "璇疯緭鍏ヨ棰戜紶杈撶綉璧勪骇鍑嗙‘鐜�", trigger: "blur" },
+          { type: "number", message: "瑙嗛浼犺緭缃戣祫浜у噯纭巼蹇呴』涓烘暟瀛�", trigger: "blur" }
         ],
+        riskProperty: [
+          { required: true, message: "璇疯緭鍏ュ急鍙d护寰楀垎", trigger: "blur" },
+          { type: "number", message: "寮卞彛浠ゅ緱鍒嗗繀椤讳负鏁板瓧", trigger: "blur" }
+        ],
+        boundaryIntegrity: [
+          { required: true, message: "璇疯緭鍏ヨ棰戜紶杈撶綉鍗遍櫓璧勪骇姣斾緥", trigger: "blur" },
+          { type: "number", message: "瑙嗛浼犺緭缃戝嵄闄╄祫浜ф瘮渚嬪繀椤讳负鏁板瓧", trigger: "blur" }
+        ],
+        boundaryIntegrity: [
+          { required: true, message: "璇疯緭鍏ヨ棰戜紶杈撶綉杈圭晫瀹屾暣鎬ф娴嬫墸鍒嗛」", trigger: "blur" },
+          { type: "number", message: "瑙嗛浼犺緭缃戣竟鐣屽畬鏁存�ф娴嬫墸鍒嗛」蹇呴』涓烘暟瀛�", trigger: "blur" }
+        ]
       },
       tableHead: [],
       cardList: [],
@@ -193,9 +247,36 @@
     }
   },
   methods: {
+    /** 淇敼鎸夐挳鎿嶄綔 */
+    handleResourceUpdate(row) {
+      this.reset("resourceForm");
+      this.resourceForm = JSON.parse(JSON.stringify(row));
+      this.resourceOpen = true;
+    },
+    /** 鎻愪氦鎸夐挳 */
+    submitForm() {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          if (this.resourceForm.id != null) {
+            updateWeight(this.resourceForm).then(() => {
+              this.$modal.msgSuccess("淇敼鎴愬姛");
+              this.resourceOpen = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    // 鍙栨秷鎸夐挳
+    cancel() {
+      this.resourceOpen = false;
+      this.reset("resourceForm");
+    },
     /** 鏌ヨ鍥惧儚璧勬簮瀹夊叏褰撴湀閰嶇疆淇℃伅 */
     getSecurityCard() {
-
+      listSecurity().then(response => {
+        this.imageResourceSecurity = response.data;
+      })
     },
     /** 鏌ヨ鍗″彛杩囪溅鏁版嵁涓�鑷存�у垪琛� */
     getList() {
@@ -291,11 +372,32 @@
       }).catch(() => {
       });
     },
-    /** 瀵煎嚭鎸夐挳鎿嶄綔 */
+    /** 瀵煎叆鎸夐挳鎿嶄綔 */
     handleExport() {
-      this.download('platform/platform/export', {
+      this.upload.title = "鏁版嵁瀵煎叆";
+      this.upload.open = true;
+    },
+    /** 涓嬭浇妯℃澘 */
+    importTemplate() {
+      this.download('platform/resourceSecurity/importTemplate', {
         ...this.queryParams
-      }, `platform_${new Date().getTime()}.xlsx`);
+      }, `瀹夊叏妫�娴嬬粨鏋滃鍏ユā鏉�.xlsx`);
+    },
+    // 鏂囦欢涓婁紶涓鐞�
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 鏂囦欢涓婁紶鎴愬姛澶勭悊
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.$modal.msgSuccess("瀵煎叆鎴愬姛");
+      this.getList();
+    },
+    // 鎻愪氦涓婁紶鏂囦欢
+    submitFileForm() {
+      this.$refs.upload.submit();
     }
   }
 };

--
Gitblit v1.8.0