cuilei
2025-05-07 da5bd5596b1f0f7a27cd0791a17a7fc3b608f523
src/views/tms/WarehouseTree.vue
@@ -170,8 +170,7 @@
      selectedKeys: [],
      expandedKeys: [],
      url: {
        factoryTreeList: '/base/warehouse/loadTree',
        getAllSiteList: '/base/site/getAllList',
        warehouseTreeList: '/tms/warehouse/loadTree'
      },
      searchValue: '',
      dataList: [],
@@ -184,24 +183,9 @@
    }
  },
  created() {
    this.getAllSiteId();
    this.queryTreeData();
    this.closeAll();
  },
  methods: {
    getAllSiteId() {
      getAction(this.url.getAllSiteList).then((res) => {
        if (res.success) {
          let allSiteList = res.result;
          for (let i = 0; i < allSiteList.length; i++) {
            const site = allSiteList[i];
            this.allSiteIds.push(site.id);
          }
        } else {
          this.$message.warn(res.message);
        }
      })
    },
    getCurrSelectedTitle() {
      return !this.currSelected.title ? '' : this.currSelected.title;
    },
@@ -223,12 +207,13 @@
    queryTreeData() {
      this.loading = true;
      this.cardLoading = true;
      getAction(this.url.factoryTreeList).then((res) => {
      getAction(this.url.warehouseTreeList).then((res) => {
        if (res.success) {
          this.dataList = [];
          this.allTreeKeys = [];
          this.treeDataSource = res.result;
          this.generateList(res.result);
          this.expandAll()
        } else {
          this.$message.warn(res.message);
        }
@@ -302,7 +287,7 @@
      this.expandedKeys = this.allTreeKeys;
    },
    closeAll() {
      this.expandedKeys = this.allSiteIds;
      this.expandedKeys = []
    },
    refreshTree() {
      this.queryTreeData();
@@ -310,6 +295,11 @@
  },
  mounted() {
    this.$bus.$on('queryTreeData', this.queryTreeData);
    this.$bus.$on('clearTreeSelection', this.onClearSelected)
  },
  beforeDestroy() {
    this.$bus.$off('queryTreeData', this.queryTreeData);
    this.$bus.$off('clearTreeSelection', this.onClearSelected)
  },
  //监听
  watch: {