xiangpei
2024-09-03 ff01e654442ee6bd83dfe29701dfb465f9163c1f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
<template>
  <div class="app-container">
    <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>
            <div class="icon-container">
              <i :class="card.icon"></i>
            </div>
          </div>
          <div v-if="card.dataList && card.dataList.length > 0">
            <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>
            </div>
          </div>
 
        </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>
 
    <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-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;">{{ item.deptName }}</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>
                <div style="font-size: 14px;">视频传输网边界完整性检测扣分项:{{ item.boundaryIntegrity }}</div> -->
              </el-card>
            </el-col>
          </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>
 
    <right-toolbar :showSearch.sync="showSearch" @queryTable="handleQuery" :columns="showList"></right-toolbar>
 
    <div v-if="tableData.list && tableData.list.length >0">
      <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="showListPD(item)"/>
      </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" />
 
    <!-- 修改视频图像资源安全管理对话框 -->
    <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-form-item>
        <el-form-item label="平台运行率" prop="platformOnline">
          <el-input-number v-model="resourceForm.platformOnline" />
        </el-form-item>
        <el-form-item label="视频传输网资产准确率" prop="propertyAccuracy">
          <el-input-number v-model="resourceForm.propertyAccuracy" />
        </el-form-item>
        <el-form-item label="弱口令得分" prop="weakPassword">
          <el-input-number v-model="resourceForm.weakPassword" />
        </el-form-item>
        <el-form-item label="视频传输网危险资产比例" prop="riskProperty">
          <el-input-number v-model="resourceForm.riskProperty" />
        </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">
        <el-button @click="cancelR">取 消</el-button>
        <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>仅允许导入xls、xlsx格式文件。</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 { 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;
  //   }
  // },
  data() {
    return {
      list: [],
      // 导入参数
      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,
      uniqueCarData: 431163,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      tableData: {
        list: []
      },
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        keyword: '',
        timeRange: [],
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        platformOnline: [
          { required: true, message: "请输入平台运行率", trigger: "blur" },
          { type: "number", message: "平台运行率必须为数字", trigger: "blur" }
        ],
        propertyAccuracy: [
          { required: true, message: "请输入视频传输网资产准确率", trigger: "blur" },
          { type: "number", message: "视频传输网资产准确率必须为数字", trigger: "blur" }
        ],
        riskProperty: [
          { required: true, message: "请输入弱口令得分", trigger: "blur" },
          { type: "number", message: "弱口令得分必须为数字", trigger: "blur" }
        ],
        boundaryIntegrity: [
          { required: true, message: "请输入视频传输网危险资产比例", trigger: "blur" },
          { type: "number", message: "视频传输网危险资产比例必须为数字", trigger: "blur" }
        ],
 
      },
      showList: [],
      tableHead: [],
      cardList: [],
      index: null
    };
  },
  mounted() {
    // 获取当前日期
    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');
 
    // 拼接成 yyyy-MM-dd 格式
    let yesterday1 =  `${year}-${month}-${day}`;
    this.queryParams.timeRange = [yesterday1, yesterday1]
    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;
      console.log(data)
      this.showList = data.showList;
    }
    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: {
    showListPD(item) {
      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");
      this.resourceForm = JSON.parse(JSON.stringify(row));
      this.resourceOpen = true;
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.resourceForm.id != null) {
            updateSecurity(this.resourceForm).then(() => {
              this.$modal.msgSuccess("修改成功");
              this.resourceOpen = false;
              this.getList();
            });
          }
        }
      });
    },
    // 取消按钮
    cancelR() {
      this.resourceOpen = false;
      this.reset("resourceForm");
    },
    /** 查询图像资源安全当月配置信息 */
    getSecurityCard() {
      listSecurity().then(response => {
        this.imageResourceSecurity = response.rows;
      })
    },
    /** 查询卡口过车数据一致性列表 */
    getList() {
      let url = this.$route.query.url;
      this.loading = true;
      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 : []
        this.tableData = response.data;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancelImport() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        regionCode: null,
        bayonetName: null,
        bayonetNumber: null,
        vehicleDataNumber: null,
        notUniqueData: null,
        notUniqueDataNumber: null,
        createTime: null,
        updateTime: null,
        deleted: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 导入按钮操作 */
    handleExport() {
      this.upload.title = "数据导入";
      this.upload.open = true;
    },
    /** 下载模板 */
    importTemplate() {
      this.download('platform/resourceSecurity/importTemplate', {
        ...this.queryParams
      }, `安全检测结果导入模板.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();
    }
  }
};
</script>
<style scoped>
.box-card {
  background-color: #F5F9FE;
  width: 100%;
  margin-bottom: 20px;
  height: 120px
}
 
.icon-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  border-radius: 10px;
  width: 20%;
  height: 80px;
  margin-left: 5%;
  background-color: #1890FF;
  font-size: 50px;
  color: #FFF;
  width: 85px;
}
 
.el-icon-refresh-left {
  font-size: 50px;
  color: #FFFFFF;
}
 
.dashboard-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 150px;
}
</style>