This commit is contained in:
zyy 2020-10-30 15:26:54 +08:00
commit dfbca08c80
18 changed files with 409 additions and 327 deletions

View File

@ -36,9 +36,9 @@
<el-col :span="10">
<div class="nav-border">
<el-row>
<el-col :span="6"><el-button style="width: 80px;" :style="{background:levelList.includes('A')?'#F00':'#FFF' }" plain :class="{'headerBox' :levelList.includes('A')}" @click="showLowAlarm('A')">A级警报</el-button></el-col>
<el-col :span="6"><el-button style="width: 80px;" :style="{background:levelList.includes('B')?'#F00':'#FFF' }" plain :class="{'headerBox' :levelList.includes('B')}" @click="showLowAlarm('B')">B级警报</el-button></el-col>
<el-col :span="6"><el-button style="width: 80px;" :style="{background:levelList.includes('C')?'#F00':'#FFF' }" plain :class="{'headerBox' :levelList.includes('C')}" @click="showLowAlarm('C')">C级警报</el-button></el-col>
<el-col :span="6"><el-button style="width: 80px;" :style="{background:isNoRecoverLevelA || isNoConfirmLevelA?'#F00':'#FFF' }" plain :class="{'headerBox' :isNoConfirmLevelA}" @click="showLowAlarm('A')">A级警报</el-button></el-col>
<el-col :span="6"><el-button style="width: 80px;" :style="{background:isNoRecoverLevelB || isNoConfirmLevelB?'#F00':'#FFF' }" plain :class="{'headerBox' :isNoConfirmLevelB}" @click="showLowAlarm('B')">B级警报</el-button></el-col>
<el-col :span="6"><el-button style="width: 80px;" :style="{background:isNoRecoverLevelC?'#F00':'#FFF' }" plain>C级警报</el-button></el-col>
<el-col :span="6"><el-button style="width: 80px;" plain @click="undeveloped">记录</el-button></el-col>
</el-row>
<el-row>
@ -107,9 +107,9 @@
<el-col :span="4">
<div style="width: calc(100% - 10px);border: 2px solid #DDD9CA;border-radius: 5px;">
<el-row style="height: 68px;display: flex; justify-content: space-between;align-items: center;">
<div style="width: 40px;" class="div-simulate-button" :class="{'headerBox' :levelList.includes('A')}" @click="showHimAlarm('A')">A</div>
<div style="width: 40px;" class="div-simulate-button" :class="{'headerBox' :levelList.includes('B')}" @click="showHimAlarm('B')">B</div>
<div style="width: 40px;" class="div-simulate-button" :class="{'headerBox' :levelList.includes('C')}" @click="showHimAlarm('C')">C</div>
<div style="width: 40px;" class="div-simulate-button" :style="{background:isNoRecoverLevelA || isNoConfirmLevelA?'#F00':'#FFF' }" :class="{'headerBox' :isNoConfirmLevelA}" @click="showHimAlarm('A')">A</div>
<div style="width: 40px;" class="div-simulate-button" :style="{background:isNoRecoverLevelB || isNoConfirmLevelB?'#F00':'#FFF' }" :class="{'headerBox' :isNoConfirmLevelB}" @click="showHimAlarm('B')">B</div>
<div style="width: 40px;" class="div-simulate-button" :style="{background:isNoRecoverLevelC?'#F00':'#FFF' }" @click="showHimAlarm('C')">C</div>
<img :src="voiceIcon" style="width: 40px;height: 40px;" @click="controlAudio(false)">
</el-row>
<el-row class="button-row">
@ -187,9 +187,18 @@ export default {
version: '',
centralizedMap: {},
tipContent: [],
levelList: [],
sound: false,
buzzerAudio: BuzzerAudio
buzzerAudio: BuzzerAudio,
noConfirmMapA: {},
noConfirmMapB: {},
confirmNoRecoverMapA: {},
confirmNoRecoverMapB: {},
confirmNoRecoverMapC: {},
noConfirmMapAString: '{}',
noConfirmMapBString: '{}',
confirmNoRecoverMapAString: '{}',
confirmNoRecoverMapBString: '{}',
confirmNoRecoverMapCString: '{}'
};
},
computed: {
@ -208,6 +217,21 @@ export default {
},
voiceIcon() {
return this.sound ? voiceOpen : voiceClose;
},
isNoConfirmLevelA() {
return this.noConfirmMapAString !== '{}';
},
isNoConfirmLevelB() {
return this.noConfirmMapBString !== '{}';
},
isNoRecoverLevelA() {
return this.confirmNoRecoverMapAString !== '{}';
},
isNoRecoverLevelB() {
return this.confirmNoRecoverMapBString !== '{}';
},
isNoRecoverLevelC() {
return this.confirmNoRecoverMapCString !== '{}';
}
},
watch: {
@ -243,13 +267,52 @@ export default {
}
},
'$store.state.socket.simulationAlarmInfo': function(val) {
if (val) {
this.tipContent.push(val);
this.handleAlarm(val);
if (this.tipContent.length > 3) {
this.tipContent.shift();
(val || []).forEach(item => {
if (!item.confirmed) {
this.tipContent.push(item);
this.handleAlarm(item);
if (this.tipContent.length > 3) {
this.tipContent.shift();
}
if (item.level === 'A') {
this.noConfirmMapA[item.code] = item;
this.noConfirmMapAString = JSON.stringify(this.noConfirmMapA);
} else if (item.level === 'B') {
this.noConfirmMapB[item.code] = item;
this.noConfirmMapBString = JSON.stringify(this.noConfirmMapB);
}
} else if (!item.recovered) {
if (item.level === 'A') {
delete this.noConfirmMapA[item.code];
this.confirmNoRecoverMapA[item.code] = item;
this.noConfirmMapAString = JSON.stringify(this.noConfirmMapA);
this.confirmNoRecoverMapAString = JSON.stringify(this.confirmNoRecoverMapA);
} else if (item.level === 'B') {
delete this.noConfirmMapB[item.code];
this.confirmNoRecoverMapB[item.code] = item;
this.noConfirmMapBString = JSON.stringify(this.noConfirmMapB);
this.confirmNoRecoverMapBString = JSON.stringify(this.confirmNoRecoverMapB);
} else if (item.level === 'C') {
this.confirmNoRecoverMapC[item.code] = item;
this.confirmNoRecoverMapCString = JSON.stringify(this.confirmNoRecoverMapC);
}
} else {
if (item.level === 'A') {
delete this.noConfirmMapA[item.code];
delete this.confirmNoRecoverMapA[item.code];
this.noConfirmMapAString = JSON.stringify(this.noConfirmMapA);
this.confirmNoRecoverMapAString = JSON.stringify(this.confirmNoRecoverMapA);
} else if (item.level === 'B') {
delete this.noConfirmMapB[item.code];
delete this.confirmNoRecoverMapB[item.code];
this.noConfirmMapBString = JSON.stringify(this.noConfirmMapB);
this.confirmNoRecoverMapBString = JSON.stringify(this.confirmNoRecoverMapB);
} else if (item.level === 'C') {
delete this.confirmNoRecoverMapC[item.code];
this.confirmNoRecoverMapCString = JSON.stringify(this.confirmNoRecoverMapC);
}
}
}
});
}
},
mounted() {
@ -262,10 +325,9 @@ export default {
},
methods: {
handleAlarm(val) {
if (!this.levelList.includes(val.level)) {
this.levelList.push(val.level);
if (val.level === 'A' || val.level === 'B') {
this.controlAudio(true);
}
this.controlAudio(true);
},
initMenu() {
//
@ -351,17 +413,9 @@ export default {
});
},
showHimAlarm(level) {
const index = this.levelList.indexOf(level);
if (index > -1) {
this.levelList.splice(index, 1);
}
this.$refs.alarmTableHmi.doShow(level);
},
showLowAlarm(level) {
const index = this.levelList.indexOf(level);
if (index > -1) {
this.levelList.splice(index, 1);
}
this.$refs.alarmTableLow.doShow(level);
},
controlAudio(val) {

View File

@ -25,19 +25,8 @@
</el-col>
<el-col :span="4" style="text-align: center;">
<el-button style="margin-left: 10px;" @click="queryData(true)">查询</el-button>
</el-col>
</el-row>
<el-row>
<el-col :span="10" style="text-align: center;">
<div style="display: inline-block;margin-right: 5px;">设备编号:</div>
<el-input v-model="deviceCode" placeholder="请输入内容" style="width:220px;" size="small" />
</el-col>
<el-col :span="10" style="text-align: center;">
<div style="display: inline-block;margin-right: 5px;margin-left: 10px;">元素编号:</div>
<el-input v-model="elementCode" placeholder="请输入内容" style="width:220px;" size="small" />
</el-col>
<el-col :span="4" style="text-align: center;">
<el-button style="margin-left: 10px;" @click="queryData(false)">撤销查询</el-button>
</el-col>
</el-row>
</div>
@ -66,7 +55,11 @@
<el-table-column prop="level" label="报警级别" />
<el-table-column prop="time" label="日期/时间" width="150px" />
<el-table-column prop="code" label="报警序号" />
<el-table-column prop="deviceCode" label="设备编号" />
<el-table-column prop="deviceCode" label="设备编号">
<template slot-scope="scope">
<span>{{ handleDeviceName(scope.row.deviceCode) }}</span>
</template>
</el-table-column>
<el-table-column prop="address" label="信号编号" />
<el-table-column prop="address" label="元素编号" />
<el-table-column prop="confirmed" label="确认">
@ -76,7 +69,7 @@
</el-table-column>
<el-table-column prop="confirmedUserName" label="确认人编号" width="120px" />
<el-table-column prop="confirmTime" label="确认时间" width="150px" />
<el-table-column prop="recover" label="恢复">
<el-table-column prop="recoverTime" label="恢复">
<template slot-scope="scope">
<span>{{ scope.row.recovered? 'Y':'N' }}</span>
</template>
@ -145,6 +138,10 @@ export default {
}).catch(() => {
this.$message.error('确认消息失败!');
});
},
handleDeviceName(code) {
const device = this.$store.getters['map/getDeviceByCode'](code);
return device.name;
}
}
};

