绘图相关调整_(区段快捷删除调整)

This commit is contained in:
fan 2019-12-06 14:36:18 +08:00
parent c0c580ec1d
commit 7cc2b68d13
7 changed files with 17 additions and 24 deletions

View File

@ -14,20 +14,23 @@ export function getUID(type, list) {
} else { } else {
name = Math.floor((Math.random() * 100000) + 1); name = Math.floor((Math.random() * 100000) + 1);
} }
const code = [(type || ''), name].join(''); function checkUid() {
let count = 0; let count = 0;
for (let index = 0; index < list.length; index++) { for (let index = 0; index < list.length; index++) {
count++; count++;
if (list[index].code == code) { if (list[index].code == [(type || ''), name].join('')) {
this.getUID(type, list); name++;
return; return checkUid();
}
} }
return count == list.length;
} }
if (count == list.length) { if (checkUid()) {
return code; return [(type || ''), name].join('');
} }
// } else { // } else {
// return [(type || ''), Math.floor((Math.random() * 100000) + 1)].join(''); // return [(type || ''), Math.floor((Math.random() * 100000) + 1)].join('');
// } // }
// use Math.random to make id as unique as possible. // use Math.random to make id as unique as possible.
} }

View File

@ -254,6 +254,11 @@ export default {
return this.mapInfo && this.mapInfo.id; return this.mapInfo && this.mapInfo.id;
} }
}, },
watch: {
'$store.state.map.deleteCount': function (val) {
this.$refs[this.enabledTab].deleteObj();
}
},
mounted() { mounted() {
this.initPage(); this.initPage();
}, },

View File

@ -603,9 +603,6 @@ export default {
watch: { watch: {
'$store.state.menuOperation.mapDrawSelectCount': function(val) { '$store.state.menuOperation.mapDrawSelectCount': function(val) {
this.deviceSelect(this.selected); this.deviceSelect(this.selected);
},
'$store.state.map.deleteCount': function (val) {
this.deleteObj();
} }
}, },
mounted() { mounted() {

View File

@ -196,9 +196,6 @@ export default {
watch: { watch: {
selected(val, oldVal) { selected(val, oldVal) {
this.deviceSelect(val); this.deviceSelect(val);
},
'$store.state.map.deleteCount': function (val) {
this.deleteObj();
} }
}, },
mounted() { mounted() {

View File

@ -227,9 +227,6 @@ export default {
watch: { watch: {
selected: function (val) { selected: function (val) {
this.deviceSelect(val); this.deviceSelect(val);
},
'$store.state.map.deleteCount': function (val) {
this.deleteObj();
} }
}, },
methods: { methods: {

View File

@ -205,9 +205,6 @@ export default {
watch: { watch: {
selected: function (val, oldVal) { selected: function (val, oldVal) {
this.deviceSelect(val); this.deviceSelect(val);
},
'$store.state.map.deleteCount': function (val) {
this.deleteObj();
} }
}, },
mounted() { mounted() {

View File

@ -173,9 +173,6 @@ export default {
watch: { watch: {
selected: function (val, oldVal) { selected: function (val, oldVal) {
this.deviceSelect(val); this.deviceSelect(val);
},
'$store.state.map.deleteCount': function (val) {
this.deleteObj();
} }
}, },
methods: { methods: {