BD中心-BD身份设置模块完成
This commit is contained in:
58
src/api/BD/IdentitySettings.js
Normal file
58
src/api/BD/IdentitySettings.js
Normal file
@@ -0,0 +1,58 @@
|
||||
import request from '@/utils/request';
|
||||
// 列表
|
||||
export const getBdList = query => {
|
||||
return request({
|
||||
url: '/admin/bd/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 添加
|
||||
|
||||
export const addBdInfo = query => {
|
||||
return request({
|
||||
url: '/admin/bd/add',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 移除
|
||||
export const removeBdInfo = query => {
|
||||
return request({
|
||||
url: '/admin/bd/remove',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 获取用户信息
|
||||
export const getByErbanNo = query => {
|
||||
return request({
|
||||
url: '/admin/user/getByErbanNo',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 获取分区下的国家
|
||||
export const getlistByPartitionId = query => {
|
||||
return request({
|
||||
url: '/admin/regionInfo/listByPartitionId',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 公会详情
|
||||
export const getGuildsDetail = query => {
|
||||
return request({
|
||||
url: '/admin/bd/guilds',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 解绑公会
|
||||
export const operatorGuildUnBound = query => {
|
||||
return request({
|
||||
url: '/admin/bd/guildUnBound',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
353
src/views/BD/IdentitySettings.vue
Normal file
353
src/views/BD/IdentitySettings.vue
Normal file
@@ -0,0 +1,353 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="inquire">
|
||||
<span>用户ID:</span>
|
||||
<el-input v-model="formData.erbanNo" placeholder="" class="input" />
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>分区</span>
|
||||
<partition-select v-model:partition-id="formData.partitionId" @update:partitionId="getlistByPartition" />
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>国家</span>
|
||||
<el-select v-model="formData.regionId" placeholder="请选择">
|
||||
<el-option v-for="item in adminCountryArr" :key="item.id" :label="JSON.parse(item.name).zh"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<el-button style="" type="primary" @click="getData()">查询</el-button>
|
||||
<el-button style="" type="primary" @click="addDialog = true">新增</el-button>
|
||||
<el-table v-loading="tableData.loading" :data="tableData.data" ref="multipleTable"
|
||||
@selection-change="handleSelectionChange" border style="width: 100%; margin-top: 25px">
|
||||
<el-table-column prop="erbanNo" align="center" label="用户ID" />
|
||||
<el-table-column prop="nick" align="center" label="用户昵称" />
|
||||
<el-table-column prop="partitionDesc" align="center" label="分区" />
|
||||
<el-table-column prop="regionName" align="center" label="国家" />
|
||||
<el-table-column prop="createTime" align="center" label="创建时间">
|
||||
<template v-slot="scope">
|
||||
{{ dateFormat(scope.row.createTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="guildNum" align="center" label="旗下公会数量">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" size="small" @click="editFen(scope.row)">
|
||||
{{ scope.row.guildNum }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="owner" align="center" label="负责人" />
|
||||
<el-table-column align="center" label="操作" width="300">
|
||||
<template v-slot="scope">
|
||||
<el-button class="primary" type="primary" @click="
|
||||
removePageFun(scope.row);
|
||||
" size="default" v-if="scope.row.status == 1">移除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="operator" align="center" label="操作人" />
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<el-pagination style="margin-top: 10px" class="paginationClass" :current-page="formData.pageNo"
|
||||
:page-size="formData.pageSize" :page-sizes="[10, 20, 50, 100, 200]" layout="sizes, prev, pager, next"
|
||||
:total="tableData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||
<el-dialog v-model="addDialog" title="新增" width="28%" center>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label">平台ID</span>
|
||||
<el-input v-model="addFormData.erbanNo" style="width: 50%" class="input"
|
||||
@change="getByErbanNoInfo()"></el-input>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px;display: inline-block;width: 100%;">
|
||||
<span style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label">用户昵称</span>
|
||||
<div>
|
||||
<span style="display: inline-block;" class="col-sm-2 control-label">{{ ByErbanNoInfo.nick }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div style="margin-bottom: 25px;display: inline-block;width: 100%;">
|
||||
<span style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label">用户分区</span>
|
||||
<div>
|
||||
<span style="display: inline-block;" class="col-sm-2 control-label">{{ ByErbanNoInfo.partitionName
|
||||
}}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label">负责人</span>
|
||||
<el-input v-model="addFormData.owner" style="width: 50%" class="input"></el-input>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="addDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="addFun()" v-if="ByErbanNoInfo.uid != ''"> 确认 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 详情表格 -->
|
||||
<el-dialog v-model="detailsDialog" title="公会详情" width="70%" center>
|
||||
<!-- 内表格 -->
|
||||
<el-table v-loading="tableDetailData.loading" :data="tableDetailData.data" border
|
||||
style="width: 100%; margin-top: 25px">
|
||||
<el-table-column prop="guildId" align="center" label="公会ID" />
|
||||
<el-table-column prop="guildName" align="center" label="公会昵称" />
|
||||
<el-table-column prop="ownerErbanNo" align="center" label="公会长ID" />
|
||||
<el-table-column prop="nick" align="center" label="公会长昵称" />
|
||||
<el-table-column prop="regionName" align="center" label="所属国家" />
|
||||
<el-table-column prop="createTime" align="center" label="公会成立时间">
|
||||
<template v-slot="scope">
|
||||
{{ dateFormat(scope.row.createTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="memberNum" align="center" label="公会成员数(不包括公会长)" />
|
||||
<el-table-column prop="status" align="center" label="绑定状态" >
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.status == 1 ? '有效' : '无效' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="300">
|
||||
<template v-slot="scope">
|
||||
<el-button class="primary" type="primary" @click="
|
||||
unbindPageFun(scope.row);
|
||||
" size="default" v-if="scope.row.status == 1">解绑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="operator" align="center" label="操作人" />
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<el-pagination style="margin-top: 10px" class="paginationClass" :current-page="formDetailData.pageNo"
|
||||
:page-size="formDetailData.pageSize" :page-sizes="[10, 20, 50, 100, 200]"
|
||||
layout="sizes, prev, pager, next" :total="tableDetailData.total" @size-change="handleSizeChangeDetail"
|
||||
@current-change="handleCurrentChangeDetail" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, onMounted, reactive, computed } from 'vue'
|
||||
import PartitionSelect from "@/views/common/partitionSelect.vue";
|
||||
import { getBdList, addBdInfo, removeBdInfo, getByErbanNo, getlistByPartitionId, getGuildsDetail ,operatorGuildUnBound} from "@/api/BD/IdentitySettings.js"
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
export default {
|
||||
name: 'IdentitySettings',
|
||||
components: {
|
||||
PartitionSelect
|
||||
},
|
||||
setup() {
|
||||
const formData = reactive({
|
||||
partitionId: undefined,
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
erbanNo: '',
|
||||
regionId: ''
|
||||
})
|
||||
const addFormData = reactive({
|
||||
erbanNo: '',
|
||||
uid: '',
|
||||
owner: ''
|
||||
})
|
||||
const tableData = reactive({
|
||||
data: [],
|
||||
total: 0,
|
||||
loading: false,
|
||||
})
|
||||
const ByErbanNoInfo = reactive({
|
||||
uid: '',
|
||||
partitionName: '',
|
||||
nick: ''
|
||||
})
|
||||
const formDetailData = reactive({
|
||||
bdId: '',
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
})
|
||||
const tableDetailData = reactive({
|
||||
data: [],
|
||||
total: 0,
|
||||
loading: false,
|
||||
})
|
||||
const adminCountryArr = ref([])
|
||||
const addDialog = ref(false)
|
||||
const detailsDialog = ref(false)
|
||||
const getlistByPartition = (e) => {
|
||||
if (e) {
|
||||
formData.partitionId = e;
|
||||
}
|
||||
getlistByPartitionId({ partitionId: formData.partitionId, containAll: true }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
adminCountryArr.value = res.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
const getData = () => {
|
||||
tableData.loading = true;
|
||||
getBdList(formData).then(res => {
|
||||
if (res.code == 200) {
|
||||
tableData.data = res.data.rows
|
||||
tableData.total = res.data.total
|
||||
tableData.loading = false
|
||||
} else {
|
||||
tableData.loading = false;
|
||||
ElMessage.error(res.message)
|
||||
}
|
||||
})
|
||||
};
|
||||
const getByErbanNoInfo = () => {
|
||||
getByErbanNo({ erbanNo: addFormData.erbanNo }).then(res => {
|
||||
if (res.code == 200) {
|
||||
Object.assign(ByErbanNoInfo, res.data)
|
||||
} else {
|
||||
ElMessage.error(res.message)
|
||||
Object.assign(ByErbanNoInfo, { partitionName: '', nick: '', uid: '' })
|
||||
}
|
||||
})
|
||||
}
|
||||
// 增加
|
||||
const addFun = () => {
|
||||
if (addFormData.erbanNo == '') {
|
||||
ElMessage.error('请输入正确的用户ID')
|
||||
return
|
||||
}
|
||||
addDialog.value = false
|
||||
addBdInfo({ owner: addFormData.owner, uid: ByErbanNoInfo.uid }).then(res => {
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('添加成功')
|
||||
getData()
|
||||
} else {
|
||||
ElMessage.error(res.message)
|
||||
}
|
||||
Object.assign(addFormData, { erbanNo: '', owner: '', uid: '' })
|
||||
Object.assign(ByErbanNoInfo, { partitionName: '', nick: '', uid: '' })
|
||||
})
|
||||
}
|
||||
const removePageFun = (row) => {
|
||||
ElMessageBox.confirm('确定要移除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
removeBdInfo({ id: row.id }).then(res => {
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('移除成功')
|
||||
getData()
|
||||
} else {
|
||||
ElMessage.error(res.message)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
// 详情
|
||||
const editFen = (row) => {
|
||||
if(row){
|
||||
formDetailData.bdId = row.id
|
||||
}
|
||||
tableDetailData.loading = true;
|
||||
getGuildsDetail(formDetailData).then(res => {
|
||||
if (res.code == 200) {
|
||||
tableDetailData.data = res.data.rows
|
||||
tableDetailData.total = res.data.total
|
||||
tableDetailData.loading = false
|
||||
detailsDialog.value = true
|
||||
|
||||
} else {
|
||||
tableDetailData.loading = false
|
||||
ElMessage.error(res.message)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
// 解绑
|
||||
const unbindPageFun = (row) => {
|
||||
ElMessageBox.confirm('确定要解除绑定吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
operatorGuildUnBound({ bdGuildId : row.bdGuildId }).then(res => {
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('解除成功')
|
||||
editFen()
|
||||
}else{
|
||||
ElMessage.error(res.message)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
const dateFormat = (row) => {
|
||||
const date = new Date(row);
|
||||
return date.format("yyyy-MM-dd hh:mm:ss");
|
||||
}
|
||||
const handleSizeChange = (val) => {
|
||||
formData.pageSize = val;
|
||||
getData();
|
||||
};
|
||||
const handleCurrentChange = (val) => {
|
||||
formData.pageNo = val;
|
||||
getData();
|
||||
};
|
||||
const handleSizeChangeDetail = (val) => {
|
||||
formDetailData.pageSize = val;
|
||||
editFen();
|
||||
};
|
||||
const handleCurrentChangeDetail = (val) => {
|
||||
formDetailData.pageNo = val;
|
||||
editFen();
|
||||
};
|
||||
return {
|
||||
formData,
|
||||
addFormData,
|
||||
tableData,
|
||||
addDialog,
|
||||
getData,
|
||||
detailsDialog,
|
||||
adminCountryArr,
|
||||
getlistByPartition,
|
||||
getByErbanNoInfo,
|
||||
ByErbanNoInfo,
|
||||
addFun,
|
||||
dateFormat,
|
||||
removePageFun,
|
||||
editFen,
|
||||
formDetailData,
|
||||
tableDetailData,
|
||||
unbindPageFun,
|
||||
handleSizeChange,
|
||||
handleCurrentChange,
|
||||
handleSizeChangeDetail,
|
||||
handleCurrentChangeDetail
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.box {
|
||||
padding-top: 20px;
|
||||
background: #ecf0f5;
|
||||
|
||||
.inquire {
|
||||
display: inline-block;
|
||||
margin-right: 20px;
|
||||
|
||||
span {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 180px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.dialogTableVisibleBut {
|
||||
display: block;
|
||||
margin: 30px 0 0 830px;
|
||||
}
|
||||
|
||||
.paginationClass {
|
||||
margin: 15px 0 5px 0px;
|
||||
}
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user