Files
yinmeng-admin-web/src/views/hall/HallAdminView.vue
2023-12-19 11:19:16 +08:00

163 lines
7.5 KiB
Vue

<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<div id="toolbar">
<div class="col-sm-12">
<label for="hallIdStr" class="col-sm-4 control-label">公会id:</label>
<div class="col-sm-8"><input type="text" class="form-control" name="name" id="hallIdStr"
placeholder="请输入公会id,填多个用,隔开"></div>
</div>
<div class="col-sm-12">
<label for="ownerErbanNo" class="col-sm-4 control-label">会长音萌号:</label>
<div class="col-sm-8"><input type="text" class="form-control" name="name" id="ownerErbanNo"
placeholder="请输入会长音萌号,填多个用,隔开"></div>
</div>
<div class="col-sm-12">
<label for="clanElderErbanNoStr" class="col-sm-4 control-label">族长音萌号:</label>
<div class="col-sm-8"><input type="text" class="form-control" name="name" id="clanElderErbanNoStr"
placeholder="请输入族长音萌号,填多个用,隔开"></div>
</div>
<div class="col-sm-12">
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
<button id="btnExport" class="btn btn-default">
<i class="glyphicon glyphicon-export"></i>导出
</button>
</div>
</div>
</div>
<!-- .content -->
<div id="table"></div>
</div>
</section>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
import { cleanArray } from '@/utils/maintainer';
export default {
name: "HallAdminView",
setup() { },
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
// 清空分页组件的容器
$('.fixed-table-pagination').empty();
$('#table').bootstrapTable({
columns: [
{
field: 'clanId', title: '家族id', align: 'center', width: '5%',
formatter: function (val, row, index) {
if (val) {
return val;
} else {
return '-';
}
}
},
{
field: 'clanElderUid', title: '族长uid', align: 'center', width: '5%',
formatter: function (val, row, index) {
if (val) {
return val;
} else {
return '-';
}
}
},
{
field: 'clanElderErbanNo', title: '族长音萌号', align: 'center', width: '5%',
formatter: function (val, row, index) {
if (val) {
return val;
} else {
return '-';
}
}
},
{ field: 'clanElderNick', title: '家族昵称', align: 'center', width: '5%' },
{ field: 'clanName', title: '家族名称', align: 'center', width: '5%' },
{ field: 'hallNick', title: '会长昵称', align: 'center', width: '5%' },
{ field: 'hallId', title: '公会id', align: 'center', width: '5%' },
{ field: 'ownerUid', title: '会长uid', align: 'center', width: '5%' },
{ field: 'ownerErbanNo', title: '会长音萌号', align: 'center', width: '5%' },
{ field: 'memberCount', title: '公会成员人数', align: 'center', width: '5%' },
{ field: 'managerCount', title: '公会高管人数', align: 'center', width: '5%' },
{ field: 'publicChatCount', title: '公开群数', align: 'center', width: '5%' },
{ field: 'privateChatCount', title: '内部群数', align: 'center', width: '5%' }
],
undefinedText: 0,
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: true,
pageList: [20, 50, 100, 200, 300, 500],
search: false,
sidePagination: "server", //表示服务端请求
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageNum: params.pageNumber,
pageSize: params.pageSize,
ownerErbanNo: $('#ownerErbanNo').val(),
hallIdStr: $('#hallIdStr').val(),
clanElderErbanNoStr: $('#clanElderErbanNoStr').val()
};
return param;
},
toolbar: '#toolbar',
url: '/admin/hall/statistic/get.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
// 导出
$('#btnExport').on('click', function () {
console.log("导出")
window.location.href = `/admin/hall/exportHallMemberStatistic?${param(getQueryParams())}`
})
function param(json) {
if (!json) return ''
return cleanArray(Object.keys(json).map(key => {
if (json[key] === undefined) return ''
return encodeURIComponent(key) + '=' +
encodeURIComponent(json[key])
})).join('&')
}
function getQueryParams() {
var param = {
ownerErbanNo: $('#ownerErbanNo').val(),
hallIdStr: $('#hallIdStr').val(),
clanElderErbanNoStr: $('#clanElderErbanNoStr').val(),
};
return param;
}
});
}
}
};
</script>