| | |
| | | </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-row> |
| | | <el-row class="content-warp"> |
| | |
| | | <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 |
| | |
| | | |
| | | <!-- 新增白名单--> |
| | | <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> |
| | |
| | | |
| | | import { |
| | | getWhiteList, |
| | | getWhite, |
| | | addWhiteList, |
| | | bathDelete, |
| | | updateWhite |
| | | } from "@/api/platform/work-order"; |
| | | |
| | | import { pointSelectData } from "@/api/platform/point"; |
| | | export default { |
| | | dicts: ["image_qualify", "video_qualify"], |
| | | dicts: ["image_qualify", "video_qualify", "error_type"], |
| | | name: "Threshold", |
| | | data() { |
| | | return { |
| | | download: false, |
| | | // 下拉加载 |
| | | selectLoading: false, |
| | | ifEditVideo: false, |
| | | ifEditFace: false, |
| | | ifEditCar: false, |
| | | // 点位list |
| | | pointList: [], |
| | | indicators: [], |
| | | // 遮罩层 |
| | | loading: true, |
| | |
| | | // 白名单列表 |
| | | 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 |
| | | exportData(this.queryParams).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)); |
| | |
| | | }); |
| | | } |
| | | }, |
| | | 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) => { |
| | | // 白名单框提交 |
| | | whiteSubmit() { |
| | | this.$refs["whiteForm"].validate((valid) => { |
| | | if (valid) { |
| | | addWhiteList(this.addForm).then((response) => { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | this.addShow = false; |
| | | this.getWhiteList(); |
| | | this.addReset(); |
| | | }); |
| | | 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) { |
| | |
| | | }; |
| | | </script> |
| | | <style scoped> |
| | | .add-form /deep/ .el-form-item { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | ::v-deep .el-input-half-width { |
| | | width: calc(50% - 6px); /* 减去一些间隔 */ |
| | | } |
| | |
| | | .content-warp { |
| | | margin-top: 10px; |
| | | } |
| | | |
| | | |
| | | </style> |