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]) {
this.$painter.delete(this.mapDevice[code]);
delete this.mapDevice[code];
}
if (!elem._dispose) {
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.blockade && this.block(); // 道岔封锁
model.singleLock && model.blockade && this.blockMonolock(); // 单锁&锁闭状态
if (!this.style.Switch.core.graphShow) {
const path = window.location.href;
if (!this.style.Switch.core.graphShow && !path.includes('/map/draw')) {
this.setSectionState(this.sheltertriangle, this.model); // 处理岔芯颜色
}
// this.interlockingReserved(); // 联锁预留道岔

View File

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

View File

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

View File

@ -130,7 +130,9 @@
</el-row>
</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 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>
</template>
@ -211,7 +213,7 @@ export default {
versionBaseNoShow: VersionBaseNoShow,
mainBodyNoShow: MainBodyNoShow,
noQrcodeList: NoQrcodeList,
expirationDate: 1607562000000,
expirationDate: 1605488400000,
countdown: null,
days: [0, 0, 0],
gameOver: false,
@ -583,8 +585,14 @@ export default {
this.days.push(Math.floor((day % 100) / 10));
this.days.push(day % 10);
},
goCompetitionRules() {
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');
goCompetitionRules(val) {
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() {
this.loading = true;
overSimulationConversition(this.group, this.conversitionId).then(resp => {
this.$emit('resetCoversition');
// this.$emit('resetCoversition');
this.loading = false;
}).catch(() => {
this.$message.error('退出会话失败!');

View File

@ -204,6 +204,9 @@ export default {
// }
// });
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});
const activeMemberList = [];
res.data.actionList.forEach((activeMember)=>{

View File

@ -3,25 +3,15 @@
<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"
:user-role="userRole"
/>
<script-tip ref="scriptTip" :offset="offset" :member-data="memberData" @allowCreatCoversition="allowCreatCoversition" />
<script-tip ref="scriptTip" :offset="offset" @allowCreatCoversition="allowCreatCoversition" />
</div>
</template>
<script>
import {covertMemberData} from './utils';
import ChatBox from '../chatView/chatBox.vue';
import ChatBox from '../jointTrainingNew/chatView/chatBox.vue';
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 {
name:'DemonChat',
components:{
@ -47,7 +37,6 @@ export default {
isHasCoversition:false,
conversitionId:'',
currentMemberList:[],
memberData:[],
chatContentList:[],
activeTrainList:[],
isStartRecord:false,
@ -68,165 +57,179 @@ export default {
}
},
watch:{
'$store.state.map.mapViewLoadedCount': function (val) { // 仿
getSimulationMemberList(this.group).then(resp => {
this.driverList = [];
this.treeData = [];
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]
}];
this.memberData = result.lastMemberList;
}).catch(() => {
this.$messageBox('获取仿真成员列表失败!');
});
},
// '$store.state.map.mapViewLoadedCount': function (val) { // 仿
// getSimulationMemberList(this.group).then(resp => {
// this.driverList = [];
// this.treeData = [];
// 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]
// }];
// this.memberData = result.lastMemberList;
// }).catch(() => {
// this.$messageBox('仿');
// });
// },
//
'$store.state.socket.createConversition':function(val) {
if (this.memberData.length > 0) {
const conversitionMember = this.memberData.find(member=>{ return member.userId == this.$store.state.user.id; });
if (conversitionMember && val.memberIds.includes(conversitionMember.id)) {
//
if (val.creatorId !== conversitionMember.id) {
this.$message.success(this.coverName(val) + '与你开启会话');
}
this.isHasCoversition = true;
this.isStartRecord = true;
this.isQuitShow = true;
this.conversitionId = val.id;
const memberList = [];
val.memberIds.forEach(id=>{
if (val.creatorId == id) {
const member = this.memberData.find(member=>{ return member.id == 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.createConversition':function(val) {
// if (this.memberData.length > 0) {
// const conversitionMember = this.memberData.find(member=>{ return member.userId == this.$store.state.user.id; });
// if (conversitionMember && val.memberIds.includes(conversitionMember.id)) {
// //
// if (val.creatorId !== conversitionMember.id) {
// this.$message.success(this.coverName(val) + '');
// }
// this.isHasCoversition = true;
// this.isStartRecord = true;
// this.isQuitShow = true;
// this.conversitionId = val.id;
// const memberList = [];
// val.memberIds.forEach(id=>{
// if (val.creatorId == id) {
// const member = this.memberData.find(member=>{ return member.id == 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) {
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.isStartRecord = true;
if (member.userId != this.inviteUser.userId) {
this.isQuitShow = false;
} else {
this.isQuitShow = true;
}
this.inviteUser = {};
this.isHasCoversition = true;
}
}
}
this.currentMemberList = memberList;
}
},
// '$store.state.socket.acceptConversionInvite':function(val) {
// this.conversitionId = val.id;
// 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.isStartRecord = true;
// this.isQuitShow = true;
// this.inviteUser = {};
// 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')) {
const content = this.addContent(simulationText.message);
this.chatContentList.push(content);
if (!content.self) {
this.$refs.chatbox.addAudioList(content);
}
}
},
// '$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')) {
// const content = this.addContent(simulationText.message);
// this.chatContentList.push(content);
// if (!content.self) {
// this.$refs.chatbox.addAudioList(content);
// }
// }
// },
// ()
'$store.state.map.activeTrainListChange': function (val) {
const activeTrainList = this.$store.state.map.activeTrainList;
activeTrainList.sort((a, b) => {
return parseInt(a) - parseInt(b);
});
if (this.driverList.length > 0) {
const driverList = [];
if (activeTrainList && activeTrainList.length) {
activeTrainList.forEach(groupNumber => {
const drivers = this.driverList.find(driver=>{
return driver.deviceCode == groupNumber;
});
if (drivers) {
driverList.push(drivers);
}
});
}
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];
} else {
this.activeTrainList = activeTrainList;
}
},
// '$store.state.map.activeTrainListChange': function (val) {
// const activeTrainList = this.$store.state.map.activeTrainList;
// activeTrainList.sort((a, b) => {
// return parseInt(a) - parseInt(b);
// });
// if (this.driverList.length > 0) {
// const driverList = [];
// if (activeTrainList && activeTrainList.length) {
// activeTrainList.forEach(groupNumber => {
// const drivers = this.driverList.find(driver=>{
// return driver.deviceCode == groupNumber;
// });
// if (drivers) {
// driverList.push(drivers);
// }
// });
// }
// 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];
// } else {
// this.activeTrainList = activeTrainList;
// }
// },
//
'$store.state.socket.scriptFinish':function(val, old) {
this.$message('剧本演出完毕');
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;
}
},
// '$store.state.socket.overConversition': function (val) {
// if (val.id === this.conversitionId) {
// this.conversitionId = '';
// this.currentMemberList = [];
// this.chatContentList = [];
// this.isHasCoversition = 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) {
// const conversitionMember = this.memberData.find(member=>{ return member.id == val.creatorId; });

View File

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

View File

@ -97,6 +97,9 @@ export default {
EventBus.$emit('clearRunSeries');
if (res.data.memberList && res.data.memberList.length > 0) {
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});
const activeMemberList = [];
res.data.actionList.forEach((activeMember)=>{
@ -118,6 +121,8 @@ export default {
}
if (member.type === 'DISPATCHER') {
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.clearAllData();
this.$store.dispatch('scriptRecord/updateBgSet', false);
}).catch(()=>{
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
}).catch(() => {
this.$messageBox(this.$t('display.demon.exitTaskFail'));
@ -334,9 +332,12 @@ export default {
this.$store.dispatch('training/setRoles', 'AUDIENCE');
this.$store.dispatch('training/setPrdType', '');
}
this.$refs.menuSchema.loadRunData();
this.userRole = userRole;
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);
if (res && res.code == 200) {
if (mapLocation) {
@ -370,10 +371,10 @@ export default {
}
}
this.userRole = userRole;
this.$refs.chatbox.setMembers(this.$store.state.training.orignalUserRoleId);
this.$refs.chatbox.clearAllData();
this.$store.dispatch('training/setPrdType', this.$route.query.prdType);
this.$store.dispatch('training/setRoles', userRole);
this.$store.dispatch('training/setScriptQuit');
// this.$store.dispatch('scriptRecord/updateSimulationPause', false);
},
clearAllData() {

View File

@ -11,10 +11,6 @@ export default {
offset: {
type: Number,
required: true
},
memberData:{
type: Array,
required: true
}
},
data() {
@ -22,6 +18,11 @@ export default {
scriptTipMessage:''
};
},
computed: {
memberData() {
return this.$store.state.training.memberData;
}
},
watch:{
//
'$store.state.socket.simulationScriptTip':function(val, old) {
@ -38,12 +39,12 @@ export default {
this.$emit('allowCreatCoversition');
val.conversationMemberIds.forEach(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();
} 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 = {
Drive_Ahead:'确认运行至前方站',
Route_Block_Drive:'进路闭塞法行车',

View File

@ -18,11 +18,9 @@
@clearAllData="clearAllData"
@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" />
</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" />
<run-plan-Load ref="runPlanLoad" :group="group" />
<run-plan-view ref="runPlanView" :group="group" />
@ -49,9 +47,6 @@ import {loadDraftScript, loadDraftScriptNew} from '@/api/designPlatform';
import Vue from 'vue';
import ConstConfig from '@/scripts/ConstConfig';
//
// import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation';
// import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
export default {
name: 'DisplayDraft',
components: {
@ -63,7 +58,6 @@ export default {
MenuSystemTime,
SelectRole,
ScriptButtonGroup
// Jl3dDrive
},
data() {
return {
@ -74,12 +68,7 @@ export default {
panelShow: true,
memberData:[],
mapLocation:{},
// firstLoad: true,
// simulationShow: false,
// drivingShow: false,
showStation: '',
// stationListMode: [],
// showSelectStation: false, // select
group: '',
prdTypeMap: {
'01': '01', // =>
@ -102,9 +91,6 @@ export default {
'map',
'stationList'
]),
// ...mapGetters('training', [
// 'offsetStationCode'
// ]),
...mapGetters('config', [
'canvasId'
]),
@ -118,9 +104,6 @@ export default {
const drawWay = this.$route.query.drawWay;
return drawWay && JSON.parse(drawWay);
}
// isDrive() {
// return this.prdType == '04';
// },
},
watch: {
'$store.state.config.menuBarLoadedCount': function (val) {
@ -138,10 +121,6 @@ export default {
this.setPosition();
// this.setMode();
}
// 'stationList': function () {
// debugger;
// this.setStationList();
// }
},
created() {
this.group = this.$route.query.group || '';
@ -162,6 +141,8 @@ export default {
this.$store.dispatch('scriptRecord/updateBgSet', true);
this.$refs.scriptButtonGroup.setIsscriptRun(true);
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;
typeList.forEach(type=>{
if (role.type == type.label) {
@ -246,9 +227,6 @@ export default {
switchMode(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() {
this.$refs.selectRole.doShow();
},
@ -273,25 +251,6 @@ export default {
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) {
if (val == null && this.stationListMode.length > 0) {
this.showStation = this.stationListMode[0].value;
@ -301,17 +260,6 @@ export default {
this.$store.dispatch('map/setShowCentralizedStationCode', this.showStation);
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>

View File

@ -182,6 +182,9 @@ export default {
const resp = await getDraftScriptByGroupNew(group);
if (resp.code == 200) {
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});
if (this.$store.state.training.started) {
this.activeTrainList = this.$store.state.map.activeTrainList;

View File

@ -3,21 +3,13 @@
<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"
:user-role="userRole"
/>
<script-tip ref="scriptTip" :offset="offset" :member-data="memberData" @allowCreatCoversition="allowCreatCoversition" />
<script-tip ref="scriptTip" :offset="offset" @allowCreatCoversition="allowCreatCoversition" />
</div>
</template>
<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';
export default {
name:'ScriptPreviewChat',
@ -34,14 +26,6 @@ export default {
type: String,
required: true
},
memberData:{
type: Array,
required: true
},
treeData:{
type: Array,
required: true
},
offset: {
type: Number,
required: true
@ -49,165 +33,23 @@ export default {
},
data() {
return {
isHasCoversition:false,
conversitionId:'',
currentMemberList:[],
chatContentList:[],
isStartRecord:false,
inviteUserName:'',
createCoversition:false,
inviteUser:{},
isQuitShow:false
};
},
computed:{
isShow() {
return this.userRole != '' &&
this.userRole != 'ADMIN' && this.userRole != 'AUDIENCE' &&
!this.isHasCoversition && this.createCoversition;
}
},
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) {
this.$message('剧本演出完毕');
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:{
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() {
this.resetCoversition();
this.createCoversition = false;
this.$refs.scriptTip.resetScriptTip();
},
resetCoversition() {
this.conversitionId = '';
this.isHasCoversition = false;
this.currentMemberList = [];
this.chatContentList = [];
this.isStartRecord = false;
this.inviteUserName = '';
this.inviteUser = {};
this.isQuitShow = false;
},
allowCreatCoversition() {
this.createCoversition = true;

View File

@ -27,13 +27,6 @@
:offset-bottom="offsetBottom"
/>
<script-chat
ref="chatbox"
:group="group"
:user-role="userRole"
:tree-data="treeData"
:member-data="memberData"
/>
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
<tip-script-record-new
ref="tipTaskRecordNew"
@ -46,6 +39,11 @@
@addScriptMember="addScriptMember"
@resetChat="resetChat"
/>
<chat-box
ref="chatbox"
:group="group"
:user-role="userRole"
/>
</div>
</template>
@ -54,22 +52,22 @@
import { TrainingMode } from '@/scripts/ConstDic';
import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import DemonMenu from '@/views/newMap/displayNew/demonMenu';
import ScriptChat from './scriptChat';
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/jointTrainingNew/chatView/chatBox.vue';
export default {
name: 'MenuScript',
components: {
SetTime,
ScriptChat,
MenuSchema,
DemonMenu,
TipScriptRecordNew
TipScriptRecordNew,
ChatBox
},
props: {
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;
} else {
this.activeTrainList = activeTrainList;
@ -161,7 +159,7 @@ export default {
},
'$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.$store.dispatch('training/setMemberList', {memberList:resp.data, userId:this.$store.state.user.id});
this.driverList = [];
this.treeData = [];
if (this.$store.state.training.started) {
@ -197,7 +195,6 @@ export default {
children: result.deviceListData[4]
}];
this.memberData = result.lastMemberList;
//
const member = resp.data.find(mem=>{
return mem.userId != '' && mem.userId != undefined;
@ -300,7 +297,7 @@ export default {
});
},
resetChat() {
this.$refs.chatbox.resetCoversition();
// this.$refs.chatbox.resetCoversition();
},
changeTreeData({newRole, oldRole}) {
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.includes(member.deviceCode)) {
deviceListData[deviceTypeIndex].push(member);
lastMemberList.push(member);
}
}
lastMemberList.push(member);
driverList.push(member);
} else {
deviceListData[deviceTypeIndex].push(member);

View File

@ -48,7 +48,6 @@
<div class="chat-box-footer">
<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>
<div v-if="scriptTip" class="scriptTip">{{ scriptTip }}</div>
</div>
</template>
<template v-else>
@ -80,6 +79,7 @@
:conversition-id="conversitionId"
:conversition-member-list="conversitionMemberList"
:message-list="messageList"
:my-member-id="myMemberId"
:simulation-users="simulationUsers"
:common-conversation="commonConversation"
:user-role="userRole"
@ -96,21 +96,17 @@
</div>
<div class="chat-box-footer">
<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>
<div v-if="scriptTip" class="scriptTip">{{ scriptTip }}</div>
</div>
</template>
</div>
<chat-setting ref="chatSetting" :form="form" @setSetting="setSetting" />
<chat-tooltip :group="group" :simulation-users="simulationUsers" @acceptInvite="acceptInvite" />
</div>
</template>
<script>
import ChatSetting from './chatSetting';
import ChatTooltip from './chatTooltip';
import ChatContent from './chatContent';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import ChatMemberList from './chatMemberList';
import RecordRTC from 'recordrtc';
import {sendSimulationConversition, startConversition, overSimulationConversition, getAllConversition} from '@/api/chat';
@ -119,7 +115,6 @@ export default {
name: 'ChatBox',
components:{
ChatSetting,
ChatTooltip,
ChatContent,
ChatMemberList
},
@ -138,7 +133,6 @@ export default {
drawer: false,
bottom:15,
recordSending:false,
conversitionId: '',
commonConversation: false,
seconds:0,
inter:null,
@ -149,7 +143,6 @@ export default {
language:'zh',
sex:'1'
},
scriptTip:'',
treeData: [],
defaultProps: {
children: 'children',
@ -165,12 +158,11 @@ export default {
quitLoading: false,
conversitionMemberList: [],
commonMemberList: [],
privateMemberList: [],
isConversitionCreator: false,
messageList: [],
commonMessageList: [],
privateMessageList: [],
temData: []
temData: [],
conversitionStateMap:{},
myMemberId: ''
};
},
computed:{
@ -182,6 +174,18 @@ export default {
},
IsAnswering() {
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:{
@ -190,10 +194,18 @@ export default {
this.$refs.tree.filter(val);
}
},
conversitionId(val) {
if (val) {
this.conversitionMemberList = this.privateMemberList;
this.messageList = this.privateMessageList;
}
},
userRole(val) {
if (val === 'AUDIENCE') {
// this.isAudienceInitData();
this.goCommonConversation();
this.myMemberId = '';
} else {
this.myMemberId = (this.simulationUsers[this.userId] || {}).memberId;
}
},
'$store.state.map.mapViewLoadedCount':function(val) {
@ -218,57 +230,9 @@ export default {
});
},
'$store.state.socket.createConversition':function(val) {
const member = this.temData.find(member=>{ return member.userId == this.$store.state.user.id; });
if (member && val.memberIds.includes(member.id)) {
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('剧本执行完成');
val.memberList.forEach(member => {
this.$set(this.conversitionStateMap, member.memberId, {conversitionId: val.id, privateMemberList: val.memberList, privateMessageList: []});
});
},
'$store.state.map.activeTrainListChange': function (val) { //
this.activeTrains = [];
@ -282,12 +246,6 @@ export default {
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': {
handler(val, o) {
this.simulationUsers = {};
@ -295,17 +253,26 @@ export default {
val.forEach(user => {
this.simulationUsers[user.userId] = user;
});
this.myMemberId = this.simulationUsers[this.userId].memberId;
}
},
deep: true
},
'$store.state.socket.overConversition': function (val) {
if (val.id === this.conversitionId) {
this.conversitionId = '';
this.conversitionMemberList = [];
this.privateMemberList = [];
this.messageList = [];
this.privateMessageList = [];
'$store.state.socket.exitConversition': function (val) {
for (const memberId in this.conversitionStateMap) {
if (memberId == val.memberId) {
this.conversitionStateMap[memberId].conversitionId = '';
this.conversitionStateMap[memberId].privateMemberList = [];
this.conversitionStateMap[memberId].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) {
@ -321,7 +288,7 @@ export default {
const device = this.$store.getters['map/getDeviceByCode'](item.deviceCode);
switch (item.type) {
case 'DISPATCHER':
this.memberData[item.id].label = '行调' + (dispatcherList.length + 1);
this.memberData[item.id].label = '行调' + (item.name || '');
dispatcherList.push(this.memberData[item.id]);
break;
case 'ELECTRIC_DISPATCHER':
@ -340,7 +307,7 @@ export default {
driverList.push(this.memberData[item.id]);
break;
case 'MAINTAINER':
this.memberData[item.id].label = '通号' + (maintainerList.length + 1);
this.memberData[item.id].label = '通号' + (item.name || '');
maintainerList.push(this.memberData[item.id]);
break;
}
@ -383,7 +350,6 @@ export default {
},
mounted() {
this.firstClick = true;
this.scriptTip = '';
},
methods:{
clickBtn() {
@ -405,12 +371,9 @@ export default {
if (this.memberIdList.length) {
this.createLoading = true;
startConversition(this.group, this.memberIdList).then(resp => {
this.conversitionId = resp.data.id;
this.messageList = [];
this.privateMessageList = [];
this.memberIdList = [];
this.userString = '';
this.isConversitionCreator = true;
this.$message.success('创建会话成功!');
this.createLoading = false;
}).catch((error) => {
@ -432,7 +395,6 @@ export default {
},
//
startRecording() {
this.scriptTip = '';
const that = this;
if (!this.recordSending && !this.recorders && !this.microphone) {
this.$refs.chatSetting.doClose();
@ -541,6 +503,9 @@ export default {
if (memberList && memberList.length) {
memberList.forEach(memberId => {
const member = this.memberData[memberId];
if (member && member.type === 'DRIVER' && !this.activeTrains.includes(member.deviceCode)) {
return;
}
if (member && member.userId) {
this.memberIdList.push(member.id);
this.userString += ((this.userString ? ',' : '') + member.label + '(' + this.simulationUsers[member.userId].nickName + ')');
@ -564,13 +529,9 @@ export default {
},
quitConversition() {
this.quitLoading = true;
this.scriptTip = '';
overSimulationConversition(this.group, this.conversitionId).then(resp => {
this.conversitionId = '';
this.conversitionMemberList = [];
this.privateMemberList = [];
this.messageList = [];
this.privateMessageList = [];
this.quitLoading = false;
this.$nextTick(() => {
this.$refs.tree && this.$refs.tree.filter(this.queryMember);
@ -580,34 +541,6 @@ export default {
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) {
const time1 = new Date(message1.time).valueOf();
const time2 = new Date(message2.time).valueOf();
@ -627,26 +560,18 @@ export default {
}
messages.push(message);
});
if (this.userRole !== 'AUDIENCE') {
const user = this.simulationUsers[this.$store.state.user.id];
this.isConversitionCreator = conversation.creatorId == user.memberId;
!conversation.over && conversation.memberList.forEach(member =>{
if (member.memberId == user.memberId && member.connect) {
this.conversitionMemberList = conversation.memberList;
this.conversitionId = conversation.id;
this.messageList = [];
conversation.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.privateMessageList.push(message);
this.messageList.push(message);
});
}
});
}
const tempMessageList = [];
!conversation.over && conversation.messageList.forEach(message => {
message.src = `/audio/${message.audioPath}`;
tempMessageList.push(message);
});
!conversation.over && conversation.memberList.forEach(member => {
this.conversitionStateMap[member.memberId] = {
conversationId: conversation.id,
privateMemberList: conversation.memberList,
privateMessageList: tempMessageList
};
});
});
}
this.commonMessageList = messages.sort(this.sortByMessageTime);
@ -681,37 +606,33 @@ export default {
this.commonMemberList = [...temDispatcherList, ...temStationSupervisorList, ...temMaintainerList, ...temDriverList, ...temDepotDispatcherList];
if (this.userRole === 'AUDIENCE' || this.commonConversation) {
this.conversitionMemberList = [];
this.messageList = [...this.commonMessageList];
this.messageList = this.commonMessageList;
this.conversitionMemberList = this.commonMemberList;
}
},
changeMessageList(data) {
if (data.flag) {
this.messageList.push(data.message);
}
this.commonMessageList.push(data.message);
if (this.userRole !== 'AUDIENCE' && data.private) {
this.privateMessageList.push(data.message);
if (this.conversitionStateMap[data.message.memberId]) {
this.conversitionStateMap[data.message.memberId].privateMessageList.push(data.message);
}
},
goCommonConversation() {
!this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange();
this.commonConversation = true;
this.conversitionMemberList = this.commonMemberList;
this.messageList = [...this.commonMessageList];
this.messageList = this.commonMessageList;
},
cancelCommonConversation() {
this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange();
this.commonConversation = false;
this.conversitionMemberList = this.privateMemberList;
this.messageList = [...this.privateMessageList];
this.messageList = this.privateMessageList;
this.$nextTick(() => {
this.$refs.tree && this.$refs.tree.filter(this.queryMember);
});
},
clearAllData() {
this.recordSending = false;
this.conversitionId = '';
this.inter = null;
this.recorders = null;
this.microphone = null;
@ -941,28 +862,4 @@ export default {
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>

View File

@ -5,7 +5,7 @@
<div :class="chatContent.self?'rightUser':'leftUser'">
<div class="userHeader">
<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 class="userBubble" @click="playAudio(baseUrl+chatContent.src)">
<div class="userMessage">
@ -50,6 +50,12 @@ export default {
commonConversation: {
type: Boolean,
required: true
},
myMemberId: {
type: String,
default() {
return '';
}
}
},
data() {
@ -66,11 +72,8 @@ export default {
const conversationInfo = this.$store.state.socket.conversationInfo;
const member = this.$store.state.training.memberData[val.message.memberId];
conversationInfo.message.src = `/audio/${conversationInfo.message.audioPath}`;
if (member) {
conversationInfo.message.self = this.$store.state.userId == member.userId;
}
this.$emit('changeMessageList', conversationInfo);
if (this.conversitionId == val.id) {
this.$emit('changeMessageList', {message:conversationInfo.message, flag: true, private: true});
if (member && member.userId != this.$store.state.user.id) {
this.currentAudioList.push(this.baseUrl + '/audio/' + conversationInfo.message.audioPath);
if (!this.isPlay) {
@ -80,7 +83,6 @@ export default {
}
this.scrollTop();
} 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) {
this.currentAudioList.push(this.baseUrl + '/audio/' + conversationInfo.message.audioPath);
if (!this.isPlay) {
@ -88,7 +90,7 @@ export default {
this.playAllAudio();
}
}
} else { this.$emit('changeMessageList', {message:conversationInfo.message, flag: false, private: false}); }
}
}
},
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 { OperateMode, TrainingMode } from '@/scripts/ConstDic';
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 { getSessionStorage } from '@/utils/auth';
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
@ -182,7 +182,7 @@ export default {
'$store.state.map.mapViewLoadedCount': function () { //
this.mapViewLoadedOver = true;
this.showSelectStation && this.setShowStation(this.showStation);
this.initMemberUserInfo();
// this.initMemberUserInfo();
if (this.$route.query.type === 'VR_PSD') {
this.deviceShow = true;
}
@ -192,9 +192,9 @@ export default {
this.hidepanel();
}
},
'$store.state.socket.memberChangeCount': function () { // 仿
this.initMemberUserInfo();
},
// '$store.state.socket.memberChangeCount': function () { // 仿
// this.initMemberUserInfo();
// },
'$store.state.socket.permissionOver': function () {
this.$alert(this.$t('tip.userRightsHaveBeenReclaimed'), this.$t('tip.hint'), {
confirmButtonText: this.$t('global.confirm'),
@ -291,19 +291,19 @@ export default {
this.endViewLoading();
}
},
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('获取所有仿真用户失败!');
});
},
// 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('仿');
// });
// },
devicemodel() {
if (this.deviceShow == false) {
this.deviceShow = true;

View File

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

View File

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

View File

@ -9,6 +9,7 @@ import MapCommon from './common/index';
import { getToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
import { checkLoginLine } from '@/api/login';
import { getSimulationMemberList, getAllSimulationUser } from '@/api/simulation';
import { mapGetters } from 'vuex';
export default {
@ -46,12 +47,24 @@ export default {
'$store.state.map.mapViewLoadedCount': function (val) { //
this.mapBoxP = document.getElementById(this.canvasId).children[0];
this.mapBoxP.style.cursor = '';
this.initMemberUserInfo();
this.subscribe();
},
'$store.state.socket.memberChangeCount': function () { // 仿
this.initMemberUserInfo();
},
'$store.state.training.setScriptQuit': function () {
this.initMemberUserInfo();
},
'$store.state.socket.simulationError': function (val) {
if (val) {
this.simulationError(val);
}
},
'$store.state.socket.simulationRoleList':function(val) {
if (val && val.length) {
this.handlerMemberOnOff(val);
}
}
},
mounted() {
@ -149,6 +162,22 @@ export default {
}
}
}, 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;
},
changeSectionAttr() { //
//
changeSectionAttr() {
const changeSectionList = []; //
this.sectionList.forEach(section => {
const oneSection = section.points[section.points.length - 1];
@ -244,45 +245,45 @@ export default {
const sectionb = this.findSectionData(sectionLists, elem.sectionBCode);
const sectiona = this.findSectionData(sectionLists, elem.sectionACode);
const sectionc = this.findSectionData(sectionLists, elem.sectionCCode);
const parentSectionModel = this.$store.getters['map/getDeviceByCode'](sectiona.parentCode);
if (!parentSectionModel) { //
if (switchSectionList.indexOf(elem.code) == -1) {
let uid;
if (!elem['uid']) {
uid = getUID('T', [...this.sectionList, ...addSectionList]);
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);
}
});
}
});
// const parentSectionModel = this.$store.getters['map/getDeviceByCode'](sectiona.parentCode);
// if (!parentSectionModel) { //
if (switchSectionList.indexOf(elem.code) == -1) {
let uid;
if (!elem['uid']) {
uid = getUID('T', [...this.sectionList, ...addSectionList]);
elem['uid'] = uid;
}
} else {
parentSectionModel.relevanceSectionList.push(elem.sectionACode);
parentSectionModel.relevanceSectionList.push(elem.sectionBCode);
parentSectionModel.relevanceSectionList.push(elem.sectionCCode);
models.push(parentSectionModel);
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 {
// parentSectionModel.relevanceSectionList.push(elem.sectionACode);
// parentSectionModel.relevanceSectionList.push(elem.sectionBCode);
// parentSectionModel.relevanceSectionList.push(elem.sectionCCode);
// models.push(parentSectionModel);
// }
sectiona.relSwitchCode = elem.code;
sectionb.relSwitchCode = elem.code;
sectionc.relSwitchCode = elem.code;