|
|
@@ -66,13 +66,13 @@
|
|
|
watch: {
|
|
|
project: {
|
|
|
handler(newVal) {
|
|
|
- const catalogId = this.getCatalogId(newVal)
|
|
|
- if (catalogId) {
|
|
|
- // 如果 catalogId 没有变化,不重复加载
|
|
|
- if (this.projectIdCache === catalogId) {
|
|
|
+ const taskId = this.getTaskId(newVal)
|
|
|
+ if (taskId) {
|
|
|
+ // 如果 taskId 没有变化,不重复加载
|
|
|
+ if (this.projectIdCache === taskId) {
|
|
|
return
|
|
|
}
|
|
|
- this.projectIdCache = catalogId
|
|
|
+ this.projectIdCache = taskId
|
|
|
// 调用接口加载数据
|
|
|
this.loadSurveyData()
|
|
|
}
|
|
|
@@ -83,13 +83,27 @@
|
|
|
},
|
|
|
mounted() {
|
|
|
console.log('project', this.project)
|
|
|
- // 如果已有 catalogId,立即加载
|
|
|
- const catalogId = this.getCatalogId(this.project)
|
|
|
- if (catalogId) {
|
|
|
+ // 如果已有 taskId,立即加载
|
|
|
+ const taskId = this.getTaskId(this.project)
|
|
|
+ if (taskId) {
|
|
|
this.loadSurveyData()
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 从任务信息中获取 taskId
|
|
|
+ getTaskId(project) {
|
|
|
+ if (!project) return null
|
|
|
+ if (project.taskId) return project.taskId
|
|
|
+ if (project.basicInfo && project.basicInfo.taskId)
|
|
|
+ return project.basicInfo.taskId
|
|
|
+ if (
|
|
|
+ project.data &&
|
|
|
+ project.data.basicInfo &&
|
|
|
+ project.data.basicInfo.taskId
|
|
|
+ )
|
|
|
+ return project.data.basicInfo.taskId
|
|
|
+ return null
|
|
|
+ },
|
|
|
// 从立项信息中获取 catalogId
|
|
|
getCatalogId(project) {
|
|
|
if (!project) {
|
|
|
@@ -115,15 +129,15 @@
|
|
|
},
|
|
|
// 加载成本调查表数据
|
|
|
async loadSurveyData() {
|
|
|
- const catalogId = this.getCatalogId(this.project)
|
|
|
- if (!catalogId) {
|
|
|
+ const taskId = this.getTaskId(this.project)
|
|
|
+ if (!taskId) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
this.loading = true
|
|
|
const params = {
|
|
|
- catalogId: catalogId,
|
|
|
+ taskId: taskId,
|
|
|
}
|
|
|
const res = await getSurveyList(params)
|
|
|
|