修改列车操作

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:', switchACodeNum: 'Switch ID 1:',
switchBCodeNum: 'Switch ID 2:', 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', creatingFailed: 'Create a failure',
confirmDeletion: 'Confirm deletion?', confirmDeletion: 'Confirm deletion?',
confirmBatchGeneration: 'Is batch generation confirmed?', confirmBatchGeneration: 'Is batch generation confirmed?',
confirmBatchDelete: 'Is batch deletion confirmed?',
hint: 'Tips', hint: 'Tips',
cancelledDelete: 'Cancelled delete', cancelledDelete: 'Cancelled delete',
cancelGeneration: 'Batch generation has been cancelled', cancelGeneration: 'Batch generation has been cancelled',

View File

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

View File

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

View File

@ -455,6 +455,15 @@ const map = {
if (index >= 0) { if (index >= 0) {
list.splice(index, 1); 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> </el-scrollbar>
<div class="button_box"> <div class="button_box">
<el-button-group class="map-draft-group"> <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 type="primary" size="small" @click="handleCreate">{{ $t('map.create') }}</el-button>
</el-button-group> </el-button-group>
</div> </div>
@ -142,10 +143,16 @@ export default {
} }
}, },
delTrainMode(code) { delTrainMode(code) {
if (code) { this.$confirm(this.$t('map.wellDelTrianModel'), this.$t('global.tips'), {
const model = { code }; confirmButtonText: this.$t('global.confirm'),
this.$refs.trainMode.operateTrainModel({ model, type: 'DEL' }); cancelButtonText: this.$t('global.cancel'),
} type: 'warning'
}).then(() => {
if (code) {
const model = { code };
this.$refs.trainMode.operateTrainModel({ model, type: 'DEL' });
}
});
}, },
handleEdit(index, row) { handleEdit(index, row) {
@ -153,22 +160,33 @@ export default {
handleDelete(index, row) { handleDelete(index, row) {
const train = this.$store.getters['map/getDeviceByCode'](row.code); const train = this.$store.getters['map/getDeviceByCode'](row.code);
if (train) { if (train) {
const _that = this;
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), { this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'), confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
_that.$emit('delMapModel', train); this.$emit('delMapModel', train);
_that.deviceSelect(); this.deviceSelect();
}).catch(() => { }).catch(() => {
_that.$message.info(this.$t('tip.cancelledDelete')); this.$message.info(this.$t('tip.cancelledDelete'));
}); });
} }
}, },
handleCreate() { handleCreate() {
this.$refs.create.doShow(); 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) { dispatch(opts) {
this[opts.callback](opts.params); this[opts.callback](opts.params);
} }

View File

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