From 2bd1f17a22b1a3ee9850056f560a067d2bc09cdf Mon Sep 17 00:00:00 2001 From: xuechunyuan <17853500702@163.com> Date: Wed, 16 Aug 2023 18:14:08 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/rails/rails.js | 2 +- src/views/rails/arealist.vue | 41 ++++++++++------- .../wirelessintrusion/deployment/list.vue | 45 ++++++++++--------- 3 files changed, 50 insertions(+), 38 deletions(-) diff --git a/src/api/rails/rails.js b/src/api/rails/rails.js index 6bd63c3..76534b5 100644 --- a/src/api/rails/rails.js +++ b/src/api/rails/rails.js @@ -52,7 +52,7 @@ export const railsAdd = (token, data) => { //围栏编辑 export const railsUpdate = (token, data) => { return request({ - url: baseUrl + '/api/electronicFencePlatform/editRail/' + data.id, + url: baseUrl + '/api/electronicFencePlatform/editRail', method: 'put', headers: { Authorization: token diff --git a/src/views/rails/arealist.vue b/src/views/rails/arealist.vue index aa86624..4068c83 100644 --- a/src/views/rails/arealist.vue +++ b/src/views/rails/arealist.vue @@ -28,26 +28,27 @@ - + - - +
-
@@ -55,8 +56,8 @@ - + @@ -78,7 +79,8 @@ export default { data() { return { addForm: { - points: [] + points: [], + railIds: [] }, rules: { floorNo: [ @@ -166,6 +168,9 @@ export default { handleSelectionChange(val) { this.multipleSelection = val; }, + getRowKey(row) { + return row._id; + }, //查看详情 rowView(row) { this.addForm = JSON.parse(JSON.stringify(row)); @@ -192,6 +197,7 @@ export default { this.diaPage.currentPage = 1; this.dialogVisible = true; this.$nextTick(() => { + this.$refs.multipleTable.clearSelection(); this.queryRailsList(this.diaPage); this.$refs.addForm.clearValidate(); }) @@ -205,6 +211,7 @@ export default { this.diaPage.currentPage = 1; this.dialogVisible = true; this.$nextTick(() => { + this.$refs.multipleTable.clearSelection(); this.queryRailsList(this.diaPage); this.$refs.addForm.clearValidate(); }) @@ -217,17 +224,19 @@ export default { if (token == 'undefined' || !token) { return; } - if (this.multipleSelection.length < 1) { + if (this.multipleSelection.length < 1 && this.addForm.railIds.length < 1) { this.$message({ type: "error", message: "请选择电子围栏!" }); return; } + if(this.multipleSelection.length > 0) { + this.addForm.railIds = this.multipleSelection.map(item => item._id); + } this.submitLoading = true; - this.addForm.railIds = this.multipleSelection.map(item => {return item._id}); if (this.addForm._id != undefined) { - regionUpdate(token, { ...this.addForm, id: this.addForm._id}).then(res => { + regionUpdate(token, { ...this.addForm, id: this.addForm._id }).then(res => { this.submitLoading = false; if (res.data.code == 401) { window.sessionStorage.removeItem('bizToken'); @@ -243,7 +252,7 @@ export default { type: "success", message: "操作成功!" }); - }else { + } else { this.$message({ type: "error", message: res.data.msg @@ -269,7 +278,7 @@ export default { type: "success", message: "操作成功!" }); - }else { + } else { this.$message({ type: "error", message: res.data.msg @@ -397,7 +406,6 @@ export default { const data = res2.data.data; this.diaPage.total = data.totalElements; this.tableData = data.content; - this.$refs.multipleTable.clearSelection(); if (this.addForm.railIds.length > 0) { // 判断是否存在勾选过的数据 this.$nextTick(() => { this.tableData.forEach(row => { // 获取数据列表接口请求到的数据 @@ -422,7 +430,7 @@ export default { const data = res2.data.data; this.diaPage.total = data.totalElements; this.tableData = data.content; - this.$refs.multipleTable.clearSelection(); + console.log(this.addForm.railIds) if (this.addForm.railIds.length > 0) { // 判断是否存在勾选过的数据 this.$nextTick(() => { this.tableData.forEach(row => { // 获取数据列表接口请求到的数据 @@ -457,6 +465,7 @@ export default { .el-table th.el-table__cell { background: #F7F8FA; } + .table_box { th.el-table__cell { background: #F7F8FA; diff --git a/src/views/wirelessintrusion/deployment/list.vue b/src/views/wirelessintrusion/deployment/list.vue index 06d3dc1..e40da14 100644 --- a/src/views/wirelessintrusion/deployment/list.vue +++ b/src/views/wirelessintrusion/deployment/list.vue @@ -22,8 +22,8 @@ 删除 - + @@ -179,12 +179,17 @@ export default { align: "center", slot: true, }, + { + label: "创建时间", + prop: "createTime", + align: "center", + width: 150 + }, ] }, tableData: [], data: [], multipleSelection: [], - selectedArr: [], isDetail: false }; }, @@ -198,13 +203,6 @@ export default { editBtn: this.vaildData(this.permission.notice_edit, false) }; }, - ids() { - let ids = []; - this.selectionList.forEach(ele => { - ids.push(ele.id); - }); - return ids.join(","); - }, }, mounted() { this.loadDict(); @@ -259,6 +257,7 @@ export default { taskDescribe: '', type: 1, executeTime: null, + ids: '', deviceId: '', status: '1' } @@ -267,6 +266,7 @@ export default { this.isDetail = false; this.diaPage.currentPage = 1; this.$nextTick(() => { + this.$refs.multipleTable.clearSelection(); this.queryDeviceList(this.diaPage); }) }, @@ -278,22 +278,26 @@ export default { submitForm() { this.$refs.addform.validate((valid) => { if (valid) { - if (this.multipleSelection.length === 0) { + if (this.multipleSelection.length === 0 && this.addForm.deviceId == '') { this.$message({ type: "warning", message: "请选择关联设备" }) return; } - let ids = [], deviceId = []; - this.multipleSelection.forEach(ele => { - let tags = JSON.parse(ele.tags) - ids.push(ele.id); - deviceId.push(tags.sectorNo); - }); + if (this.multipleSelection.length > 0) { + let ids = [], deviceId = []; + this.multipleSelection.forEach(ele => { + let tags = JSON.parse(ele.tags) + ids.push(ele.id); + deviceId.push(tags.sectorNo); + }); + this.addForm.ids = ids.join(","); + this.addForm.deviceId = deviceId.join(","); + } this.submitLoading = true; if (this.addForm.id > 0) { - cornJobUpdate({ ...this.addForm, deviceId: deviceId.join(","), ids: ids.join(",") }).then((res) => { + cornJobUpdate(this.addForm).then((res) => { this.submitLoading = false; this.dialogVisible = false; this.onLoad(this.page); @@ -305,7 +309,7 @@ export default { this.submitLoading = false; }) } else { - cornJobSave({ ...this.addForm, deviceId: deviceId.join(","), ids: ids.join(",") }).then(res => { + cornJobSave(this.addForm).then(res => { this.submitLoading = false; this.dialogVisible = false; this.onLoad(this.page); @@ -357,6 +361,7 @@ export default { this.dialogVisible = true; this.isDetail = false; this.$nextTick(() => { + this.$refs.multipleTable.clearSelection(); this.queryDeviceList(this.diaPage); }) }, @@ -445,7 +450,6 @@ export default { item.productName = item.bizProduct.name; }) this.tableData = data.records; - this.$refs.multipleTable.clearSelection(); let multipleSelection = this.addForm.ids ? this.addForm.ids.split(",") : []; if (multipleSelection.length > 0) { // 判断是否存在勾选过的数据 this.$nextTick(() => { @@ -477,7 +481,6 @@ export default { item.productName = item.bizProduct.name; }) this.tableData = data.rows; - this.$refs.multipleTable.clearSelection(); let multipleSelection = this.addForm.ids ? this.addForm.ids.split(",") : []; if (multipleSelection.length > 0) { // 判断是否存在勾选过的数据 this.$nextTick(() => {