<template>
  <ListViewWithHead
    :table-config="tableConfig"
    :head-config="headFormConfigs"
    :dialog-configs="dialogConfigs"
    :car-payload-dialog-configs="carPayloadDialogConfigs"
    :listQueryExtra="[{ code, orderCode: '' }]"
    attach-list-query-data="code"
    :trigger-update="triggerUpdateKey" />
</template>

<script>
import initConfig from "./config";
import ListViewWithHead from "./components/ListViewWithHead.vue";

export default {
  name: "CarHistoryView",
  components: { ListViewWithHead },
  provide() {
    return {
      urls: this.allUrls,
    };
  },
  // computed: {
  //   code() {
  //     return this.$route.query.code || "0";
  //   },
  // },
  data() {
    const { tableConfig, headFormConfigs, carPayloadDialogConfigs, urls, dialogConfigs } = initConfig.call(this);
    return {
      carPayloadDialogConfigs,
      tableConfig,
      headFormConfigs,
      allUrls: urls,
      dialogConfigs,
      triggerUpdateKey: "",
      code: "",
    };
  },
  activated() {
    //console.log("activated", this.$route.query)
    this.code = this.$route.query.code || "";
    this.triggerUpdateKey = Math.random().toString();
  },
};
</script>

<style scoped></style>
