This commit is contained in:
zyy 2020-08-18 16:02:35 +08:00
commit c448e2e1ab
2 changed files with 51 additions and 39 deletions

View File

@ -94,19 +94,14 @@ export default {
const device = this.$store.getters['map/getDeviceByCode'](member.deviceCode); const device = this.$store.getters['map/getDeviceByCode'](member.deviceCode);
if (device) { if (device) {
if (device._type == 'Train') { if (device._type == 'Train') {
member.label = member.name;
driverList.push(member); driverList.push(member);
} else { } else {
member.label = member.name;
if (device._type == 'Station') { if (device._type == 'Station') {
stationSupervisorList.push(member); stationSupervisorList.push(member);
} }
} }
} else {
member.label = member.name;
} }
} else { } else {
member.label = member.name;
if (member.type == '行调') { if (member.type == '行调') {
dispatcherList.push(member); dispatcherList.push(member);
} else if (member.type == '通号') { } else if (member.type == '通号') {
@ -207,7 +202,7 @@ export default {
this.$store.dispatch('scriptRecord/updateRole', each.value + ':' + role.id); this.$store.dispatch('scriptRecord/updateRole', each.value + ':' + role.id);
} }
}); });
this.$emit('setMemberId', role.id); this.$emit('setMemberId', role);
this.$message('切换角色成功'); this.$message('切换角色成功');
// this.$refs.changeScriptRole.blur(); // this.$refs.changeScriptRole.blur();
}).catch(()=>{ }).catch(()=>{

View File

@ -7,31 +7,22 @@
<div class="eachScriptPanel"> <div class="eachScriptPanel">
<div class="scriptPanelLeft"> <div class="scriptPanelLeft">
<div class="panelLeftSelect"> <div class="panelLeftSelect">
<span style="font-size:13px;">当前剧本角色:</span> <div>
<span style="font-size:13px;">{{ getRoleName(memberId) }}</span> <span style="font-size:13px;">当前剧本角色:</span>
<span style="font-size:13px;">{{ getRoleName(memberId) }}</span>
<!-- <el-tree </div>
ref="tree" <div class="quickChange">
:data="quickChangeMember" <!-- <div class="quickChange_head">快捷切换</div> -->
:props="defaultProps" <div class="quickChangeList" style="margin:10px 0px 10px 0px;overflow-y:auto;height:200px;">
node-key="id" <div v-for="member in quickChangeMember" :key="member.id" class="setGroupOut">
default-expand-all <span style="font-size: 14px">{{ member.label }}</span>
style="margin: 10px;overflow-y:auto;height:255px;margin-right: 0;" <span class="setGroup">
> <span v-if="member.id!=memberId" class="settingBtn" @click="changeRole(member)">设置</span>
<span :id="data.id" slot-scope="{ node, data }" style="width:100%"> <span v-else class="hasSetted">已设置</span>
<span style="font-size: 14px">{{ data.label }}</span> </span>
<span v-if="data.type!='role'" class="setGroup"> </div>
<span v-if="data.id!=memberId" class="settingBtn" @click="changeRole(data)">设置</span> </div>
<span v-else class="hasSetted">已设置</span> </div>
</span>
</span>
</el-tree> -->
<!-- :disabled="!backDisabled||isPause" -->
<!-- <el-select ref="changeScriptRole" v-model="memberId" filterable placeholder="请选择" @change="changeRole">
<el-option v-for="member in memberList" :key="member.id" :label="member.name" :value="member.id" />
</el-select> -->
</div> </div>
<el-button-group class="button-group"> <el-button-group class="button-group">
<el-button v-if="isPause" size="small" type="primary" :disabled="executeDisabled" @click="pauseScript">{{ $t('scriptRecord.drivingPause') }}</el-button> <el-button v-if="isPause" size="small" type="primary" :disabled="executeDisabled" @click="pauseScript">{{ $t('scriptRecord.drivingPause') }}</el-button>
@ -104,11 +95,7 @@ export default {
memberId:'', memberId:'',
allMemberList:[], allMemberList:[],
memberList:[], memberList:[],
// defaultProps: { quickChangeMember:[],
// children: 'children',
// label: 'label'
// },
// quickChangeMember:[],
size: { size: {
width: 300, width: 300,
height: 300 height: 300
@ -170,7 +157,8 @@ export default {
this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setPrdType', '02');
this.$store.dispatch('training/setRoles', 'DISPATCHER'); this.$store.dispatch('training/setRoles', 'DISPATCHER');
getAllSelectedScriptRole(this.group).then(res=>{ getAllSelectedScriptRole(this.group).then(res=>{
this.quickChangeMember = res.data; const lastData = JSON.stringify(res.data);
this.quickChangeMember = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew);
}); });
}).catch(error => { }).catch(error => {
this.$message(error.message); this.$message(error.message);
@ -186,9 +174,12 @@ export default {
covertmember.forEach(each=>{ covertmember.forEach(each=>{
this.memberList.push(each); this.memberList.push(each);
}); });
}, },
setMemberId(memberId) { setMemberId(member) {
this.memberId = memberId; this.memberId = member.id;
const memberdata = this.quickChangeMember.find(mem=>{ return mem.id == member.id; });
if (!memberdata) { this.quickChangeMember.push(member); }
}, },
addMember() { addMember() {
this.$refs.addScriptMember.doShow(); this.$refs.addScriptMember.doShow();
@ -212,6 +203,9 @@ export default {
}); });
} }
}, },
changeRole(member) {
this.$refs.allScriptRole.changeRole(member);
},
getRoleName(memberId) { getRoleName(memberId) {
const currentMember = this.memberList.find(member=>{ const currentMember = this.memberList.find(member=>{
return member.id == memberId; return member.id == memberId;
@ -255,6 +249,7 @@ export default {
} }
} }
each.name = each.type + deviceName; each.name = each.type + deviceName;
each.label = each.name;
}); });
return lastData; return lastData;
}, },
@ -413,5 +408,27 @@ export default {
} }
.scriptPanelRight{ .scriptPanelRight{
}
.quickChange{
width: 300px;
}
.quickChange_head{
font-size: 14px;
margin-top: 5px;
color: #409eff;
}
.setGroup{
font-size: 14px;
float: right;
margin-right: 15px;
}
.settingBtn{
color: #409eff;
cursor: pointer;
padding: 5px 10px;
border-radius: 4px;
}
.setGroupOut{
margin-bottom: 5px;
} }
</style> </style>