This commit is contained in:
sunzhenyu 2020-09-11 13:52:27 +08:00
commit d678d1369c
26 changed files with 418 additions and 953 deletions

View File

@ -270,6 +270,7 @@ class Jlmap {
// } // }
if (this.mapDevice[code]) { if (this.mapDevice[code]) {
this.$painter.delete(this.mapDevice[code]); this.$painter.delete(this.mapDevice[code]);
delete this.mapDevice[code];
} }
if (!elem._dispose) { if (!elem._dispose) {
this.mapDevice[code] = deepAssign(this.mapDevice[code] || {}, oDevice); this.mapDevice[code] = deepAssign(this.mapDevice[code] || {}, oDevice);

View File

@ -516,8 +516,8 @@ export default class Switch extends Group {
model.singleLock && this.setMonolock(); // 道岔单锁 model.singleLock && this.setMonolock(); // 道岔单锁
model.blockade && this.block(); // 道岔封锁 model.blockade && this.block(); // 道岔封锁
model.singleLock && model.blockade && this.blockMonolock(); // 单锁&锁闭状态 model.singleLock && model.blockade && this.blockMonolock(); // 单锁&锁闭状态
const path = window.location.href;
if (!this.style.Switch.core.graphShow) { if (!this.style.Switch.core.graphShow && !path.includes('/map/draw')) {
this.setSectionState(this.sheltertriangle, this.model); // 处理岔芯颜色 this.setSectionState(this.sheltertriangle, this.model); // 处理岔芯颜色
} }
// this.interlockingReserved(); // 联锁预留道岔 // this.interlockingReserved(); // 联锁预留道岔

View File

@ -177,6 +177,9 @@ function handleSimulationInfo(state, data) {
case 'CREATE': case 'CREATE':
state.createConversition = data; state.createConversition = data;
break; break;
case 'EXIT':
state.exitConversition = data;
break;
} }
} }
@ -234,6 +237,7 @@ const socket = {
acceptConversionInvite:{}, // 仿真会话成员接收邀请 acceptConversionInvite:{}, // 仿真会话成员接收邀请
createConversition:{}, // 仿真创建会话 createConversition:{}, // 仿真创建会话
overConversition: {}, // 仿真会话结束 overConversition: {}, // 仿真会话结束
exitConversition: {}, // 仿真成员退出会话
conversationInfo: {}, // 仿真会话消息 conversationInfo: {}, // 仿真会话消息
message: {}, // 仿真聊天 message: {}, // 仿真聊天

View File

@ -40,7 +40,8 @@ const training = {
memberList: [], // 综合仿真成员列表 memberList: [], // 综合仿真成员列表
memberData: {}, // 综合仿真成员列表 memberData: {}, // 综合仿真成员列表
simulationUserList: [], // 综合仿真用户列表 simulationUserList: [], // 综合仿真用户列表
orignalUserRoleId:'' // 设置旧的角色的id orignalUserRoleId:'', // 设置旧的角色的id
scriptQuitCount: 0 // 主动退出剧本
}, },
getters: { getters: {
@ -103,6 +104,9 @@ const training = {
}, },
commonMenuStep: (state) => { commonMenuStep: (state) => {
return state.commonMenuStep; return state.commonMenuStep;
},
scriptQuitCount: (state) => {
return state.scriptQuitCount;
} }
}, },
@ -290,6 +294,9 @@ const training = {
}, },
setOrignalUserRoleId:(state, orignalUserRoleId) => { setOrignalUserRoleId:(state, orignalUserRoleId) => {
state.orignalUserRoleId = orignalUserRoleId; state.orignalUserRoleId = orignalUserRoleId;
},
setScriptQuit: (state) => {
state.scriptQuitCount++;
} }
}, },
@ -712,6 +719,10 @@ const training = {
setRoleDeviceCode:({ commit }, roleDeviceCode) => { setRoleDeviceCode:({ commit }, roleDeviceCode) => {
commit('setRoleDeviceCode', roleDeviceCode); commit('setRoleDeviceCode', roleDeviceCode);
}, },
/** 剧本仿真 主动退出*/
setScriptQuit:({ commit }) => {
commit('setScriptQuit');
},
/** 剧本仿真 设置旧的角色的id */ /** 剧本仿真 设置旧的角色的id */
setOrignalUserRoleId:({ commit }, data) => { setOrignalUserRoleId:({ commit }, data) => {
commit('setOrignalUserRoleId', data); commit('setOrignalUserRoleId', data);

View File

@ -130,7 +130,9 @@
</el-row> </el-row>
</div> </div>
<div v-if="project === 'drts'" style="position: absolute; bottom: 50px; font-size: 20px;left: 20px;color:#3D3D3D;width: 200px;height: 150px;background: #FFF;padding: 10px;border: 5px solid #CCC;border-radius: 8px;cursor: pointer;"> <div v-if="project === 'drts'" style="position: absolute; bottom: 50px; font-size: 20px;left: 20px;color:#3D3D3D;width: 200px;height: 150px;background: #FFF;padding: 10px;border: 5px solid #CCC;border-radius: 8px;cursor: pointer;">
<div class="news-box" @click="goCompetitionRules"><img :src="handRight" width="14" height="14" style="margin-right: 15px">新誉杯竞赛规程</div> <div class="news-box" @click="goCompetitionRules('3')"><img :src="handRight" width="14" height="14" style="margin-right: 15px">新誉杯官方网站</div>
<div class="news-box" @click="goCompetitionRules('2')"><img :src="handRight" width="14" height="14" style="margin-right: 15px">新誉杯决赛事项通知</div>
<div class="news-box" @click="goCompetitionRules('1')"><img :src="handRight" width="14" height="14" style="margin-right: 15px">新誉杯竞赛规程</div>
</div> </div>
</div> </div>
</template> </template>
@ -211,7 +213,7 @@ export default {
versionBaseNoShow: VersionBaseNoShow, versionBaseNoShow: VersionBaseNoShow,
mainBodyNoShow: MainBodyNoShow, mainBodyNoShow: MainBodyNoShow,
noQrcodeList: NoQrcodeList, noQrcodeList: NoQrcodeList,
expirationDate: 1607562000000, expirationDate: 1605488400000,
countdown: null, countdown: null,
days: [0, 0, 0], days: [0, 0, 0],
gameOver: false, gameOver: false,
@ -583,8 +585,14 @@ export default {
this.days.push(Math.floor((day % 100) / 10)); this.days.push(Math.floor((day % 100) / 10));
this.days.push(day % 10); this.days.push(day % 10);
}, },
goCompetitionRules() { goCompetitionRules(val) {
window.open('https://mp.weixin.qq.com/s?__biz=MzI3NzMwODY3OQ==&mid=2247506304&idx=1&sn=77708ca228404cee2b28e131cdfb9735&chksm=eb6aade8dc1d24fe6eb9f1334aadda239f47dafc79de7d522e0f3f00e2d3ba1dd213dda6764c&xtrack=1&scene=90&subscene=93&sessionid=1598522875&clicktime=1598523062&enterid=1598523062&ascene=56&devicetype=android-29&version=3.0.27.2701&nettype=WIFI&abtest_cookie=AAACAA%3D%3D&lang=zh_CN&exportkey=AQZ2cTPSob%2B5kBDiWnKw0Js%3D&pass_ticket=12Xyhe%2BbZsC9Vuzfs0iYUUn0i%2Br5JlZiOGCxWoExuthBhnIrpkmUyjVRi6bjyA1I&wx_header=1&platform=win', '_blank'); if (val === '1') {
window.open('https://mp.weixin.qq.com/s?__biz=MzI3NzMwODY3OQ==&mid=2247506304&idx=1&sn=77708ca228404cee2b28e131cdfb9735&chksm=eb6aade8dc1d24fe6eb9f1334aadda239f47dafc79de7d522e0f3f00e2d3ba1dd213dda6764c&xtrack=1&scene=90&subscene=93&sessionid=1598522875&clicktime=1598523062&enterid=1598523062&ascene=56&devicetype=android-29&version=3.0.27.2701&nettype=WIFI&abtest_cookie=AAACAA%3D%3D&lang=zh_CN&exportkey=AQZ2cTPSob%2B5kBDiWnKw0Js%3D&pass_ticket=12Xyhe%2BbZsC9Vuzfs0iYUUn0i%2Br5JlZiOGCxWoExuthBhnIrpkmUyjVRi6bjyA1I&wx_header=1&platform=win', '_blank');
} else if (val === '2') {
window.open('https://mp.weixin.qq.com/s?__biz=MzI3NzMwODY3OQ==&mid=2247506789&idx=1&sn=5b5c1e6e0ca7dc54a935f57cee4eb1a2&chksm=eb6aaf0ddc1d261ba2ba7b9bed810b12b3317d45b1a484095d13b3d7e075b091d92fc7b9afb8&mpshare=1&scene=1&srcid=0910Yd3PVFs0WjWZyumLN9Jo&sharer_sharetime=1599740490862&sharer_shareid=98d62529ea7e8d0f6fb2281f854f3ea1&version=3.0.30.2006&platform=win&rd2werd=1#wechat_redirect', '_blank');
} else if (val === '3') {
window.open('http://metroskills.camet.org.cn', '_blank');
}
} }
} }
}; };

View File

