From 648868a816e40f339acb3859c3e5a565be40afad Mon Sep 17 00:00:00 2001 From: nihaotian Date: Tue, 23 Jul 2024 11:56:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=81=BE=E5=AE=B3=E4=BA=BA=E5=91=98=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=BC=B9=E7=AA=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../responding/component/selectUserNew.vue | 145 +++++++++++++++--- 1 file changed, 120 insertions(+), 25 deletions(-) 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;