增加删除范围,调整退出仿真发送取消订阅

This commit is contained in:
zyy 2020-12-08 13:56:36 +08:00
parent 407d1d421b
commit 9ede8ad97d
5 changed files with 51 additions and 102 deletions

View File

@ -7,7 +7,7 @@
<script>
import MapCommon from './common/index';
import { getToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
import { creatSubscribe, clearSubscribe, displayTopic } from '@/utils/stomp';
import { checkLoginLine } from '@/api/login';
import { getSimulationMemberList, getAllSimulationUser } from '@/api/simulation';
import { mapGetters } from 'vuex';
@ -27,7 +27,8 @@ export default {
mouseNum: 1,
mouseNumTime: 0,
mapBoxP: null,
mode: ''
mode: '',
groupModel: ''
};
},
computed: {
@ -71,6 +72,7 @@ export default {
window.onbeforeunload = this.clearSubscribe;
this.mode = this.$route.params.mode || '';
this.currentMap = this.$refs.mapCommon;
this.groupModel = this.$route.query.group;
this.checkLoginLineTimer(); //
this.checkMouseStatusTimer(); //
this.$nextTick(() => {
@ -112,7 +114,7 @@ export default {
await this.$store.dispatch('training/setHasSubscribed');
},
clearSubscribe() {
clearSubscribe(`${displayTopic}\/${this.$route.query.group}`);
clearSubscribe(`${displayTopic}\/${this.groupModel}`);
},
setCenter(code) {
this.$refs.mapCommon && this.$refs.mapCommon.setCenter(code);

View File

@ -24,6 +24,11 @@
</el-button-group>
</div>
</el-tab-pane>
<el-tab-pane class="view-control" label="批量操作" name="three" :lazy="lazy">
<div class="view-control-content">
<el-button type="primary" style="margin: 0 auto;display: block;" @click="handleDelete">一键删除无效数据</el-button>
</div>
</el-tab-pane>
</el-tabs>
</template>
@ -448,6 +453,25 @@ export default {
}
return idPrefix;
},
handleDelete() {
this.$confirm('您是否确定一键删除无用数据?', this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
const models = [];
this.indicatorLightList.forEach(item => {
const model = this.$store.getters['map/getDeviceByCode'](item.stationCode);
if (!model) {
models.push(deepAssign(item, { _dispose: true }));
}
});
models.length && this.$emit('updateMapModel', models);
this.$message.success('删除成功!');
}).catch(() => {
this.$message.info('删除失败');
});
},
changeBelongStation(code) {
if (code) {
this.stationList.forEach(item => {

View File

@ -125,7 +125,7 @@ export default {
{label: this.$t('map.trainWindow'), name:'TrainWindow', menus:TrainWindowDraft},
{label: this.$t('map.zcZoneControl'), name:'ZcControl', menus:ZcControlDraft},
{label: this.$t('map.functionButton'), name:'ControlDraft', menus:ControlDraft},
{label: this.$t('map.saidLamp'), name:'ControlLamp', menus:ControlLamp},
{label: this.$t('map.saidLamp'), name:'ControlLamp', menus:ControlLamp}, //
{label: this.$t('map.train'), name:'Train', menus:TrainDraft},
{label: this.$t('map.line'), name:'Line', menus:LineDraft},
{label: '供电线', name:'Power', menus:PowerDraft},

View File

@ -406,7 +406,7 @@ export default {
models.push(deepAssign(item, { _dispose: true }));
}
});
const arrList = ['signalList', 'stationList', 'psdList', 'axleCounterResetButtonList', 'tbStrategyList', 'zcList', 'cycleButtonList', 'totalGuideLockButtonVOList', 'automaticRouteButtonList', 'outerFrameList', 'directionRodList', 'textList'];
const arrList = ['signalList', 'stationList', 'psdList', 'axleCounterResetButtonList', 'tbStrategyList', 'zcList', 'cycleButtonList', 'totalGuideLockButtonVOList', 'automaticRouteButtonList', 'outerFrameList', 'directionRodList', 'textList', 'indicatorLightList', 'splitStationList'];
arrList.forEach(itemName => {
map[itemName] && map[itemName].forEach(item => {
const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
@ -423,85 +423,6 @@ export default {
esp && models.push(deepAssign(esp, { _dispose: true }));
}
});
// map.signalList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {
// models.push(deepAssign(item, { _dispose: true }));
// }
// });
// map.stationList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {
// models.push(deepAssign(item, { _dispose: true }));
// }
// });
// map.psdList && map.psdList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {
// models.push(deepAssign(item, { _dispose: true }));
// }
// });
// //
// map.axleCounterResetButtonList && map.axleCounterResetButtonList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {
// models.push(deepAssign(item, { _dispose: true }));
// }
// });
// // GQX
// map.tbStrategyList && map.tbStrategyList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {
// models.push(deepAssign(item, { _dispose: true }));
// }
// });
// map.zcList && map.zcList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {
// models.push(deepAssign(item, { _dispose: true }));
// }
// });
// //
// map.cycleButtonList && map.cycleButtonList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {
// models.push(deepAssign(item, { _dispose: true }));
// }
// });
// //
// map.totalGuideLockButtonVOList && map.totalGuideLockButtonVOList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {
// models.push(deepAssign(item, { _dispose: true }));
// }
// });
// //
// map.automaticRouteButtonList && map.automaticRouteButtonList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {
// models.push(deepAssign(item, { _dispose: true }));
// }
// });
// //
// map.outerFrameList && map.outerFrameList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {
// models.push(deepAssign(item, { _dispose: true }));
// }
// });
// //
// map.directionRodList && map.directionRodList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {
// models.push(deepAssign(item, { _dispose: true }));
// }
// });
// map.textList && map.textList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {
// models.push(deepAssign(item, { _dispose: true }));
// }
// });
if (this.fromModel.right && section.rightSectionCode) {
section.rightSectionCode = '';
}

View File

@ -63,24 +63,26 @@ export default {
watch: {
'$store.state.runPlan.selected': function (select) {
this.stationListConfig.data = [];
const serviceObj = this.$store.state.runPlan.editData[select.serviceNumber];
if (serviceObj) {
const trainMap = serviceObj.trainMap;
if (trainMap) {
const trainObj = trainMap[select.tripNumber];
if (trainObj) {
const stationTimeList = trainObj.stationTimeList;
if (stationTimeList && stationTimeList.length) {
stationTimeList.forEach((elem, index) => {
const stationObj = {
stationName: formatName(elem.stationCode),
startTime: formatTime(index == 0 ? null : stationTimeList[index - 1].secondTime),
stopTime: formatTime(index == 0 ? null : elem.secondTime - stationTimeList[index - 1].secondTime),
endTime: formatTime(elem.secondTime),
level: ''
};
this.stationListConfig.data.push(stationObj);
});
if (select) {
const serviceObj = this.$store.state.runPlan.editData[select.serviceNumber];
if (serviceObj) {
const trainMap = serviceObj.trainMap;
if (trainMap) {
const trainObj = trainMap[select.tripNumber];
if (trainObj) {
const stationTimeList = trainObj.stationTimeList;
if (stationTimeList && stationTimeList.length) {
stationTimeList.forEach((elem, index) => {
const stationObj = {
stationName: formatName(elem.stationCode),
startTime: formatTime(index == 0 ? null : stationTimeList[index - 1].secondTime),
stopTime: formatTime(index == 0 ? null : elem.secondTime - stationTimeList[index - 1].secondTime),
endTime: formatTime(elem.secondTime),
level: ''
};
this.stationListConfig.data.push(stationObj);
});
}
}
}
}