| | |
| | | v-hasPermi="['ycl:threshold:edit']" |
| | | @click="showEdit('video')" |
| | | v-if="!ifEditVideo" |
| | | >修改 |
| | | >修改 |
| | | </el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="primary" |
| | | @click="saveEdit('video')" |
| | | v-if="ifEditVideo" |
| | | >保存 |
| | | >保存 |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | |
| | | justify-content: space-between; |
| | | " |
| | | > |
| | | |
| | | <div> |
| | | <div |
| | | style=" |
| | |
| | | :key="item.id" |
| | | > |
| | | <el-input |
| | | v-model="videoList[index].value" |
| | | v-model="videoList[index].valueAuto" |
| | | size="mini" |
| | | style="width: 100px" |
| | | :type="item.countType=='int'?'number':''" |
| | | v-if="ifEditVideo" |
| | | ></el-input> |
| | | <span v-else>{{ item.value }}</span> |
| | | <span v-else>{{ item.valueAuto }}</span> |
| | | <span class="unit" v-if="item.countType=='percent'">%</span> |
| | | <span class="unit" v-if="item.countType=='second'">秒</span> |
| | | </el-form-item> |
| | |
| | | :key="item.id" |
| | | > |
| | | <el-input |
| | | v-model="videoList[index].valueAuto" |
| | | v-model="videoList[index].value" |
| | | size="mini" |
| | | style="width: 100px" |
| | | :type="item.countType=='int'?'number':''" |
| | | v-if="ifEditVideo" |
| | | ></el-input> |
| | | <span v-else>{{ item.valueAuto }}</span> |
| | | <span v-else>{{ item.value }}</span> |
| | | <span class="unit" v-if="item.countType=='percent'">%</span> |
| | | <span class="unit" v-if="item.countType=='second'">秒</span> |
| | | </el-form-item> |
| | |
| | | v-hasPermi="['ycl:threshold:edit']" |
| | | @click="showEdit('face')" |
| | | v-if="!ifEditFace" |
| | | >修改 |
| | | >修改 |
| | | </el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="primary" |
| | | @click="saveEdit('face')" |
| | | v-if="ifEditFace" |
| | | >保存 |
| | | >保存 |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | |
| | | :key="item.id" |
| | | > |
| | | <el-input |
| | | v-model="faceList[index].value" |
| | | v-model="faceList[index].valueAuto" |
| | | size="mini" |
| | | style="width: 100px" |
| | | :type="item.countType=='int'?'number':''" |
| | | v-if="ifEditFace" |
| | | ></el-input> |
| | | <span v-else>{{ item.value }}</span> |
| | | <span v-else>{{ item.valueAuto }}</span> |
| | | <span class="unit" v-if="item.countType=='percent'">%</span> |
| | | <span class="unit" v-if="item.countType=='second'">秒</span> |
| | | </el-form-item> |
| | |
| | | :key="item.id" |
| | | > |
| | | <el-input |
| | | v-model="faceList[index].valueAuto" |
| | | v-model="faceList[index].value" |
| | | size="mini" |
| | | style="width: 100px" |
| | | :type="item.countType=='int'?'number':''" |
| | | v-if="ifEditFace" |
| | | ></el-input> |
| | | <span v-else>{{ item.valueAuto }}</span> |
| | | <span v-else>{{ item.value }}</span> |
| | | <span class="unit" v-if="item.countType=='percent'">%</span> |
| | | <span class="unit" v-if="item.countType=='second'">秒</span> |
| | | </el-form-item |
| | | </el-form-item |
| | | > |
| | | </el-form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </el-card></el-col |
| | | </el-card> |
| | | </el-col |
| | | > |
| | | <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8"> |
| | | <el-card style="margin-bottom: 20px; height: 350px; margin-right: 20px;color: #656565;"> |
| | |
| | | v-hasPermi="['ycl:threshold:edit']" |
| | | @click="showEdit('car')" |
| | | v-if="!ifEditCar" |
| | | >修改 |
| | | >修改 |
| | | </el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="primary" |
| | | @click="saveEdit('car')" |
| | | v-if="ifEditCar" |
| | | >保存 |
| | | >保存 |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | |
| | | :key="item.id" |
| | | > |
| | | <el-input |
| | | v-model="carList[index].value" |
| | | v-model="carList[index].valueAuto" |
| | | size="mini" |
| | | style="width: 100px" |
| | | :type="item.countType=='int'?'number':''" |
| | | v-if="ifEditCar" |
| | | ></el-input> |
| | | <span v-else>{{ item.value }}</span> |
| | | <span v-else>{{ item.valueAuto }}</span> |
| | | <span class="unit" v-if="item.countType=='percent'">%</span> |
| | | <span class="unit" v-if="item.countType=='second'">秒</span> |
| | | </el-form-item> |
| | |
| | | :key="item.id" |
| | | > |
| | | <el-input |
| | | v-model="carList[index].valueAuto" |
| | | v-model="carList[index].value" |
| | | size="mini" |
| | | style="width: 100px" |
| | | :type="item.countType=='int'?'number':''" |
| | | v-if="ifEditCar" |
| | | ></el-input> |
| | | <span v-else>{{ item.valueAuto }}</span> |
| | | <span v-else>{{ item.value }}</span> |
| | | <span class="unit" v-if="item.countType=='percent'">%</span> |
| | | <span class="unit" v-if="item.countType=='second'">秒</span> |
| | | </el-form-item> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </el-card></el-col |
| | | </el-card> |
| | | </el-col |
| | | > |
| | | </el-row> |
| | | |
| | | <el-row class="content-warp"> |
| | | <div class="header—text" style="margin-bottom: 5px">工单白名单</div> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" @submit.native.prevent> |
| | |
| | | </el-form> |
| | | </el-row> |
| | | <el-row class="content-warp"> |
| | | <el-button size="small" type="success" @click="addOpen" plain>新增</el-button> |
| | | <el-button size="small" type="success" @click="whiteOpen" plain>新增</el-button> |
| | | <el-button size="small" type="danger" @click="bathDelete" plain>删除</el-button> |
| | | <el-popover style="margin-left: 10px" placement="bottom" trigger="hover" content="导入点位"> |
| | | <div class="bottom_"> |
| | | <p>导入点位只做新增操作</p> |
| | | </div> |
| | | <el-button type="primary" plain icon="el-icon-top" v-loading="download" size="mini" @click="handleExport" |
| | | >导出白名单 |
| | | </el-button> |
| | | <el-popover style="margin-left: 10px" placement="bottom" trigger="hover" content="导入白名单"> |
| | | <div class="bottom_"> |
| | | <el-upload |
| | | ref="upload" |
| | |
| | | </div> |
| | | <div> |
| | | <el-button class="bottom_" type="primary" size="small" v-loading="upload" @click="handleImport" |
| | | v-hasPermi="['point:import']">导入</el-button> |
| | | >导入 |
| | | </el-button> |
| | | </div> |
| | | <el-button type="primary" size="small" plain icon="el-icon-bottom" slot="reference" v-hasPermi="['point:import']">导入白名单</el-button> |
| | | <el-button type="primary" size="small" plain icon="el-icon-bottom" slot="reference">导入白名单</el-button> |
| | | </el-popover> |
| | | |
| | | <el-popover style="margin-left: 10px" placement="bottom" content="添加故障类型"> |
| | | <div class="bottom_"> |
| | | <el-form ref = "addErrorForm" :model="addErrorForm" v-loading="addErrorLoading" rules="addErrorFormRules" :inline="true" > |
| | | <el-form-item label="故障类型" prop="errorTypeList"> |
| | | <el-select v-model="addErrorForm.errorTypeList" multiple> |
| | | <el-option v-for="dict in dict.type.error_type" |
| | | :value="dict.value" |
| | | :key="dict.value" |
| | | :label="dict.label"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div> |
| | | <el-button class="bottom_" type="primary" size="small" @click="addError" plain>确认</el-button> |
| | | </div> |
| | | <el-button style="margin-left: 10px" size="small" type="primary" slot="reference" plain>添加故障类型</el-button> |
| | | </el-popover> |
| | | |
| | | </el-row> |
| | | |
| | | <el-row class="content-warp"> |
| | | <el-col :span="24"> |
| | | <el-table v-loading="loading" :data="workOrderWhiteList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" prop="id"/> |
| | | <el-table-column label="设备编码" align="center" prop="serialNumber"/> |
| | | <el-table-column label="点位名称" align="center" prop="pointName"/> |
| | | <el-table-column label="创建人" align="center" prop="createBy"/> |
| | | <el-table-column label="故障类型" align="center" prop="errorType"/> |
| | | <el-table-column label="备注" align="center" prop="remark"/> |
| | | <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="handleWhiteUpdate(scope.row)" |
| | | >修改 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :auto-scroll="false" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getWhiteList" |
| | |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <!-- 新增白名单--> |
| | | <!-- 新增白名单--> |
| | | <el-dialog |
| | | title="新增白名单" |
| | | :visible.sync="addShow" |
| | | :title="title" |
| | | :visible.sync="whiteShow" |
| | | width="500px" |
| | | :close-on-click-modal="false" |
| | | :before-close="addClose"> |
| | | :before-close="whiteClose"> |
| | | <div> |
| | | <el-form :model="addForm" label-position="top" :rules="addFormRules" ref="addForm" size="small"> |
| | | <el-form-item label="设备编码" prop="serialNumber"> |
| | | <el-input v-model="addForm.serialNumber"></el-input> |
| | | <el-form :model="whiteForm" label-position="top" :rules="whiteFormRules" ref="whiteForm" size="small" |
| | | class="add-form"> |
| | | <el-form-item label="点位" prop="serialNumber"> |
| | | <el-select |
| | | v-model="whiteForm.pointName" |
| | | filterable |
| | | remote |
| | | reserve-keyword |
| | | :disabled="whiteForm.id" |
| | | placeholder="国标码/点位名称搜索" |
| | | :remote-method="remoteGetPoints" |
| | | @change="setPointId" |
| | | :loading="selectLoading" |
| | | style="width: 460px"> |
| | | <el-option |
| | | v-for="item in pointList" |
| | | :key="item.id" |
| | | :label="item.value" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="故障类型" prop="errorTypeList"> |
| | | <el-select v-model="whiteForm.errorTypeList" multiple> |
| | | <el-option v-for="dict in dict.type.error_type" |
| | | :value="dict.value" |
| | | :key="dict.value" |
| | | :label="dict.label"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注信息" prop="remark"> |
| | | <el-input v-model="addForm.remark"></el-input> |
| | | <el-input v-model="whiteForm.remark"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="addClose">取 消</el-button> |
| | | <el-button type="primary" @click="addSubmit">新 增</el-button> |
| | | <el-button @click="whiteClose">取 消</el-button> |
| | | <el-button type="primary" @click="whiteSubmit">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | |
| | | </template> |
| | | |
| | | <script> |
| | |
| | | getThreshold, |
| | | updateThreshold, |
| | | importData, |
| | | } from "@/api/platform/threshold"; |
| | | import { |
| | | editCar, |
| | | editFace, |
| | | getCar, |
| | | getFace, |
| | | getVideo, |
| | | } from "../../../../api/platform/threshold"; |
| | | |
| | | import { |
| | | getWhiteList, |
| | | getWhite, |
| | | addWhiteList, |
| | | bathDelete, |
| | | } from "@/api/platform/work-order"; |
| | | updateWhite, |
| | | whiteExport |
| | | } from "@/api/platform/threshold"; |
| | | |
| | | import {pointSelectData} from "@/api/platform/point"; |
| | | import {addError} from "../../../../api/platform/threshold"; |
| | | |
| | | export default { |
| | | dicts: ["image_qualify", "video_qualify"], |
| | | dicts: ["image_qualify", "video_qualify", "error_type"], |
| | | name: "Threshold", |
| | | data() { |
| | | return { |
| | | download: false, |
| | | addErrorLoading: false, |
| | | scrollPosition: 0, // 用于保存滚动位置 |
| | | // 下拉加载 |
| | | selectLoading: false, |
| | | ifEditVideo: false, |
| | | ifEditFace: false, |
| | | ifEditCar: false, |
| | | // 点位list |
| | | pointList: [], |
| | | indicators: [], |
| | | // 遮罩层 |
| | | loading: true, |
| | |
| | | videoForm: {}, |
| | | carForm: {}, |
| | | faceForm: {}, |
| | | addErrorForm: {}, |
| | | // 新增框校验 |
| | | addErrorFormRules: { |
| | | errorTypeList: [ |
| | | {required: true, message: "请选择故障类型", trigger: "blur"} |
| | | ], |
| | | }, |
| | | // 表单校验 |
| | | faceRules: { |
| | | monitorType: [ |
| | |
| | | // 白名单列表 |
| | | workOrderWhiteList: [], |
| | | // 新增框 |
| | | addShow: false, |
| | | addForm: { |
| | | whiteShow: false, |
| | | whiteForm: { |
| | | serialNumber: "", |
| | | remark: "", |
| | | }, |
| | | // 新增框校验 |
| | | addFormRules: { |
| | | whiteFormRules: { |
| | | serialNumber: [ |
| | | {required: true, message: "设备编码不能为空", trigger: "blur"}, |
| | | {required: true, message: "设备不能为空", trigger: "blur"}, |
| | | ], |
| | | errorTypeList: [ |
| | | {required: true, message: "请选择故障类型", trigger: "blur"} |
| | | ], |
| | | }, |
| | | // 导入文件路径 |
| | |
| | | this.getWhiteList(); |
| | | }, |
| | | methods: { |
| | | setPointId(selectedValue) { |
| | | const selectedItem = this.pointList.find(item => item.value === selectedValue); |
| | | this.whiteForm.serialNumber = selectedItem.id |
| | | }, |
| | | // 远程搜索点位 |
| | | remoteGetPoints(query) { |
| | | if (query !== '') { |
| | | this.selectLoading = true; |
| | | let data = { |
| | | "keyword": query |
| | | } |
| | | pointSelectData(data).then(res => { |
| | | this.pointList = res.data; |
| | | this.selectLoading = false; |
| | | }) |
| | | } else { |
| | | this.pointList = []; |
| | | } |
| | | }, |
| | | handleExport() { |
| | | this.download = true |
| | | whiteExport().then(res => { |
| | | // 将二进制数据转换为 Blob 对象 |
| | | let blob = new Blob([res], {type: 'application/octet-stream'}); |
| | | |
| | | // 创建下载链接 |
| | | let downloadLink = document.createElement('a'); |
| | | downloadLink.href = URL.createObjectURL(blob); |
| | | downloadLink.setAttribute('download', "工单白名单清单.xlsx"); // 设置下载文件的文件名 |
| | | downloadLink.style.display = 'none'; |
| | | // 添加到页面并触发下载 |
| | | document.body.appendChild(downloadLink); |
| | | downloadLink.click(); |
| | | document.body.removeChild(downloadLink); |
| | | this.download = false |
| | | }) |
| | | }, |
| | | showEdit(value) { |
| | | if (value == "video") { |
| | | this.videoList = JSON.parse(JSON.stringify(this.thresholdList.video)); |
| | |
| | | }); |
| | | }, |
| | | getWhiteList() { |
| | | // 保存当前滚动位置 |
| | | this.loading = true; |
| | | getWhiteList(this.queryParams).then((response) => { |
| | | this.workOrderWhiteList = response.data; |
| | |
| | | }); |
| | | } |
| | | }, |
| | | 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.videoOpen = true; |
| | | this.title = "修改运维阈值"; |
| | | }); |
| | | }, |
| | | // 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.videoOpen = true; |
| | | // this.title = "修改运维阈值"; |
| | | // }); |
| | | // }, |
| | | /** 提交按钮 */ |
| | | submitForm() { |
| | | this.$refs["form"].validate((valid) => { |
| | |
| | | } |
| | | }, |
| | | // 打开新增框 |
| | | addOpen() { |
| | | this.addShow = true; |
| | | whiteOpen() { |
| | | this.title = "新增白名单" |
| | | this.whiteShow = true; |
| | | }, |
| | | // 关闭新增框 |
| | | addClose() { |
| | | this.addShow = false; |
| | | this.addReset(); |
| | | whiteClose() { |
| | | this.whiteShow = false; |
| | | this.whiteReset(); |
| | | }, |
| | | // 新增框提交 |
| | | addSubmit() { |
| | | this.$refs["addForm"].validate((valid) => { |
| | | // 新增故障类型 |
| | | addError() { |
| | | this.$refs["addErrorForm"].validate((valid) => { |
| | | if (valid) { |
| | | addWhiteList(this.addForm).then((response) => { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | this.addShow = false; |
| | | this.addErrorLoading = true |
| | | addError(this.addErrorForm).then((response) => { |
| | | this.$modal.msgSuccess("添加成功"); |
| | | this.getWhiteList(); |
| | | this.addReset(); |
| | | }); |
| | | this.addErrorLoading = false |
| | | } |
| | | }); |
| | | }, |
| | | // 白名单框提交 |
| | | whiteSubmit() { |
| | | this.$refs["whiteForm"].validate((valid) => { |
| | | if (valid) { |
| | | if (this.whiteForm.id != null) { |
| | | updateWhite(this.whiteForm).then((response) => { |
| | | this.$modal.msgSuccess("修改成功"); |
| | | this.whiteShow = false; |
| | | this.getWhiteList(); |
| | | this.whiteReset(); |
| | | }); |
| | | } else { |
| | | addWhiteList(this.whiteForm).then((response) => { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | this.whiteShow = false; |
| | | this.getWhiteList(); |
| | | this.whiteReset(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | // 新增框重置 |
| | | addReset() { |
| | | this.addForm = { |
| | | whiteReset() { |
| | | this.whiteForm = { |
| | | serialNumber: "", |
| | | remark: "", |
| | | }; |
| | | }, |
| | | /** 修改按钮操作 */ |
| | | handleWhiteUpdate(row) { |
| | | this.whiteReset(); |
| | | const id = row.id |
| | | getWhite(id).then(response => { |
| | | this.whiteForm = response.data; |
| | | this.title = "修改白名单"; |
| | | this.whiteShow = true; |
| | | }); |
| | | }, |
| | | // 多选框选中数据 |
| | | handleSelectionChange(selection) { |
| | |
| | | this.upload = false |
| | | this.fileList = [] |
| | | this.getWhiteList() |
| | | }).catch(() => { |
| | | this.upload = false |
| | | }) |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | <style scoped> |
| | | .add-form /deep/ .el-form-item { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | ::v-deep .el-input-half-width { |
| | | width: calc(50% - 6px); /* 减去一些间隔 */ |
| | | } |
| | | |
| | | ::v-deep .table-row { |
| | | display: flex; |
| | | flex-direction: row; |
| | | } |
| | | |
| | | ::v-deep .table-row-item { |
| | | width: 120px; |
| | | text-align: center; |
| | | } |
| | | |
| | | .fixedWidth { |
| | | width: 200px; |
| | | } |
| | | |
| | | .threshold { |
| | | display: flex; |
| | | flex-direction: row; |
| | |
| | | font-weight: bold; |
| | | font-size: large; |
| | | } |
| | | |
| | | ::v-deep .el-form-item { |
| | | margin-bottom: 0px; /* 根据需求调整这个值 */ |
| | | } |
| | | |
| | | ::v-deep .el-form-item__label { |
| | | color: #8d8d8d; |
| | | } |
| | | |
| | | .unit { |
| | | margin-left: 5px; |
| | | display: inline-block; |
| | | } |
| | | |
| | | .content-warp { |
| | | margin-top: 10px; |
| | | } |
| | | |
| | | .bottom_ { |
| | | width: 100%; |
| | | margin-bottom: 8px; |
| | | } |
| | | |
| | | </style> |