调整:场景实训参演角色可编辑

This commit is contained in:
fan 2023-02-16 10:36:34 +08:00
parent 00a1137a9a
commit 9e066023e7
3 changed files with 54 additions and 8 deletions

View File

@ -74,8 +74,14 @@
<el-divider direction="vertical" />
<el-button type="text" @click="saveStepData">保存</el-button>
</div>
<div v-if="isScene" class="player_box">
<span style="font-size: 12px;">可参演角色</span>
<template v-for="(player, index) in playerIdList">
<el-tag :key="player" closable class="margin_right_bottom" @close="deletePlayerId(index)">{{ getMemberName(player) }}</el-tag>
</template>
</div>
<el-table
style="position: relative;top: -40px;"
:class="{'offset_top': !isScene }"
:data="tableData"
:max-height="tableHeight"
>
@ -144,12 +150,13 @@ export default {
activeName: 'stepList',
mapLocationObj: {},
bgSceneObj: {},
showMode: 'draftTrainingList'
showMode: 'draftTrainingList',
playerIdList: []
};
},
computed: {
tableHeight() {
return this.$store.state.app.height - 385;
return this.$store.state.app.height - 405;
},
paneHeight() {
return this.$store.state.app.height - 55;
@ -186,6 +193,10 @@ export default {
if (this.editData['bgSceneJson']) {
this.bgSceneObj = JSON.parse(this.editData['bgSceneJson']);
}
this.playerIdList = [];
if (this.editData.playerIdJson) {
this.playerIdList = JSON.parse(this.editData.playerIdJson);
}
},
'$store.state.map.activeTrainListChange': function () {
const activeTrainList = this.$store.state.map.activeTrainList;
@ -297,6 +308,7 @@ export default {
type: 'warning'
}).then(() => {
this.tableData.splice(index, 1);
this.checkPlayerIdHas();
}).catch(e => {});
},
handleEditOperate(index, row) {
@ -342,7 +354,7 @@ export default {
delete obj.isEdit;
list.push(obj);
});
await updateTrainingStep(this.group, this.editData.id, list);
await updateTrainingStep(this.group, this.editData.id, { step2VOList: list, playerIdList: this.playerIdList });
this.$message.success('保存实训成功!');
} catch {
this.$message.error('保存实训失败');
@ -453,6 +465,29 @@ export default {
elem.memberId = val;
});
}
this.addPlayerIdList(val);
},
addPlayerIdList(playId) {
if (!this.playerIdList.includes(playId)) {
this.playerIdList.push(playId);
}
this.checkPlayerIdHas();
},
checkPlayerIdHas() {
const list = [];
this.tableData.forEach(elem => {
if (this.playerIdList.includes(elem.memberId)) {
list.push(elem.memberId);
}
});
this.playerIdList = list;
},
getMemberName(playerId) {
const member = this.roleList.find(role => role.id == playerId );
return member ? member.label : '';
},
deletePlayerId(index) {
this.playerIdList.splice(index, 1);
}
}
};
@ -473,6 +508,19 @@ export default {
transform: translateX(0px);
}
}
.offset_top {
position: relative;
top: -20px;
}
.player_box {
width: 100%;
max-height: 85px;
overflow-y: auto;
}
.margin_right_bottom {
margin-bottom: 10px;
margin-right: 10px;
}
.editContentBox {
padding: 20px;
}

View File

@ -68,9 +68,8 @@ export default {
const playerList = JSON.parse(this.trainingDetail.playerIdJson);
const memberData = this.$store.state.training.memberData;
const newMemberData = {};
const showRole = ['DISPATCHER', 'STATION_SUPERVISOR', 'STATION_SIGNALER'];
playerList.forEach(playerId => {
if (memberData[playerId] && showRole.includes(memberData[playerId].type)) {
if (memberData[playerId]) {
newMemberData[playerId] = memberData[playerId];
}
});

View File

@ -57,7 +57,7 @@
<el-select v-model="scene.cosplayId" :disabled="!scene.check" size="mini" style="margin-left: 10px;" placeholder="请选择扮演角色">
<el-option
v-for="item in totalMemberList"
v-show="scene.playerIdList.includes(item.value) && applicableMemberTypeList.includes(item.memberType)"
v-show="scene.playerIdList.includes(item.value)"
:key="item.value"
:label="item.label"
:value="item.value"
@ -155,7 +155,6 @@ export default {
score: 1
},
sceneInfo: [],
applicableMemberTypeList: ['DISPATCHER', 'STATION_SUPERVISOR', 'STATION_SIGNALER'],
labels: [],
topicNum: 0,
index: -1,