lg_frontend/pages/cleanTravel/ledger.vue

191 lines
4.3 KiB
Vue
Raw Normal View History

2024-06-26 16:52:06 +00:00
<template>
<div>
<a-page-header
:ghost="false"
style="border-bottom: 1px solid rgb(235, 237, 240)"
title="厂区车辆台账"
@back="() => $router.go(-1)"
/>
<a-row :gutter="16">
<a-col :span="6">
<a-card title="运输车辆" size="small">
2024-08-05 16:17:35 +00:00
<p>{{ headCount.t1 || 0 }}</p>
2024-06-26 16:52:06 +00:00
</a-card>
</a-col>
<a-col :span="6">
<a-card title="国Ⅵ输车辆" size="small">
2024-08-05 16:17:35 +00:00
<p>{{ headCount.t2 || 0 }}</p>
2024-06-26 16:52:06 +00:00
</a-card>
</a-col>
<a-col :span="6">
<a-card title="非道路工程机械" size="small">
2024-08-05 16:17:35 +00:00
<p>{{ headCount.t3 || 0 }}</p>
2024-06-26 16:52:06 +00:00
</a-card>
</a-col>
<a-col :span="6">
<a-card title="燃油运输车辆" size="small">
2024-08-05 16:17:35 +00:00
<p>{{ headCount.t4 || 0 }}</p>
2024-06-26 16:52:06 +00:00
</a-card>
</a-col>
</a-row>
<a-divider />
<Curd
hide-search
2024-08-05 16:17:35 +00:00
hide-action
2024-06-26 16:52:06 +00:00
:columns="columns"
:api-conf="apiConf"
:form-items="formItems"
@edit="editHandler"
>
<template slot="search-button" slot-scope="{ search }">
<a-button type="primary" @click="exportList(search)">导出历史数据</a-button>
</template>
</Curd>
</div>
</template>
<script>
import Curd from "../../components/smallCommon/Curd.vue";
import moment from 'moment'
export default {
name: "user",
layout: "user",
components: {
Curd
},
data () {
return {
2024-08-05 16:17:35 +00:00
headCount: {},
2024-06-26 16:52:06 +00:00
isEdit: false,
roles: [],
columns: [
{
dataIndex: 'outTime',
key: 'outTime',
title: '日期'
},
{
dataIndex: 'carNum',
key: 'carNum',
title: '车牌号'
},
{
dataIndex: 'carModel',
key: 'carModel',
title: '车型'
},
{
dataIndex: 'newCar',
key: 'newCar',
title: '新能源',
customRender (text) {
if (text) return '是'
return '否'
}
},
{
dataIndex: 'emissions',
key: 'emissions',
2024-08-05 16:17:35 +00:00
title: '燃油车标准'
2024-06-26 16:52:06 +00:00
},
{
dataIndex: 'createDateTime',
key: 'createDateTime',
title: '出厂日期'
}
],
apiConf: {
listApi: { api: '/api/Ledger/list', method: 'get' },
2024-08-05 16:17:35 +00:00
addApi: {api: '/api/Ledger/add', method: 'post',}
2024-06-26 16:52:06 +00:00
}
}
},
computed: {
formItems () {
return [
{
type: 'dateRange',
key: 'time',
label: '日期',
isSearch: true,
2024-08-05 16:17:35 +00:00
hide: true,
2024-06-26 16:52:06 +00:00
placeholder: ['请选择开始日期', '请选择结束日期'],
rules: [
{ required: true, message: '请选择时间范围' }
],
fields: ['startTime', 'endTime']
2024-08-05 16:17:35 +00:00
},
{
type: 'date',
key: 'outTime',
label: '日期',
placeholder: '请选择日期'
},
{
type: 'input',
key: 'carNum',
label: '车牌号',
placeholder: '请输入车牌号'
},
{
type: 'input',
key: 'carModel',
label: '车型',
placeholder: '请输入车型'
},
{
type: 'select',
key: 'newCar',
label: '新能源',
placeholder: '是否新能源',
children: [
{ label: '是', value: '是' },
{ label: '否', value: '否' },
]
},
{
type: 'select',
key: 'emissions',
label: '燃油车标准',
placeholder: '',
},
{
type: 'date',
key: 'createDateTime',
label: '出厂日期',
placeholder: '',
2024-06-26 16:52:06 +00:00
}
]
}
},
created() {
2024-08-05 16:17:35 +00:00
this.$http.get('/api/Ledger/HeaderCount').then(({data}) => {
this.headCount = data || {}
})
2024-06-26 16:52:06 +00:00
},
methods: {
2024-08-05 16:17:35 +00:00
add () {
},
2024-06-26 16:52:06 +00:00
editHandler (isEdit) {
this.isEdit = isEdit
},
exportList ({ time }) {
const [ start, end ] = time
const fmt = 'YYYY-MM-DD'
window.open(`http://101.43.201.20:5000/api/Ledger/export?start=${moment(start).format(fmt)}&end=${moment(end).format(fmt)}`, '_blank')
}
}
}
</script>
<style scoped lang="less">
</style>