141 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Vue
		
	
	
	
			
		
		
	
	
			141 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Vue
		
	
	
	
 | 
						|
 | 
						|
<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">
 | 
						|
          <p>card content</p>
 | 
						|
        </a-card>
 | 
						|
      </a-col>
 | 
						|
      <a-col :span="6">
 | 
						|
        <a-card title="国Ⅵ输车辆" size="small">
 | 
						|
          <p>card content</p>
 | 
						|
        </a-card>
 | 
						|
      </a-col>
 | 
						|
      <a-col :span="6">
 | 
						|
        <a-card title="非道路工程机械" size="small">
 | 
						|
          <p>card content</p>
 | 
						|
        </a-card>
 | 
						|
      </a-col>
 | 
						|
      <a-col :span="6">
 | 
						|
        <a-card title="燃油运输车辆"  size="small">
 | 
						|
          <p>card content</p>
 | 
						|
        </a-card>
 | 
						|
      </a-col>
 | 
						|
    </a-row>
 | 
						|
 | 
						|
    <a-divider />
 | 
						|
    <Curd
 | 
						|
      hide-action
 | 
						|
      hide-search
 | 
						|
      hide-button
 | 
						|
      :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 {
 | 
						|
      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',
 | 
						|
          title: '燃油车'
 | 
						|
        },
 | 
						|
        {
 | 
						|
          dataIndex: 'createDateTime',
 | 
						|
          key: 'createDateTime',
 | 
						|
          title: '出厂日期'
 | 
						|
        }
 | 
						|
      ],
 | 
						|
      apiConf: {
 | 
						|
        listApi: { api: '/api/Ledger/list', method: 'get' },
 | 
						|
      }
 | 
						|
    }
 | 
						|
  },
 | 
						|
 | 
						|
  computed: {
 | 
						|
    formItems () {
 | 
						|
      return [
 | 
						|
        {
 | 
						|
          type: 'dateRange',
 | 
						|
          key: 'time',
 | 
						|
          label: '日期',
 | 
						|
          isSearch: true,
 | 
						|
          placeholder: ['请选择开始日期', '请选择结束日期'],
 | 
						|
          rules: [
 | 
						|
            { required: true, message: '请选择时间范围' }
 | 
						|
          ],
 | 
						|
          fields: ['startTime', 'endTime']
 | 
						|
        }
 | 
						|
      ]
 | 
						|
    }
 | 
						|
  },
 | 
						|
  created() {
 | 
						|
  },
 | 
						|
 | 
						|
  methods: {
 | 
						|
    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>
 |