<template>
  <ListViewWithHead
    :table-config="tableConfig"
    :head-config="headFormConfigs"
    :dialog-configs="dialogConfigs"
    :listQueryExtra="['carCode', 'orderCode', 'team', { report: 0, startTime: now[0], endTime: now[1] }]" />
</template>

<script>
import initConfig from "./config";
import ListViewWithHead from "@/views/atomViews/ListViewWithHead.vue";
import moment from "moment";

export default {
  name: "CarView",
  components: { ListViewWithHead },
  provide() {
    return {
      urls: this.allUrls,
    };
  },
  data() {
    const { tableConfig, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
    return {
      tableConfig,
      headFormConfigs,
      allUrls: urls,
      dialogConfigs,
    };
  },

  computed: {
    now() {
      const curr = this.headFormConfigs.fields.find((item) => item.prop == "timerange").default.value;
      return [
        moment(curr[0]).format("YYYY-MM-DDTHH:mm:ss"),
        moment(curr[1]).format("YYYY-MM-DDTHH:mm:ss"),
      ]
      // const start = new Date(curr[0]);
      // const end = new Date(curr[1]);
      // return [
      // start.toLocaleString().replace(' ', 'T').replace(/\//g, '-'),
      // end.toLocaleString().replace(' ', 'T').replace(/\//g, '-'),
      // ]
    },
  },
  methods: {},
};
</script>

<style scoped></style>
