From de8263e062bd1a023636b76b506158aafc83daf8 Mon Sep 17 00:00:00 2001
From: joylink_cuiweidong <364937672@qq.com>
Date: Tue, 1 Sep 2020 18:27:36 +0800
Subject: [PATCH 1/9] =?UTF-8?q?=E5=89=A7=E6=9C=AC=E7=BC=96=E5=88=B6?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/store/modules/training.js | 12 --
.../component/covertOperation.js | 25 ++-
.../scriptDisplay/scriptRecord/index.vue | 182 ++++++++++++++++--
.../scriptDisplay/scriptRecord/scriptChat.vue | 115 ++---------
src/views/newMap/displayNew/utils.js | 13 +-
src/views/scriptManage/addScriptMember.vue | 6 +-
src/views/scriptManage/allScriptRole.vue | 126 +++---------
src/views/scriptManage/getAction.vue | 10 +-
src/views/scriptManage/tipScriptRecord.vue | 170 ++++++++--------
9 files changed, 329 insertions(+), 330 deletions(-)
diff --git a/src/store/modules/training.js b/src/store/modules/training.js
index 88fdb0247..554df291d 100644
--- a/src/store/modules/training.js
+++ b/src/store/modules/training.js
@@ -40,7 +40,6 @@ const training = {
memberList: [], // 综合仿真成员列表
memberData: {}, // 综合仿真成员列表
simulationUserList: [], // 综合仿真用户列表
- addMemberInScript:{}, // 剧本录制新增角色
orignalUserRoleId:'' // 设置旧的角色的id
},
@@ -253,13 +252,6 @@ const training = {
state.memberData[newMemberId].disabled = true;
},
- addMemberListInScript:(state, newMember) => {
- if (!state.memberData[newMember.id]) {
- // state.memberData[newMember.id] = newMember;
- state.addMemberInScript = newMember;
- }
- },
-
updateMemberAndUser: (state, {simulationUserList, userId}) => {
simulationUserList.forEach(item => {
let memberIndex = -1;
@@ -720,10 +712,6 @@ const training = {
setRoleDeviceCode:({ commit }, roleDeviceCode) => {
commit('setRoleDeviceCode', roleDeviceCode);
},
- /** 添加新成员(剧本录制)*/
- addMemberListInScript:({ commit }, data) => {
- commit('addMemberListInScript', data);
- },
/** 剧本仿真 设置旧的角色的id */
setOrignalUserRoleId:({ commit }, data) => {
commit('setOrignalUserRoleId', data);
diff --git a/src/views/newMap/displayNew/scriptDisplay/component/covertOperation.js b/src/views/newMap/displayNew/scriptDisplay/component/covertOperation.js
index c560855fa..12dd29bff 100644
--- a/src/views/newMap/displayNew/scriptDisplay/component/covertOperation.js
+++ b/src/views/newMap/displayNew/scriptDisplay/component/covertOperation.js
@@ -117,8 +117,29 @@ export const operateEnum = {
type:'车站'
},
Driver:{
- // code:'stationCode',
- type:'司机'
+ code:'groupNumber',
+ type:'司机',
+ Driver_Door_On_Off:{
+ isList:true,
+ params:[
+ {
+ code:'open',
+ name:'',
+ result:[
+ {data:true, name:'开', judge:'='},
+ {data:false, name:'关', judge:'='}
+ ]
+ },
+ {
+ code:'right',
+ name:'',
+ result:[
+ {data:true, name:'左门', judge:'='},
+ {data:false, name:'右门', judge:'='}
+ ]
+ }
+ ]
+ }
}
};
diff --git a/src/views/newMap/displayNew/scriptDisplay/scriptRecord/index.vue b/src/views/newMap/displayNew/scriptDisplay/scriptRecord/index.vue
index 74f47d5fc..fb2f93a9c 100644
--- a/src/views/newMap/displayNew/scriptDisplay/scriptRecord/index.vue
+++ b/src/views/newMap/displayNew/scriptDisplay/scriptRecord/index.vue
@@ -27,9 +27,25 @@
:offset-bottom="offsetBottom"
/>
-
+
-
+
@@ -43,7 +59,8 @@ 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 { mapGetters } from 'vuex';
+import {covertMemberData} from '@/views/newMap/displayNew/utils';
+import { getSimulationMemberList} from '@/api/simulation';
export default {
name: 'MenuScript',
@@ -85,7 +102,12 @@ export default {
data() {
return {
isDisable: false,
- isScriptCommand:false
+ isScriptCommand:false,
+ driverList:[],
+ treeData:[],
+ memberData:[],
+ activeTrainList:[],
+ userRole:''
};
},
@@ -93,17 +115,14 @@ export default {
scriptId() {
return this.$route.query.scriptId;
},
- ...mapGetters('map', [
- 'trainList'
- ]),
group() {
return this.$route.query.group;
},
- userRole() {
- return this.$store.state.scriptRecord.userRole ? this.$store.state.scriptRecord.userRole : 'DISPATCHER';
- },
+ // userRole() {
+ // return this.$store.state.scriptRecord.userRole ? this.$store.state.scriptRecord.userRole : 'DISPATCHER';
+ // },
isDriver() {
- return this.$store.state.scriptRecord.userRole == 'DRIVER';
+ return this.userRole == 'DRIVER';
},
isShowScheduling() {
return this.$store.state.training.prdType == '05';
@@ -115,26 +134,106 @@ export default {
watch: {
'$store.state.scriptRecord.bgSet':function (val) {
this.isScriptCommand = val;
+ },
+ // 按计划行车的列车列表更新(更新司机列表)
+ '$store.state.map.activeTrainListChange': function (val) {
+ const activeTrainList = this.$store.state.map.activeTrainList;
+ if (this.driverList.length > 0) {
+ const driverList = [];
+ if (activeTrainList && activeTrainList.length) {
+ activeTrainList.sort();
+ activeTrainList.forEach(groupNumber => {
+ const drivers = this.driverList.find(driver=>{
+ return driver.deviceCode == groupNumber;
+ });
+ if (drivers) {
+ driverList.push(drivers);
+ }
+ });
+ }
+ this.treeData[2].children = driverList;
+ } else {
+ this.activeTrainList = activeTrainList;
+ }
+ },
+ '$store.state.map.mapViewLoadedCount': function (val) { // 地图视图加载完成标识
+ getSimulationMemberList(this.group).then(resp => {
+ this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId:this.$store.state.user.id});
+ this.driverList = [];
+ this.treeData = [];
+ if (this.$store.state.training.started) {
+ this.activeTrainList = this.$store.state.map.activeTrainList;
+ }
+ // 获取仿真成员列表
+ const result = covertMemberData(this.activeTrainList, resp);
+ 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;
+
+ // 设置当前角色
+ const member = resp.data.find(mem=>{
+ return mem.userId != '' && mem.userId != undefined;
+ });
+ if (member) {
+ const memberType = ['STATION_SUPERVISOR', 'DISPATCHER', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER'];
+ const prdTypeList = ['01', '02', '04', '', ''];
+ const index = memberType.indexOf(member.type);
+ let prdType;
+ if (index >= 0) {
+ prdType = prdTypeList[index];
+ }
+ this.userRole = member.type;
+ this.$store.dispatch('training/setRoles', member.type);
+ this.$store.dispatch('scriptRecord/updateRole', member.type + ':' + member.id);
+ this.$store.dispatch('training/setPrdType', prdType);
+ }
+
+ }).catch(() => {
+ this.$messageBox('获取仿真成员列表失败!');
+ });
}
},
beforeDestroy() {
+ // this.clearAutoSave();
+ this.$store.dispatch('training/setMemberList', {memberList:[], userId:this.$store.state.user.id});
+ this.$store.dispatch('map/resetActiveTrainList', true);
+ this.$store.dispatch('scriptRecord/updateBgSet', false);
+ this.$store.dispatch('scriptRecord/updateRole', null);
+ this.$store.dispatch('training/setRoles', null);
},
mounted() {
- // this.$store.state.training.prdType
this.isScriptCommand = this.$store.state.scriptRecord.bgSet;
- // if (!this.isScriptCommand) {
- // this.$store.dispatch('training/setPrdType', '02');
- // }
this.$store.dispatch('training/end', TrainingMode.NORMAL);
- this.$store.dispatch('training/setPrdType', '01');
this.$nextTick(() => {
this.$refs.demonMenu.menuClick();
});
},
methods: {
- initPlannedDriving(isDisable) {
- this.isDisable = isDisable;
- },
selectBeginTime() {
this.$refs.setTime.doShow();
},
@@ -196,6 +295,51 @@ export default {
history.go(-1);
Notification.closeAll();
});
+ },
+ resetChat() {
+ this.$refs.chatbox.resetCoversition();
+ },
+ changeTreeData({newRole, oldRole}) {
+ const deviceTypeList = ['DISPATCHER', 'STATION_SUPERVISOR', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER'];
+ if (oldRole.id) {
+ const oldIndex = deviceTypeList.indexOf(oldRole.type);
+ if (oldIndex >= 0) {
+ const oldTreeDataIn = this.treeData[oldIndex];
+ oldTreeDataIn.children.map(device=>{
+ if (device.id == oldRole.id) {
+ device.userName = '';
+ delete device.userId;
+ device.disabled = false;
+ device.label = device.type + (device.deviceName ? '- ' + device.deviceName : '') + (device.name ? device.name : '');
+ }
+ });
+ this.treeData[oldIndex] = oldTreeDataIn;
+ }
+ }
+ const newIndex = deviceTypeList.indexOf(newRole.type);
+ if (newIndex >= 0) {
+ const newTreeDataIn = this.treeData[newIndex];
+ newTreeDataIn.children.map(device=>{
+ if (device.id == newRole.id) {
+ device.userName = this.$store.state.user.nickname;
+ device.userId = this.$store.state.user.id;
+ device.disabled = true;
+ device.label = device.type + (device.deviceName ? '- ' + device.deviceName : '') + (device.name ? device.name : '') + '-' + device.userName;
+ }
+ });
+ this.treeData[newIndex] = newTreeDataIn;
+ }
+ this.userRole = newRole.type;
+ },
+ addScriptMember(member) {
+ this.memberData.push(member);
+ const deviceTypeList = ['行调', '行值', '司机', '通号', '车辆段调度'];
+ const index = deviceTypeList.indexOf(member.type);
+ if (index >= 0) {
+ const treeDataIn = this.treeData[index];
+ treeDataIn.children.push(member);
+ this.treeData[index] = treeDataIn;
+ }
}
}
};
diff --git a/src/views/newMap/displayNew/scriptDisplay/scriptRecord/scriptChat.vue b/src/views/newMap/displayNew/scriptDisplay/scriptRecord/scriptChat.vue
index 50d8a632f..efb66a4bd 100644
--- a/src/views/newMap/displayNew/scriptDisplay/scriptRecord/scriptChat.vue
+++ b/src/views/newMap/displayNew/scriptDisplay/scriptRecord/scriptChat.vue
@@ -31,6 +31,14 @@ export default {
userRole: {
type: String,
required: true
+ },
+ treeData:{
+ type:Array,
+ required:true
+ },
+ memberData:{
+ type:Array,
+ required:true
}
},
data() {
@@ -38,15 +46,15 @@ export default {
isHasCoversition:false,
conversitionId:'',
currentMemberList:[],
- memberData:{},
+ // memberData:{},
chatContentList:[],
activeTrainList:[],
isStartRecord:false,
inviteUserName:'',
inviteUser:{},
- isQuitShow:false,
- treeData:[],
- driverList:[]
+ isQuitShow:false
+ // treeData:[],
+ // driverList:[]
};
},
computed:{
@@ -57,80 +65,6 @@ export default {
}
},
watch:{
- '$store.state.map.mapViewLoadedCount': function (val) { // 地图视图加载完成标识 开始获取仿真成员
- getSimulationMemberList(this.group).then(resp => {
- this.driverList = [];
- this.treeData = [];
- const result = covertMemberData(this.activeTrainList, resp);
- 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.training.addMemberInScript':function(val, oldval) {
- this.memberData.push(val);
- const roleList = ['行调', '车站值班员', '司机', '通号', '车辆段'];
- const roleIndex = roleList.indexOf(val.type);
- if (roleIndex >= 0) {
- this.treeData[roleIndex].children.push(val);
- }
- },
- 'userRole':function(val, oldval) {
- // 切换对象
- this.changeRole(oldval, val);
- },
- '$store.state.scriptRecord.updateRoleStatus':function(val) {
- // 切换对象
- this.changeRole(this.$store.state.scriptRecord.userRole, this.$store.state.scriptRecord.userRole);
- },
- // 按计划行车的列车列表更新(更新司机列表)
- '$store.state.map.activeTrainListChange': function (val) {
- const activeTrainList = this.$store.state.map.activeTrainList;
- if (this.driverList.length > 0) {
- const driverList = [];
- if (activeTrainList && activeTrainList.length) {
- activeTrainList.sort();
- activeTrainList.forEach(groupNumber => {
- const drivers = this.driverList.find(driver=>{
- return driver.deviceCode == groupNumber;
- });
- if (drivers) {
- driverList.push(drivers);
- }
- });
- }
- this.treeData[2].children = driverList;
- } else {
- this.activeTrainList = activeTrainList;
- }
- },
// 创建会话
'$store.state.socket.createConversition':function(val) {
if (this.memberData.length > 0) {
@@ -214,31 +148,6 @@ export default {
this.inviteUser = {};
this.isQuitShow = false;
},
- changeRole(oldval, val) {
- const userList = ['DISPATCHER', 'STATION_SUPERVISOR', 'DRIVER', 'MAINTAINER', 'DEPOT_DISPATCHER'];
- // 切换对象 待优化
- this.getAllConversition();
- const oldIndex = userList.indexOf(oldval);
- if (oldIndex >= 0) {
- this.treeData[oldIndex].children.forEach(child=>{
- if (child.userId) {
- child.userId = '';
- child.disabled = false;
- child.label = child.type + (child.deviceName ? child.deviceName : '');
- }
- });
- }
- const index = userList.indexOf(val);
- if (index >= 0) {
- this.treeData[index].children.forEach(child=>{
- if (child.id == this.$store.state.scriptRecord.updateRoleId) {
- child.userId = this.$store.state.user.id;
- child.disabled = true;
- child.label = child.label + '-' + this.$store.state.user.nickname;
- }
- });
- }
- },
getAllConversition() {
// 获取会话列表
getAllConversition(this.$route.query.group).then(resp=>{
diff --git a/src/views/newMap/displayNew/utils.js b/src/views/newMap/displayNew/utils.js
index d66fcbfd0..b3f0e9b00 100644
--- a/src/views/newMap/displayNew/utils.js
+++ b/src/views/newMap/displayNew/utils.js
@@ -18,23 +18,24 @@ export function covertMemberData (activeTrainList, resp) {
const deviceListData = [[], [], [], [], []];
const driverList = [];
lastData.forEach((member, index)=>{
- if (!member.userId) {
- member.disabled = false;
- } else {
+ if (member.userId && member.userId == store.state.user.id) {
member.disabled = true;
member.userName = store.state.user.nickname;
store.dispatch('training/setOrignalUserRoleId', member.id);
+ } else {
+ member.disabled = false;
}
const userName = member.userName ? '-' + member.userName : '';
const name = member.name ? '-' + member.name : '';
if (member.deviceCode) {
const device = store.getters['map/getDeviceByCode'](member.deviceCode);
- const deviceName = device.name || device.groupNumber;
- member.deviceName = deviceName;
- member.label = member.type + deviceName + name + userName;
+ member.deviceName = device.name || device.groupNumber;
+ member.label = member.type + member.deviceName + name + userName;
+ member.normalName = member.type + member.deviceName + name;
} else {
member.deviceName = '';
member.label = member.type + name + userName;
+ member.normalName = member.type + name;
}
lastMemberList.push(member);
const deviceType = ['行调', '通号', '行值', '司机', '车辆段调度'];
diff --git a/src/views/scriptManage/addScriptMember.vue b/src/views/scriptManage/addScriptMember.vue
index e19a73790..9bb9e2b74 100644
--- a/src/views/scriptManage/addScriptMember.vue
+++ b/src/views/scriptManage/addScriptMember.vue
@@ -59,11 +59,7 @@ export default {
}
},
methods: {
- initData(row) {
-
- },
doShow(row) {
- this.initData(row);
this.dialogVisible = true;
},
doSave() {
@@ -71,9 +67,9 @@ export default {
if (valid) {
this.lodaing = true;
addSimulationMember(this.formModel, this.$route.query.group).then((res) => {
- this.lodaing = false;
this.$message.success('添加仿真角色成员成功!');
this.$emit('addScriptMember', res.data);
+ this.lodaing = false;
this.handleClose();
}).catch(() => {
this.lodaing = false;
diff --git a/src/views/scriptManage/allScriptRole.vue b/src/views/scriptManage/allScriptRole.vue
index c5335c2c2..553f797d3 100644
--- a/src/views/scriptManage/allScriptRole.vue
+++ b/src/views/scriptManage/allScriptRole.vue
@@ -8,7 +8,7 @@
- {{ data.label }}
-
- 设置
- 已设置
+
+ {{ data.label }}
+
+ {{ data.normalName }}
+
+ 设置
+ 已设置
+
+
+