xiangpei
2024-04-18 ff15c290e6cf81e13519a22f414690017ba86d04
工单阈值调整
2个文件已修改
269 ■■■■ 已修改文件
src/api/platform/threshold.js 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/threshold/index.vue 214 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/platform/threshold.js
@@ -3,16 +3,32 @@
// 查询运维阈值列表
export function listThreshold(query) {
  return request({
    url: '/ycl/threshold/list',
    url: '/threshold/list',
    method: 'get',
    params: query
  })
}
// 查询运维阈值详细
export function getThreshold(id) {
export function getVideo(id) {
  return request({
    url: '/ycl/threshold/' + id,
    url: '/threshold/video' + id,
    method: 'get'
  })
}
// 查询运维阈值详细
export function getCar(id) {
  return request({
    url: '/threshold/car' + id,
    method: 'get'
  })
}
// 查询运维阈值详细
export function getFace(id) {
  return request({
    url: '/threshold/face' + id,
    method: 'get'
  })
}
@@ -20,7 +36,7 @@
// 新增运维阈值
export function addThreshold(data) {
  return request({
    url: '/ycl/threshold',
    url: '/threshold',
    method: 'post',
    data: data
  })
@@ -29,7 +45,7 @@
// 修改运维阈值
export function updateThreshold(data) {
  return request({
    url: '/ycl/threshold',
    url: '/threshold',
    method: 'put',
    data: data
  })
@@ -38,7 +54,34 @@
// 删除运维阈值
export function delThreshold(id) {
  return request({
    url: '/ycl/threshold/' + id,
    url: '/threshold/' + id,
    method: 'delete'
  })
}
// 修改视频阈值
export function editVideo(data) {
  return request({
    url: '/threshold/video',
    method: 'put',
    data: data
  })
}
// 修改车辆阈值
export function editCar(data) {
  return request({
    url: '/threshold/car',
    method: 'put',
    data: data
  })
}
// 修改人脸阈值
export function editFace(data) {
  return request({
    url: '/threshold/face',
    method: 'put',
    data: data
  })
}
src/views/system/threshold/index.vue
@@ -23,7 +23,6 @@
          <span v-show="scope.row['monitorType'] === 'video'">视频</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" style="display: flex;flex-direction: row">
@@ -46,8 +45,8 @@
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['ycl:threshold:edit']"
            @click="updateWho(scope.row)"
          >修改
          </el-button>
<!--          <el-button-->
@@ -70,36 +69,87 @@
      @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-dialog title="修改人脸工单阈值" :visible.sync="faceOpen" width="400px" append-to-body>
      <el-form ref="faceForm" :model="faceForm" :rules="rules" label-width="150px">
        <el-form-item label="设备类型" prop="monitorType">
          <el-select v-model="form.monitorType" placeholder="请选择设备类型" @change="handleModeNameChange">
          <el-select v-model="faceForm.monitorType" placeholder="请选择设备类型" @change="handleModeNameChange">
            <el-option label="人脸" value="face"/>
            <el-option label="车辆" value="car"/>
            <el-option label="视频" value="video"/>
          </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-half-width" v-model="indicator.value" placeholder="工单阈值"/>
          <el-input style="float: right;" class="el-input-half-width" v-model="indicator.value2" placeholder="下发阈值"/>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="editFace">确 定</el-button>
        <el-button @click="cancelFace">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 车辆阈值 -->
    <el-dialog title="修改车辆工单阈值" :visible.sync="faceOpen" width="400px" append-to-body>
      <el-form ref="faceForm" :model="faceForm" :rules="rules" label-width="150px">
        <el-form-item label="设备类型" prop="monitorType">
          <el-select v-model="faceForm.monitorType" placeholder="请选择设备类型" @change="handleModeNameChange">
            <el-option label="人脸" value="face"/>
            <el-option label="车辆" value="car"/>
            <el-option label="视频" value="video"/>
          </el-select>
        </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>
        <el-button type="primary" @click="editCar">确 定</el-button>
        <el-button @click="cancelCar">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 视频阈值 -->
    <el-dialog title="修改视频工单阈值" :visible.sync="videoOpen" width="500px" append-to-body>
      <el-form ref="videoForm" :model="videoForm" :rules="rules" label-width="100px">
        <el-form-item label="设备类型" prop="monitorType">
          <el-select v-model="videoForm.monitorType" disabled placeholder="请选择设备类型" @change="handleModeNameChange">
            <el-option label="人脸" value="face"/>
            <el-option label="车辆" value="car"/>
            <el-option label="视频" value="video"/>
          </el-select>
        </el-form-item>
        <el-form-item label="图像质量" prop="imageQuality" label-width="100px">
          <el-select v-model="videoForm.imageQuality" placeholder="工单阈值" @change="handleModeNameChange">
            <el-option :key="dict.value" :label="dict.value" v-for="dict in dict.type.image_qualify"/>
          </el-select>
          <el-select v-model="videoForm.imageQualityAuto" placeholder="下发阈值" @change="handleModeNameChange">
            <el-option :key="dict.value" :label="dict.value" v-for="dict in dict.type.image_qualify"/>
          </el-select>
        </el-form-item>
        <el-form-item label="视频质量" prop="videoQuality" label-width="100px">
          <el-select v-model="videoForm.videoQuality" placeholder="工单阈值" @change="handleModeNameChange">
            <el-option :key="dict.value" :label="dict.value" v-for="dict in dict.type.video_qualify"/>
          </el-select>
          <el-select v-model="videoForm.videoQualityAuto" placeholder="下发阈值" @change="handleModeNameChange">
            <el-option :key="dict.value" :label="dict.value" v-for="dict in dict.type.video_qualify"/>
          </el-select>
        </el-form-item>
        <el-form-item label="标注准确率" prop="annotationAccuracy" label-width="100px">
          <el-input v-model="videoForm.annotationAccuracy" type="number" size="small" placeholder="工单阈值"></el-input>
          <el-input v-model="videoForm.annotationAccuracy" type="number" size="small" placeholder="下发阈值"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="editVideo">确 定</el-button>
        <el-button @click="cancelVideo">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { listThreshold, getThreshold, delThreshold, addThreshold, updateThreshold } from '@/api/platform/threshold'
import { listThreshold, getThreshold, editVideo } from '@/api/platform/threshold'
import { editCar, editFace, getCar, getFace, getVideo } from '../../../api/platform/threshold'
export default {
  dicts: ['image_qualify', 'video_qualify'],
  name: 'Threshold',
  data() {
    return {
@@ -121,7 +171,8 @@
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      videoOpen: false,
      faceOpen: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
@@ -129,15 +180,23 @@
        monitorType: null
      },
      // 表单参数
      form: {},
      videoForm: {},
      carForm: {},
      faceForm: {},
      // 表单校验
      rules: {
        monitorType: [
          { required: true, message: '设备类型:1人脸 2车辆 3视频不能为空', trigger: 'change' }
        ],
        timeout: [
          { required: true, message: '超时天数不能为空', trigger: 'blur' }
        ]
        videoQuality: [
          { required: true, message: '请选择视频质量阈值', trigger: 'change' }
        ],
        imageQuality: [
          { required: true, message: '请选择图像质量阈值', trigger: 'change' }
        ],
        annotationAccuracy: [
          { required: true, message: '请填写标注准确率阈值', trigger: 'blur' }
        ],
      }
    }
  },
@@ -145,6 +204,48 @@
    this.getList()
  },
  methods: {
    editVideo() {
      this.$refs['videoForm'].validate(validate => {
        if (validate) {
          editVideo(this.videoForm).then(res => {
            if (res.code === 200) {
              this.$message.success("修改成功")
              this.getList();
            } else {
              this.$message.success("修改失败")
            }
          })
        }
      })
    },
    editFace() {
      this.$refs['faceForm'].validate(validate => {
        if (validate) {
          editFace(this.videoForm).then(res => {
            if (res.code === 200) {
              this.$message.success("修改成功")
              this.getList();
            } else {
              this.$message.success("修改失败")
            }
          })
        }
      })
    },
    editCar() {
      this.$refs['carForm'].validate(validate => {
        if (validate) {
          editCar(this.carForm).then(res => {
            if (res.code === 200) {
              this.$message.success("修改成功")
              this.getList();
            } else {
              this.$message.success("修改失败")
            }
          })
        }
      })
    },
    /** 查询运维阈值列表 */
    getList() {
      this.loading = true
@@ -155,9 +256,17 @@
      })
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    cancelFace() {
      this.faceOpen = false
      this.resetFace()
    },
    cancelCar() {
      this.carOpen = false
      this.resetCar()
    },
    cancelVideo() {
      this.videoOpen = false
      this.resetVideo()
    },
    // 表单重置
    reset() {
@@ -171,6 +280,45 @@
        deleted: null
      }
      this.resetForm('form')
    },
    resetVideo() {
      this.videoForm = {
        id: null,
        monitorType: "",
        imageQuality: "",
        imageQualityAuto: "",
        videoQuality: "",
        videoQualityAuto: "",
        annotationAccuracy: null,
        annotationAccuracyAuto: null,
      }
      this.resetForm('videoForm')
    },
    resetFace() {
      this.faceForm = {
        id: null,
        monitorType: "",
        imageQuality: "",
        imageQualityAuto: "",
        videoQuality: "",
        videoQualityAuto: "",
        annotationAccuracy: null,
        annotationAccuracyAuto: null,
      }
      this.resetForm('faceForm')
    },
    resetCar() {
      this.carForm = {
        id: null,
        monitorType: "",
        imageQuality: "",
        imageQualityAuto: "",
        videoQuality: "",
        videoQualityAuto: "",
        annotationAccuracy: null,
        annotationAccuracyAuto: null,
      }
      this.resetForm('carForm')
    },
    /** 搜索按钮操作 */
    handleQuery() {
@@ -196,13 +344,31 @@
      this.handleModeNameChange()
    },
    /** 修改按钮操作 */
    updateWho(row) {
      if (row.monitorType === 'face') {
        getFace(id).then(response => {
          this.faceForm = response.data
          this.faceOpen = true;
        })
      } else if (row.monitorType === 'car') {
        getCar(id).then(response => {
          this.carForm = response.data
          this.carOpen = true;
        })
      } else {
        getVideo(id).then(response => {
          this.videoForm = response.data
          this.videoOpen = true;
        })
      }
    },
    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.videoOpen = true
        this.title = '修改运维阈值'
      })
    },