This commit is contained in:
fan 2020-12-17 13:20:47 +08:00
commit ca8da79986
3 changed files with 21 additions and 7 deletions

View File

@ -35,7 +35,7 @@ export default {
components: { components: {
MenuBar, MenuBar,
MenuRequest, MenuRequest,
MenuCancel, // MenuCancel,
MenuSignal, MenuSignal,
MenuSwitch, MenuSwitch,
MenuSection, MenuSection,

View File

@ -71,7 +71,7 @@
<div> <div>
<el-form ref="ruleForm" label-width="100px"> <el-form ref="ruleForm" label-width="100px">
<el-form-item label="客流数据:" prop="role"> <el-form-item label="客流数据:" prop="role">
<el-select v-model="currentFlowDataId" placeholder="请选择客流数据"> <el-select v-model="currentFlowDataId" placeholder="请选择客流数据" @change="changeData">
<el-option <el-option
v-for="item in flowDataList" v-for="item in flowDataList"
:key="item.id" :key="item.id"
@ -84,7 +84,7 @@
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="flowDataClose">{{ $t('global.cancel') }}</el-button> <el-button @click="flowDataClose">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" @click="confirmFlowData">{{ $t('global.confirm') }}</el-button> <el-button type="primary" :disabled="isDisabled" :loading="loading" @click="confirmFlowData">{{ $t('global.confirm') }}</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
@ -127,6 +127,8 @@ export default {
flowDataList:[], flowDataList:[],
currentFlowDataName:'', currentFlowDataName:'',
currentFlowDataId:'', currentFlowDataId:'',
isDisabled:false,
loading:false,
messageBoard: false messageBoard: false
}; };
}, },
@ -313,13 +315,16 @@ export default {
}, },
confirmFlowData() { confirmFlowData() {
if (this.currentFlowDataId) { if (this.currentFlowDataId) {
this.loading = true;
changePassengerFlowData(this.group, this.currentFlowDataId).then(res=>{ changePassengerFlowData(this.group, this.currentFlowDataId).then(res=>{
this.$store.dispatch('socket/resetTrainPassagerNum'); this.$store.dispatch('socket/resetTrainPassagerNum');
// this.$store.dispatch('map/mapClear'); // this.$store.dispatch('map/mapClear');
this.flowDataShow = false; this.flowDataShow = false;
const currentFlowData = this.flowDataList.find(each=>{ return each.id == this.currentFlowDataId; }); const currentFlowData = this.flowDataList.find(each=>{ return each.id == this.currentFlowDataId; });
if (currentFlowData) { this.currentFlowDataName = currentFlowData.name; } if (currentFlowData) { this.currentFlowDataName = currentFlowData.name; }
this.loading = false;
}).catch(error=>{ }).catch(error=>{
this.loading = false;
this.$messageBox('切换客流数据失败'); this.$messageBox('切换客流数据失败');
console.log(error.message); console.log(error.message);
}); });
@ -382,9 +387,18 @@ export default {
}, },
changeFlowData() { changeFlowData() {
this.flowDataShow = true; this.flowDataShow = true;
this.isDisabled = true;
const currentFlowData = this.flowDataList.find(each=>{ return each.name == this.currentFlowDataName; }); const currentFlowData = this.flowDataList.find(each=>{ return each.name == this.currentFlowDataName; });
if (currentFlowData) { this.currentFlowDataId = currentFlowData.id; } if (currentFlowData) { this.currentFlowDataId = currentFlowData.id; }
}, },
changeData(id) {
const currentFlowData = this.flowDataList.find(each=>{ return each.id == id; });
if (currentFlowData && currentFlowData.name == this.currentFlowDataName) {
this.isDisabled = true;
} else {
this.isDisabled = false;
}
},
end() { end() {
exitRunPlan(this.group).then(() => { exitRunPlan(this.group).then(() => {
this.$store.dispatch('training/over').then(() => { this.$store.dispatch('training/over').then(() => {

View File

@ -110,8 +110,7 @@ export default {
deleteSection(list, index) { deleteSection(list, index) {
const data = list.splice(index, 1); const data = list.splice(index, 1);
if (data.length > 0) { if (data.length > 0) {
const section = this.$store.getters['map/getDeviceByCode'](data[0].sectionCode); this.setSectionColor({'sectionCode':data[0].sectionCode}, '');
section.instance.drawBatchSelected(section, '');
} }
}, },
hover(field) { hover(field) {
@ -142,6 +141,7 @@ export default {
if (!sectionState) { if (!sectionState) {
this.sectionCodeList.push({'sectionCode':sectionCode, 'stationCode':stationCode}); this.sectionCodeList.push({'sectionCode':sectionCode, 'stationCode':stationCode});
this.setSectionColor({'sectionCode':sectionCode}, 'routingSection'); this.setSectionColor({'sectionCode':sectionCode}, 'routingSection');
this.sectionCode = '';
} else { } else {
this.$messageBox('一个车站只能添加一个折返区段'); this.$messageBox('一个车站只能添加一个折返区段');
} }
@ -193,7 +193,7 @@ export default {
this.loading = false; this.loading = false;
}); });
} else { } else {
this.$messageBox('添加折返区段'); this.$messageBox('添加折返区段');
} }
}, },
clear() { clear() {