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

View File

@ -7,31 +7,22 @@
<div class="eachScriptPanel">
<div class="scriptPanelLeft">
<div class="panelLeftSelect">
<span style="font-size:13px;">当前剧本角色:</span>
<span style="font-size:13px;">{{ getRoleName(memberId) }}</span>
<!-- <el-tree
ref="tree"
:data="quickChangeMember"
:props="defaultProps"
node-key="id"
default-expand-all
style="margin: 10px;overflow-y:auto;height:255px;margin-right: 0;"
>
<span :id="data.id" slot-scope="{ node, data }" style="width:100%">
<span style="font-size: 14px">{{ data.label }}</span>
<span v-if="data.type!='role'" class="setGroup">
<span v-if="data.id!=memberId" class="settingBtn" @click="changeRole(data)">设置</span>
<span v-else class="hasSetted">已设置</span>
</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>
<span style="font-size:13px;">当前剧本角色:</span>
<span style="font-size:13px;">{{ getRoleName(memberId) }}</span>
</div>
<div class="quickChange">
<!-- <div class="quickChange_head">快捷切换</div> -->
<div class="quickChangeList" style="margin:10px 0px 10px 0px;overflow-y:auto;height:200px;">
<div v-for="member in quickChangeMember" :key="member.id" class="setGroupOut">
<span style="font-size: 14px">{{ member.label }}</span>
<span class="setGroup">
<span v-if="member.id!=memberId" class="settingBtn" @click="changeRole(member)">设置</span>
<span v-else class="hasSetted">已设置</span>
</span>
</div>
</div>
</div>
</div>
<el-button-group class="button-group">
<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:'',
allMemberList:[],
memberList:[],
// defaultProps: {
// children: 'children',
// label: 'label'
// },
// quickChangeMember:[],
quickChangeMember:[],
size: {
width: 300,
height: 300
@ -170,7 +157,8 @@ export default {
this.$store.dispatch('training/setPrdType', '02');
this.$store.dispatch('training/setRoles', 'DISPATCHER');
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 => {
this.$message(error.message);
@ -186,9 +174,12 @@ export default {
covertmember.forEach(each=>{
this.memberList.push(each);
});
},
setMemberId(memberId) {
this.memberId = memberId;
setMemberId(member) {
this.memberId = member.id;
const memberdata = this.quickChangeMember.find(mem=>{ return mem.id == member.id; });
if (!memberdata) { this.quickChangeMember.push(member); }
},
addMember() {
this.$refs.addScriptMember.doShow();
@ -212,6 +203,9 @@ export default {
});
}
},
changeRole(member) {
this.$refs.allScriptRole.changeRole(member);
},
getRoleName(memberId) {
const currentMember = this.memberList.find(member=>{
return member.id == memberId;
@ -255,6 +249,7 @@ export default {
}
}
each.name = each.type + deviceName;
each.label = each.name;
});
return lastData;
},
@ -413,5 +408,27 @@ export default {
}
.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>