| | |
| | | }; |
| | | return { |
| | | xiugais: true, |
| | | xiugaiList: [], |
| | | xiugaiList: null, // 改为 null,便于判断是否已加载 |
| | | deptOptions: [], |
| | | dialogTableVisible: false, |
| | | isPriceDisabled: false, |
| | |
| | | this.deptList = this.handleTree(response.data, "proId"); |
| | | }); |
| | | }, |
| | | getDeptTree() { |
| | | /* getDeptTree() { |
| | | this.loadings = true; |
| | | return deptTree111() |
| | | .then((response) => { |
| | |
| | | .finally(() => { |
| | | this.loadings = false; // 无论成功或失败,结束加载 |
| | | }); |
| | | }, |
| | | }, */ |
| | | handleNodeClick(date) { |
| | | this.treeDate = date; |
| | | this.xiugaiList = {}; |
| | |
| | | }); |
| | | }); |
| | | }, |
| | | // 刷新当前选中项目的数据 |
| | | async refreshCurrentProjectData() { |
| | | if (this.id) { |
| | | try { |
| | | const response = await getInfoByProId(this.id); |
| | | this.xiugaiList = response.data; |
| | | console.log("刷新项目数据成功:", this.xiugaiList); |
| | | return response.data; |
| | | } catch (error) { |
| | | console.error("刷新项目数据失败:", error); |
| | | this.$message.error("刷新项目数据失败"); |
| | | this.xiugaiList = null; // 刷新失败时重置为 null |
| | | return null; |
| | | } |
| | | } |
| | | return null; |
| | | }, |
| | | // 调试方法:检查当前数据状态 |
| | | debugDataState() { |
| | | console.log("=== 数据状态调试 ==="); |
| | | console.log("当前ID:", this.id); |
| | | console.log("xiugaiList:", this.xiugaiList); |
| | | console.log("form:", this.form); |
| | | console.log("treeDate:", this.treeDate); |
| | | console.log("=================="); |
| | | }, |
| | | getSelectValue(val) { |
| | | this.form.consumablesList.forEach((formitem) => { |
| | | if (formitem.makings === val) { |
| | |
| | | |
| | | // 等待右侧表格刷新 |
| | | await this.getList(); |
| | | |
| | | // 立即刷新当前项目数据,确保数据是最新的 |
| | | await this.refreshCurrentProjectData(); |
| | | |
| | | this.pageLoading = false; // ✅ 统一加载状态控制 |
| | | }, |