diff --git a/src/store/modules/training.js b/src/store/modules/training.js index 8ab4d8fb6..aa47dec18 100644 --- a/src/store/modules/training.js +++ b/src/store/modules/training.js @@ -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); } } }; diff --git a/src/views/scriptManage/allScriptRole.vue b/src/views/scriptManage/allScriptRole.vue index 11deb8bc1..d7e2cb9b3 100644 --- a/src/views/scriptManage/allScriptRole.vue +++ b/src/views/scriptManage/allScriptRole.vue @@ -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 } diff --git a/src/views/scriptManage/tipScriptRecord.vue b/src/views/scriptManage/tipScriptRecord.vue index dd4cce263..2dbb2ba6a 100644 --- a/src/views/scriptManage/tipScriptRecord.vue +++ b/src/views/scriptManage/tipScriptRecord.vue @@ -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=>{