From 59ad7ba6452b2028fd7faca000c626a148256620 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@iotlink.com> Date: 星期二, 01 九月 2020 23:29:50 +0800 Subject: [PATCH] fix: do not allow empty data to be saved. for area manager --- src/pages/areaManage/index/App.vue | 57 ++++++++++++++++++++++----------------------------------- 1 files changed, 22 insertions(+), 35 deletions(-) diff --git a/src/pages/areaManage/index/App.vue b/src/pages/areaManage/index/App.vue index b1ddebb..9e16b9b 100644 --- a/src/pages/areaManage/index/App.vue +++ b/src/pages/areaManage/index/App.vue @@ -58,7 +58,7 @@ import { guid } from '@/scripts/util.js' import { findAllPolygons, getAllAreas, saveAreaInfo, delArea } from '@/api/camera' export default { - data () { + data() { return { isEdit: false, groups: [], @@ -98,19 +98,19 @@ checkedData: [] } }, - mounted () { + mounted() { this.renderTable(); this.getAllPolygons(); }, methods: { - renderTable () { + renderTable() { getAllAreas().then(res => { if (res.code == 200) { this.groups = res.data } }) }, - getAllPolygons () { + getAllPolygons() { findAllPolygons().then(res => { if (res.code == 200) { this.areaData = res.data.map(item => { @@ -127,11 +127,10 @@ } }); }, - edit (row) { + edit(row) { this.isEdit = true; this.dialogFormVisible = true; this.areaForm = row; - debugger //鍥炴樉绌挎妗� let _this = this; _this.checkedData = []; @@ -148,7 +147,7 @@ }); console.log(this.checkedData) }, - createArea () { + createArea() { this.isEdit = false; this.dialogFormVisible = true; this.areaForm = JSON.parse(JSON.stringify(this.areaForm)); @@ -158,7 +157,7 @@ this.areaForm.camPolygons = []; this.checkedData = []; }, - removeItem (id) { + removeItem(id) { this.$confirm('纭畾鍒犻櫎璇ラ」鍚�?', '鎻愮ず', { confirmButtonText: '纭畾', cancelButtonText: '鍙栨秷', @@ -177,34 +176,23 @@ }); }, - getIdCode () { + getIdCode() { this.areaForm.id = guid(); }, - handleChange (value, direction, movedKeys) { + handleChange(value, direction, movedKeys) { console.log(value, direction, movedKeys); }, - save () { - // this.checkedData.forEach(item=>{ - // let node = JSON.parse(item); - // this.camPolygon.cameraId = node.cameraId; - // this.camPolygon.cameraName = node.cameraName; - // this.pgn.polygonId = node.polygonId; - // this.pgn.polygonName = node.polygonName; - // this.camPolygon.pgns.push(this.pgn); - // this.areaForm.camPolygons.push(this.camPolygon); - // let _this = this; - // saveAreaInfo(this.areaForm).then(res=>{ - // if(res.code==200){ - // _this.$notify({ - // type:'success', - // message:'淇濆瓨鎴愬姛!' - // }); - // _this.dialogFormVisible = false; - // _this.getAllAreas(); - // } - // }) - // }); + save() { + if (this.areaForm.id === "") { + this.$notify({ + type: 'error', + message: '鍖哄煙ID涓嶈兘涓虹┖' + }); + + return; + } + let tempArr = []; let tempIdArr = []; this.areaForm.camPolygons = []; @@ -238,7 +226,6 @@ }) let _this = this; console.log(this.areaForm); - debugger saveAreaInfo(this.areaForm).then(res => { if (res.code == 200) { _this.$notify({ @@ -334,7 +321,7 @@ /deep/.el-transfer-panel__item.el-checkbox .el-checkbox__label { overflow: visible; } -/deep/.el-transfer-panel__item.el-checkbox .el-checkbox__label span{ +/deep/.el-transfer-panel__item.el-checkbox .el-checkbox__label span { font-size: 12px !important; padding-right: 20px; } @@ -344,7 +331,7 @@ .el-checkbox__label { font-size: 14px !important; } -/deep/.el-transfer-panel{ - width:300px; +/deep/.el-transfer-panel { + width: 300px; } </style> \ No newline at end of file -- Gitblit v1.8.0