修改列车操作

This commit is contained in:
ival 2019-08-21 15:00:58 +08:00
parent 6bbfd49150
commit 242e082dc7
7 changed files with 46 additions and 19 deletions

View File

@ -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'
};

View File

@ -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',

View File

@ -499,6 +499,7 @@ export default {
switchACodeNum: '道岔ID 1:',
switchBCodeNum: '道岔ID 2:',
wellDelTrianModel: '删除车模型会将关联的类车一起删除,请确认是否继续?'
wellDelTrianModel: '删除车模型会将关联的类车一起删除,请确认是否继续?',
clear: '清空'
};

View File

@ -5,6 +5,7 @@ export default {
creatingFailed: '创建失败',
confirmDeletion: '是否确认删除?',
confirmBatchGeneration: '是否确认批量生成?',
confirmBatchDelete: '是否确认批量删除?',
hint: '提示',
cancelledDelete: '已取消删除',
cancelGeneration: '已取消批量生成',

View File

@ -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);
}
}
},

View File

@ -18,6 +18,7 @@
</el-scrollbar>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="danger" size="small" @click="handleClear">{{ $t('map.clear') }}</el-button>
<el-button type="primary" size="small" @click="handleCreate">{{ $t('map.create') }}</el-button>
</el-button-group>
</div>
@ -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);
}

View File

@ -44,8 +44,8 @@
</template>
<script>
import { getUID } from '@/jmap/utils/Uid';
import { mapGetters } from 'vuex';
export default {
name: 'TrainModeOperate',
@ -70,6 +70,9 @@ export default {
};
},
computed: {
...mapGetters('map', [
'trainList'
]),
addRules: function () {
return {
code: [
@ -156,13 +159,7 @@ export default {
} else if (this.isUpt) {
this.operateTrainModel({ model: this.formModel, type: 'UPT' });
} else if (this.isDel) {
this.$confirm(this.$t('map.wellDelTrianModel'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
this.operateTrainModel({ model: this.formModel, type: 'DEL'});
}).catch(() => { });
this.operateTrainModel({ model: this.formModel, type: 'DEL'});
}
this.doClose();
}