@ -297,7 +297,7 @@ export default {
quitConversition() { quitConversition() {
this.loading = true; this.loading = true;
overSimulationConversition(this.group, this.conversitionId).then(resp => { overSimulationConversition(this.group, this.conversitionId).then(resp => {
this.$emit('resetCoversition'); // this.$emit('resetCoversition');
this.loading = false; this.loading = false;
}).catch(() => { }).catch(() => {
this.$message.error('退出会话失败!'); this.$message.error('退出会话失败!');

View File

@ -204,6 +204,9 @@ export default {
// } // }
// }); // });
this.form.type = ''; this.form.type = '';
res.data.memberList.sort((a, b) => {
return parseInt(a.id) - parseInt(b.id);
});
this.$store.dispatch('training/setMemberList', {memberList:res.data.memberList, userId:this.$store.state.user.id}); this.$store.dispatch('training/setMemberList', {memberList:res.data.memberList, userId:this.$store.state.user.id});
const activeMemberList = []; const activeMemberList = [];
res.data.actionList.forEach((activeMember)=>{ res.data.actionList.forEach((activeMember)=>{

View File

@ -3,25 +3,15 @@
<chat-box <chat-box
ref="chatbox" ref="chatbox"
:group="group" :group="group"
:is-show="isShow" :user-role="userRole"
:tree-data="treeData"
:conversition-id="conversitionId"
:current-member-list="currentMemberList"
:chat-content-list="chatContentList"
:is-start-record="isStartRecord"
:invite-user-name="inviteUserName"
:is-quit-show="isQuitShow"
@resetCoversition="resetCoversition"
/> />
<script-tip ref="scriptTip" :offset="offset" :member-data="memberData" @allowCreatCoversition="allowCreatCoversition" /> <script-tip ref="scriptTip" :offset="offset" @allowCreatCoversition="allowCreatCoversition" />
</div> </div>
</template> </template>
<script> <script>
import {covertMemberData} from './utils'; import ChatBox from '../jointTrainingNew/chatView/chatBox.vue';
import ChatBox from '../chatView/chatBox.vue';
import ScriptTip from '@/views/newMap/displayNew/scriptDisplay/component/scriptTip'; import ScriptTip from '@/views/newMap/displayNew/scriptDisplay/component/scriptTip';
import { getSimulationMemberList} from '@/api/simulation'; // import {getAllConversition} from '@/api/chat';
import {getAllConversition} from '@/api/chat';
export default { export default {
name:'DemonChat', name:'DemonChat',
components:{ components:{
@ -47,7 +37,6 @@ export default {
isHasCoversition:false, isHasCoversition:false,
conversitionId:'', conversitionId:'',
currentMemberList:[], currentMemberList:[],
memberData:[],
chatContentList:[], chatContentList:[],
activeTrainList:[], activeTrainList:[],
isStartRecord:false, isStartRecord:false,
@ -68,165 +57,179 @@ export default {
} }
}, },
watch:{ watch:{
'$store.state.map.mapViewLoadedCount': function (val) { // 仿 // '$store.state.map.mapViewLoadedCount': function (val) { // 仿
getSimulationMemberList(this.group).then(resp => { // getSimulationMemberList(this.group).then(resp => {
this.driverList = []; // this.driverList = [];
this.treeData = []; // this.treeData = [];
const result = covertMemberData(this.activeTrainList, resp.data); // const result = covertMemberData(this.activeTrainList, resp.data);
this.driverList = result.driverList; // this.driverList = result.driverList;
this.treeData = [{ // this.treeData = [{
label: '行调', // label: '',
id: 'dispatcher', // id: 'dispatcher',
type: 'role', // type: 'role',
children: result.deviceListData[0] // children: result.deviceListData[0]
}, { // }, {
label: '车站值班员', // label: '',
id: 'stationSupervisor', // id: 'stationSupervisor',
type: 'role', // type: 'role',
children: result.deviceListData[2] // children: result.deviceListData[2]
}, { // }, {
label: '司机', // label: '',
id: 'driver', // id: 'driver',
type: 'role', // type: 'role',
children: result.deviceListData[3] // children: result.deviceListData[3]
}, { // }, {
label: '通号', // label: '',
id: 'maintainer', // id: 'maintainer',
type: 'role', // type: 'role',
children: result.deviceListData[1] // children: result.deviceListData[1]
}, { // }, {
label: '车辆段', // label: '',
id: 'depotDispatcher', // id: 'depotDispatcher',
type: 'role', // type: 'role',
children: result.deviceListData[4] // children: result.deviceListData[4]
}]; // }];
this.memberData = result.lastMemberList; // this.memberData = result.lastMemberList;
}).catch(() => { // }).catch(() => {
this.$messageBox('获取仿真成员列表失败!'); // this.$messageBox('仿');
}); // });
}, // },
// //
'$store.state.socket.createConversition':function(val) { // '$store.state.socket.createConversition':function(val) {
if (this.memberData.length > 0) { // if (this.memberData.length > 0) {
const conversitionMember = this.memberData.find(member=>{ return member.userId == this.$store.state.user.id; }); // const conversitionMember = this.memberData.find(member=>{ return member.userId == this.$store.state.user.id; });
if (conversitionMember && val.memberIds.includes(conversitionMember.id)) { // if (conversitionMember && val.memberIds.includes(conversitionMember.id)) {
// // //
if (val.creatorId !== conversitionMember.id) { // if (val.creatorId !== conversitionMember.id) {
this.$message.success(this.coverName(val) + '与你开启会话'); // this.$message.success(this.coverName(val) + '');
} // }
this.isHasCoversition = true; // this.isHasCoversition = true;
this.isStartRecord = true; // this.isStartRecord = true;
this.isQuitShow = true; // this.isQuitShow = true;
this.conversitionId = val.id; // this.conversitionId = val.id;
const memberList = []; // const memberList = [];
val.memberIds.forEach(id=>{ // val.memberIds.forEach(id=>{
if (val.creatorId == id) { // if (val.creatorId == id) {
const member = this.memberData.find(member=>{ return member.id == id; }); // const member = this.memberData.find(member=>{ return member.id == id; });
member.connect = true; // member.connect = true;
memberList.push(member); // memberList.push(member);
} else { // } else {
const member = this.memberData.find(member=>{ return member.id == id; }); // const member = this.memberData.find(member=>{ return member.id == id; });
// member.connect = false; // // member.connect = false;
member.connect = true; // member.connect = true;
member && memberList.push(member); // member && memberList.push(member);
} // }
}); // });
this.currentMemberList = memberList; // this.currentMemberList = memberList;
} else { // } else {
// // //
if (this.userRole == 'AUDIENCE') { // if (this.userRole == 'AUDIENCE') {
this.isHasCoversition = true; // this.isHasCoversition = true;
this.currentMemberList = this.memberData; // this.currentMemberList = this.memberData;
} // }
} // }
} // }
}, // },
// //
'$store.state.socket.acceptConversionInvite':function(val) { // '$store.state.socket.acceptConversionInvite':function(val) {
this.conversitionId = val.id; // this.conversitionId = val.id;
if (this.conversitionId) { // if (this.conversitionId) {
let result = false; // let result = false;
// // //
const memberList = this.currentMemberList.map(member => { // const memberList = this.currentMemberList.map(member => {
if (member.id == val.memberId) { // if (member.id == val.memberId) {
member.connect = true; // member.connect = true;
result = true; // result = true;
} // }
return member; // return member;
}); // });
// // //
if (!result && this.conversitionId) { // if (!result && this.conversitionId) {
const member = this.memberData.find(member=>{ return member.id == val.memberId; }); // const member = this.memberData.find(member=>{ return member.id == val.memberId; });
if (member) { // if (member) {
member.connect = true; // member.connect = true;
memberList.push(member); // memberList.push(member);
// // //
if (member.userId == this.$store.state.user.id) { // if (member.userId == this.$store.state.user.id) {
memberList.push(this.inviteUser); // memberList.push(this.inviteUser);
this.isStartRecord = true; // this.isStartRecord = true;
if (member.userId != this.inviteUser.userId) { // this.isQuitShow = true;
this.isQuitShow = false; // this.inviteUser = {};
} else { // this.isHasCoversition = true;
this.isQuitShow = true; // }
} // }
this.inviteUser = {}; // }
this.isHasCoversition = true; // this.currentMemberList = memberList;
} // }
} // },
}
this.currentMemberList = memberList;
}
},
// //
'$store.state.socket.conversationInfo':function (val, old) { // 仿 // '$store.state.socket.conversationInfo':function (val, old) { // 仿
const simulationText = this.$store.state.socket.conversationInfo; // const simulationText = this.$store.state.socket.conversationInfo;
if (val.messageType == 'MESSAGE' && (this.conversitionId == val.id || this.userRole == 'AUDIENCE')) { // if (val.messageType == 'MESSAGE' && (this.conversitionId == val.id || this.userRole == 'AUDIENCE')) {
const content = this.addContent(simulationText.message); // const content = this.addContent(simulationText.message);
this.chatContentList.push(content); // this.chatContentList.push(content);
if (!content.self) { // if (!content.self) {
this.$refs.chatbox.addAudioList(content); // this.$refs.chatbox.addAudioList(content);
} // }
} // }
}, // },
// () // ()
'$store.state.map.activeTrainListChange': function (val) { // '$store.state.map.activeTrainListChange': function (val) {
const activeTrainList = this.$store.state.map.activeTrainList; // const activeTrainList = this.$store.state.map.activeTrainList;
activeTrainList.sort((a, b) => { // activeTrainList.sort((a, b) => {
return parseInt(a) - parseInt(b); // return parseInt(a) - parseInt(b);
}); // });
if (this.driverList.length > 0) { // if (this.driverList.length > 0) {
const driverList = []; // const driverList = [];
if (activeTrainList && activeTrainList.length) { // if (activeTrainList && activeTrainList.length) {
activeTrainList.forEach(groupNumber => { // activeTrainList.forEach(groupNumber => {
const drivers = this.driverList.find(driver=>{ // const drivers = this.driverList.find(driver=>{
return driver.deviceCode == groupNumber; // return driver.deviceCode == groupNumber;
}); // });
if (drivers) { // if (drivers) {
driverList.push(drivers); // driverList.push(drivers);
} // }
}); // });
} // }
this.treeData[2].children = driverList; // this.treeData[2].children = driverList;
this.memberData = [...this.treeData[0].children, ...this.treeData[1].children, ...this.treeData[2].children, ...this.treeData[3].children, ...this.treeData[4].children]; // this.memberData = [...this.treeData[0].children, ...this.treeData[1].children, ...this.treeData[2].children, ...this.treeData[3].children, ...this.treeData[4].children];
} else { // } else {
this.activeTrainList = activeTrainList; // this.activeTrainList = activeTrainList;
} // }
}, // },
// //
'$store.state.socket.scriptFinish':function(val, old) { '$store.state.socket.scriptFinish':function(val, old) {
this.$message('剧本演出完毕'); this.$message('剧本演出完毕');
this.$refs.scriptTip.resetScriptTip(); this.$refs.scriptTip.resetScriptTip();
}, },
// 退 // 退
'$store.state.socket.overConversition': function (val) { // '$store.state.socket.overConversition': function (val) {
if (val.id === this.conversitionId) { // if (val.id === this.conversitionId) {
this.conversitionId = ''; // this.conversitionId = '';
this.currentMemberList = []; // this.currentMemberList = [];
this.chatContentList = []; // this.chatContentList = [];
this.isHasCoversition = false; // this.isHasCoversition = false;
this.isStartRecord = false; // this.isStartRecord = false;
} // }
}, // },
// '$store.state.socket.exitConversition': function (val) {
// const member = this.memberData.find(member=>{ return member.memberId == val.member; });
// if (val.id === this.conversitionId && member.userId == this.$store.state.user.id) {
// this.conversitionId = '';
// this.currentMemberList = [];
// this.chatContentList = [];
// this.isHasCoversition = false;
// this.isStartRecord = false;
// } else if (val.id === this.conversitionId) {
// const mList = [];
// this.currentMemberList.forEach(member => {
// if (member.memberId != val.memberId) {
// mList.push(member);
// }
// });
// this.currentMemberList = mList;
// }
// },
// //
'$store.state.socket.inviteSimulationConversition':function(val) { '$store.state.socket.inviteSimulationConversition':function(val) {
// const conversitionMember = this.memberData.find(member=>{ return member.id == val.creatorId; }); // const conversitionMember = this.memberData.find(member=>{ return member.id == val.creatorId; });

View File

@ -414,6 +414,7 @@ export default {
this.$refs.chatbox.clearAllData(); this.$refs.chatbox.clearAllData();
this.$store.dispatch('training/setPrdType', this.$route.query.prdType); this.$store.dispatch('training/setPrdType', this.$route.query.prdType);
this.$store.dispatch('training/setRoles', userRole); this.$store.dispatch('training/setRoles', userRole);
this.$store.dispatch('training/setScriptQuit');
// this.$store.dispatch('scriptRecord/updateSimulationPause', false); // this.$store.dispatch('scriptRecord/updateSimulationPause', false);
}, },
clearAllData() { clearAllData() {

View File

@ -97,6 +97,9 @@ export default {
EventBus.$emit('clearRunSeries'); EventBus.$emit('clearRunSeries');
if (res.data.memberList && res.data.memberList.length > 0) { if (res.data.memberList && res.data.memberList.length > 0) {
this.form.type = ''; this.form.type = '';
res.data.memberList.sort((a, b) => {
return parseInt(a.id) - parseInt(b.id);
});
this.$store.dispatch('training/setMemberList', {memberList:res.data.memberList, userId:this.$store.state.user.id}); this.$store.dispatch('training/setMemberList', {memberList:res.data.memberList, userId:this.$store.state.user.id});
const activeMemberList = []; const activeMemberList = [];
res.data.actionList.forEach((activeMember)=>{ res.data.actionList.forEach((activeMember)=>{
@ -118,6 +121,8 @@ export default {
} }
if (member.type === 'DISPATCHER') { if (member.type === 'DISPATCHER') {
this.memberId = member.id; this.memberId = member.id;
(this.$store.state.training.memberData[member.id] || {}).userId = this.$store.state.user.id;
(this.$store.state.training.memberData[member.id] || {}).disabled = true;
} }
}); });
} }

View File

@ -303,8 +303,6 @@ export default {
this.initLoadPage(); this.initLoadPage();
this.clearAllData(); this.clearAllData();
this.$store.dispatch('scriptRecord/updateBgSet', false); this.$store.dispatch('scriptRecord/updateBgSet', false);
}).catch(()=>{
this.$messageBox(this.$t('display.demon.exitTaskFail'));
}); });
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('display.demon.exitTaskFail')); this.$messageBox(this.$t('display.demon.exitTaskFail'));
@ -334,9 +332,12 @@ export default {
this.$store.dispatch('training/setRoles', 'AUDIENCE'); this.$store.dispatch('training/setRoles', 'AUDIENCE');
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setPrdType', '');
} }
this.$refs.menuSchema.loadRunData();
this.userRole = userRole; this.userRole = userRole;
this.$store.dispatch('scriptRecord/updateBgSet', true); this.$store.dispatch('scriptRecord/updateBgSet', true);
this.$refs.chatbox.setMembers(id); // this.$refs.chatbox.setMembers(id);
(this.$store.state.training.memberData[id] || {}).userId = this.$store.state.user.id;
(this.$store.state.training.memberData[id] || {}).disabled = true;
const res = await loadScriptNew(row.id, id, this.group); const res = await loadScriptNew(row.id, id, this.group);
if (res && res.code == 200) { if (res && res.code == 200) {
if (mapLocation) { if (mapLocation) {
@ -370,10 +371,10 @@ export default {
} }
} }
this.userRole = userRole; this.userRole = userRole;
this.$refs.chatbox.setMembers(this.$store.state.training.orignalUserRoleId);
this.$refs.chatbox.clearAllData(); this.$refs.chatbox.clearAllData();
this.$store.dispatch('training/setPrdType', this.$route.query.prdType); this.$store.dispatch('training/setPrdType', this.$route.query.prdType);
this.$store.dispatch('training/setRoles', userRole); this.$store.dispatch('training/setRoles', userRole);
this.$store.dispatch('training/setScriptQuit');
// this.$store.dispatch('scriptRecord/updateSimulationPause', false); // this.$store.dispatch('scriptRecord/updateSimulationPause', false);
}, },
clearAllData() { clearAllData() {

View File

@ -11,10 +11,6 @@ export default {
offset: { offset: {
type: Number, type: Number,
required: true required: true
},
memberData:{
type: Array,
required: true
} }
}, },
data() { data() {
@ -22,6 +18,11 @@ export default {
scriptTipMessage:'' scriptTipMessage:''
}; };
}, },
computed: {
memberData() {
return this.$store.state.training.memberData;
}
},
watch:{ watch:{
// //
'$store.state.socket.simulationScriptTip':function(val, old) { '$store.state.socket.simulationScriptTip':function(val, old) {
@ -38,12 +39,12 @@ export default {
this.$emit('allowCreatCoversition'); this.$emit('allowCreatCoversition');
val.conversationMemberIds.forEach(id=>{ val.conversationMemberIds.forEach(id=>{
if (val.memberId != id) { if (val.memberId != id) {
inviteMember.push((this.memberData.find(member=>{ return member.id == id; }) || {label:''}).label ); inviteMember.push((this.memberData[id] || {label: ''}).label);
} }
}); });
this.scriptTipMessage = '请创建会话,选择' + inviteMember.toString(); this.scriptTipMessage = '请创建会话,选择' + inviteMember.toString();
} else if (val.type == 'Command') { } else if (val.type == 'Command') {
const targetName = this.memberData.find(member=>{ return member.id == val.commandInitiateVO.targetMemberId; }); const targetName = this.memberData[val.commandInitiateVO.targetMemberId];
const CommandList = { const CommandList = {
Drive_Ahead:'确认运行至前方站', Drive_Ahead:'确认运行至前方站',
Route_Block_Drive:'进路闭塞法行车', Route_Block_Drive:'进路闭塞法行车',

View File

@ -18,11 +18,9 @@
@clearAllData="clearAllData" @clearAllData="clearAllData"
@setTreeData="setTreeData" @setTreeData="setTreeData"
/> />
<script-preview-chat ref="chatbox" :group="group" :user-role="userRole" :member-data="memberData" :tree-data="treeData" :offset="offset" /> <script-preview-chat ref="chatbox" :group="group" :user-role="userRole" :offset="offset" />
<menu-system-time ref="menuSystemTime" :offset="offset" :group="group" /> <menu-system-time ref="menuSystemTime" :offset="offset" :group="group" />
</div> </div>
<!-- <Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" /> -->
<!-- <Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" /> -->
<select-role ref="selectRole" :member-list="memberList" @selectRole="selectRole" /> <select-role ref="selectRole" :member-list="memberList" @selectRole="selectRole" />
<run-plan-Load ref="runPlanLoad" :group="group" /> <run-plan-Load ref="runPlanLoad" :group="group" />
<run-plan-view ref="runPlanView" :group="group" /> <run-plan-view ref="runPlanView" :group="group" />
@ -49,9 +47,6 @@ import {loadDraftScript, loadDraftScriptNew} from '@/api/designPlatform';
import Vue from 'vue'; import Vue from 'vue';
import ConstConfig from '@/scripts/ConstConfig'; import ConstConfig from '@/scripts/ConstConfig';
//
// import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation';
// import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
export default { export default {
name: 'DisplayDraft', name: 'DisplayDraft',
components: { components: {
@ -63,7 +58,6 @@ export default {
MenuSystemTime, MenuSystemTime,
SelectRole, SelectRole,
ScriptButtonGroup ScriptButtonGroup
// Jl3dDrive
}, },
data() { data() {
return { return {
@ -74,12 +68,7 @@ export default {
panelShow: true, panelShow: true,
memberData:[], memberData:[],
mapLocation:{}, mapLocation:{},
// firstLoad: true,
// simulationShow: false,
// drivingShow: false,
showStation: '', showStation: '',
// stationListMode: [],
// showSelectStation: false, // select
group: '', group: '',
prdTypeMap: { prdTypeMap: {
'01': '01', // => '01': '01', // =>
@ -102,9 +91,6 @@ export default {
'map', 'map',
'stationList' 'stationList'
]), ]),
// ...mapGetters('training', [
// 'offsetStationCode'
// ]),
...mapGetters('config', [ ...mapGetters('config', [
'canvasId' 'canvasId'
]), ]),
@ -118,9 +104,6 @@ export default {
const drawWay = this.$route.query.drawWay; const drawWay = this.$route.query.drawWay;
return drawWay && JSON.parse(drawWay); return drawWay && JSON.parse(drawWay);
} }
// isDrive() {
// return this.prdType == '04';
// },
}, },
watch: { watch: {
'$store.state.config.menuBarLoadedCount': function (val) { '$store.state.config.menuBarLoadedCount': function (val) {
@ -138,10 +121,6 @@ export default {
this.setPosition(); this.setPosition();
// this.setMode(); // this.setMode();
} }
// 'stationList': function () {
// debugger;
// this.setStationList();
// }
}, },
created() { created() {
this.group = this.$route.query.group || ''; this.group = this.$route.query.group || '';
@ -162,6 +141,8 @@ export default {
this.$store.dispatch('scriptRecord/updateBgSet', true); this.$store.dispatch('scriptRecord/updateBgSet', true);
this.$refs.scriptButtonGroup.setIsscriptRun(true); this.$refs.scriptButtonGroup.setIsscriptRun(true);
if (role.type) { if (role.type) {
(this.$store.state.training.memberData[role.id] || {}).userId = this.$store.state.user.id;
(this.$store.state.training.memberData[role.id] || {}).disabled = true;
const typeList = ConstConfig.ConstSelect.roleTypeNew; const typeList = ConstConfig.ConstSelect.roleTypeNew;
typeList.forEach(type=>{ typeList.forEach(type=>{
if (role.type == type.label) { if (role.type == type.label) {
@ -246,9 +227,6 @@ export default {
switchMode(prdType) { switchMode(prdType) {
this.$store.dispatch('training/setPrdType', prdType); this.$store.dispatch('training/setPrdType', prdType);
}, },
// setMode() {
// this.showSelectStation = this.$store.state.map.map.skinVO.code === '06' && this.$store.state.training.prdType === '01';
// },
viewScriptRoles() { viewScriptRoles() {
this.$refs.selectRole.doShow(); this.$refs.selectRole.doShow();
}, },
@ -273,25 +251,6 @@ export default {
clearAllData() { clearAllData() {
this.$refs.chatbox.clearAllData(); this.$refs.chatbox.clearAllData();
}, },
// hidepanel() {
// if (this.isDrive) {
// this.panelShow = false;
// this.drivingShow = true;
// this.$refs.Jl3dDrive.show(this.mapId, this.group);
// } else {
// this.panelShow = false;
// this.simulationShow = true;
// this.$refs.Jl3dSimulation.show(this.mapId, this.group);
// }
// },
// showpanel() {
// this.panelShow = true;
// this.simulationShow = false;
// },
// showdriving() {
// this.panelShow = true;
// this.drivingShow = false;
// },
switchStationMode(val) { switchStationMode(val) {
if (val == null && this.stationListMode.length > 0) { if (val == null && this.stationListMode.length > 0) {
this.showStation = this.stationListMode[0].value; this.showStation = this.stationListMode[0].value;
@ -301,17 +260,6 @@ export default {
this.$store.dispatch('map/setShowCentralizedStationCode', this.showStation); this.$store.dispatch('map/setShowCentralizedStationCode', this.showStation);
this.$store.dispatch('map/setShowCentralizedStationNum'); this.$store.dispatch('map/setShowCentralizedStationNum');
} }
// setStationList() {
// this.stationListMode = [];
// (this.stationList || []).forEach(item => {
// if (item.centralized) {
// this.stationListMode.push({value: item.code, name: item.name});
// }
// });
// if (this.stationListMode.length) {
// this.showStation = this.stationListMode[0].value;
// }
// }
} }
}; };
</script> </script>

View File

@ -182,6 +182,9 @@ export default {
const resp = await getDraftScriptByGroupNew(group); const resp = await getDraftScriptByGroupNew(group);
if (resp.code == 200) { if (resp.code == 200) {
if (resp.data.memberList && resp.data.memberList.length > 0) { if (resp.data.memberList && resp.data.memberList.length > 0) {
resp.data.memberList.sort((a, b) => {
return parseInt(a.id) - parseInt(b.id);
});
this.$store.dispatch('training/setMemberList', {memberList:resp.data.memberList, userId:this.$store.state.user.id}); this.$store.dispatch('training/setMemberList', {memberList:resp.data.memberList, userId:this.$store.state.user.id});
if (this.$store.state.training.started) { if (this.$store.state.training.started) {
this.activeTrainList = this.$store.state.map.activeTrainList; this.activeTrainList = this.$store.state.map.activeTrainList;

View File

@ -3,21 +3,13 @@
<chat-box <chat-box
ref="chatbox" ref="chatbox"
:group="group" :group="group"
:is-show="isShow" :user-role="userRole"
:tree-data="treeData"
:conversition-id="conversitionId"
:current-member-list="currentMemberList"
:chat-content-list="chatContentList"
:is-start-record="isStartRecord"
:invite-user-name="inviteUserName"
:is-quit-show="isQuitShow"
@resetCoversition="resetCoversition"
/> />
<script-tip ref="scriptTip" :offset="offset" :member-data="memberData" @allowCreatCoversition="allowCreatCoversition" /> <script-tip ref="scriptTip" :offset="offset" @allowCreatCoversition="allowCreatCoversition" />
</div> </div>
</template> </template>
<script> <script>
import ChatBox from '@/views/newMap/chatView/chatBox.vue'; import ChatBox from '@/views/newMap/jointTrainingNew/chatView/chatBox.vue';
import ScriptTip from '@/views/newMap/displayNew/scriptDisplay/component/scriptTip'; import ScriptTip from '@/views/newMap/displayNew/scriptDisplay/component/scriptTip';
export default { export default {
name:'ScriptPreviewChat', name:'ScriptPreviewChat',
@ -34,14 +26,6 @@ export default {
type: String, type: String,
required: true required: true
}, },
memberData:{
type: Array,
required: true
},
treeData:{
type: Array,
required: true
},
offset: { offset: {
type: Number, type: Number,
required: true required: true
@ -49,165 +33,23 @@ export default {
}, },
data() { data() {
return { return {
isHasCoversition:false,
conversitionId:'',
currentMemberList:[],
chatContentList:[],
isStartRecord:false,
inviteUserName:'',
createCoversition:false,
inviteUser:{},
isQuitShow:false
}; };
}, },
computed:{ computed:{
isShow() {
return this.userRole != '' &&
this.userRole != 'ADMIN' && this.userRole != 'AUDIENCE' &&
!this.isHasCoversition && this.createCoversition;
}
}, },
watch:{ watch:{
//
'$store.state.socket.createConversition':function(val) {
if (this.memberData.length > 0) {
const member = this.memberData.find(member=>{ return member.id == val.creatorId; });
if (member && member.userId == this.$store.state.user.id) {
//
this.isHasCoversition = true;
this.isStartRecord = true;
this.isQuitShow = true;
this.conversitionId = val.id;
const memberList = [];
val.memberIds.forEach(id=>{
if (val.creatorId == id) {
member.connect = true;
memberList.push(member);
} else {
const member = this.memberData.find(member=>{ return member.id == id; });
// member.connect = false;
member.connect = true;
member && memberList.push(member);
}
});
this.currentMemberList = memberList;
} else {
//
if (this.userRole == 'AUDIENCE') {
this.isHasCoversition = true;
this.currentMemberList = this.memberData;
}
}
}
},
//
'$store.state.socket.acceptConversionInvite':function(val) {
if (this.conversitionId) {
let result = false;
//
const memberList = this.currentMemberList.map(member => {
if (member.id == val.memberId) {
member.connect = true;
result = true;
}
return member;
});
//
if (!result && this.conversitionId) {
const member = this.memberData.find(member=>{ return member.id == val.memberId; });
if (member) {
member.connect = true;
memberList.push(member);
//
if (member.userId == this.$store.state.user.id) {
memberList.push(this.inviteUser);
this.inviteUser = {};
this.isStartRecord = true;
if (member.userId != this.inviteUser.userId) {
this.isQuitShow = false;
} else {
this.isQuitShow = true;
}
this.isHasCoversition = true;
}
}
}
this.currentMemberList = memberList;
}
},
//
'$store.state.socket.conversationInfo':function (val, old) { // 仿
const simulationText = this.$store.state.socket.conversationInfo;
if (val.messageType == 'MESSAGE' && (this.conversitionId == val.id || this.userRole == 'AUDIENCE')) {
this.chatContentList.push(this.addContent(simulationText.message));
}
},
// //
'$store.state.socket.scriptFinish':function(val, old) { '$store.state.socket.scriptFinish':function(val, old) {
this.$message('剧本演出完毕'); this.$message('剧本演出完毕');
this.$refs.scriptTip.resetScriptTip(); this.$refs.scriptTip.resetScriptTip();
},
// 退
'$store.state.socket.overConversition': function (val) {
if (val.id === this.conversitionId) {
this.conversitionId = '';
this.currentMemberList = [];
this.chatContentList = [];
this.isHasCoversition = false;
this.isStartRecord = false;
// this.createCoversition = true;
}
},
//
'$store.state.socket.inviteSimulationConversition':function(val) {
const invitemember = this.memberData.find(member=>{ return member.id == val.creatorId; });
if (invitemember) {
this.inviteUserName = invitemember.label;
this.conversitionId = val.id;
invitemember.connect = true;
this.inviteUser = invitemember;
this.currentMemberList.push(invitemember);
const member = this.memberData.find(member=>{ return member.id == val.memberId; });
member.connect = true;
const userName = member.userName ? '-' + member.userName : '';
const name = member.name == undefined ? '' : '-' + member.name;
member.label = member.type + member.deviceName + name + userName;
this.currentMemberList.push(member);
this.isStartRecord = true;
// this.$refs.chatbox.inviteMember();
this.$message.success(this.inviteUserName + '与你开启会话');
}
} }
}, },
methods:{ methods:{
addContent(simulationText) {
const text = {};
const member = this.currentMemberList.find(member=>{
return member.id == simulationText.memberId;
});
if (member) {
text.self = (this.$store.state.user.id == member.userId);
text.member = member;
text.chatTime = simulationText.time;
text.src = simulationText.audioPath;
text.message = simulationText.content;
}
return text;
},
clearAllData() { clearAllData() {
this.resetCoversition(); this.resetCoversition();
this.createCoversition = false;
this.$refs.scriptTip.resetScriptTip(); this.$refs.scriptTip.resetScriptTip();
}, },
resetCoversition() { resetCoversition() {
this.conversitionId = '';
this.isHasCoversition = false;
this.currentMemberList = [];
this.chatContentList = [];
this.isStartRecord = false;
this.inviteUserName = '';
this.inviteUser = {};
this.isQuitShow = false;
}, },
allowCreatCoversition() { allowCreatCoversition() {
this.createCoversition = true; this.createCoversition = true;

View File

@ -27,13 +27,6 @@
:offset-bottom="offsetBottom" :offset-bottom="offsetBottom"
/> />
<script-chat
ref="chatbox"
:group="group"
:user-role="userRole"
:tree-data="treeData"
:member-data="memberData"
/>
<set-time ref="setTime" @ConfirmSelectBeginTime="start" /> <set-time ref="setTime" @ConfirmSelectBeginTime="start" />
<tip-script-record-new <tip-script-record-new
ref="tipTaskRecordNew" ref="tipTaskRecordNew"
@ -46,6 +39,11 @@
@addScriptMember="addScriptMember" @addScriptMember="addScriptMember"
@resetChat="resetChat" @resetChat="resetChat"
/> />
<chat-box
ref="chatbox"
:group="group"
:user-role="userRole"
/>
</div> </div>
</template> </template>
@ -54,22 +52,22 @@
import { TrainingMode } from '@/scripts/ConstDic'; import { TrainingMode } from '@/scripts/ConstDic';
import MenuSchema from '@/views/newMap/displayNew/menuSchema'; import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import DemonMenu from '@/views/newMap/displayNew/demonMenu'; import DemonMenu from '@/views/newMap/displayNew/demonMenu';
import ScriptChat from './scriptChat';
import TipScriptRecordNew from '@/views/scriptManage/tipScriptRecord'; import TipScriptRecordNew from '@/views/scriptManage/tipScriptRecord';
import SetTime from '@/views/newMap/displayNew/demon/setTime'; import SetTime from '@/views/newMap/displayNew/demon/setTime';
import { Notification } from 'element-ui'; import { Notification } from 'element-ui';
import { ranAsPlan, exitRunPlan } from '@/api/simulation'; import { ranAsPlan, exitRunPlan } from '@/api/simulation';
import {covertMemberData} from '@/views/newMap/displayNew/utils'; import {covertMemberData} from '@/views/newMap/displayNew/utils';
import { getSimulationMemberList} from '@/api/simulation'; import { getSimulationMemberList} from '@/api/simulation';
import ChatBox from '@/views/newMap/jointTrainingNew/chatView/chatBox.vue';
export default { export default {
name: 'MenuScript', name: 'MenuScript',
components: { components: {
SetTime, SetTime,
ScriptChat,
MenuSchema, MenuSchema,
DemonMenu, DemonMenu,
TipScriptRecordNew TipScriptRecordNew,
ChatBox
}, },
props: { props: {
offsetBottom: { offsetBottom: {
@ -153,7 +151,7 @@ export default {
} }
}); });
} }
this.memberData = [...this.treeData[0].children, ...this.treeData[1].children, ...this.treeData[2].children, ...this.treeData[3].children, ...this.treeData[4].children]; // 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; this.treeData[2].children = driverList;
} else { } else {
this.activeTrainList = activeTrainList; this.activeTrainList = activeTrainList;
@ -161,7 +159,7 @@ export default {
}, },
'$store.state.map.mapViewLoadedCount': function (val) { // '$store.state.map.mapViewLoadedCount': function (val) { //
getSimulationMemberList(this.group).then(resp => { getSimulationMemberList(this.group).then(resp => {
this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId:this.$store.state.user.id}); // this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId:this.$store.state.user.id});
this.driverList = []; this.driverList = [];
this.treeData = []; this.treeData = [];
if (this.$store.state.training.started) { if (this.$store.state.training.started) {
@ -197,7 +195,6 @@ export default {
children: result.deviceListData[4] children: result.deviceListData[4]
}]; }];
this.memberData = result.lastMemberList; this.memberData = result.lastMemberList;
// //
const member = resp.data.find(mem=>{ const member = resp.data.find(mem=>{
return mem.userId != '' && mem.userId != undefined; return mem.userId != '' && mem.userId != undefined;
@ -300,7 +297,7 @@ export default {
}); });
}, },
resetChat() { resetChat() {
this.$refs.chatbox.resetCoversition(); // this.$refs.chatbox.resetCoversition();
}, },
changeTreeData({newRole, oldRole}) { changeTreeData({newRole, oldRole}) {
const deviceTypeList = ['DISPATCHER', 'STATION_SUPERVISOR', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER']; const deviceTypeList = ['DISPATCHER', 'STATION_SUPERVISOR', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER'];

View File

@ -1,192 +0,0 @@
<template>
<chat-box
ref="chatbox"
:group="group"
:is-show="isShow"
:tree-data="treeData"
:conversition-id="conversitionId"
:current-member-list="currentMemberList"
:chat-content-list="chatContentList"
:is-start-record="isStartRecord"
:invite-user-name="inviteUserName"
:is-quit-show="isQuitShow"
@resetCoversition="resetCoversition"
/>
</template>
<script>
import ChatBox from '@/views/newMap/chatView/chatBox.vue';
import {getAllConversition} from '@/api/chat';
export default {
name:'ScriptChat',
components:{
ChatBox
},
props: {
group: {
type: String,
required: true
},
userRole: {
type: String,
required: true
},
treeData:{
type:Array,
required:true
},
memberData:{
type:Array,
required:true
}
},
data() {
return {
isHasCoversition:false,
conversitionId:'',
currentMemberList:[],
// memberData:{},
chatContentList:[],
activeTrainList:[],
isStartRecord:false,
inviteUserName:'',
inviteUser:{},
isQuitShow:false
// treeData:[],
// driverList:[]
};
},
computed:{
isShow() {
return this.userRole != '' &&
this.userRole != 'ADMIN' && this.userRole != 'AUDIENCE' &&
!this.isHasCoversition;
}
},
watch:{
//
'$store.state.socket.createConversition':function(val) {
if (this.memberData.length > 0) {
const member = this.memberData.find(member=>{ return member.id == val.creatorId; });
if (member && member.userId == this.$store.state.user.id) {
//
this.isHasCoversition = true;
this.isStartRecord = true;
this.isQuitShow = true;
this.conversitionId = val.id;
const memberList = [];
val.memberIds.forEach(id=>{
if (val.creatorId == id) {
member.connect = true;
memberList.push(member);
} else {
const member = this.memberData.find(member=>{ return member.id == id; });
// member.connect = false;
member.connect = true;
member && memberList.push(member);
}
});
this.currentMemberList = memberList;
} else {
//
if (this.userRole == 'AUDIENCE') {
this.isHasCoversition = true;
this.currentMemberList = this.memberData;
}
}
}
},
//
'$store.state.socket.acceptConversionInvite':function(val) {
this.conversitionId = val.id;
if (this.conversitionId) {
//
const memberList = this.currentMemberList.map(member => {
if (member.id == val.memberId) {
member.connect = true;
}
return member;
});
this.currentMemberList = memberList;
}
},
//
'$store.state.socket.conversationInfo':function (val, old) { // 仿
const simulationText = this.$store.state.socket.conversationInfo;
if (val.messageType == 'MESSAGE' && (this.conversitionId == val.id || this.userRole == 'AUDIENCE')) {
this.chatContentList.push(this.addContent(simulationText.message));
}
},
'$store.state.scriptRecord.updateCoversitionStatus':function(val) {
//
this.getAllConversition();
}
},
methods:{
addContent(simulationText) {
const text = {};
const member = this.currentMemberList.find(member=>{
return member.id == simulationText.memberId;
});
if (member) {
text.self = (this.$store.state.user.id == member.userId);
text.member = member;
text.chatTime = simulationText.time;
text.src = simulationText.audioPath;
text.message = simulationText.content;
}
return text;
},
resetCoversition() {
this.conversitionId = '';
this.isHasCoversition = false;
this.currentMemberList = [];
this.chatContentList = [];
this.isStartRecord = false;
this.inviteUserName = '';
this.inviteUser = {};
this.isQuitShow = false;
},
getAllConversition() {
//
getAllConversition(this.$route.query.group).then(resp=>{
let isHasCoversition = false;
let isQuitShow = false;
if (resp.data && resp.data.length && resp.data.length > 0) {
const coversitionList = resp.data;
let memberList = [];
let messageList = [];
coversitionList.forEach(coversition=>{
//
if (!coversition.over) {
coversition.memberList.forEach(member=>{
if (member.memberId == this.$store.state.scriptRecord.updateRoleId) {
if (member.memberId == coversition.creatorId) {
isQuitShow = true;
}
isHasCoversition = true;
memberList = coversition.memberList;
messageList = coversition.messageList;
this.conversitionId = coversition.id;
this.isStartRecord = true;
}
});
}
});
this.currentMemberList = [];
memberList.forEach(memberSimple=>{
const member = this.memberData.find(member=>{ return member.id == memberSimple.memberId; });
member.connect = memberSimple.connect;
member && this.currentMemberList.push(member);
});
this.chatContentList = [];
messageList.forEach(message=>{
this.chatContentList.push(this.addContent(message));
});
}
this.isHasCoversition = isHasCoversition;
this.isQuitShow = isQuitShow;
});
}
}
};
</script>

View File

@ -45,9 +45,9 @@ export function covertMemberData (activeTrainList, resp) {
if (activeTrainList.length > 0) { if (activeTrainList.length > 0) {
if (activeTrainList.includes(member.deviceCode)) { if (activeTrainList.includes(member.deviceCode)) {
deviceListData[deviceTypeIndex].push(member); deviceListData[deviceTypeIndex].push(member);
lastMemberList.push(member);
} }
} }
lastMemberList.push(member);
driverList.push(member); driverList.push(member);
} else { } else {
deviceListData[deviceTypeIndex].push(member); deviceListData[deviceTypeIndex].push(member);

View File

@ -48,7 +48,6 @@
<div class="chat-box-footer"> <div class="chat-box-footer">
<div style="width: 400px;font-size: 14px;">{{ userString }}</div> <div style="width: 400px;font-size: 14px;">{{ userString }}</div>
<el-button size="mini" type="primary" class="chat-box-footer-create" :loading="createLoading" @click="createCoversition()">创建会话</el-button> <el-button size="mini" type="primary" class="chat-box-footer-create" :loading="createLoading" @click="createCoversition()">创建会话</el-button>
<div v-if="scriptTip" class="scriptTip">{{ scriptTip }}</div>
</div> </div>
</template> </template>
<template v-else> <template v-else>
@ -80,6 +79,7 @@
:conversition-id="conversitionId" :conversition-id="conversitionId"
:conversition-member-list="conversitionMemberList" :conversition-member-list="conversitionMemberList"
:message-list="messageList" :message-list="messageList"
:my-member-id="myMemberId"
:simulation-users="simulationUsers" :simulation-users="simulationUsers"
:common-conversation="commonConversation" :common-conversation="commonConversation"
:user-role="userRole" :user-role="userRole"
@ -96,21 +96,17 @@
</div> </div>
<div class="chat-box-footer"> <div class="chat-box-footer">
<div class="chat-box-footer-tool" /> <div class="chat-box-footer-tool" />
<el-button v-if="isConversitionCreator && isButtonShow && !commonConversation" size="mini" type="danger" class="chat-box-footer-quit" :loading="quitLoading" @click="quitConversition()">结束会话</el-button> <el-button v-if="isButtonShow && !commonConversation" size="mini" type="danger" class="chat-box-footer-quit" :loading="quitLoading" @click="quitConversition()">结束会话</el-button>
<el-button v-if="isButtonShow && !commonConversation" class="chat-box-footer-send" size="mini" type="primary" :disabled="recordSending" @click="startRecording()">发送语音</el-button> <el-button v-if="isButtonShow && !commonConversation" class="chat-box-footer-send" size="mini" type="primary" :disabled="recordSending" @click="startRecording()">发送语音</el-button>
<div v-if="scriptTip" class="scriptTip">{{ scriptTip }}</div>
</div> </div>
</template> </template>
</div> </div>
<chat-setting ref="chatSetting" :form="form" @setSetting="setSetting" /> <chat-setting ref="chatSetting" :form="form" @setSetting="setSetting" />
<chat-tooltip :group="group" :simulation-users="simulationUsers" @acceptInvite="acceptInvite" />
</div> </div>
</template> </template>
<script> <script>
import ChatSetting from './chatSetting'; import ChatSetting from './chatSetting';
import ChatTooltip from './chatTooltip';
import ChatContent from './chatContent'; import ChatContent from './chatContent';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import ChatMemberList from './chatMemberList'; import ChatMemberList from './chatMemberList';
import RecordRTC from 'recordrtc'; import RecordRTC from 'recordrtc';
import {sendSimulationConversition, startConversition, overSimulationConversition, getAllConversition} from '@/api/chat'; import {sendSimulationConversition, startConversition, overSimulationConversition, getAllConversition} from '@/api/chat';
@ -119,7 +115,6 @@ export default {
name: 'ChatBox', name: 'ChatBox',
components:{ components:{
ChatSetting, ChatSetting,
ChatTooltip,
ChatContent, ChatContent,
ChatMemberList ChatMemberList
}, },
@ -138,7 +133,6 @@ export default {
drawer: false, drawer: false,
bottom:15, bottom:15,
recordSending:false, recordSending:false,
conversitionId: '',
commonConversation: false, commonConversation: false,
seconds:0, seconds:0,
inter:null, inter:null,
@ -149,7 +143,6 @@ export default {
language:'zh', language:'zh',
sex:'1' sex:'1'
}, },
scriptTip:'',
treeData: [], treeData: [],
defaultProps: { defaultProps: {
children: 'children', children: 'children',
@ -165,12 +158,11 @@ export default {
quitLoading: false, quitLoading: false,
conversitionMemberList: [], conversitionMemberList: [],
commonMemberList: [], commonMemberList: [],
privateMemberList: [],
isConversitionCreator: false,
messageList: [], messageList: [],
commonMessageList: [], commonMessageList: [],
privateMessageList: [], temData: [],
temData: [] conversitionStateMap:{},
myMemberId: ''
}; };
}, },
computed:{ computed:{
@ -182,6 +174,18 @@ export default {
}, },
IsAnswering() { IsAnswering() {
return !(this.$route.path.includes('refereeJsxtDisplay')); return !(this.$route.path.includes('refereeJsxtDisplay'));
},
userId() {
return this.$store.state.user.id;
},
conversitionId() {
return (this.conversitionStateMap[this.myMemberId] || {conversitionId:''}).conversitionId;
},
privateMemberList() {
return (this.conversitionStateMap[this.myMemberId] || {privateMemberList: []}).privateMemberList;
},
privateMessageList() {
return (this.conversitionStateMap[this.myMemberId] || {privateMessageList: []}).privateMessageList;
} }
}, },
watch:{ watch:{
@ -190,10 +194,18 @@ export default {
this.$refs.tree.filter(val); this.$refs.tree.filter(val);
} }
}, },
conversitionId(val) {
if (val) {
this.conversitionMemberList = this.privateMemberList;
this.messageList = this.privateMessageList;
}
},
userRole(val) { userRole(val) {
if (val === 'AUDIENCE') { if (val === 'AUDIENCE') {
// this.isAudienceInitData();
this.goCommonConversation(); this.goCommonConversation();
this.myMemberId = '';
} else {
this.myMemberId = (this.simulationUsers[this.userId] || {}).memberId;
} }
}, },
'$store.state.map.mapViewLoadedCount':function(val) { '$store.state.map.mapViewLoadedCount':function(val) {
@ -218,57 +230,9 @@ export default {
}); });
}, },
'$store.state.socket.createConversition':function(val) { '$store.state.socket.createConversition':function(val) {
const member = this.temData.find(member=>{ return member.userId == this.$store.state.user.id; }); val.memberList.forEach(member => {
if (member && val.memberIds.includes(member.id)) { this.$set(this.conversitionStateMap, member.memberId, {conversitionId: val.id, privateMemberList: val.memberList, privateMessageList: []});
const memberList = []; });
if (val.creatorId !== member.id) {
this.$message.success(this.coverName(val) + '与你开启会话');
}
val.memberIds.forEach(id=>{
if (val.creatorId == id) {
memberList.push({memberId:id, connect:true});
} else {
// memberList.push({memberId:id, connect:false});
memberList.push({memberId:id, connect:true});
}
});
this.conversitionMemberList = memberList;
this.privateMemberList = memberList;
this.commonConversation = false;
}
this.conversitionId = val.id;
},
'$store.state.socket.simulationScriptTip':function(val, old) {
if (val) {
if (val.type == 'Conversation') {
// const target = this.$refs.chatMemberList.getMember(val.targetId);
// if (target && target.length > 0) {
this.scriptTip = '请说:' + val.content;
// }
} else if (val.type == 'Command') {
const commandName = val.operationType;
let device = val.operationType.split('_')[0];
if (device == 'CM') {
device = 'ControlConvertMenu';
}
const operateName = Object.values(CMD[device]).find(res=>{ return res.value == commandName; });
this.$messageBox('请执行【' + operateName.label + '】操作');
} else if (val.type == 'Over_Conversation') {
this.scriptTip = '请结束当前会话';
} else if (val.type == 'Start_Conversation' ) {
const inviteMember = [];
val.conversationMemberIds.forEach(id=>{
if (val.memberId != id) {
// const userName = memberList.find(elem=>{ return elem.id == id; });
inviteMember.push(this.memberData[id].label);
}
});
this.scriptTip = '请创建会话,选择' + inviteMember.toString();
}
}
},
'$store.state.socket.scriptFinish':function(val, old) {
this.$message('剧本执行完成');
}, },
'$store.state.map.activeTrainListChange': function (val) { // '$store.state.map.activeTrainListChange': function (val) { //
this.activeTrains = []; this.activeTrains = [];
@ -282,12 +246,6 @@ export default {
this.$refs.tree.filter(this.queryMember); this.$refs.tree.filter(this.queryMember);
} }
}, },
'$store.state.socket.inviteSimulationConversition':function(val) {
// this.userName = this.coverName(val);
// this.conversitionId = val.id;
// this.commonConversation = false;
// this.$message.success(this.userName + '');
},
'$store.state.training.simulationUserList': { '$store.state.training.simulationUserList': {
handler(val, o) { handler(val, o) {
this.simulationUsers = {}; this.simulationUsers = {};
@ -295,17 +253,26 @@ export default {
val.forEach(user => { val.forEach(user => {
this.simulationUsers[user.userId] = user; this.simulationUsers[user.userId] = user;
}); });
this.myMemberId = this.simulationUsers[this.userId].memberId;
} }
}, },
deep: true deep: true
}, },
'$store.state.socket.overConversition': function (val) { '$store.state.socket.exitConversition': function (val) {
if (val.id === this.conversitionId) { for (const memberId in this.conversitionStateMap) {
this.conversitionId = ''; if (memberId == val.memberId) {
this.conversitionMemberList = []; this.conversitionStateMap[memberId].conversitionId = '';
this.privateMemberList = []; this.conversitionStateMap[memberId].privateMemberList = [];
this.messageList = []; this.conversitionStateMap[memberId].privateMessageList = [];
this.privateMessageList = []; } else if ( this.conversitionStateMap[memberId].conversitionId == val.id ) {
const mList = [];
this.conversitionStateMap[memberId].privateMemberList.forEach(member => {
if (member.memberId != val.memberId) {
mList.push(member);
}
});
this.conversitionStateMap[memberId].privateMemberList = mList;
}
} }
}, },
'$store.state.training.memberList': function (val) { '$store.state.training.memberList': function (val) {
@ -321,7 +288,7 @@ export default {
const device = this.$store.getters['map/getDeviceByCode'](item.deviceCode); const device = this.$store.getters['map/getDeviceByCode'](item.deviceCode);
switch (item.type) { switch (item.type) {
case 'DISPATCHER': case 'DISPATCHER':
this.memberData[item.id].label = '行调' + (dispatcherList.length + 1); this.memberData[item.id].label = '行调' + (item.name || '');
dispatcherList.push(this.memberData[item.id]); dispatcherList.push(this.memberData[item.id]);
break; break;
case 'ELECTRIC_DISPATCHER': case 'ELECTRIC_DISPATCHER':
@ -340,7 +307,7 @@ export default {
driverList.push(this.memberData[item.id]); driverList.push(this.memberData[item.id]);
break; break;
case 'MAINTAINER': case 'MAINTAINER':
this.memberData[item.id].label = '通号' + (maintainerList.length + 1); this.memberData[item.id].label = '通号' + (item.name || '');
maintainerList.push(this.memberData[item.id]); maintainerList.push(this.memberData[item.id]);
break; break;
} }
@ -383,7 +350,6 @@ export default {
}, },
mounted() { mounted() {
this.firstClick = true; this.firstClick = true;
this.scriptTip = '';
}, },
methods:{ methods:{
clickBtn() { clickBtn() {
@ -405,12 +371,9 @@ export default {
if (this.memberIdList.length) { if (this.memberIdList.length) {
this.createLoading = true; this.createLoading = true;
startConversition(this.group, this.memberIdList).then(resp => { startConversition(this.group, this.memberIdList).then(resp => {
this.conversitionId = resp.data.id;
this.messageList = []; this.messageList = [];
this.privateMessageList = [];
this.memberIdList = []; this.memberIdList = [];
this.userString = ''; this.userString = '';
this.isConversitionCreator = true;
this.$message.success('创建会话成功!'); this.$message.success('创建会话成功!');
this.createLoading = false; this.createLoading = false;
}).catch((error) => { }).catch((error) => {
@ -432,7 +395,6 @@ export default {
}, },
// //
startRecording() { startRecording() {
this.scriptTip = '';
const that = this; const that = this;
if (!this.recordSending && !this.recorders && !this.microphone) { if (!this.recordSending && !this.recorders && !this.microphone) {
this.$refs.chatSetting.doClose(); this.$refs.chatSetting.doClose();
@ -541,6 +503,9 @@ export default {
if (memberList && memberList.length) { if (memberList && memberList.length) {
memberList.forEach(memberId => { memberList.forEach(memberId => {
const member = this.memberData[memberId]; const member = this.memberData[memberId];
if (member && member.type === 'DRIVER' && !this.activeTrains.includes(member.deviceCode)) {
return;
}
if (member && member.userId) { if (member && member.userId) {
this.memberIdList.push(member.id); this.memberIdList.push(member.id);
this.userString += ((this.userString ? ',' : '') + member.label + '(' + this.simulationUsers[member.userId].nickName + ')'); this.userString += ((this.userString ? ',' : '') + member.label + '(' + this.simulationUsers[member.userId].nickName + ')');
@ -564,13 +529,9 @@ export default {
}, },
quitConversition() { quitConversition() {
this.quitLoading = true; this.quitLoading = true;
this.scriptTip = '';
overSimulationConversition(this.group, this.conversitionId).then(resp => { overSimulationConversition(this.group, this.conversitionId).then(resp => {
this.conversitionId = '';
this.conversitionMemberList = []; this.conversitionMemberList = [];
this.privateMemberList = [];
this.messageList = []; this.messageList = [];
this.privateMessageList = [];
this.quitLoading = false; this.quitLoading = false;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.tree && this.$refs.tree.filter(this.queryMember); this.$refs.tree && this.$refs.tree.filter(this.queryMember);
@ -580,34 +541,6 @@ export default {
this.quitLoading = false; this.quitLoading = false;
}); });
}, },
acceptInvite(data) {
this.userString = '';
this.conversitionId = data.id;
this.conversitionMemberList = data.memberList;
this.privateMemberList = data.memberList;
this.isConversitionCreator = false;
this.messageList = [];
this.privateMessageList = [];
if (data.messageList && data.messageList) {
data.messageList.forEach(message => {
const member = this.memberData[message.memberId];
message.src = `/audio/${message.audioPath}`;
if (member) {
message.self = this.$store.state.userId == member.userId;
}
this.messageList.push(message);
this.privateMessageList.push(message);
});
}
this.cancelCommonConversation();
},
// connectMember(val) {
// this.conversitionMemberList.forEach(member => {
// if (member.memberId == val.memberId) {
// member.connect = true;
// }
// });
// },
sortByMessageTime(message1, message2) { sortByMessageTime(message1, message2) {
const time1 = new Date(message1.time).valueOf(); const time1 = new Date(message1.time).valueOf();
const time2 = new Date(message2.time).valueOf(); const time2 = new Date(message2.time).valueOf();
@ -627,26 +560,18 @@ export default {
} }
messages.push(message); messages.push(message);
}); });
if (this.userRole !== 'AUDIENCE') { const tempMessageList = [];
const user = this.simulationUsers[this.$store.state.user.id]; !conversation.over && conversation.messageList.forEach(message => {
this.isConversitionCreator = conversation.creatorId == user.memberId; message.src = `/audio/${message.audioPath}`;
!conversation.over && conversation.memberList.forEach(member =>{ tempMessageList.push(message);
if (member.memberId == user.memberId && member.connect) { });
this.conversitionMemberList = conversation.memberList; !conversation.over && conversation.memberList.forEach(member => {
this.conversitionId = conversation.id; this.conversitionStateMap[member.memberId] = {
this.messageList = []; conversationId: conversation.id,
conversation.messageList.forEach(message => { privateMemberList: conversation.memberList,
const member = this.memberData[message.memberId]; privateMessageList: tempMessageList
message.src = `/audio/${message.audioPath}`; };
if (member) { });
message.self = this.$store.state.userId == member.userId;
}
this.privateMessageList.push(message);
this.messageList.push(message);
});
}
});
}
}); });
} }
this.commonMessageList = messages.sort(this.sortByMessageTime); this.commonMessageList = messages.sort(this.sortByMessageTime);
@ -681,37 +606,33 @@ export default {
this.commonMemberList = [...temDispatcherList, ...temStationSupervisorList, ...temMaintainerList, ...temDriverList, ...temDepotDispatcherList]; this.commonMemberList = [...temDispatcherList, ...temStationSupervisorList, ...temMaintainerList, ...temDriverList, ...temDepotDispatcherList];
if (this.userRole === 'AUDIENCE' || this.commonConversation) { if (this.userRole === 'AUDIENCE' || this.commonConversation) {
this.conversitionMemberList = []; this.conversitionMemberList = [];
this.messageList = [...this.commonMessageList]; this.messageList = this.commonMessageList;
this.conversitionMemberList = this.commonMemberList; this.conversitionMemberList = this.commonMemberList;
} }
}, },
changeMessageList(data) { changeMessageList(data) {
if (data.flag) {
this.messageList.push(data.message);
}
this.commonMessageList.push(data.message); this.commonMessageList.push(data.message);
if (this.userRole !== 'AUDIENCE' && data.private) { if (this.conversitionStateMap[data.message.memberId]) {
this.privateMessageList.push(data.message); this.conversitionStateMap[data.message.memberId].privateMessageList.push(data.message);
} }
}, },
goCommonConversation() { goCommonConversation() {
!this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange(); !this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange();
this.commonConversation = true; this.commonConversation = true;
this.conversitionMemberList = this.commonMemberList; this.conversitionMemberList = this.commonMemberList;
this.messageList = [...this.commonMessageList]; this.messageList = this.commonMessageList;
}, },
cancelCommonConversation() { cancelCommonConversation() {
this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange(); this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange();
this.commonConversation = false; this.commonConversation = false;
this.conversitionMemberList = this.privateMemberList; this.conversitionMemberList = this.privateMemberList;
this.messageList = [...this.privateMessageList]; this.messageList = this.privateMessageList;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.tree && this.$refs.tree.filter(this.queryMember); this.$refs.tree && this.$refs.tree.filter(this.queryMember);
}); });
}, },
clearAllData() { clearAllData() {
this.recordSending = false; this.recordSending = false;
this.conversitionId = '';
this.inter = null; this.inter = null;
this.recorders = null; this.recorders = null;
this.microphone = null; this.microphone = null;
@ -941,28 +862,4 @@ export default {
cursor: no-drop; cursor: no-drop;
} }
.scriptTip{
position: absolute;
width: 260px;
padding: 10px;
background: rgb(250, 246, 3);
right: 89px;
bottom:45px;
border-radius: 5px;
font-size: 14px;
color: #000000;
z-index:2;
}
.scriptTip::after{
content: '';
position: absolute;
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 8px solid #faf603;
right: 16px;
bottom: -7px;
}
</style> </style>

View File

@ -5,7 +5,7 @@
<div :class="chatContent.self?'rightUser':'leftUser'"> <div :class="chatContent.self?'rightUser':'leftUser'">
<div class="userHeader"> <div class="userHeader">
<div v-if="!chatContent.self" class="userName">{{ covertName(chatContent.memberId) }}</div> <div v-if="!chatContent.self" class="userName">{{ covertName(chatContent.memberId) }}</div>
<div :class="chatContent.self?'userChatTime textRight':'userChatTime'">{{ chatContent.time }}</div> <div :class="chatContent.memberId == myMemberId?'userChatTime textRight':'userChatTime'">{{ chatContent.time }}</div>
</div> </div>
<div class="userBubble" @click="playAudio(baseUrl+chatContent.src)"> <div class="userBubble" @click="playAudio(baseUrl+chatContent.src)">
<div class="userMessage"> <div class="userMessage">
@ -50,6 +50,12 @@ export default {
commonConversation: { commonConversation: {
type: Boolean, type: Boolean,
required: true required: true
},
myMemberId: {
type: String,
default() {
return '';
}
} }
}, },
data() { data() {
@ -66,11 +72,8 @@ export default {
const conversationInfo = this.$store.state.socket.conversationInfo; const conversationInfo = this.$store.state.socket.conversationInfo;
const member = this.$store.state.training.memberData[val.message.memberId]; const member = this.$store.state.training.memberData[val.message.memberId];
conversationInfo.message.src = `/audio/${conversationInfo.message.audioPath}`; conversationInfo.message.src = `/audio/${conversationInfo.message.audioPath}`;
if (member) { this.$emit('changeMessageList', conversationInfo);
conversationInfo.message.self = this.$store.state.userId == member.userId;
}
if (this.conversitionId == val.id) { if (this.conversitionId == val.id) {
this.$emit('changeMessageList', {message:conversationInfo.message, flag: true, private: true});
if (member && member.userId != this.$store.state.user.id) { if (member && member.userId != this.$store.state.user.id) {
this.currentAudioList.push(this.baseUrl + '/audio/' + conversationInfo.message.audioPath); this.currentAudioList.push(this.baseUrl + '/audio/' + conversationInfo.message.audioPath);
if (!this.isPlay) { if (!this.isPlay) {
@ -80,7 +83,6 @@ export default {
} }
this.scrollTop(); this.scrollTop();
} else if (this.userRole === 'AUDIENCE' || this.commonConversation) { } else if (this.userRole === 'AUDIENCE' || this.commonConversation) {
this.$emit('changeMessageList', {message:conversationInfo.message, flag: true, private: false});
if (member && member.userId != this.$store.state.user.id) { if (member && member.userId != this.$store.state.user.id) {
this.currentAudioList.push(this.baseUrl + '/audio/' + conversationInfo.message.audioPath); this.currentAudioList.push(this.baseUrl + '/audio/' + conversationInfo.message.audioPath);
if (!this.isPlay) { if (!this.isPlay) {
@ -88,7 +90,7 @@ export default {
this.playAllAudio(); this.playAllAudio();
} }
} }
} else { this.$emit('changeMessageList', {message:conversationInfo.message, flag: false, private: false}); } }
} }
}, },
mounted() { mounted() {

View File

@ -1,104 +0,0 @@
<template>
<div v-show="dialogVisible" class="chatTooltipAll">
<div class="chatTooltip">
<div class="chatTooltipHeader">
{{ userName }} 邀请您加入会话
</div>
<div class="chatTooltipBootom">
<div class="create-group-bottom">
<el-button :loading="loading" size="small" type="primary" @click="doCreate">接受</el-button>
<el-button size="small" @click="doClose">拒绝</el-button>
</div>
</div>
</div>
</div>
</template>
<script>
import {acceptConversitionInvite} from '@/api/chat';
export default {
name:'ChatTooltip',
props: {
group: {
type: String,
required: true
},
simulationUsers: {
type: Object,
required: true
}
},
data() {
return {
userName:'',
dialogVisible:false,
loading:false,
conversationId:''
};
},
watch:{
'$store.state.socket.inviteSimulationConversition':function(val) {
this.userName = this.coverName(val);
// this.dialogVisible = true;
// this.conversationId = val.id;
this.$message.success(this.userName + '与你开启会话');
}
},
methods:{
coverName(inviteUser) {
const member = this.$store.state.training.memberData[inviteUser.creatorId];
if (member.userId) {
const user = this.simulationUsers[member.userId];
return member.label + '(' + user.nickName + ')';
} else {
return member.label;
}
},
doCreate() {
this.loading = true;
acceptConversitionInvite(this.group, this.conversationId).then(res=>{
this.loading = false;
this.dialogVisible = false;
this.$emit('acceptInvite', res.data);
}).catch(error=>{
this.$messageBox('接受邀请失败: ' + error.message);
});
},
doClose() {
this.dialogVisible = false;
}
}
};
</script>
<style lang="scss" scoped>
.chatTooltip{
position: absolute;
width: 290px;
left: 32%;
top: 42%;
z-index: 5;
background: #fff;
padding: 15px;
box-shadow: #969090 0px 0px 10px;
border-radius: 4px;
line-height: 20px;
transform: translateY(-50%);
}
.chatTooltipHeader{
margin-top:10px;
font-size:14px;
}
.chatTooltipBootom{
margin-top:10px;
text-align: center;
margin-bottom:10px;
}
.chatTooltipAll{
position:absolute;
width:100%;
height:100%;
left:0;
top:0;
z-index: 10;
}
</style>

View File

@ -72,7 +72,7 @@ import MenuTrainList from './menuTrainList';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { OperateMode, TrainingMode } from '@/scripts/ConstDic'; import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
import { loadNewMapDataByGroup } from '@/utils/loaddata'; import { loadNewMapDataByGroup } from '@/utils/loaddata';
import { clearSimulation, getSimulationInfoNew, getSimulationUserInfo, getSimulationMemberList, getAllSimulationUser } from '@/api/simulation'; import { clearSimulation, getSimulationInfoNew, getSimulationUserInfo } from '@/api/simulation';
import {getRaceUserById, getTestPaperDatail} from '@/api/competition'; import {getRaceUserById, getTestPaperDatail} from '@/api/competition';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive'; import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
@ -182,7 +182,7 @@ export default {
'$store.state.map.mapViewLoadedCount': function () { // '$store.state.map.mapViewLoadedCount': function () { //
this.mapViewLoadedOver = true; this.mapViewLoadedOver = true;
this.showSelectStation && this.setShowStation(this.showStation); this.showSelectStation && this.setShowStation(this.showStation);
this.initMemberUserInfo(); // this.initMemberUserInfo();
if (this.$route.query.type === 'VR_PSD') { if (this.$route.query.type === 'VR_PSD') {
this.deviceShow = true; this.deviceShow = true;
} }
@ -192,9 +192,9 @@ export default {
this.hidepanel(); this.hidepanel();
} }
}, },
'$store.state.socket.memberChangeCount': function () { // 仿 // '$store.state.socket.memberChangeCount': function () { // 仿
this.initMemberUserInfo(); // this.initMemberUserInfo();
}, // },
'$store.state.socket.permissionOver': function () { '$store.state.socket.permissionOver': function () {
this.$alert(this.$t('tip.userRightsHaveBeenReclaimed'), this.$t('tip.hint'), { this.$alert(this.$t('tip.userRightsHaveBeenReclaimed'), this.$t('tip.hint'), {
confirmButtonText: this.$t('global.confirm'), confirmButtonText: this.$t('global.confirm'),
@ -291,19 +291,19 @@ export default {
this.endViewLoading(); this.endViewLoading();
} }
}, },
initMemberUserInfo() { // initMemberUserInfo() {
// 仿 // // 仿
getSimulationMemberList(this.$route.query.group).then(resp => { // getSimulationMemberList(this.$route.query.group).then(resp => {
this.$store.dispatch('training/setMemberList', { memberList: resp.data, userId: this.$store.state.user.id }); // this.$store.dispatch('training/setMemberList', { memberList: resp.data, userId: this.$store.state.user.id });
}).catch(() => { // }).catch(() => {
this.$messageBox('获取仿真成员列表失败!'); // this.$messageBox('仿');
}); // });
getAllSimulationUser(this.$route.query.group).then(resp => { // getAllSimulationUser(this.$route.query.group).then(resp => {
this.$store.dispatch('training/setSimulationUserList', resp.data); // this.$store.dispatch('training/setSimulationUserList', resp.data);
}).catch(() => { // }).catch(() => {
this.$messageBox('获取所有仿真用户失败!'); // this.$messageBox('仿');
}); // });
}, // },
devicemodel() { devicemodel() {
if (this.deviceShow == false) { if (this.deviceShow == false) {
this.deviceShow = true; this.deviceShow = true;

View File

@ -19,6 +19,9 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="仿真成员名称:" prop="name">
<el-input v-model="formModel.name" size="small" placeholder="请输入成员名称" />
</el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button> <el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
@ -35,7 +38,8 @@ export default {
return { return {
dialogVisible: false, dialogVisible: false,
formModel: { formModel: {
type: '' type: '',
name: ''
}, },
rules: { rules: {
type: [ type: [

View File

@ -137,11 +137,11 @@ export default {
queryMember(val) { queryMember(val) {
this.$refs.tree.filter(val); this.$refs.tree.filter(val);
}, },
'$store.state.socket.simulationRoleList':function(val) { // '$store.state.socket.simulationRoleList':function(val) {
if (val && val.length) { // if (val && val.length) {
this.handlerMemberOnOff(val); // this.handlerMemberOnOff(val);
} // }
}, // },
'$store.state.training.simulationUserList': function(val) { '$store.state.training.simulationUserList': function(val) {
this.simulationUserList = val; this.simulationUserList = val;
}, },
@ -158,7 +158,7 @@ export default {
const device = this.$store.getters['map/getDeviceByCode'](item.deviceCode); const device = this.$store.getters['map/getDeviceByCode'](item.deviceCode);
switch (item.type) { switch (item.type) {
case 'DISPATCHER': case 'DISPATCHER':
this.memberData[item.id].label = '行调' + (dispatcherList.length + 1); this.memberData[item.id].label = '行调' + (item.name || '');
dispatcherList.push(this.memberData[item.id]); dispatcherList.push(this.memberData[item.id]);
break; break;
case 'ELECTRIC_DISPATCHER': case 'ELECTRIC_DISPATCHER':
@ -176,7 +176,7 @@ export default {
driverList.push(this.memberData[item.id]); driverList.push(this.memberData[item.id]);
break; break;
case 'MAINTAINER': case 'MAINTAINER':
this.memberData[item.id].label = '通号' + (maintainerList.length + 1); this.memberData[item.id].label = '通号' + (item.name || '');
maintainerList.push(this.memberData[item.id]); maintainerList.push(this.memberData[item.id]);
break; break;
} }
@ -276,10 +276,10 @@ export default {
driverNoShow = false; driverNoShow = false;
} }
return (data.label.indexOf(value) !== -1 || flag) && driverNoShow; return (data.label.indexOf(value) !== -1 || flag) && driverNoShow;
},
handlerMemberOnOff(data) {
this.$store.dispatch('training/updateMemberAndUser', { simulationUserList: data, userId: this.userId });
} }
// handlerMemberOnOff(data) {
// this.$store.dispatch('training/updateMemberAndUser', { simulationUserList: data, userId: this.userId });
// }
} }
}; };
</script> </script>

View File

@ -9,6 +9,7 @@ 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 { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
export default { export default {
@ -46,12 +47,24 @@ export default {
'$store.state.map.mapViewLoadedCount': function (val) { // '$store.state.map.mapViewLoadedCount': function (val) { //
this.mapBoxP = document.getElementById(this.canvasId).children[0]; this.mapBoxP = document.getElementById(this.canvasId).children[0];
this.mapBoxP.style.cursor = ''; this.mapBoxP.style.cursor = '';
this.initMemberUserInfo();
this.subscribe(); this.subscribe();
}, },
'$store.state.socket.memberChangeCount': function () { // 仿
this.initMemberUserInfo();
},
'$store.state.training.setScriptQuit': function () {
this.initMemberUserInfo();
},
'$store.state.socket.simulationError': function (val) { '$store.state.socket.simulationError': function (val) {
if (val) { if (val) {
this.simulationError(val); this.simulationError(val);
} }
},
'$store.state.socket.simulationRoleList':function(val) {
if (val && val.length) {
this.handlerMemberOnOff(val);
}
} }
}, },
mounted() { mounted() {
@ -149,6 +162,22 @@ export default {
} }
} }
}, 1000); }, 1000);
},
initMemberUserInfo() {
// 仿
getSimulationMemberList(this.$route.query.group).then(resp => {
this.$store.dispatch('training/setMemberList', { memberList: resp.data, userId: this.$store.state.user.id });
}).catch(() => {
this.$messageBox('获取仿真成员列表失败!');
});
getAllSimulationUser(this.$route.query.group).then(resp => {
this.$store.dispatch('training/setSimulationUserList', resp.data);
}).catch(() => {
this.$messageBox('获取所有仿真用户失败!');
});
},
handlerMemberOnOff(data) {
this.$store.dispatch('training/updateMemberAndUser', { simulationUserList: data, userId: this.userId });
} }
} }
}; };

View File

@ -153,7 +153,8 @@ export default {
} }
return rtn; return rtn;
}, },
changeSectionAttr() { // //
changeSectionAttr() {
const changeSectionList = []; // const changeSectionList = []; //
this.sectionList.forEach(section => { this.sectionList.forEach(section => {
const oneSection = section.points[section.points.length - 1]; const oneSection = section.points[section.points.length - 1];
@ -244,45 +245,45 @@ export default {
const sectionb = this.findSectionData(sectionLists, elem.sectionBCode); const sectionb = this.findSectionData(sectionLists, elem.sectionBCode);
const sectiona = this.findSectionData(sectionLists, elem.sectionACode); const sectiona = this.findSectionData(sectionLists, elem.sectionACode);
const sectionc = this.findSectionData(sectionLists, elem.sectionCCode); const sectionc = this.findSectionData(sectionLists, elem.sectionCCode);
const parentSectionModel = this.$store.getters['map/getDeviceByCode'](sectiona.parentCode); // const parentSectionModel = this.$store.getters['map/getDeviceByCode'](sectiona.parentCode);
if (!parentSectionModel) { // // if (!parentSectionModel) { //
if (switchSectionList.indexOf(elem.code) == -1) { if (switchSectionList.indexOf(elem.code) == -1) {
let uid; let uid;
if (!elem['uid']) { if (!elem['uid']) {
uid = getUID('T', [...this.sectionList, ...addSectionList]); uid = getUID('T', [...this.sectionList, ...addSectionList]);
elem['uid'] = uid; elem['uid'] = uid;
}
addSectionList.push({ code: elem.uid });
sectiona.parentCode = elem['uid'];
sectionb.parentCode = elem['uid'];
sectionc.parentCode = elem['uid'];
elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode];
sectionList.push(elem);
switchList.forEach(ele => {
const sectiona1 = this.findSectionData(sectionLists, ele.sectionACode);
const sectionc1 = this.findSectionData(sectionLists, ele.sectionCCode);
const sectionb1 = this.findSectionData(sectionLists, ele.sectionBCode);
if (sectionb1.points[sectionb1.points.length - 1].x == sectionb.points[0].x && sectionb1.points[sectionb1.points.length - 1].y == sectionb.points[0].y) {
ele['uid'] = uid;
elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode];
sectiona1.parentCode = uid;
sectionb1.parentCode = uid;
sectionc1.parentCode = uid;
switchSectionList.push(ele.code);
sectionList.forEach((item, index) => {
if (item.code == ele.code) {
sectionList.splice(index, 1);
}
});
}
});
} }
} else { addSectionList.push({ code: elem.uid });
parentSectionModel.relevanceSectionList.push(elem.sectionACode); sectiona.parentCode = elem['uid'];
parentSectionModel.relevanceSectionList.push(elem.sectionBCode); sectionb.parentCode = elem['uid'];
parentSectionModel.relevanceSectionList.push(elem.sectionCCode); sectionc.parentCode = elem['uid'];
models.push(parentSectionModel); elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode];
sectionList.push(elem);
switchList.forEach(ele => {
const sectiona1 = this.findSectionData(sectionLists, ele.sectionACode);
const sectionc1 = this.findSectionData(sectionLists, ele.sectionCCode);
const sectionb1 = this.findSectionData(sectionLists, ele.sectionBCode);
if (sectionb1.points[sectionb1.points.length - 1].x == sectionb.points[0].x && sectionb1.points[sectionb1.points.length - 1].y == sectionb.points[0].y) {
ele['uid'] = uid;
elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode];
sectiona1.parentCode = uid;
sectionb1.parentCode = uid;
sectionc1.parentCode = uid;
switchSectionList.push(ele.code);
sectionList.forEach((item, index) => {
if (item.code == ele.code) {
sectionList.splice(index, 1);
}
});
}
});
} }
// } else {
// parentSectionModel.relevanceSectionList.push(elem.sectionACode);
// parentSectionModel.relevanceSectionList.push(elem.sectionBCode);
// parentSectionModel.relevanceSectionList.push(elem.sectionCCode);
// models.push(parentSectionModel);
// }
sectiona.relSwitchCode = elem.code; sectiona.relSwitchCode = elem.code;
sectionb.relSwitchCode = elem.code; sectionb.relSwitchCode = elem.code;
sectionc.relSwitchCode = elem.code; sectionc.relSwitchCode = elem.code;