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

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

View File

@ -24,6 +24,11 @@
</el-button-group> </el-button-group>
</div> </div>
</el-tab-pane> </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> </el-tabs>
</template> </template>
@ -448,6 +453,25 @@ export default {
} }
return idPrefix; 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) { changeBelongStation(code) {
if (code) { if (code) {
this.stationList.forEach(item => { 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.trainWindow'), name:'TrainWindow', menus:TrainWindowDraft},
{label: this.$t('map.zcZoneControl'), name:'ZcControl', menus:ZcControlDraft}, {label: this.$t('map.zcZoneControl'), name:'ZcControl', menus:ZcControlDraft},
{label: this.$t('map.functionButton'), name:'ControlDraft', menus:ControlDraft}, {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.train'), name:'Train', menus:TrainDraft},
{label: this.$t('map.line'), name:'Line', menus:LineDraft}, {label: this.$t('map.line'), name:'Line', menus:LineDraft},
{label: '供电线', name:'Power', menus:PowerDraft}, {label: '供电线', name:'Power', menus:PowerDraft},

View File

@ -406,7 +406,7 @@ export default {
models.push(deepAssign(item, { _dispose: true })); 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 => { arrList.forEach(itemName => {
map[itemName] && map[itemName].forEach(item => { map[itemName] && map[itemName].forEach(item => {
const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX; 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 })); 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) { if (this.fromModel.right && section.rightSectionCode) {
section.rightSectionCode = ''; section.rightSectionCode = '';
} }

View File

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