xiangpei
2024-09-01 10ec0d1db5179d90a82e7d534cda6e9bcf597c08
src/views/system/data-manage/data-detail/index.vue
@@ -1,97 +1,105 @@
<template>
  <div class="app-container">
    <el-card class="box-card">
    <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">
            <div>
              <div class="icon-container">
                <i :class="card.icon"></i>
              </div>
            </div>
            <div v-for="data in card.dataList" class="dashboard-item">
              <div style="color: #5C9BF8;margin-bottom: 20px;font-size: 20px">{{ data.value }}</div>
              <div>{{data.label}}</div>
        <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>
<!--        <el-col :span="1">-->
<!--          <div class="dashboard-item">-->
<!--            <div style="width: 1px;height: 55px;border: 1px solid #D7EBFA;margin: 20px;"></div>-->
<!--          </div>-->
<!--        </el-col>-->
          <div v-for="data, index in card.dataList" class="dashboard-item" :key="data.label">
            <div style="color: #5C9BF8;margin-bottom: 20px;font-size: 20px">{{ platformList.count[index] }}</div>
            <div>{{ data.label }}</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.bayonetNumber" placeholder="请输入卡口编号" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="卡口名称" prop="bayonetName">
        <el-input v-model="queryParams.bayonetName" placeholder="请输入卡口名称" clearable @keyup.enter.native="handleQuery" />
      </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-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.bayonetNumber" placeholder="请输入卡口编号" clearable-->
    <!--          @keyup.enter.native="handleQuery" />-->
    <!--      </el-form-item>-->
    <!--      <el-form-item label="卡口名称" prop="bayonetName">-->
    <!--        <el-input v-model="queryParams.bayonetName" placeholder="请输入卡口名称" clearable @keyup.enter.native="handleQuery" />-->
    <!--      </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">
    <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-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-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="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">
      <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 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 v-loading="loading" :data="platformList.list">
      <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" />
    <!-- 添加或修改卡口过车数据一致性对话框 -->
    <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="请输入卡口名称" />
    <!-- 修改视频图像资源安全管理对话框 -->
    <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="bayonetNumber">
          <el-input v-model="form.bayonetNumber" placeholder="请输入卡口编号" />
        <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="weakPassword">
          <el-input-number v-model="resourceForm.weakPassword" />
        </el-form-item>
        <el-form-item label="不唯一数据量" prop="notUniqueDataNumber">
          <el-input v-model="form.notUniqueDataNumber" placeholder="请输入不唯一数据量" />
        <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">
@@ -99,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>仅允许导入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 { 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';
import { listSecurity, updateSecurity } 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,
@@ -145,15 +189,30 @@
      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: "请输入弱口令得分", 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: []
      cardList: [],
      index: null
    };
  },
  beforeRouteEnter(to, from, next) {
@@ -161,13 +220,12 @@
    next();
  },
  created() {
    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, "aaa")
      console.log(this.cardList, "ddd")
    };
    }
    if (this.$route.query.type === '2') {
      let data = carData.table.filter(item => item.index === this.$route.query.index)[0]
      this.tableHead = data.columns;
@@ -178,15 +236,54 @@
      this.tableHead = data.columns;
      this.cardList = data.card;
    }
    if (this.$route.query.type === '4') this.tableHead = equipment[this.$route.query.index].columns;
    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: {
    /** 修改按钮操作 */
    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();
            });
          }
        }
      });
    },
    // 取消按钮
    cancel() {
      this.resourceOpen = false;
      this.reset("resourceForm");
    },
    /** 查询图像资源安全当月配置信息 */
    getSecurityCard() {
      listSecurity().then(response => {
        this.imageResourceSecurity = response.rows;
      })
    },
    /** 查询卡口过车数据一致性列表 */
    getList() {
      let url = this.$route.query.url;
      this.loading = true;
      listPlatform(this.queryParams).then(response => {
        this.platformList = response.rows;
      if (this.index === 'image_resource_security') {
        this.getSecurityCard()
      }
      dataCenter(url, this.queryParams).then(response => {
        this.platformList = response.data;
        this.total = response.total;
        this.loading = false;
      });
@@ -214,7 +311,6 @@
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
@@ -222,63 +318,32 @@
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加卡口过车数据一致性";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getPlatform(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改卡口过车数据一致性";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updatePlatform(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addPlatform(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除卡口过车数据一致性编号为"' + ids + '"的数据项?').then(function () {
        return delPlatform(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).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();
    }
  }
};