| | |
| | | }; |
| | | 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 = {}; |
| | |
| | | } |
| | | }, |
| | | handleUpdate1() { |
| | | this.updateLoading = true; |
| | | // this.updateLoading = true; |
| | | this.form = {}; |
| | | this.form = this.xiugaiList; |
| | | this.form.proStatus = this.form.proStatus.toString(); |
| | | this.form.sfcyyc = this.form.sfcyyc.toString(); |
| | | this.proParent = true; |
| | | this.isPriceDisabled = true; |
| | | getlist() |
| | | .then((response) => { |
| | | if (response.code == 200) { |
| | | this.loading = false; |
| | | this.projectOptions = []; |
| | | const project = { proId: 0, proName: "主类目", children: [] }; |
| | | project.children = this.handleTree(response.data.list, "proId"); |
| | | this.key = response.data.key; |
| | | this.projectOptions.push(project); |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | this.updateLoading = false; |
| | | }); |
| | | this.open = true; |
| | | |
| | | // 先加载科室列表数据,再设置表单数据 |
| | | Promise.all([ |
| | | listDept(this.queryParams), |
| | | getlist() |
| | | ]).then(([deptResponse, listResponse]) => { |
| | | // 先设置科室列表 |
| | | this.parentNameList = deptResponse.data; |
| | | |
| | | // 再设置表单数据 |
| | | this.form = this.xiugaiList; |
| | | this.form.proStatus = this.form.proStatus.toString(); |
| | | this.form.sfcyyc = this.form.sfcyyc.toString(); |
| | | |
| | | // 处理项目选项 |
| | | if (listResponse.code == 200) { |
| | | this.loading = false; |
| | | this.projectOptions = []; |
| | | const project = { proId: 0, proName: "主类目", children: [] }; |
| | | project.children = this.handleTree(listResponse.data.list, "proId"); |
| | | this.key = listResponse.data.key; |
| | | this.projectOptions.push(project); |
| | | } |
| | | |
| | | this.open = true; |
| | | }).catch((error) => { |
| | | console.error("加载数据失败:", error); |
| | | this.$message.error("加载数据失败"); |
| | | }) |
| | | }, |
| | | handleUpdate(row) { |
| | | this.reset(); |
| | |
| | | const proId = row.proId || this.ids; |
| | | this.proParent = false; |
| | | this.isPriceDisabled = false; |
| | | getProject(proId).then((response) => { |
| | | this.form = response.data; |
| | | this.showPrise = this.form.proParentId === "0"; |
| | | this.showRentPrise = !this.showPrise; |
| | | this.form.proStatus = this.form.proStatus.toString(); |
| | | this.form.sfcyyc = this.form.sfcyyc.toString(); |
| | | this.form.consumablesList = response.data.consumablesList; |
| | | this.form.tjStandardList = response.data.tjStandardList; |
| | | if (this.form.tjStandardList) { |
| | | this.form.tjStandardList.forEach((item) => { |
| | | item.tjSex = |
| | | item.tjSex === "0" || item.tjSex === "男" |
| | | ? "男" |
| | | : item.tjSex === "1" || item.tjSex === "女" |
| | | ? "女" |
| | | : null; |
| | | item.tjType = |
| | | { |
| | | 0: "婴儿", |
| | | 1: "幼儿", |
| | | 2: "儿童", |
| | | 3: "少年", |
| | | 4: "青年", |
| | | 5: "中年", |
| | | 6: "老年", |
| | | }[item.tjType] || item.tjType; |
| | | }); |
| | | } |
| | | getlist().then((response) => { |
| | | if (response.code == 200) { |
| | | // this.loading = false; |
| | | this.projectOptions = []; |
| | | const project = { proId: 0, proName: "主类目", children: [] }; |
| | | project.children = this.handleTree(response.data.list, "proId"); |
| | | this.key = response.data.key; |
| | | this.projectOptions.push(project); |
| | | listDept(this.queryParams).then((response) => { |
| | | this.parentNameList = response.data; |
| | | // this.deptList = this.handleTree(response.data, "proId"); |
| | | getProject(proId).then((response) => { |
| | | this.form = response.data; |
| | | this.form.deptId = response.data.deptId; |
| | | this.showPrise = this.form.proParentId === "0"; |
| | | this.showRentPrise = !this.showPrise; |
| | | this.form.proStatus = this.form.proStatus.toString(); |
| | | this.form.sfcyyc = this.form.sfcyyc.toString(); |
| | | this.form.consumablesList = response.data.consumablesList; |
| | | this.form.tjStandardList = response.data.tjStandardList; |
| | | if (this.form.tjStandardList) { |
| | | this.form.tjStandardList.forEach((item) => { |
| | | item.tjSex = |
| | | item.tjSex === "0" || item.tjSex === "男" |
| | | ? "男" |
| | | : item.tjSex === "1" || item.tjSex === "女" |
| | | ? "女" |
| | | : null; |
| | | item.tjType = |
| | | { |
| | | 0: "婴儿", |
| | | 1: "幼儿", |
| | | 2: "儿童", |
| | | 3: "少年", |
| | | 4: "青年", |
| | | 5: "中年", |
| | | 6: "老年", |
| | | }[item.tjType] || item.tjType; |
| | | }); |
| | | } |
| | | getlist().then((response) => { |
| | | if (response.code == 200) { |
| | | // this.loading = false; |
| | | this.projectOptions = []; |
| | | const project = { proId: 0, proName: "主类目", children: [] }; |
| | | project.children = this.handleTree(response.data.list, "proId"); |
| | | this.key = response.data.key; |
| | | this.projectOptions.push(project); |
| | | } |
| | | }); |
| | | // this.loadPage(); |
| | | this.open = true; |
| | | this.title = "体检项目信息维护"; |
| | | }); |
| | | // this.loadPage(); |
| | | this.open = true; |
| | | this.title = "体检项目信息维护"; |
| | | }); |
| | | }, |
| | | // 刷新当前选中项目的数据 |
| | | 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) => { |
| | |
| | | |
| | | // 等待右侧表格刷新 |
| | | await this.getList(); |
| | | |
| | | // 立即刷新当前项目数据,确保数据是最新的 |
| | | await this.refreshCurrentProjectData(); |
| | | |
| | | this.pageLoading = false; // ✅ 统一加载状态控制 |
| | | }, |