View File

@ -32,7 +32,11 @@
<span>{{ handleDeviceType(scope.row.deviceCode) }}</span>
</template>
</el-table-column>
<el-table-column prop="deviceCode" label="设备编号" />
<el-table-column prop="deviceCode" label="设备编号">
<template slot-scope="scope">
<span>{{ handleDeviceName(scope.row.deviceCode) }}</span>
</template>
</el-table-column>
<el-table-column prop="code" label="故障号" />
<el-table-column prop="description" label="故障描述" />
<el-table-column prop="recover" label="已恢复">
@ -72,14 +76,6 @@ export default {
},
computed:{
},
watch: {
startTime() {
this.queryData();
},
endTime() {
this.queryData();
}
},
methods:{
doShow(level) {
this.show = true;
@ -101,6 +97,10 @@ export default {
handleDeviceType(code) {
const device = this.$store.getters['map/getDeviceByCode'](code);
return deviceType[device.type];
},
handleDeviceName(code) {
const device = this.$store.getters['map/getDeviceByCode'](code);
return device.name;
}
}
};

View File

@ -110,6 +110,7 @@ export default {
//
if (!this.dialogShow) {
this.addModel.groupNumber = selected.groupNumber;
this.addModel.serviceNumber = selected.serviceNumber;
}
this.dialogShow = true;
this.$nextTick(function () {

View File

@ -95,9 +95,9 @@ export default {
{label: '司机', value: 'DRIVER', enLabel: 'Driver '},
{label: '通号', value: 'MAINTAINER', enLabel: 'Repairman '},
{label: '车辆段调度', value: 'DEPOT_DISPATCHER', enLabel: 'Depot dispatcher '},
{label: '电调度', value: 'ELECTRIC_DISPATCHER', enLabel: 'Electric dispatcher'},
{label: '调度', value: 'ELECTRIC_DISPATCHER', enLabel: 'Electric dispatcher'},
{label: '行调', value: 'DISPATCHER', enLabel: 'Dispatcher '},
{label: '上级部门', value: 'PARENT_DEPARTMENT', enLabel: 'Parent_department'}
{label: '上级部门', value: 'PARENT_DEPARTMENT', enLabel: 'Parent department'}
],
SimulationType: [

View File

@ -276,7 +276,7 @@ const socket = {
simulationTimeSync: '', // 仿真时间
simulationIbpStatus: null,
competitionPracticeFinish:0, // 竞赛场景结束标识
simulationAlarmInfo: {} // 仿真报警信息
simulationAlarmInfo: []// 仿真报警信息
},
getters: {
},

View File

@ -375,6 +375,8 @@ export default {
dispatcherList[item.id] = this.memberData[item.id];
break;
case 'ELECTRIC_DISPATCHER':
this.memberData[item.id].label = '电力调度' + (item.name || '');
this.memberData[item.id].labelName = '电力调度' + (item.name || '');
electricDispatcherList[item.id] = this.memberData[item.id];
break;
case 'DEPOT_DISPATCHER':
@ -439,6 +441,11 @@ export default {
id: 'parentDepartment',
type: 'role',
children: parentDepartmentList
}, {
label: '电力调度',
id: 'electricDispatcher',
type: 'role',
children: electricDispatcherList
}];
this.initCommonMemberList();
this.filterNode();

View File

@ -168,6 +168,10 @@ export default {
member.label = '上级部门' + (member.name ? member.name : '');
break;
}
case 'ELECTRIC_DISPATCHER': {
member.label = '电力调度' + (member.name ? member.name : '');
break;
}
}
// if (member.type === 'DISPATCHER') {
// this.memberId = member.id;

View File

@ -222,6 +222,12 @@ export default {
id: 'parentDepartment',
type: 'role',
children: result.deviceListData[5]
},
{
label: '电力调度',
id: 'electricDispatcher',
type: 'role',
children: result.deviceListData[6]
}];
const lastMemberList = result.lastMemberList;
this.$emit('setTreeData', treeData);

View File

@ -28,15 +28,12 @@
/>
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
<tip-script-record-new
ref="tipTaskRecordNew"
:group="group"
:offset-bottom="offsetBottom"
:offset="offset"
:tree-data="treeData"
:member-list="memberData"
@changeTreeData="changeTreeData"
@addScriptMember="addScriptMember"
@resetChat="resetChat"
/>
<chat-box
@ -56,7 +53,6 @@ import TipScriptRecordNew from '@/views/scriptManage/tipScriptRecord';
import SetTime from '@/views/newMap/displayNew/demon/setTime';
import { Notification } from 'element-ui';
import { ranAsPlan, exitRunPlan } from '@/api/simulation';
import {covertMemberData} from '@/views/newMap/displayNew/utils';
import { getSimulationMemberList} from '@/api/simulation';
import ChatBox from '@/views/newMap/chatView/chatBox.vue';
@ -101,10 +97,6 @@ export default {
return {
isDisable: false,
isScriptCommand:false,
driverList:[],
treeData:[],
memberData:[],
activeTrainList:[],
userRole:''
};
},
@ -133,82 +125,16 @@ export default {
'$store.state.scriptRecord.bgSet':function (val) {
this.isScriptCommand = val;
},
// ()
'$store.state.map.activeTrainListChange': function (val) {
// driverList
const activeTrainList = this.$store.state.map.activeTrainList;
if (this.driverList.length > 0) {
const driverList = [];
if (activeTrainList && activeTrainList.length) {
activeTrainList.sort();
activeTrainList.forEach(groupNumber => {
const drivers = this.driverList.find(driver=>{
return driver.deviceCode == groupNumber;
});
if (drivers) {
driverList.push(drivers);
}
});
}
// this.memberData = [...this.treeData[0].children, ...this.treeData[1].children, ...this.treeData[2].children, ...this.treeData[3].children, ...this.treeData[4].children];
this.treeData[2].children = driverList;
} else {
this.activeTrainList = activeTrainList;
}
},
'$store.state.map.mapViewLoadedCount': function (val) { //
getSimulationMemberList(this.group).then(resp => {
// this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId:this.$store.state.user.id});
this.driverList = [];
this.treeData = [];
if (this.$store.state.training.started) {
this.activeTrainList = this.$store.state.map.activeTrainList;
}
// 仿
const result = covertMemberData(this.activeTrainList, resp.data);
this.driverList = result.driverList;
this.treeData = [{
label: '行调',
id: 'dispatcher',
type: 'role',
children: result.deviceListData[0]
}, {
label: '车站值班员',
id: 'stationSupervisor',
type: 'role',
children: result.deviceListData[2]
}, {
label: '司机',
id: 'driver',
type: 'role',
children: result.deviceListData[3]
}, {
label: '通号',
id: 'maintainer',
type: 'role',
children: result.deviceListData[1]
}, {
label: '车辆段',
id: 'depotDispatcher',
type: 'role',
children: result.deviceListData[4]
}, {
label: '上级部门',
id: 'parentDepartment',
type: 'role',
children: result.deviceListData[5]
}
// PARENT_DEPARTMENT
];
this.memberData = result.lastMemberList;
this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId:this.$store.state.user.id});
//
const member = resp.data.find(mem=>{
return mem.userId != '' && mem.userId != undefined;
});
if (member) {
const memberType = ['STATION_SUPERVISOR', 'DISPATCHER', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER', 'PARENT_DEPARTMENT'];
const prdTypeList = ['01', '02', '04', '', '', ''];
const memberType = ['STATION_SUPERVISOR', 'DISPATCHER', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER', 'PARENT_DEPARTMENT', 'ELECTRIC_DISPATCHER'];
const prdTypeList = ['01', '02', '04', '', '05', '', ''];
const index = memberType.indexOf(member.type);
let prdType;
if (index >= 0) {
@ -223,6 +149,9 @@ export default {
}).catch(() => {
this.$messageBox('获取仿真成员列表失败!');
});
},
'$store.state.scriptRecord.userRole':function (val) {
this.userRole = val;
}
},
beforeDestroy() {
@ -305,48 +234,6 @@ export default {
},
resetChat() {
// this.$refs.chatbox.resetCoversition();
},
changeTreeData({newRole, oldRole}) {
const deviceTypeList = ['DISPATCHER', 'STATION_SUPERVISOR', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER', 'PARENT_DEPARTMENT'];
if (oldRole.id) {
const oldIndex = deviceTypeList.indexOf(oldRole.type);
if (oldIndex >= 0) {
const oldTreeDataIn = this.treeData[oldIndex];
oldTreeDataIn.children.map(device=>{
if (device.id == oldRole.id) {
device.userName = '';
delete device.userId;
device.disabled = false;
device.label = device.type + (device.deviceName ? '- ' + device.deviceName : '') + (device.name ? device.name : '');
}
});
this.treeData[oldIndex] = oldTreeDataIn;
}
}
const newIndex = deviceTypeList.indexOf(newRole.type);
if (newIndex >= 0) {
const newTreeDataIn = this.treeData[newIndex];
newTreeDataIn.children.map(device=>{
if (device.id == newRole.id) {
device.userName = this.$store.state.user.nickname;
device.userId = this.$store.state.user.id;
device.disabled = true;
device.label = device.type + (device.deviceName ? '- ' + device.deviceName : '') + (device.name ? device.name : '') + '-' + device.userName;
}
});
this.treeData[newIndex] = newTreeDataIn;
}
this.userRole = newRole.type;
},
addScriptMember(member) {
this.memberData.push(member);
const deviceTypeList = ['行调', '行值', '司机', '通号', '车辆段调度', '上级部门'];
const index = deviceTypeList.indexOf(member.type);
if (index >= 0) {
const treeDataIn = this.treeData[index];
treeDataIn.children.push(member);
this.treeData[index] = treeDataIn;
}
}
}
};

View File

@ -15,7 +15,7 @@ export function covertMemberData (activeTrainList, resp) {
lastData = JSON.parse(lastData);
const lastMemberList = [];
// const electricDispatcherList = [];
const deviceListData = [[], [], [], [], [], []];
const deviceListData = [[], [], [], [], [], [], []];
const driverList = [];
lastData.forEach((member, index)=>{
if (member.userId && member.userId == store.state.user.id) {
@ -37,7 +37,7 @@ export function covertMemberData (activeTrainList, resp) {
member.label = member.type + name + userName;
member.normalName = member.type + name;
}
const deviceType = ['行调', '通号', '行值', '司机', '车辆段调度', '上级部门'];
const deviceType = ['行调', '通号', '行值', '司机', '车辆段调度', '上级部门', '电力调度'];
const deviceTypeIndex = deviceType.indexOf(member.type);
if (deviceTypeIndex >= 0) {
if (deviceTypeIndex == 3) {

View File

@ -154,9 +154,11 @@ export default {
dispatcherList.push(this.memberData[item.id]);
break;
case 'ELECTRIC_DISPATCHER':
this.memberData[item.id].labelName = '电力调度' + (item.name || '');
electricDispatcherList.push(this.memberData[item.id]);
break;
case 'DEPOT_DISPATCHER':
this.memberData[item.id].labelName = '车辆段调度' + (item.name || '');
depotDispatcherList.push(this.memberData[item.id]);
break;
case 'STATION_SUPERVISOR':
@ -193,7 +195,12 @@ export default {
labelName: '车辆段',
id: 'depotDispatcher',
children: depotDispatcherList
}];
}, {
labelName: '电力调度',
id: 'electricDispatcher',
children: electricDispatcherList
}
];
this.$nextTick(() => {
if (this.$refs.tree) {
this.$refs.tree.filter(this.queryMember);

View File

@ -80,6 +80,7 @@ export default {
listLines().then(resp => {
this.lineList = resp.data;
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
},
@ -88,6 +89,7 @@ export default {
listStations(this.lineId).then(resp => {
this.stationList = resp.data;
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
}
@ -103,6 +105,7 @@ export default {
this.refreshStationList();
this.$message.success('修改成功。')
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
}

View File

@ -264,15 +264,18 @@ export default {
turnBackTime: data.turnBackTime
}
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
} else {
this.$refs.schedule.clear();
}
}).catch(error => {
console.error(error);
this.$messageBox(error.message);
})
} else {
@ -396,6 +399,7 @@ export default {
this.$router.replace({ path: 'AUStool'});
this.$message.success('Run plan group created successfully.')
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
},
@ -412,13 +416,16 @@ export default {
? this.$router.replace({ path: 'AUStool'})
: this.loadPlanData();
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
}).catch(() => {
this.$message({ type: 'info', message: 'Deletion cancelled.' });
}).catch(error => {
console.error(error);
this.$message.info('Deletion cancelled.');
});
},
doSetPlanParams(data) {
@ -426,6 +433,7 @@ export default {
this.config = data;
this.$message.success('Parameters of plan were modified successfully.');
}).catch(error => {
console.error(error);
this.$message.info(error.message);
})
},
@ -437,6 +445,7 @@ export default {
modifyAreaNote(this.planId, data.id, model).then(resp => {
this.refresh(false);
}).catch(error => {
console.error(error);
this.$message.info(error.message);
this.refresh(false);
});
@ -451,6 +460,7 @@ export default {
justTripNoRunning(this.planId, this.selected.tripNo, model).then(resp => {
this.refresh(false);
}).catch(error => {
console.error(error);
this.$message.info(error.message);
this.refresh(false);
});
@ -466,6 +476,7 @@ export default {
justTripNoStop(this.planId, this.selected.tripNo, model).then(resp => {
this.refresh(false);
}).catch(error => {
console.error(error);
this.$message.info(error.message);
this.refresh(false);
});
@ -481,6 +492,7 @@ export default {
justTripTurnBack(this.planId, this.selected.tripNo, model).then(resp => {
this.refresh(false);
}).catch(error => {
console.error(error);
this.$message.info(error.message);
this.refresh(false);
});
@ -497,6 +509,7 @@ export default {
addRpTrip(this.planId, model).then(resp => {
this.refresh();
}).catch(error => {
console.error(error);
this.$message.info(error.message);
this.refresh();
this.$refs.schedule.clearGraphic(['mark']);
@ -518,6 +531,7 @@ export default {
createRpArea(this.planId, model).then(resp => {
this.refresh();
}).catch(error => {
console.error(error);
this.$message.info(error.message);
this.refresh();
this.$refs.schedule.clearGraphic(['mark']);
@ -532,7 +546,8 @@ export default {
translateRpService(this.planId, this.selected.serviceNo, model).then(resp => {
this.refresh(false);
}).catch(error => {
this.refresh(false);
this.refresh(false);
console.error(error);
this.$message.info(error.message);
});
}
@ -551,7 +566,8 @@ export default {
modifyRpArea(this.planId, data.areaNo, model).then(resp => {
this.refresh(false);
}).catch(error => {
this.refresh(false);
this.refresh(false);
console.error(error);
this.$message.info(error.message);
});
}
@ -566,11 +582,13 @@ export default {
delRpService(this.planId, this.selected.serviceNo).then(resp => {
this.refresh();
}).catch(error => {
this.refresh();
this.refresh();
console.error(error);
this.$message.info(error.message);
});
}).catch(() => {
this.$message({ type: 'info', message: 'Deletion cancelled.' });
}).catch(error => {
console.error(error);
this.$message.info('Deletion cancelled.');
});
}
},
@ -585,11 +603,13 @@ export default {
delRpTrip(this.planId, this.selected.tripNo).then(resp => {
this.refresh();
}).catch(error => {
this.refresh();
this.refresh();
console.error(error);
this.$message.info(error.message);
});
}).catch(() => {
this.$message({ type: 'info', message: 'Deletion cancelled.' });
}).catch(error => {
console.error(error);
this.$message.info('Deletion cancelled.');
});
}
},
@ -604,11 +624,13 @@ export default {
delRpArea(this.planId, data.areaNo).then(resp => {
this.refresh();
}).catch(error => {
this.refresh();
this.refresh();
console.error(error);
this.$message.info(error.message);
});
}).catch(() => {
this.$message({ type: 'info', message: 'Deletion cancelled.' });
}).catch(error => {
console.error(error);
this.$message.info('Deletion cancelled.');
});
}
},
@ -620,7 +642,8 @@ export default {
if (cls) {
this.onClear();
}
}).catch(() => {
}).catch(error => {
console.error(error);
this.$messageBox('Failed to load the plan.');
});
}

View File

@ -203,7 +203,8 @@ export default {
const mw = this.myChart.getWidth()-100;
const view = this.myChart.getViewOfComponentModel({__viewId: "_ec_shape_graphic"});
if (view.group) {
if (view &&
view.group) {
view.group.eachChild(el => {
if (['area'].includes(el.subType)) {
const position1 = this.myChart.convertToPixel('grid', el.point1);
@ -452,7 +453,10 @@ export default {
const elemList = option.graphic[0].elements.filter(el => { return !['drag'].includes(el.subType) });
const elem = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == e.target.model.areaNo; });
option.graphic[0].elements = this.calcHornList(elemList, elem);
if (elem) {
option.graphic[0].elements = this.calcHornList(elemList, elem);
}
this.myChart.setOption(option, true);
}
},
@ -642,14 +646,16 @@ export default {
const elemList = option.graphic[0].elements.filter(el => { return !['drag'].includes(el.subType) });
const elem = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == model.areaNo; });
elem.position = args.position;
elem.point1 = args.point1;
elem.point2 = args.point2;
elem.shape.width = args.width;
elem.shape.height = args.height;
elem.style.textOffset = [ -args.width/2, -args.height/2 ];
if (elem) {
elem.position = args.position;
elem.point1 = args.point1;
elem.point2 = args.point2;
elem.shape.width = args.width;
elem.shape.height = args.height;
elem.style.textOffset = [ -args.width/2, -args.height/2 ];
option.graphic[0].elements = this.calcHornList(elemList, elem);
}
option.graphic[0].elements = this.calcHornList(elemList, elem);
this.myChart.setOption(option, true);
}
}

View File

@ -250,6 +250,7 @@ export default {
this.myChart.hideLoading();
}
} catch (error) {
console.error(error);
this.$messageBox(error.message);
}
},
@ -286,7 +287,9 @@ export default {
this.target.model) {
const elemList = option.graphic[0].elements.filter(el => { return !['drag'].includes(el.subType) });
const elem = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == this.target.model.areaNo; });
option.graphic[0].elements = this.calcHornList(elemList, elem);
if (elem) {
option.graphic[0].elements = this.calcHornList(elemList, elem);
}
}
}
@ -300,6 +303,7 @@ export default {
this.setTargetLight();
}
} catch (error) {
console.error(error);
this.$messageBox(error.message);
}
},

View File

@ -23,8 +23,8 @@
<span v-else>
<span style="font-size: 14px">{{ data.normalName }}</span>
<span v-if="data.type!='role'" class="setGroup">
<span v-if="!data.disabled" class="settingBtn" @click="changeRole(data)">设置</span>
<span v-else class="hasSetted">设置</span>
<span v-if="data.id==memberId" class="hasSetted">设置</span>
<span v-else class="settingBtn" @click="changeRole(data)">设置</span>
</span>
</span>
@ -33,7 +33,6 @@
</div>
</template>
<script>
import { getToken } from '@/utils/auth';
import {changeScriptRole} from '@/api/script';
export default {
name:'AllScriptRole',
@ -59,7 +58,7 @@ export default {
return {
covertMemberList:[],
driverList:[],
oldMember:{id:null, type:''},
// oldMember:{id:null, type:''},
queryMember:'',
loading:false,
defaultProps: {
@ -73,11 +72,11 @@ export default {
if (this.$refs.tree) {
this.$refs.tree.filter(val);
}
},
'treeData':function(val) {
const roleName = this.$store.state.scriptRecord.userRole;
this.oldMember = {id:this.memberId, type:roleName};
}
// 'treeData':function(val) {
// const roleName = this.$store.state.scriptRecord.userRole;
// this.oldMember = {id:this.memberId, type:roleName};
// }
},
methods:{
filterNode(value, data) {
@ -91,68 +90,16 @@ export default {
addMember() {
this.$emit('addMember');
},
updateLoading() {
this.loading = false;
this.$message('切换角色成功');
},
switchMode(member) {
this.loading = true;
changeScriptRole(this.group, member.id).then(res=>{
let prdType = '';
if (this.openWindow) {
this.openWindow.close();
}
const role = Object.assign({}, member);
if (role.type == '行值') {
prdType = '01';
role.type = 'STATION_SUPERVISOR';
this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
this.$store.dispatch('training/setRoleDeviceCode', role.deviceCode);
} else if (role.type == '行调') {
prdType = '02';
role.type = 'DISPATCHER';
this.$store.dispatch('training/setRoles', 'DISPATCHER');
} else if (role.type == '司机') {
prdType = '04';
role.type = 'DRIVER';
this.$store.dispatch('training/setRoles', 'DRIVER');
} else if (role.type == '通号') {
prdType = '';
role.type = 'MAINTAINER';
this.$store.dispatch('training/setRoles', 'MAINTAINER');
const routeData = this.$router.resolve({
path:'/jlmap3d/maintainer',
query:{
mapid:this.$route.query.mapId,
group:this.group,
token:getToken(),
project: this.project,
noPreLogout: true
}
});
this.openWindow = window.open(routeData.href);
} else if (role.type == '车辆段调度') {
prdType = '05';
role.type = 'DEPOT_DISPATCHER';
this.$store.dispatch('training/setRoles', 'DEPOT_DISPATCHER');
} else if (role.type == '上级部门') {
prdType = '';
role.type = 'PARENT_DEPARTMENT';
this.$store.dispatch('training/setRoles', 'PARENT_DEPARTMENT');
} else {
prdType = '';
}
this.$store.dispatch('training/setPrdType', prdType);
this.$store.dispatch('scriptRecord/updateRole', role.type + ':' + role.id);
this.$emit('setMemberId', {newRole:role, oldRole:this.oldMember});
this.$store.dispatch('training/updateMemberListInScript',
{
oldMemberId:Object.assign({}, this.oldMember).id,
newMemberId:role.id,
userId:this.$store.state.user.id,
name:this.$store.state.user.nickname
}
);
this.oldMember = Object.assign({}, role);
this.loading = false;
this.$message('切换角色成功');
this.$emit('changeMode', member);
}).catch(()=>{
this.loading = false;
this.$messageBox('切换角色失败');
// this.$refs.changeScriptRole.blur();
});

View File

@ -33,7 +33,7 @@
</el-button-group>
</div>
<div class="scriptPanelRight">
<get-action-new ref="getAction" :group="group" :size="size" :member-list="memberList" @setAction="setAction" />
<get-action-new ref="getAction" :group="group" :size="size" :member-list="memberList" />
</div>
</div>
</el-tab-pane>
@ -44,7 +44,7 @@
:member-id="memberId"
:tree-data="treeData"
:group="group"
@setMemberId="setMemberId"
@changeMode="changeMode"
@addMember="addMember"
/>
</div>
@ -60,14 +60,15 @@
</template>
<script>
import Vue from 'vue';
import GetActionNew from './getAction';
import {executeScriptNew, dumpScriptDataNew, saveScriptDataNew, saveScriptScenesNew, updateMapLocationNew, simulationPause} from '@/api/simulation';
import ConstConfig from '@/scripts/ConstConfig';
import {getDraftScriptByGroupNew, getAllSelectedScriptRole } from '@/api/script';
import AddScriptMember from './addScriptMember';
import Cookies from 'js-cookie';
import {getDraftScriptByGroupNew, getAllSelectedScriptRole } from '@/api/script';
import ConstConfig from '@/scripts/ConstConfig';
import AddScriptMember from './addScriptMember';
import {covertMemberData} from '@/views/newMap/displayNew/utils';
import GetActionNew from './getAction';
import AllScriptRole from './allScriptRole';
import { getToken } from '@/utils/auth';
import {executeScriptNew, dumpScriptDataNew, saveScriptDataNew, saveScriptScenesNew, updateMapLocationNew, simulationPause} from '@/api/simulation';
export default {
name:'TipScriptRecord',
components: {
@ -87,14 +88,6 @@ export default {
offset:{
type: Number,
required: true
},
treeData:{
type:Array,
required: true
},
memberList:{
type:Array,
required: true
}
},
data() {
@ -113,13 +106,21 @@ export default {
width: 300,
height: 300
},
openWindow:null
openWindow:null,
treeData:[],
memberList:[],
driverList:[],
activeTrainList:[],
oldMember:{id:null, type:''}
};
},
computed:{
memberId() {
return this.$store.state.scriptRecord.updateRoleId;
},
memberType() {
return this.$store.state.scriptRecord.userRole;
},
orignalUserRoleId() {
return this.$store.state.training.orignalUserRoleId;
}
@ -144,6 +145,82 @@ export default {
this.isFirst = false;
this.initData();
}
},
'$store.state.training.memberList': function (val) {
if (val && val.length) {
const memberData = this.$store.state.training.memberData;
this.driverList = [];
this.treeData = [];
if (this.$store.state.training.started) {
this.activeTrainList = this.$store.state.map.activeTrainList;
}
// 仿
const result = covertMemberData(this.activeTrainList, Object.values(memberData));
this.driverList = result.driverList;
this.treeData = [{
label: '行调',
id: 'dispatcher',
type: 'role',
children: result.deviceListData[0]
}, {
label: '车站值班员',
id: 'stationSupervisor',
type: 'role',
children: result.deviceListData[2]
}, {
label: '司机',
id: 'driver',
type: 'role',
children: result.deviceListData[3]
}, {
label: '通号',
id: 'maintainer',
type: 'role',
children: result.deviceListData[1]
}, {
label: '车辆段',
id: 'depotDispatcher',
type: 'role',
children: result.deviceListData[4]
}, {
label: '上级部门',
id: 'parentDepartment',
type: 'role',
children: result.deviceListData[5]
}, {
label: '电力调度',
id: 'electricDispatcher',
type: 'role',
children: result.deviceListData[6]
}
// PARENT_DEPARTMENT
];
this.memberList = result.lastMemberList;
}
},
// ()
'$store.state.map.activeTrainListChange': function (val) {
// driverList
const activeTrainList = this.$store.state.map.activeTrainList;
if (this.driverList.length > 0) {
const driverList = [];
if (activeTrainList && activeTrainList.length) {
activeTrainList.sort();
activeTrainList.forEach(groupNumber => {
const drivers = this.driverList.find(driver=>{
return driver.deviceCode == groupNumber;
});
if (drivers) {
driverList.push(drivers);
}
});
}
// this.memberData = [...this.treeData[0].children, ...this.treeData[1].children, ...this.treeData[2].children, ...this.treeData[3].children, ...this.treeData[4].children];
this.treeData[2].children = driverList;
} else {
this.activeTrainList = activeTrainList;
}
}
},
mounted() {
@ -163,6 +240,7 @@ export default {
this.quickChangeMember.list.push(eachMember);
}
});
this.oldMember = {id:this.memberId, type:this.memberType};
});
},
addScriptMember(member) {
@ -170,33 +248,14 @@ export default {
member.disabled = false;
const lastData = JSON.stringify([member]);
const covertmember = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew);
this.$emit('addScriptMember', covertmember[0]);
},
setMemberId({newRole, oldRole}) {
this.$emit('changeTreeData', {newRole:newRole, oldRole:oldRole});
const quickChangeMember = this.quickChangeMember.list;
quickChangeMember.forEach((mem, index)=>{
if (oldRole.id && mem.id == oldRole.id) {
delete mem.userId;
}
if (newRole.id == mem.id) {
mem.userId = this.$store.state.user.id;
}
});
this.quickChangeMember = {list:quickChangeMember};
const memberdata = this.quickChangeMember.list.find(mem=>{ return mem.id == newRole.id; });
if (!memberdata) {
newRole.userId = this.$store.state.user.id;
const roleTypeEnumMap = {
'STATION_SUPERVISOR':'行值',
'DISPATCHER':'行调',
'DRIVER':'司机',
'MAINTAINER':'通号',
'DEPOT_DISPATCHER':'车辆段调度',
'PARENT_DEPARTMENT':'上级部门'
};
newRole.type = roleTypeEnumMap[newRole.type];
this.quickChangeMember.list.push(newRole);
const newMember = covertmember[0];
this.memberList.push(newMember);
const deviceTypeList = ['行调', '行值', '司机', '通号', '车辆段调度', '上级部门', '电力调度'];
const index = deviceTypeList.indexOf(newMember.type);
if (index >= 0) {
const treeDataIn = this.treeData[index];
treeDataIn.children.push(newMember);
this.treeData[index] = treeDataIn;
}
},
addMember() {
@ -251,9 +310,6 @@ export default {
each.label = each.normalName;
});
return lastData;
},
setAction() {
},
pauseScript() {
simulationPause(this.group).then(resp => {
@ -325,7 +381,7 @@ export default {
});
},
dumpScenesData() {
this.clearAutoSave();
// this.clearAutoSave();
const group = this.group;
this.$confirm(this.$t('scriptRecord.clearDataTip'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
@ -335,7 +391,6 @@ export default {
dumpScriptDataNew(group).then(resp => {
this.$parent.resetBeginTime();
this.$refs['getAction'].loadInitData();
// this.changeRunPlanStatus();
this.$store.dispatch('training/updateMemberListInScript',
{
oldMemberId:this.memberId,
@ -350,31 +405,108 @@ export default {
new_member.userId = this.$store.state.user.id;
new_member.disabled = true;
this.quickChangeMember.list = [new_member];
const deviceList = ['行值', '行调', '司机', '通号', '车辆段', '上级部门'];
const deviceType = ['STATION_SUPERVISOR', 'DISPATCHER', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER', 'PARENT_DEPARTMENT'];
const new_index = deviceList.indexOf(new_member.type);
const old_index = deviceList.indexOf(old_member.type);
let oldType, newType;
if (new_index >= 0) {
newType = deviceType[new_index];
}
if (old_index >= 0) {
oldType = deviceType[old_index];
}
this.$emit('changeTreeData', {oldRole:{id:this.memberId, type:oldType }, newRole:{id:this.orignalUserRoleId, type:newType}});
this.$emit('resetChat');
}
// this.initAutoSaveScript();
this.$store.dispatch('training/setPrdType', '02');
this.$store.dispatch('map/resetActiveTrainList');
this.$store.dispatch('scriptRecord/updateRole', new_member.type + ':' + this.orignalUserRoleId);
this.$store.dispatch('scriptRecord/updateBgSet', false);
// this.memberId = this.orignalUserRoleId;
this.oldMember = {id:this.orignalUserRoleId, type:new_member.type};
this.$message.success(this.$t('scriptRecord.resetDataSuccess'));
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.resetDataFail'));
});
});
},
changeMode(member) {
let prdType = '';
if (this.openWindow) {
this.openWindow.close();
}
const role = Object.assign({}, member);
if (role.type == '行值') {
prdType = '01';
role.type = 'STATION_SUPERVISOR';
this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
this.$store.dispatch('training/setRoleDeviceCode', role.deviceCode);
} else if (role.type == '行调') {
prdType = '02';
role.type = 'DISPATCHER';
this.$store.dispatch('training/setRoles', 'DISPATCHER');
} else if (role.type == '司机') {
prdType = '04';
role.type = 'DRIVER';
this.$store.dispatch('training/setRoles', 'DRIVER');
} else if (role.type == '通号') {
prdType = '';
role.type = 'MAINTAINER';
this.$store.dispatch('training/setRoles', 'MAINTAINER');
const routeData = this.$router.resolve({
path:'/jlmap3d/maintainer',
query:{
mapid:this.$route.query.mapId,
group:this.group,
token:getToken(),
project: this.project,
noPreLogout: true
}
});
this.openWindow = window.open(routeData.href);
} else if (role.type == '车辆段调度') {
prdType = '05';
role.type = 'DEPOT_DISPATCHER';
this.$store.dispatch('training/setRoles', 'DEPOT_DISPATCHER');
} else if (role.type == '上级部门') {
prdType = '';
role.type = 'PARENT_DEPARTMENT';
this.$store.dispatch('training/setRoles', 'PARENT_DEPARTMENT');
} else if (role.type == '电力调度') {
prdType = '';
role.type = 'ELECTRIC_DISPATCHER';
this.$store.dispatch('training/setRoles', 'ELECTRIC_DISPATCHER');
} else {
prdType = '';
}
this.$store.dispatch('training/setPrdType', prdType);
this.$store.dispatch('scriptRecord/updateRole', role.type + ':' + role.id);
const newRole = role;
const oldRole = this.oldMember;
const quickChangeMember = this.quickChangeMember.list;
quickChangeMember.forEach((mem, index)=>{
if (oldRole.id && mem.id == oldRole.id) {
delete mem.userId;
}
if (newRole.id == mem.id) {
mem.userId = this.$store.state.user.id;
}
});
this.quickChangeMember = {list:quickChangeMember};
const memberdata = this.quickChangeMember.list.find(mem=>{ return mem.id == newRole.id; });
if (!memberdata) {
newRole.userId = this.$store.state.user.id;
const roleTypeEnumMap = {
'STATION_SUPERVISOR':'行值',
'DISPATCHER':'行调',
'DRIVER':'司机',
'MAINTAINER':'通号',
'DEPOT_DISPATCHER':'车辆段调度',
'PARENT_DEPARTMENT':'上级部门',
'ELECTRIC_DISPATCHER':'电力调度'
};
newRole.type = roleTypeEnumMap[newRole.type];
this.quickChangeMember.list.push(newRole);
}
this.$store.dispatch('training/updateMemberListInScript',
{
oldMemberId:this.oldMember.id,
newMemberId:role.id,
userId:this.$store.state.user.id,
name:this.$store.state.user.nickname
}
);
this.oldMember = Object.assign({}, role);
this.$refs.allScriptRole.updateLoading();
}
}
};
@ -455,6 +587,10 @@ export default {
border-radius: 4px;
}
.setGroupOut{
margin-bottom: 5px;
padding: 4px 6px;
}
.setGroupOut:hover{
background-color:#ccc;
}
</style>