Files
peko-admin-web/src/views/car/CarRecordView.vue
2024-04-22 10:45:13 +08:00

121 lines
4.7 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="qErbanNo" class="col-sm-4 control-label">平台号:</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="qErbanNo" id="qErbanNo" placeholder="">
</div>
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
</div>
</div>
</div>
<!-- .content -->
<div id="table"></div>
</div>
</section>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
import { formatTime, serverError, apiResult } from '@/utils/maintainer';
export default {
name: "CarRecordView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('.datetime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
{ field: 'carId', title: '座驾ID', align: 'center', width: '5%' },
{ field: 'carName', title: '座驾名称', align: 'center', width: '5%' },
{ field: 'uid', title: '用户ID', align: 'center', width: '5%' },
{ field: 'erbanNo', title: '用户靓号', align: 'center', width: '5%' },
{ field: 'nick', title: '用户昵称', align: 'center', width: '5%' },
{ field: 'days', title: '天数', align: 'center', width: '5%' },
{ field: 'objSrc', title: '备注', align: 'center', width: '5%' },
{ field: 'createTime', title: '创建时间', align: 'center', valign: 'middle', width: '10%', formatter: formatTime },
],
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 = {
page: params.pageNumber,
pageSize: params.pageSize,
erbanNo: $('#qErbanNo').val(),
};
return param;
},
ajax: function (request) { //使用ajax请求
$.ajax({
type: "GET",
url: '/admin/carRecord/list',
contentType: 'application/json;charset=utf-8',
dataType: 'json',
data: request.data,
success: function (res) {
apiResult(res);
request.success({
rows: res.data.rows,
total: res.data.total
});
},
error: function (req) {
serverError(req);
}
})
},
toolbar: '#toolbar',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
});
}
},
};
</script>
<style scoped></style>