灾害人员管理弹窗修改

This commit is contained in:
遥望-倪浩天 2024-07-23 11:56:55 +08:00
parent caa456f7c6
commit 648868a816
1 changed files with 120 additions and 25 deletions

View File

@ -4,7 +4,7 @@
<div class="top_left"> <div class="top_left">
<el-card shadow="hover" class="layout-padding-auto"> <el-card shadow="hover" class="layout-padding-auto">
<el-table :data="state.tableDataNew.data" v-loading="state.tableDataNew.loading" style="width: 100%" @selection-change="selectionChange"> <el-table :data="state.tableDataNew.data" v-loading="state.tableDataNew.loading" style="width: 100%" @selection-change="selectionChange">
<el-table-column type="selection" width="60" @select="selectRow" /> <!-- <el-table-column type="selection" width="60" @select="selectRow" />-->
<el-table-column prop="userName" label="Name" show-overflow-tooltip></el-table-column> <el-table-column prop="userName" label="Name" show-overflow-tooltip></el-table-column>
<el-table-column prop="userEmail" label="E-mail" show-overflow-tooltip></el-table-column> <el-table-column prop="userEmail" label="E-mail" show-overflow-tooltip></el-table-column>
<el-table-column prop="userStatus" label="role" show-overflow-tooltip> <el-table-column prop="userStatus" label="role" show-overflow-tooltip>
@ -13,6 +13,19 @@
<el-tag type="info" v-if="scope.row.userStatus == 1">B2</el-tag> <el-tag type="info" v-if="scope.row.userStatus == 1">B2</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column fixed="right" label="Operations" min-width="120">
<template #default="scope">
<el-button
link
type="button"
size="default"
style="color: #0952d9;background-color: #d7e2ea"
@click.prevent="sendToRight(scope.$index,scope.row,0)"
>
<el-icon><ele-Right /></el-icon>
</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<el-pagination <el-pagination
@size-change="onHandleSizeChangeNew" @size-change="onHandleSizeChangeNew"
@ -86,7 +99,7 @@
type="button" type="button"
size="default" size="default"
style="color: #0952d9;background-color: #d7e2ea" style="color: #0952d9;background-color: #d7e2ea"
@click.prevent="sendToRight(scope.$index,scope.row)" @click.prevent="sendToRight(scope.$index,scope.row,1)"
> >
<el-icon><ele-Right /></el-icon> <el-icon><ele-Right /></el-icon>
</el-button> </el-button>
@ -173,6 +186,8 @@ const state = reactive({
}, },
}, },
selectData: [], selectData: [],
selectData2: [],
selectType: []
}); });
const sendToLeft = (index,row) => { const sendToLeft = (index,row) => {
@ -186,31 +201,100 @@ const sendToLeft = (index,row) => {
dataIndex.splice(index, 1) dataIndex.splice(index, 1)
}; };
const sendToRight = (index,row) => { const sendToRight = (index,row,type) => {
if (state.selectData.length>0){ console.log(state.selectType)
if (state.selectData.length==1){ if (type==0){
if (state.selectData[0].roleId==row.roleId){ let userStatus =row.userStatus==0?'1793193529859244033':'1123598816738675203'
state.tableData.data.splice(index, 1) console.log(userStatus)
state.tableData.data.splice(index,0,state.selectData[0]) if (state.tableDataNew.data.length>0){
state.selectData[0] =row if (state.selectData.length==1){
}else { if (state.selectData[0].roleId==userStatus){
state.tableData.data.splice(index, 1) state.tableDataNew.data.splice(index, 1)
state.selectData[state.selectData.length] =row if (state.selectType[0]==1){
} state.tableDataNew.data.splice(index,0,state.selectData[0])
}else if (state.selectData.length==2){ }else {
if (state.selectData[0].roleId==row.roleId){ state.tableData.data.splice(index,0,state.selectData[0])
state.tableData.data.splice(index, 1) }
state.tableData.data.splice(index,0,state.selectData[0]) state.selectData[0] =row
state.selectData[0] =row state.selectType[0]=1
}else if (state.selectData[1].roleId==row.roleId){ }else {
state.tableData.data.splice(index, 1) state.tableDataNew.data.splice(index, 1)
state.tableData.data.splice(index,0,state.selectData[1]) state.selectData[state.selectData.length] =row
state.selectData[1] =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) => { const selectRow = (row) => {
@ -333,6 +417,7 @@ const selectDataSet = async () => {
state.selectData[index] = item state.selectData[index] = item
state.selectData[index].userId =item.id; state.selectData[index].userId =item.id;
state.selectData[index].userName = item.name; state.selectData[index].userName = item.name;
state.selectType[index]=0
adminCount=1 adminCount=1
}); });
} }
@ -346,10 +431,17 @@ const selectDataSet = async () => {
website.value.tenantId website.value.tenantId
); );
res.records.forEach((item) => { 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 let index = state.selectData.length
state.selectData[index] = item state.selectData[index] = item
state.selectData[index].userId =item.id; state.selectData[index].userId =item.id;
state.selectData[index].userName = item.name; state.selectData[index].userName = item.name;
state.selectType[index]=0
chiefCount=1 chiefCount=1
}); });
} }
@ -361,6 +453,9 @@ const getTableDataNew = () => {
state.tableDataNew.data = da.records; state.tableDataNew.data = da.records;
state.tableDataNew.data.forEach((item) => { state.tableDataNew.data.forEach((item) => {
item.userId = item.adminId; 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.total = da.total;
state.tableDataNew.loading = false; state.tableDataNew.loading = false;