fix : asset list Box 页面打开时请求错误

This commit is contained in:
likexuan
2022-07-12 15:06:27 +08:00
parent a4c1a235f0
commit c9c3767d00

View File

@@ -820,26 +820,28 @@ export default {
}, },
getModelData () { getModelData () {
return new Promise(resolve => { return new Promise(resolve => {
this.$get('asset/model?pageSize=-1&typeIds=' + this.editAsset.typeId).then(response => { if (this.editAsset.typeId) {
if (response.code === 200) { this.$get('asset/model?pageSize=-1&typeIds=' + this.editAsset.typeId).then(response => {
this.options.modelOptions = response.data.list if (response.code === 200) {
const titleSearchData = {} this.options.modelOptions = response.data.list
this.options.modelOptions.forEach(m => { const titleSearchData = {}
if (titleSearchData[m.brand.name]) { this.options.modelOptions.forEach(m => {
titleSearchData[m.brand.name].children.push(m) if (titleSearchData[m.brand.name]) {
titleSearchData[m.brand.name].children.push(m)
} else {
titleSearchData[m.brand.name] = { ...m.brand, children: [m] }
}
})
this.options.brandAndModelOptions = Object.keys(titleSearchData).map(b => titleSearchData[b])
if (!this.editAsset.type.name) {
this.judgeTypes = true
} else { } else {
titleSearchData[m.brand.name] = { ...m.brand, children: [m] } this.judgeTypes = false
} }
})
this.options.brandAndModelOptions = Object.keys(titleSearchData).map(b => titleSearchData[b])
if (!this.editAsset.type.name) {
this.judgeTypes = true
} else {
this.judgeTypes = false
} }
} resolve()
resolve() })
}) }
}) })
}, },
checkLocation (rule, value, callback) { checkLocation (rule, value, callback) {