| | |
| | | selectedKeys: [], |
| | | expandedKeys: [], |
| | | url: { |
| | | factoryTreeList: '/base/warehouse/loadTree', |
| | | getAllSiteList: '/base/site/getAllList', |
| | | warehouseTreeList: '/tms/warehouse/loadTree' |
| | | }, |
| | | searchValue: '', |
| | | dataList: [], |
| | |
| | | } |
| | | }, |
| | | 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; |
| | | }, |
| | |
| | | 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); |
| | | } |
| | |
| | | this.expandedKeys = this.allTreeKeys; |
| | | }, |
| | | closeAll() { |
| | | this.expandedKeys = this.allSiteIds; |
| | | this.expandedKeys = [] |
| | | }, |
| | | refreshTree() { |
| | | this.queryTreeData(); |
| | |
| | | }, |
| | | 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: { |