zxl
2025-05-26 74d3009146d83a272286e1d5e60d38a13a3f3c89
src/views/system/data-manage/data-detail/index.vue
@@ -1,9 +1,25 @@
<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 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 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>
@@ -25,33 +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">
      <el-form-item label="关键词" prop="bayonetNumber">
        <el-input v-model="queryParams.keyword" placeholder="关键词搜索" clearable @input="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%;
@@ -74,30 +72,100 @@
          </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 v-show="index !== 'image_resource_security'" :showSearch.sync="showSearch" @queryTable="handleQuery" :columns="showList"></right-toolbar>
    </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>
        <el-tooltip v-show="needDynamicColumn" style="position: absolute" class="item" effect="dark" content="自定义列" placement="top">
          <el-button size="mini" circle icon="el-icon-collection-tag" @click="addDynamicColumn()" />
        </el-tooltip>
      </div>
    </div>
    <div  v-show="exportUrl" style="margin-bottom: 5px" >
      <el-form :model="exportParam" :inline="true">
        <el-form-item label="列选择">
          <el-select  v-model="exportParam.id" size="small"  clearable>
            <el-option  v-for="option in dynamicColumnList" :key="option.id" :label="option.labelValue"  :value="option.id"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="列值">
          <el-input v-model="exportParam.value" size="small" placeholder="自定义列值"/>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" size="mini" @click="handleExport(exportUrl)" plain v-hasPermi="['platform:platform:export']">导出
          </el-button>
        </el-form-item>
      </el-form>
    </div>
    <div v-show="index === 'image_resource_security'" style="margin-bottom: 5px">
        <el-button type="primary" plain icon="el-icon-upload" size="mini" @click="handleImport"
                   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="showListPD(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-column v-for="(column, index) in dynamicColumnList" :key="index" :label="column.labelValue" :prop="column.propName" align="center">
          <template slot-scope="scope">
            {{ getDynamicValue(scope.row, column.propName) }}
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" fixed="right" 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="['point:edit']">修改</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <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" :precision="2" :step="0.1" :min="0" :max="1"/>
@@ -111,7 +179,8 @@
        <el-form-item label="视频传输网危险资产比例" prop="riskProperty">
          <el-input-number v-model="resourceForm.riskProperty" :precision="2" :step="0.1" :min="0" :max="1"/>
        </el-form-item>
        <el-tooltip class="item" effect="dark" content="违规连接互联网扣减20个百分点/次,违规无线AP接入、随身wifi接入、共享网络各扣减5个百分点/次,直至此项指标扣完为止。" placement="top-start">
        <el-tooltip class="item" effect="dark" content="违规连接互联网扣减20个百分点/次,违规无线AP接入、随身wifi接入、共享网络各扣减5个百分点/次,直至此项指标扣完为止。"
                    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>
@@ -127,14 +196,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>仅允许导入xls、xlsx格式文件。</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,14 +213,65 @@
      </div>
    </el-dialog>
    <el-dialog
      title="添加动态列"
      :visible.sync="showDynamicColumn"
      width="500px"
      :before-close="dynamicColumnClose">
      <div>
        <div style="margin-bottom: 8px">
          <el-button style="float: right" type="primary" @click="addColumn" size="small">新增一条</el-button>
        </div>
        <div v-for="(dynamicColumn, index) in dynamicColumnList" :key="index">
          <el-form :inline="true" size="small">
            <el-form-item label="列名" prop="labelValue">
              <div style="display: flex; flex-direction: row">
                <el-input v-model="dynamicColumn.labelValue"></el-input>
                <el-button style="margin-left: 8px" type="danger" @click="delColumn(dynamicColumn.id, index)">删除</el-button>
              </div>
            </el-form-item>
          </el-form>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="closeAdd">取 消</el-button>
        <el-button type="primary" size="small" :disabled="!dynamicColumnList || dynamicColumnList.length < 1" @click="saveColumns">保 存</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="修改"
      :visible.sync="showUpdateDynamicColumn"
      width="500px"
      :before-close="updateValueDynamicColumnClose">
        <div v-for="(dynamicColumn, index) in updateDynamicList" :key="index">
          <el-form :inline="true" size="small">
            <el-form-item :label="dynamicColumn.labelValue" :prop="dynamicColumn.propName"  label-width="100px">
              <div style="display: flex; flex-direction: row">
                <el-input v-model="dynamicColumn.columnValue"></el-input>
              </div>
            </el-form-item>
          </el-form>
        </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="closeEdit">取 消</el-button>
        <el-button type="primary" size="small" @click="updateValue">确认</el-button>
      </span>
    </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";
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";
import {deleteDynamicColumnById,editDynamicColumnByPath,getDynamicColumnListByTableName,updateDynamicValue} from  '@/api/platform/dynamicColumn';
export default {
  name: "Platform",
  computed: {
@@ -160,6 +281,20 @@
  },
  data() {
    return {
      //导出参数
      exportParam: {
        id: '',
        value: ''
      },
      //复原用
      saveDynamicColumnList:[],
      dynamicColumnList: [],
      showDynamicColumn:false,
      showUpdateDynamicColumn:false,
      updateDynamicList:[],
      upDateDynamicListNew:[],
      id: null,
      // 导入参数
      upload: {
        // 是否显示弹出层
@@ -169,11 +304,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,
@@ -204,85 +340,212 @@
        pageNum: 1,
        pageSize: 10,
        keyword: '',
        timeRange: [],
        date: '',
        dataType: 0,
        option: null,
        dyId: '',
        dyValue:''
        ,
      },
      // 表单参数
      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: "请输入弱口令得分", trigger: "blur" },
          { type: "number", message: "弱口令得分必须为数字", trigger: "blur" }
          {required: true, message: "请输入弱口令得分", 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
      index: null,
      exportUrl: null,
      needDynamicColumn: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]
      console.log(data)
      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.exportUrl = data.exportUrl;
      this.needDynamicColumn = data.needDynamicColumn;
    }
    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;
      this.exportUrl = data.exportUrl
      this.needDynamicColumn = data.needDynamicColumn;
    }
    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;
      this.exportUrl = data.exportUrl
      this.needDynamicColumn = data.needDynamicColumn;
    }
    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.exportUrl = data.exportUrl
      this.needDynamicColumn = data.needDynamicColumn;
    }
    this.getList();
    this.getDyColumn();
  },
  methods: {
    closeAdd(){
      this.dynamicColumnList = JSON.parse(JSON.stringify(this.saveDynamicColumnList));
      this.showDynamicColumn = false;
    },
    closeEdit(){
      this.showUpdateDynamicColumn = false;
    },
    addDynamicColumn() {
      this.showDynamicColumn = true
    },
    saveColumns() {
      let params = {
        pathName: this.$route.query.ruleName,
      }
      console.log(params.pathName)
      editDynamicColumnByPath(params,this.dynamicColumnList).then(res => {
        this.$message.success("保存成功")
        this.$emit('refreshHeader');
        this.showDynamicColumn = false
        //重新刷新页面
        this.getDyColumn()
        this.getList()
      })
    },
    addColumn() {
      this.dynamicColumnList.push({
        id: null,
        labelValue: '',
      })
    },
    handleUpdate(row){
      this.showUpdateDynamicColumn = true;
      //row 赋值给元素
      console.log(row)
      if("录像可用率" === this.$route.query.ruleName){
        this.id = row.id;
      }else {
        this.id = row.no;
      }
      //深拷贝
      this.updateDynamicList = JSON.parse(JSON.stringify(row.dynamicColumnList));
      console.log(updateDynamicList)
    },
    updateValue(){
      let data = {
        id:this.id,
        dynamicColumnVOList:this.updateDynamicList,
      }
      updateDynamicValue(data).then(res =>{
        this.$message.success("修改成功")
        this.getList();
        this.showUpdateDynamicColumn = false;
      })
    },
    delColumn(id, index) {
      if(id) {
        deleteDynamicColumnById(id).then(res => {
          this.$message.success("删除成功")
          this.getDyColumn();
          this.$emit('refreshHeader');
        })
      }else {
        this.dynamicColumnList.splice(index,1)
      }
    },
    getDyColumn() {
      // 查询动态列
      let params = {
        pathName: this.$route.query.ruleName,
      }
      getDynamicColumnListByTableName(params).then(res => {
        this.dynamicColumnList = res.data
        //复原用
        this.saveDynamicColumnList = JSON.parse(JSON.stringify(this.dynamicColumnList));
        this.refreshkey+=1
      })
    },
    getDynamicValue(row, propName) {
      let target = row.dynamicColumnList.filter(item => item.propName === propName)
      return target && target.length > 0 ? target[0].columnValue : ''
    },
    dynamicColumnClose() {
      this.showDynamicColumn = false
    },
    updateValueDynamicColumnClose() {
      this.showUpdateDynamicColumn = false
    },
    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)) {
      if (item && (!arr || arr.length < 1)) {
        return true;
      } else {
        return item && arr && arr.length > 0 && arr[0].visible
@@ -327,15 +590,12 @@
      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;
      });
    },
    // 取消按钮
@@ -369,9 +629,18 @@
      this.handleQuery();
    },
    /** 导入按钮操作 */
    handleExport() {
    handleImport() {
      this.upload.title = "数据导入";
      this.upload.open = true;
    },
    handleExport(url) {
      this.queryParams.dyId = this.exportParam.id
      this.queryParams.dyValue = this.exportParam.value
      this.download(url, {
        ...this.queryParams,
      }, this.$route.query.ruleName+`_${new Date().getTime()}.xlsx`, {
        timeout: 60000
      })
    },
    /** 下载模板 */
    importTemplate() {
@@ -399,6 +668,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%;
@@ -434,4 +730,8 @@
  width: 150px;
  margin: 0 30px;
}
.custom-label-form-item .el-form-item__label {
  width: 100px ; /* 固定宽度为 100px */
  text-align: right; /* 可选:让文本右对齐 */
}
</style>