灾害人员管理弹窗修改
This commit is contained in:
parent
caa456f7c6
commit
648868a816
|
@ -4,7 +4,7 @@
|
|||
<div class="top_left">
|
||||
<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-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="userEmail" label="E-mail" show-overflow-tooltip></el-table-column>
|
||||
<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>
|
||||
</template>
|
||||
</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-pagination
|
||||
@size-change="onHandleSizeChangeNew"
|
||||
|
@ -86,7 +99,7 @@
|
|||
type="button"
|
||||
size="default"
|
||||
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-button>
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue