ZhangXianQiang
2024-03-25 8902c5d110f0d1ebb6eeec0f35713da743bf1737
Merge branch 'master' of http://42.193.1.25:9521/r/zgyw-ui
1个文件已修改
2个文件已添加
428 ■■■■■ 已修改文件
src/api/platform/threshold.js 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/threshold/index.vue 352 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/video/index.vue 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/platform/threshold.js
New file
@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询运维阈值列表
export function listThreshold(query) {
  return request({
    url: '/ycl/threshold/list',
    method: 'get',
    params: query
  })
}
// 查询运维阈值详细
export function getThreshold(id) {
  return request({
    url: '/ycl/threshold/' + id,
    method: 'get'
  })
}
// 新增运维阈值
export function addThreshold(data) {
  return request({
    url: '/ycl/threshold',
    method: 'post',
    data: data
  })
}
// 修改运维阈值
export function updateThreshold(data) {
  return request({
    url: '/ycl/threshold',
    method: 'put',
    data: data
  })
}
// 删除运维阈值
export function delThreshold(id) {
  return request({
    url: '/ycl/threshold/' + id,
    method: 'delete'
  })
}
src/views/system/threshold/index.vue
New file
@@ -0,0 +1,352 @@
<template>
  <div class="app-container">
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['ycl:threshold: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="['ycl:threshold: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="['ycl:threshold:remove']"
        >删除
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" :data="thresholdList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column label="设备类型" align="center" prop="monitorType">
        <template slot-scope="scope">
          <span v-show="scope.row['monitorType'] === '1'">人脸</span>
          <span v-show="scope.row['monitorType'] === '2'">车辆</span>
          <span v-show="scope.row['monitorType'] === '3'">视频</span>
        </template>
      </el-table-column>
      <el-table-column label="超时天数" align="center" prop="timeout"/>
      <el-table-column label="指标" align="center" prop="indicator">
        <template slot-scope="scope">
          <div v-for="item in JSON.parse(scope.row.indicator)" :key="item">
            {{ item.label }}:{{ item.value }}
          </div>
        </template>
      </el-table-column>
      <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="['ycl:threshold:edit']"
          >修改
          </el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['ycl:threshold:remove']"
          >删除
          </el-button>
        </template>
      </el-table-column>
    </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="400px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="150px">
        <el-form-item label="设备类型" prop="monitorType">
          <el-select v-model="form.monitorType" placeholder="请选择设备类型" @change="handleModeNameChange">
            <el-option label="人脸" value="1"/>
            <el-option label="车辆" value="2"/>
            <el-option label="视频" value="3"/>
          </el-select>
        </el-form-item>
        <el-form-item label="超时天数" prop="timeout" label-width="150px">
          <el-input type="number" min="0" max="1000" v-model="form.timeout" placeholder="请输入超时天数"/>
        </el-form-item>
        <el-form-item :label="indicator.label" prop="indexOneValue" v-for="indicator in indicators" label-width="150px">
          <el-input class="el-input-width" v-model="indicator.value" :placeholder="'请输入' + indicator.label"/>
        </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>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { listThreshold, getThreshold, delThreshold, addThreshold, updateThreshold } from '@/api/platform/threshold'
export default {
  name: 'Threshold',
  data() {
    return {
      indicators: [],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 运维阈值表格数据
      thresholdList: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        monitorType: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        monitorType: [
          { required: true, message: '设备类型:1人脸 2车辆 3视频不能为空', trigger: 'change' }
        ],
        timeout: [
          { required: true, message: '超时天数不能为空', trigger: 'blur' }
        ]
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    /** 查询运维阈值列表 */
    getList() {
      this.loading = true
      listThreshold(this.queryParams).then(response => {
        this.thresholdList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        monitorType: null,
        timeout: null,
        indicator: null,
        createTime: null,
        updateTime: null,
        deleted: null
      }
      this.resetForm('form')
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      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 = '添加运维阈值'
      this.handleModeNameChange()
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      const id = row.id || this.ids
      getThreshold(id).then(response => {
        this.form = response.data
        this.indicators = JSON.parse(this.form.indicator)
        this.open = true
        this.title = '修改运维阈值'
      })
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          // 将indicators转为json赋值到form
          this.form.indicator = JSON.stringify(this.indicators)
          if (this.form.id != null) {
            updateThreshold(this.form).then(response => {
              this.$modal.msgSuccess('修改成功')
              this.open = false
              this.getList()
            })
          } else {
            addThreshold(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 delThreshold(ids)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess('删除成功')
      }).catch(() => {
      })
    },
    /** 切换不同指标 */
    handleModeNameChange() {
      if (this.form.monitorType === '1' || this.form.monitorType === null) {
        this.indicators = [
          {
            label: '抓拍量',
            value: null
          },
          {
            label: '及时率',
            value: null
          },
          {
            label: '延迟量',
            value: null
          },
          {
            label: '抽检量',
            value: null
          },
          {
            label: '设备活跃率',
            value: null
          },
          {
            label: '抓拍及时率',
            value: null
          },
          {
            label: '时钟准确率',
            value: null
          },
          {
            label: '时钟不准确率',
            value: null
          }
        ]
      } else if (this.form.monitorType === '2') {
        this.indicators = [
          {
            label: '过车数据量',
            value: null
          },
          {
            label: '过车缺失率',
            value: null
          },
          {
            label: '有效过车数据量',
            value: null
          },
          {
            label: '抽检量',
            value: null
          },
          {
            label: '设备活跃率',
            value: null
          },
          {
            label: '抓拍及时率',
            value: null
          },
          {
            label: '时钟准确率',
            value: null
          },
          {
            label: '时钟不准确率',
            value: null
          }
        ]
      } else if (this.form.monitorType === '3') {
        this.indicators = [
          {
            label: '采集设备总数',
            value: null
          },
          {
            label: '监测正常设备数',
            value: null
          },
          {
            label: '编码异常设备数',
            value: null
          },
          {
            label: '经纬度异常设备数',
            value: null
          }
        ]
      }
    }
  }
}
</script>
src/views/system/video/index.vue
@@ -116,30 +116,30 @@
          @click="handleExport"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" :data="monitorList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" align="center" />
      <el-table-column label="设备名称" align="center" prop="name" width="280" fixed/>
      <el-table-column label="设备编码" align="center" prop="serialNumber" width="180"/>
      <el-table-column label="标签" align="center" prop="tag" width="180"/>
      <el-table-column label="区域" align="center" prop="region" width="180"/>
      <el-table-column label="设备状态" align="center" prop="onState">
      <el-table-column label="标签" align="center" prop="tag" width="180" v-if="columns[0].visible"/>
      <el-table-column label="区域" align="center" prop="region" width="180" v-if="columns[1].visible"/>
      <el-table-column label="设备状态" align="center" prop="onState" v-if="columns[2].visible">
      <template slot-scope="scope">
        <dict-tag :options="dict.type.camera_state" :value="scope.row.onState"/>
      </template>
      </el-table-column>
      <el-table-column label="是否生成异常工单" align="center" prop="defaultOrder" width="180">
      <el-table-column label="是否生成异常工单" align="center" prop="defaultOrder" width="180" v-if="columns[3].visible">
      <template slot-scope="scope">
        <dict-tag :options="dict.type.platform_yes_no" :value="scope.row.defaultOrder"/>
      </template>
      </el-table-column>
      <el-table-column label="数据时间" align="center" prop="installedTime" width="180"/>
      <el-table-column label="管理单位" align="center" prop="managementUnit" width="180"/>
      <el-table-column label="信令时延(ms)" align="center" prop="sipDelay" width="180"/>
      <el-table-column label="视频时延(ms)" align="center" prop="videoDelay" width="180"/>
      <el-table-column label="关键帧时延(ms)" align="center" prop="iframeDelay" width="180"/>
      <el-table-column label="数据时间" align="center" prop="installedTime" width="180" v-if="columns[4].visible"/>
      <el-table-column label="管理单位" align="center" prop="managementUnit" width="180" v-if="columns[5].visible"/>
      <el-table-column label="信令时延(ms)" align="center" prop="sipDelay" width="180" v-if="columns[6].visible"/>
      <el-table-column label="视频时延(ms)" align="center" prop="videoDelay" width="180" v-if="columns[7].visible"/>
      <el-table-column label="关键帧时延(ms)" align="center" prop="iframeDelay" width="180" v-if="columns[8].visible"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width"  fixed="right">
          <template slot-scope="scope">
            <el-button
@@ -215,6 +215,18 @@
  dicts: ['sys_normal_disable', 'platform_yes_no','camera_state'],
  data() {
    return {
      // 列信息
      columns: [
        { key: 0, label: `标签`, visible: true },
        { key: 1, label: `区域`, visible: true },
        { key: 2, label: `设备状态`, visible: true },
        { key: 3, label: `是否生成异常工单`, visible: true },
        { key: 4, label: `数据时间`, visible: true },
        { key: 5, label: `管理单位`, visible: true },
        { key: 6, label: `信令时延`, visible: true },
        { key: 7, label: `视频时延`, visible: true },
        { key: 8, label: `关键帧时延`, visible: true }
      ],
      totalPosts: 6250,
      totalMembers: 6008,
      postsPercentage: 51,