Commit e2e36b36 authored by lijin's avatar lijin

优化选择器组件查询数据返回结果

parent b5334e6d
...@@ -48,7 +48,11 @@ export default { ...@@ -48,7 +48,11 @@ export default {
async fetchOptions() { async fetchOptions() {
try { try {
const response = await axios.get(process.env.PUTIN_API + '/app-groups') const response = await axios.get(process.env.PUTIN_API + '/app-groups')
this.options = response.data if (response.data.status === 200) {
this.options = response.data.result.data || []
} else {
this.$message.error('获取应用组失败')
}
} catch (error) { } catch (error) {
console.error('Failed to fetch app groups:', error) console.error('Failed to fetch app groups:', error)
} }
......
...@@ -48,7 +48,11 @@ export default { ...@@ -48,7 +48,11 @@ export default {
async fetchOptions() { async fetchOptions() {
try { try {
const response = await axios.get(process.env.PUTIN_API + '/description-groups') const response = await axios.get(process.env.PUTIN_API + '/description-groups')
this.options = response.data if (response.data.status === 200) {
this.options = response.data.result.data || []
} else {
this.$message.error('获取描述组失败')
}
} catch (error) { } catch (error) {
console.error('Failed to fetch description groups:', error) console.error('Failed to fetch description groups:', error)
} }
......
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
try { try {
const response = await axios.get(process.env.PUTIN_API + '/location-groups') const response = await axios.get(process.env.PUTIN_API + '/location-groups')
if (response.data.status === 200) { if (response.data.status === 200) {
this.options = response.data.result.data this.options = response.data.result.data || []
} else { } else {
this.$message.error('获取地域组失败') this.$message.error('获取地域组失败')
} }
......
...@@ -48,7 +48,11 @@ export default { ...@@ -48,7 +48,11 @@ export default {
async fetchOptions() { async fetchOptions() {
try { try {
const response = await axios.get(process.env.PUTIN_API + '/material-groups') const response = await axios.get(process.env.PUTIN_API + '/material-groups')
this.options = response.data if (response.data.status === 200) {
this.options = response.data.result.data || []
} else {
this.$message.error('获取素材组失败')
}
} catch (error) { } catch (error) {
console.error('Failed to fetch material groups:', error) console.error('Failed to fetch material groups:', error)
} }
......
...@@ -336,11 +336,11 @@ export default { ...@@ -336,11 +336,11 @@ export default {
axios.get(process.env.PUTIN_API + '/description-groups') axios.get(process.env.PUTIN_API + '/description-groups')
]) ])
app.data.forEach(item => this.groupNameMaps.app.set(item.id, item.name)) app.data.result.data.forEach(item => this.groupNameMaps.app.set(item.id, item.name))
location.data.result.data.forEach(item => this.groupNameMaps.location.set(item.id, item.name)) location.data.result.data.forEach(item => this.groupNameMaps.location.set(item.id, item.name))
material.data.forEach(item => this.groupNameMaps.material.set(item.id, item.name)) material.data.result.data.forEach(item => this.groupNameMaps.material.set(item.id, item.name))
title.data.result.data.forEach(item => this.groupNameMaps.title.set(item.id, item.name)) title.data.result.data.forEach(item => this.groupNameMaps.title.set(item.id, item.name))
description.data.forEach(item => this.groupNameMaps.description.set(item.id, item.name)) description.data.result.data.forEach(item => this.groupNameMaps.description.set(item.id, item.name))
} catch (error) { } catch (error) {
console.error('获取组名称失败:', error) console.error('获取组名称失败:', error)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment