diff --git a/src/i18n/langs/en/map.js b/src/i18n/langs/en/map.js index 76461e4c9..3d239d6f4 100644 --- a/src/i18n/langs/en/map.js +++ b/src/i18n/langs/en/map.js @@ -497,6 +497,6 @@ export default { switchACodeNum: 'Switch ID 1:', switchBCodeNum: 'Switch ID 2:', - wellDelTrianModel: 'Deleting the train model will delete the associated class cars together, please confirm whether to continue?' - + wellDelTrianModel: 'Deleting the train model will delete the associated class cars together, please confirm whether to continue?', + clear: 'Clear' }; diff --git a/src/i18n/langs/en/tip.js b/src/i18n/langs/en/tip.js index fe597eeb0..258933769 100644 --- a/src/i18n/langs/en/tip.js +++ b/src/i18n/langs/en/tip.js @@ -5,6 +5,7 @@ export default { creatingFailed: 'Create a failure', confirmDeletion: 'Confirm deletion?', confirmBatchGeneration: 'Is batch generation confirmed?', + confirmBatchDelete: 'Is batch deletion confirmed?', hint: 'Tips', cancelledDelete: 'Cancelled delete', cancelGeneration: 'Batch generation has been cancelled', diff --git a/src/i18n/langs/zh/map.js b/src/i18n/langs/zh/map.js index 3d2b0164a..b13b8c2a3 100644 --- a/src/i18n/langs/zh/map.js +++ b/src/i18n/langs/zh/map.js @@ -499,6 +499,7 @@ export default { switchACodeNum: '道岔ID 1:', switchBCodeNum: '道岔ID 2:', - wellDelTrianModel: '删除车模型会将关联的类车一起删除,请确认是否继续?' + wellDelTrianModel: '删除车模型会将关联的类车一起删除,请确认是否继续?', + clear: '清空' }; diff --git a/src/i18n/langs/zh/tip.js b/src/i18n/langs/zh/tip.js index 2da8511cb..807a82d2d 100644 --- a/src/i18n/langs/zh/tip.js +++ b/src/i18n/langs/zh/tip.js @@ -5,6 +5,7 @@ export default { creatingFailed: '创建失败', confirmDeletion: '是否确认删除?', confirmBatchGeneration: '是否确认批量生成?', + confirmBatchDelete: '是否确认批量删除?', hint: '提示', cancelledDelete: '已取消删除', cancelGeneration: '已取消批量生成', diff --git a/src/store/modules/map.js b/src/store/modules/map.js index 96ac47f31..5899cec89 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -455,6 +455,15 @@ const map = { if (index >= 0) { list.splice(index, 1); } + + const trainList = state.map.trainList; + trainList.forEach(elem => { + if (elem.modelCode == model.code) { + elem['_dispose'] = true; + } + }); + + Vue.prototype.$jlmap && Vue.prototype.$jlmap.render(trainList); } } }, diff --git a/src/views/map/mapdraft/mapedit/mapoperate/train/index.vue b/src/views/map/mapdraft/mapedit/mapoperate/train/index.vue index 08870ffc6..9b56a11c1 100644 --- a/src/views/map/mapdraft/mapedit/mapoperate/train/index.vue +++ b/src/views/map/mapdraft/mapedit/mapoperate/train/index.vue @@ -18,6 +18,7 @@
@@ -142,10 +143,16 @@ export default { } }, delTrainMode(code) { - if (code) { - const model = { code }; - this.$refs.trainMode.operateTrainModel({ model, type: 'DEL' }); - } + this.$confirm(this.$t('map.wellDelTrianModel'), this.$t('global.tips'), { + confirmButtonText: this.$t('global.confirm'), + cancelButtonText: this.$t('global.cancel'), + type: 'warning' + }).then(() => { + if (code) { + const model = { code }; + this.$refs.trainMode.operateTrainModel({ model, type: 'DEL' }); + } + }); }, handleEdit(index, row) { @@ -153,22 +160,33 @@ export default { handleDelete(index, row) { const train = this.$store.getters['map/getDeviceByCode'](row.code); if (train) { - const _that = this; this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), { confirmButtonText: this.$t('tip.confirm'), cancelButtonText: this.$t('tip.cancel'), type: 'warning' }).then(() => { - _that.$emit('delMapModel', train); - _that.deviceSelect(); + this.$emit('delMapModel', train); + this.deviceSelect(); }).catch(() => { - _that.$message.info(this.$t('tip.cancelledDelete')); + this.$message.info(this.$t('tip.cancelledDelete')); }); } }, handleCreate() { this.$refs.create.doShow(); }, + handleClear() { + this.$confirm(this.$t('tip.confirmBatchDelete'), this.$t('tip.hint'), { + confirmButtonText: this.$t('tip.confirm'), + cancelButtonText: this.$t('tip.cancel'), + type: 'warning' + }).then(() => { + this.$emit('delMapModel', this.trainList); + this.deviceSelect(); + }).catch(() => { + this.$message.info(this.$t('tip.cancelledDelete')); + }); + }, dispatch(opts) { this[opts.callback](opts.params); } diff --git a/src/views/map/mapdraft/mapedit/mapoperate/train/trainmodel.vue b/src/views/map/mapdraft/mapedit/mapoperate/train/trainmodel.vue index b1922bfde..a27c0dff7 100644 --- a/src/views/map/mapdraft/mapedit/mapoperate/train/trainmodel.vue +++ b/src/views/map/mapdraft/mapedit/mapoperate/train/trainmodel.vue @@ -44,8 +44,8 @@