150 lines
6.3 KiB
Vue
150 lines
6.3 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>
|
|
<!-- .content -->
|
|
<div id="table"></div>
|
|
<div id="toolbar">
|
|
<div class="col-sm-12">
|
|
<h3 id="version"></h3>
|
|
<div class="pull-left">
|
|
<form id="searchForm" class="col-sm-pull-12" action="/admin/family/statistics/export"
|
|
method="post" target="_blank">
|
|
家族ID :<input type="text" class="input-sm" name="familyId" id="familyId">
|
|
<div class="pull-right">
|
|
<label for="beginDate" class="col-sm-2 control-label">开始日期:</label>
|
|
<div class="col-sm-4"><input type="text" class="form-control" name="beginDate"
|
|
id="beginDate">
|
|
</div>
|
|
<label for="endDate" class="col-sm-2 control-label">结束日期:</label>
|
|
<div class="col-sm-4"><input type="text" class="form-control" name="endDate"
|
|
id="endDate"></div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="pull-right">
|
|
<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>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</template>
|
|
|
|
<script>
|
|
import TableHelper from '@/utils/bootstrap-table-helper';
|
|
|
|
export default {
|
|
name: "FamilyStatisticsView",
|
|
setup() {
|
|
return {};
|
|
},
|
|
created() {
|
|
this.$nextTick(function () {
|
|
this.initData();
|
|
});
|
|
},
|
|
methods: {
|
|
initData() {
|
|
$(function () {
|
|
$('#table').bootstrapTable('destroy');
|
|
$('#table').bootstrapTable({
|
|
columns: [
|
|
{ field: 'familyId', title: '家族ID', align: 'center', width: '5%' },
|
|
{ field: 'familyName', title: '家族名', align: 'center', width: '5%' },
|
|
{ field: 'totalNum', title: '总数', align: 'center', width: '5%' },
|
|
// {
|
|
// field: 'dateStr',
|
|
// title: '日期',
|
|
// align: 'center',
|
|
// valign: 'middle',
|
|
// width: '5%',
|
|
// formatter: function (val, row, index) {
|
|
// if (val) {
|
|
// var date = new Date(val);
|
|
// return date.format("yyyy-MM-dd");
|
|
// } else {
|
|
// return '-';
|
|
// }
|
|
// }
|
|
// }
|
|
],
|
|
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 = {
|
|
page: params.pageNumber,
|
|
pageSize: params.pageSize,
|
|
familyId: $('#familyId').val(),
|
|
beginDate: $('#beginDate').val(),
|
|
endDate: $('#endDate').val(),
|
|
};
|
|
return param;
|
|
},
|
|
toolbar: '#toolbar',
|
|
url: '/admin/family/statistics/list',
|
|
onLoadSuccess: function (json) { //加载成功时执行
|
|
console.log("load success");
|
|
},
|
|
onLoadError: function () { //加载失败时执行
|
|
console.log("load fail");
|
|
}
|
|
});
|
|
|
|
// 导出EXCEL
|
|
$('#btnExport').on('click', function () {
|
|
if (!$('#beginDate').val() || !$('#endDate').val()) {
|
|
$("#tipMsg").text("请选择导出的开始和结束日期");
|
|
$("#tipModal").modal('show');
|
|
return;
|
|
}
|
|
var form = $("#searchForm");
|
|
form.submit();
|
|
});
|
|
// 查询刷新
|
|
$('#btnSearch').on('click', function () {
|
|
TableHelper.doRefresh('#table');
|
|
});
|
|
|
|
var picker1 = $("#beginDate").datetimepicker({
|
|
format: 'yyyy-mm-dd hh:ii:00',
|
|
autoclose: true
|
|
});
|
|
var picker2 = $('#endDate').datetimepicker({
|
|
format: 'yyyy-mm-dd hh:ii:00',
|
|
autoclose: true
|
|
});
|
|
picker1.on('changeDate', function () {
|
|
var date = $('#beginDate').datetimepicker('getDate');
|
|
picker2.datetimepicker('beginDate', date);
|
|
});
|
|
picker2.on('changeDate', function () {
|
|
var date = $('#endDate').datetimepicker('getDate');
|
|
picker1.datetimepicker('setEndDate', date);
|
|
});
|
|
});
|
|
}
|
|
},
|
|
|
|
};
|
|
</script>
|
|
|
|
<style scoped></style> |