diff --git a/src/views/responseManagement/responding/component/selectUserNew.vue b/src/views/responseManagement/responding/component/selectUserNew.vue index fd55d89..778c246 100644 --- a/src/views/responseManagement/responding/component/selectUserNew.vue +++ b/src/views/responseManagement/responding/component/selectUserNew.vue @@ -4,7 +4,7 @@
- + @@ -13,6 +13,19 @@ B2 + + + @@ -173,6 +186,8 @@ const state = reactive({ }, }, selectData: [], + selectData2: [], + selectType: [] }); const sendToLeft = (index,row) => { @@ -186,31 +201,100 @@ const sendToLeft = (index,row) => { dataIndex.splice(index, 1) }; -const sendToRight = (index,row) => { - if (state.selectData.length>0){ - if (state.selectData.length==1){ - if (state.selectData[0].roleId==row.roleId){ - state.tableData.data.splice(index, 1) - state.tableData.data.splice(index,0,state.selectData[0]) - state.selectData[0] =row - }else { - state.tableData.data.splice(index, 1) - state.selectData[state.selectData.length] =row - } - }else if (state.selectData.length==2){ - if (state.selectData[0].roleId==row.roleId){ - state.tableData.data.splice(index, 1) - state.tableData.data.splice(index,0,state.selectData[0]) - state.selectData[0] =row - }else if (state.selectData[1].roleId==row.roleId){ - state.tableData.data.splice(index, 1) - state.tableData.data.splice(index,0,state.selectData[1]) - state.selectData[1] =row +const sendToRight = (index,row,type) => { + console.log(state.selectType) + if (type==0){ + let userStatus =row.userStatus==0?'1793193529859244033':'1123598816738675203' + console.log(userStatus) + if (state.tableDataNew.data.length>0){ + if (state.selectData.length==1){ + if (state.selectData[0].roleId==userStatus){ + state.tableDataNew.data.splice(index, 1) + if (state.selectType[0]==1){ + state.tableDataNew.data.splice(index,0,state.selectData[0]) + }else { + state.tableData.data.splice(index,0,state.selectData[0]) + } + state.selectData[0] =row + state.selectType[0]=1 + }else { + state.tableDataNew.data.splice(index, 1) + state.selectData[state.selectData.length] =row + } + }else if (state.selectData.length==2){ + if (state.selectData[0].roleId==userStatus){ + state.tableDataNew.data.splice(index, 1) + + if (state.selectType[0]==1){ + state.tableDataNew.data.splice(index,0,state.selectData[0]) + }else { + state.tableData.data.splice(index,0,state.selectData[0]) + } + state.selectData[0] =row + state.selectType[0]=1 + }else if (state.selectData[1].roleId==userStatus){ + state.tableDataNew.data.splice(index, 1) + + if (state.selectType[1]==1){ + state.tableDataNew.data.splice(index,0,state.selectData[1]) + }else { + state.tableData.data.splice(index,0,state.selectData[1]) + } + + state.selectData[1] =row + state.selectType[1]=1 + } } + } else { + state.tableDataNew.data.splice(index, 1) + state.selectData[state.selectData.length] =row + state.selectType[state.selectType.length]=1 + } + }else { + if (state.selectData.length>0){ + if (state.selectData.length==1){ + if (state.selectData[0].roleId==row.roleId){ + state.tableData.data.splice(index, 1) + if (state.selectType[0]==1){ + state.tableDataNew.data.splice(index,0,state.selectData[0]) + }else { + state.tableData.data.splice(index,0,state.selectData[0]) + } + state.selectData[0] =row + state.selectType[0]=0 + }else { + state.tableData.data.splice(index, 1) + state.selectData[state.selectData.length] =row + } + }else if (state.selectData.length==2){ + if (state.selectData[0].roleId==row.roleId){ + state.tableData.data.splice(index, 1) + + if (state.selectType[0]==1){ + state.tableDataNew.data.splice(index,0,state.selectData[0]) + }else { + state.tableData.data.splice(index,0,state.selectData[0]) + } + state.selectData[0] =row + state.selectType[0]=0 + }else if (state.selectData[1].roleId==row.roleId){ + state.tableData.data.splice(index, 1) + + if (state.selectType[1]==1){ + state.tableDataNew.data.splice(index,0,state.selectData[1]) + }else { + state.tableData.data.splice(index,0,state.selectData[1]) + } + + state.selectData[1] =row + state.selectType[1]=0 + } + } + } else { + state.tableData.data.splice(index, 1) + state.selectData[state.selectData.length] =row + state.selectType[state.selectType.length]=0 } - } else { - state.tableData.data.splice(index, 1) - state.selectData[state.selectData.length] =row } }; const selectRow = (row) => { @@ -333,6 +417,7 @@ const selectDataSet = async () => { state.selectData[index] = item state.selectData[index].userId =item.id; state.selectData[index].userName = item.name; + state.selectType[index]=0 adminCount=1 }); } @@ -346,10 +431,17 @@ const selectDataSet = async () => { website.value.tenantId ); res.records.forEach((item) => { + + item.adminId = item.userId; + item.userName =item.name; + item.userEmail = item.email; + item.userStatus = item.roleId=='1793193529859244033'?0:1; + let index = state.selectData.length state.selectData[index] = item state.selectData[index].userId =item.id; state.selectData[index].userName = item.name; + state.selectType[index]=0 chiefCount=1 }); } @@ -361,6 +453,9 @@ const getTableDataNew = () => { state.tableDataNew.data = da.records; state.tableDataNew.data.forEach((item) => { item.userId = item.adminId; + item.name = item.userName; + item.email = item.userEmail; + item.roleId = item.userStatus==0?'1793193529859244033':'1123598816738675203'; }); state.tableDataNew.total = da.total; state.tableDataNew.loading = false;