<template>
  <ListViewWithHead
    :table-config="tableConfig"
    :head-config="headFormConfigs"
    :dialog-configs="dialogConfigs"
    :list-query-extra="[{ blenderOrderId: id }]"
    attach-list-query-extra="blenderOrderId"
    :trigger-update="triggerUpdateKey"
  />
</template>

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

export default {
  name: "BlenderBatchView",
  components: { ListViewWithHead },
  provide() {
    return {
      urls: this.allUrls,
    };
  },
  computed: {
    // 混料订单id
    id() {
      return this.$route.params.id || "";
    },
  },
  data() {
    const { tableConfig, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
    return {
      tableConfig,
      headFormConfigs,
      allUrls: urls,
      dialogConfigs,
      triggerUpdateKey: ''
    };
  },
  watch: {
    $route: {
      handler: function (val) {
        if (val.params.id) {
          this.triggerUpdateKey = Math.random().toString()
          console.log('[$oute changed] val.params.id', val.params.id, this.triggerUpdateKey)
        }
      },
      immediate: true,
      deep: true
    }
  },
  created() {},
  mounted() {},
  methods: {},
};
</script>

<style scoped></style>
