From 3717e24abe2d2fd348f3cd13ad903dca3af167f1 Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期四, 05 十二月 2024 16:16:03 +0800 Subject: [PATCH] 拆分省厅标签 --- src/views/system/work-order/threshold/index.vue | 235 ++++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 168 insertions(+), 67 deletions(-) diff --git a/src/views/system/work-order/threshold/index.vue b/src/views/system/work-order/threshold/index.vue index 6e2d5af..1139da9 100644 --- a/src/views/system/work-order/threshold/index.vue +++ b/src/views/system/work-order/threshold/index.vue @@ -283,22 +283,14 @@ </el-card></el-col > </el-row> + <el-row class="content-warp"> <div class="header鈥攖ext" style="margin-bottom: 5px">宸ュ崟鐧藉悕鍗�</div> - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true"> - <el-form-item label="璁惧缂栫爜" prop="serialNumber"> + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" @submit.native.prevent> + <el-form-item label="鍏抽敭瀛�" prop="keyword"> <el-input - v-model="queryParams.serialNumber" - placeholder="璁惧缂栫爜" - clearable - @keyup.enter.native="getWhiteList" - @clear="getWhiteList" - /> - </el-form-item> - <el-form-item label="鐐逛綅鍚嶇О" prop="pointName"> - <el-input - v-model="queryParams.pointName" - placeholder="鐐逛綅鍚嶇О" + v-model="queryParams.keyword" + placeholder="璁惧缂栫爜/鐐逛綅鍚�" clearable @keyup.enter.native="getWhiteList" @clear="getWhiteList" @@ -310,12 +302,11 @@ </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" @@ -332,9 +323,9 @@ </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"> @@ -343,13 +334,20 @@ <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" @@ -359,27 +357,53 @@ <!-- 鏂板鐧藉悕鍗�--> <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> @@ -388,29 +412,34 @@ 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"; export default { - dicts: ["image_qualify", "video_qualify"], + dicts: ["image_qualify", "video_qualify", "error_type"], name: "Threshold", data() { return { + download: false, + scrollPosition: 0, // 鐢ㄤ簬淇濆瓨婊氬姩浣嶇疆 + // 涓嬫媺鍔犺浇 + selectLoading: false, ifEditVideo: false, ifEditFace: false, ifEditCar: false, + // 鐐逛綅list + pointList: [], indicators: [], // 閬僵灞� loading: true, @@ -515,15 +544,18 @@ // 鐧藉悕鍗曞垪琛� 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" } ], }, // 瀵煎叆鏂囦欢璺緞 @@ -538,6 +570,43 @@ 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)); @@ -633,6 +702,7 @@ }); }, getWhiteList() { + // 淇濆瓨褰撳墠婊氬姩浣嶇疆 this.loading = true; getWhiteList(this.queryParams).then((response) => { this.workOrderWhiteList = response.data; @@ -747,16 +817,16 @@ }); } }, - 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) => { @@ -884,33 +954,53 @@ } }, // 鎵撳紑鏂板妗� - 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) { @@ -941,12 +1031,18 @@ 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); /* 鍑忓幓涓�浜涢棿闅� */ } @@ -983,4 +1079,9 @@ .content-warp { margin-top: 10px; } +.bottom_ { + width: 100%; + margin-bottom: 8px; +} + </style> -- Gitblit v1.8.0