|
@@ -37,7 +37,7 @@
|
|
|
<el-icon v-if="data.is_type != '2'">
|
|
|
<Folder />
|
|
|
</el-icon>
|
|
|
- <SvgIcon name="iconfont icon-siweidaotu" v-if="data.is_type == '2'"></SvgIcon>
|
|
|
+ <SvgIcon name="iconfont icon-siweidaotu" v-else></SvgIcon>
|
|
|
{{ node.label }}
|
|
|
</span>
|
|
|
</div>
|
|
@@ -150,10 +150,22 @@ const buildTree = (category: any, productData: any) => {
|
|
|
}
|
|
|
|
|
|
if (category.children && category.children.length > 0) {
|
|
|
+ const products = productData.filter((product: any) => product.categoryId === category.id)
|
|
|
+ for (let product of products) {
|
|
|
+ const productNode = {
|
|
|
+ id: product.id,
|
|
|
+ label: product.name,
|
|
|
+ key: product.key,
|
|
|
+ is_type: '2', // 2是产品
|
|
|
+ }
|
|
|
+ treeNode.children.push(productNode)
|
|
|
+ }
|
|
|
+
|
|
|
for (let child of category.children) {
|
|
|
const childNode = buildTree(child, productData)
|
|
|
treeNode.children.push(childNode)
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
const products = productData.filter((product: any) => product.categoryId === category.id)
|
|
|
for (let product of products) {
|