修改IBP盘角色修改

This commit is contained in:
ival 2019-09-04 10:13:26 +08:00
parent 0879aef961
commit df839856d9
3 changed files with 89 additions and 52 deletions

View File

@ -4,8 +4,8 @@ export function getBaseUrl() {
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 BASE_API = 'http://192.168.3.5:9000'; // 袁琪
BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.4:9000' // 琰培 // BASE_API = 'http://192.168.3.4:9000' // 琰培
} else { } else {
BASE_API = process.env.VUE_APP_BASE_API; BASE_API = process.env.VUE_APP_BASE_API;

View File

@ -2,7 +2,7 @@
<div> <div>
<div class="display-draft"> <div class="display-draft">
<el-button-group> <el-button-group>
<el-button v-if="isAdmin || isIBP" type="warning" @click="jumpIbp">IBP盘</el-button> <el-button v-if="isIBP" type="warning" @click="jumpIbp">IBP盘</el-button>
<el-button v-if="isDriver" type="jumpjlmap3d" @click="jumpjlmap3d">司机视角</el-button> <el-button v-if="isDriver" type="jumpjlmap3d" @click="jumpjlmap3d">司机视角</el-button>
<template v-if="isAdmin"> <template v-if="isAdmin">
<el-button type="success" :disabled="isDisable" @click="selectBeginTime">按计划行车</el-button> <el-button type="success" :disabled="isDisable" @click="selectBeginTime">按计划行车</el-button>

View File

@ -42,7 +42,7 @@
<i <i
v-if="userId == roomInfo.creatorId" v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson" class="el-icon-close delPerson"
@click="handleDelEquipment(nor, index)" @click="handleDelUserForStation(nor, index, stationListForEquipment, equipmentList)"
/> />
<div style="float: right; margin-right: 15px;"> <div style="float: right; margin-right: 15px;">
<el-select <el-select
@ -50,10 +50,10 @@
placeholder="请选择" placeholder="请选择"
size="mini" size="mini"
:disabled="userId != roomInfo.creatorId" :disabled="userId != roomInfo.creatorId"
@change="changeEquipment(nor)" @change="handleChangeUser(nor, 'Attendant', stationListForEquipment, equipmentList)"
> >
<el-option <el-option
v-for="item in stationList" v-for="item in stationListForEquipment"
:key="item.code" :key="item.code"
:label="item.name" :label="item.name"
:value="item.code" :value="item.code"
@ -132,12 +132,34 @@
<i <i
v-if="userId == roomInfo.creatorId" v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson" class="el-icon-close delPerson"
@click="handleDelUser(ibpList, nor, index)" @click="handleDelUserForStation(nor, index, stationListForIBP, ibpList)"
/> />
<div style="float: right; margin-right: 15px;">
<el-select
v-model="nor.deviceCode"
placeholder="请选择"
size="mini"
:disabled="userId != roomInfo.creatorId"
@change="handleChangeUser(nor, 'IBP', stationListForIBP, ibpList)"
>
<el-option
v-for="item in stationListForIBP"
:key="item.code"
:label="item.name"
:value="item.code"
:disabled="item.disabled"
/>
</el-select>
</div>
</li> </li>
</ul> </ul>
<div v-if="userId == roomInfo.creatorId" class="add-box"> <div v-if="userId == roomInfo.creatorId" class="add-box">
<el-button icon="el-icon-plus" circle plain @click="addingRoles('ibp', '增加IBP')" /> <el-button
icon="el-icon-plus"
circle
plain
@click="addingRoles('ibp', '增加IBP')"
/>
</div> </div>
</div> </div>
</div> </div>
@ -281,6 +303,28 @@ export default {
computed: { computed: {
height() { height() {
return this.$store.state.app.height - 95; return this.$store.state.app.height - 95;
},
stationListForEquipment() {
return this.stationList.filter(elem => { return elem.centralized; }).map(item => {
const elem = { code: item.code, name: item.name, disabled: false };
this.equipmentList.forEach(nor => {
if (elem.code == nor.deviceCode) {
elem.disabled = true;
}
});
return elem;
});
},
stationListForIBP() {
return this.stationList.map(item => {
const elem = { code: item.code, name: item.name, disabled: false };
this.ibpList.forEach(nor => {
if (elem.code == nor.deviceCode) {
elem.disabled = true;
}
});
return elem;
});
} }
}, },
watch: { watch: {
@ -446,7 +490,13 @@ export default {
this.num++; this.num++;
break; break;
case 'IBP': case 'IBP':
this.ibpList.push(item); this.ibpList.forEach((nor, index) => {
if (nor.id == item.id) { //
this.ibpList.splice(index, 1);
this.num--;
}
});
this.ibpList.push(item); //
this.num++; this.num++;
break; break;
default: default:
@ -507,19 +557,7 @@ export default {
// //
const resp = await getStationList(res.data.mapId); const resp = await getStationList(res.data.mapId);
resp.data.forEach(item => { this.stationList = resp.data;
if (item.centralized) {
this.stationList.push(item);
}
});
this.stationList.forEach(item => {
item.disabled = false;
this.equipmentList.forEach(nor => {
if (item.code == nor.deviceCode) {
item.disabled = true;
}
});
});
}, },
// list Admin Instructor Dispatcher Attendant Audience Driver Repair IBP IBP // list Admin Instructor Dispatcher Attendant Audience Driver Repair IBP IBP
async getUserList() { async getUserList() {
@ -636,24 +674,6 @@ export default {
} }
}); });
}, },
//
changeEquipment(val) {
const params = [{
id: val.id,
nickName: val.nickName,
userRole: 'Attendant',
deviceCode: val.deviceCode
}];
putUserRoles(params, this.$route.query.group);
this.stationList.forEach(item => {
item.disabled = false;
this.equipmentList.forEach(nor => {
if (item.code == nor.deviceCode) {
item.disabled = true;
}
});
});
},
// //
addingRoles(name, title) { addingRoles(name, title) {
this.listName = name; this.listName = name;
@ -676,22 +696,22 @@ export default {
userRole: '' userRole: ''
}; };
switch (this.listName) { switch (this.listName) {
case 'admin': // case 'admin': //
params.userRole = 'Instructor'; params.userRole = 'Instructor';
break; break;
case 'dispatch': // case 'dispatch': //
params.userRole = 'Dispatcher'; params.userRole = 'Dispatcher';
break; break;
case 'equipment': // case 'equipment': //
params.userRole = 'Attendant'; params.userRole = 'Attendant';
break; break;
case 'driver': // case 'driver': //
params.userRole = 'Driver'; params.userRole = 'Driver';
break; break;
case 'signal': // case 'signal': //
params.userRole = 'Repair'; params.userRole = 'Repair';
break; break;
case 'ibp': // IBP case 'ibp': // IBP
params.userRole = 'IBP'; params.userRole = 'IBP';
break; break;
} }
@ -712,7 +732,7 @@ export default {
this.messageInfo('分配角色数量已超过可分配角色总数!', 'error'); this.messageInfo('分配角色数量已超过可分配角色总数!', 'error');
} }
this.treeData.forEach(item => { this.treeData.forEach(item => {
if (item.userRole == '' || item.userRole == 'Audience') { if (item.userRole == '' || item.userRole == 'Audience' || item.userRole == 'IBP') {
item.select = false; item.select = false;
} }
}); });
@ -728,15 +748,32 @@ export default {
}); });
}); });
}, },
handleChangeUser(val, role, stationList, list) {
const params = [{
id: val.id,
nickName: val.nickName,
userRole: role,
deviceCode: val.deviceCode
}];
putUserRoles(params, this.$route.query.group);
stationList.forEach(item => {
item.disabled = false;
list.forEach(nor => {
if (item.code == nor.deviceCode) {
item.disabled = true;
}
});
});
},
handleDelUser(list, item, index) { handleDelUser(list, item, index) {
list.splice(index, 1); list.splice(index, 1);
this.handleProperty(item); this.handleProperty(item);
}, },
handleDelEquipment(item, index) { handleDelUserForStation(item, index, stationList, list) {
this.equipmentList.splice(index, 1); list.splice(index, 1);
this.stationList.forEach(item => { stationList.forEach(item => {
item.disabled = false; item.disabled = false;
this.equipmentList.forEach(nor => { list.forEach(nor => {
if (item.code == nor.deviceCode) { if (item.code == nor.deviceCode) {
item.disabled = true; item.disabled = true;
} }
@ -744,7 +781,7 @@ export default {
}); });
this.handleProperty(item); this.handleProperty(item);
}, },
handleProperty(item) { handleProperty(item, role) {
const treeIndex = this.treeData.findIndex(nor => nor.id == item.id); const treeIndex = this.treeData.findIndex(nor => nor.id == item.id);
if (treeIndex > -1) { if (treeIndex > -1) {
this.num--; this.num--;