

<template>
  <div>
    <a-page-header
      :ghost="false"
      title="清洁运输+趋势"
      @back="() => $router.go(-1)"
    />
    <a-divider style="margin-top: 0;" />
    <a-row :gutter="16">
      <a-col :span="12">
        <a-card>
          <div slot="title">
            运输总量: {{ yunshuzongliang }}
          </div>

          <Curd
            hide-action
            hide-search
            hide-button
            :columns="columns"
            :api-conf="apiConf"
            :form-items="formItems"
          >
          </Curd>
        </a-card>

      </a-col>
      <a-col :span="12">
        <a-card title="国Ⅵ输车辆" size="small">
          <p>card content</p>
        </a-card>
      </a-col>
    </a-row>


  </div>
</template>
<script>
import Curd from "../../components/smallCommon/Curd.vue";
import moment from 'moment'
export default {
  name: "user",
  layout: "user",
  components: {
    Curd
  },
  data () {
    return {
      yunshuzongliang: 0,
      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/Transport/list', method: 'get' },
      }
    }
  },

  computed: {
    formItems () {
      return [
      ]
    }
  },
  created() {
    this.getyunshuzongliang()
  },

  methods: {
    getyunshuzongliang () {
      /*this.$get('/api/Transport/count').then(({ data }) => {
        this.yunshuzongliang = data
      })*/
    },
    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>
