代码调整

This commit is contained in:
joylink_cuiweidong 2020-08-17 19:11:59 +08:00
parent cb916647c5
commit c5a63cd1c1
3 changed files with 17 additions and 7 deletions

View File

@ -238,21 +238,23 @@ const training = {
}
}
},
updateMemberListInScript:(state, {oldMemberId, newMember, userId, name}) => {
updateMemberListInScript:(state, {oldMemberId, newMemberId, userId, name}) => {
if (oldMemberId) {
// 重置旧数据
delete state.memberData[oldMemberId].userId;
delete state.memberData[oldMemberId].name;
state.memberData[oldMemberId].disabled = false;
}
// 更新新数据
state.memberData[newMemberId].userId = userId;
state.memberData[newMemberId].name = name;
state.memberData[newMemberId].disabled = true;
},
addMemberListInScript:(state, newMember) => {
if (!state.memberData[newMember.id]) {
state.memberData[newMember.id] = newMember;
}
// 更新新数据
state.memberData[newMember.id].userId = userId;
state.memberData[newMember.id].name = name;
state.memberData[newMember.id].disabled = true;
},
updateMemberAndUser: (state, {simulationUserList, userId}) => {
@ -710,6 +712,10 @@ const training = {
/** 更新当前角色的deviceCode */
setRoleDeviceCode:({ commit }, roleDeviceCode) => {
commit('setRoleDeviceCode', roleDeviceCode);
},
/** 添加新成员(剧本录制)*/
addMemberListInScript:({ commit }, data) => {
commit('addMemberListInScript', data);
}
}
};

View File

@ -195,7 +195,7 @@ export default {
this.$store.dispatch('training/updateMemberListInScript',
{
oldMemberId:this.oldMemberId,
newMember:role,
newMemberId:role.id,
userId:this.$store.state.user.id,
name:this.$store.state.user.nickname
}

View File

@ -177,6 +177,10 @@ export default {
});
},
addScriptMember(member) {
member.userId = '';
member.name = '';
member.disabled = false;
this.$store.dispatch('training/addMemberListInScript', member);
const lastData = JSON.stringify([member]);
const covertmember = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew);
covertmember.forEach(each=>{