|
|
@ -284,7 +284,21 @@ export default { |
|
|
|
oneClassifyId |
|
|
|
}) |
|
|
|
const resData = res.data |
|
|
|
console.log("resData--->", resData) |
|
|
|
|
|
|
|
this.initLangInfo(resData) |
|
|
|
this.initImageArray(resData) |
|
|
|
if (resData) { |
|
|
|
this.treeData = [resData] |
|
|
|
} else { |
|
|
|
this.treeData = [] |
|
|
|
} |
|
|
|
// console.log("treeData--->", this.treeData) |
|
|
|
}, |
|
|
|
|
|
|
|
initLangInfo(resData){ |
|
|
|
// console.log("resData.langInfoMap['zh']--->", resData.langInfoMap['zh']) |
|
|
|
// console.log("resData.langInfoMap['en']--->", resData.langInfoMap['en']) |
|
|
|
if(resData && resData.langInfoMap && resData.langInfoMap['zh']){ |
|
|
|
resData.classifyName_ZH = resData.langInfoMap['zh'].classifyName; |
|
|
|
}else{ |
|
|
@ -295,14 +309,13 @@ export default { |
|
|
|
}else{ |
|
|
|
resData.classifyName_EN = ""; |
|
|
|
} |
|
|
|
this.initImageArray(resData) |
|
|
|
if (resData) { |
|
|
|
this.treeData = [resData] |
|
|
|
} else { |
|
|
|
this.treeData = [] |
|
|
|
if(resData.childs && resData.childs.length){ |
|
|
|
for (const index in resData.childs) { |
|
|
|
this.initLangInfo(resData.childs[index]) |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(this.treeData) |
|
|
|
}, |
|
|
|
|
|
|
|
initImageArray(treeData){ |
|
|
|
if(treeData){ |
|
|
|
treeData.classifyImageArray = [ |
|
|
@ -423,15 +436,7 @@ export default { |
|
|
|
return |
|
|
|
} |
|
|
|
for (const index in params) { |
|
|
|
let itemParams = params[index] |
|
|
|
itemParams.classifyName = itemParams.classifyName_ZH; |
|
|
|
itemParams.langInfoMap = {} |
|
|
|
itemParams.langInfoMap["zh"] = {}; |
|
|
|
itemParams.langInfoMap["zh"].classifyName = itemParams.classifyName_ZH; |
|
|
|
itemParams.langInfoMap["zh"].languageType = "zh"; |
|
|
|
itemParams.langInfoMap["en"] = {}; |
|
|
|
itemParams.langInfoMap["en"].classifyName = itemParams.classifyName_EN; |
|
|
|
itemParams.langInfoMap["en"].languageType = "en"; |
|
|
|
this.resetLangInfo(params[index]) |
|
|
|
} |
|
|
|
this.resetImage(this.treeData[0]) |
|
|
|
const obj = { |
|
|
@ -441,7 +446,7 @@ export default { |
|
|
|
if (res.code === '') { |
|
|
|
this.isVisible = false |
|
|
|
this.$message({ |
|
|
|
message: '新增成功', |
|
|
|
message: this.$t('common.addsuccessful'), |
|
|
|
type: 'success' |
|
|
|
}) |
|
|
|
this.$emit('success') |
|
|
@ -456,15 +461,7 @@ export default { |
|
|
|
return |
|
|
|
} |
|
|
|
for (const index in params) { |
|
|
|
let itemParams = params[index] |
|
|
|
itemParams.classifyName = itemParams.classifyName_ZH; |
|
|
|
itemParams.langInfoMap = {} |
|
|
|
itemParams.langInfoMap["zh"] = {}; |
|
|
|
itemParams.langInfoMap["zh"].classifyName = itemParams.classifyName_ZH; |
|
|
|
itemParams.langInfoMap["zh"].languageType = "zh"; |
|
|
|
itemParams.langInfoMap["en"] = {}; |
|
|
|
itemParams.langInfoMap["en"].classifyName = itemParams.classifyName_EN; |
|
|
|
itemParams.langInfoMap["en"].languageType = "en"; |
|
|
|
this.resetLangInfo(params[index]) |
|
|
|
} |
|
|
|
this.resetImage(this.treeData[0]) |
|
|
|
const obj = { |
|
|
@ -482,6 +479,23 @@ export default { |
|
|
|
this.deleteArr = [] |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
resetLangInfo(itemParams){ |
|
|
|
itemParams.classifyName = itemParams.classifyName_ZH; |
|
|
|
itemParams.langInfoMap = {} |
|
|
|
itemParams.langInfoMap["zh"] = {}; |
|
|
|
itemParams.langInfoMap["zh"].classifyName = itemParams.classifyName_ZH; |
|
|
|
itemParams.langInfoMap["zh"].languageType = "zh"; |
|
|
|
itemParams.langInfoMap["en"] = {}; |
|
|
|
itemParams.langInfoMap["en"].classifyName = itemParams.classifyName_EN; |
|
|
|
itemParams.langInfoMap["en"].languageType = "en"; |
|
|
|
if(itemParams.childs && itemParams.childs.length){ |
|
|
|
for (const index in itemParams.childs) { |
|
|
|
this.resetLangInfo(itemParams.childs[index]) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
setParams ({ id }) { |
|
|
|
console.log(id) |
|
|
|
this.queryOneCategory(id) |
|
|
|