|
@@ -5,7 +5,15 @@
|
|
|
<div class="body_com">
|
|
|
<scroller style="right:5.5rem;width:2rem;" class="selector-left _v-container">
|
|
|
<van-collapse v-model="left_active" accordion>
|
|
|
- <van-collapse-item :is-link="false" :name="item.id" v-for="(item,index) in category_list" :key="index" :title="item.name" v-show="item.pid == 0" :class="{on: left_active, no_child: item.child.length == 0}">
|
|
|
+ <van-collapse-item
|
|
|
+ :is-link="false"
|
|
|
+ :name="item.id"
|
|
|
+ v-for="(item,index) in category_list"
|
|
|
+ :key="index"
|
|
|
+ :title="item.name"
|
|
|
+ v-show="item.isRoot"
|
|
|
+ :class="{on: left_active, no_child: item.child.length === 0}"
|
|
|
+ >
|
|
|
<template v-if="item.child.length > 0">
|
|
|
<div v-for="(child_item,child_index) in item.child" :key="child_index" @click.stop="show_child(child_item)" style="padding: 0.16rem 0;border-bottom: 1px solid #f1f1f1;">
|
|
|
<span :class="{blue: pid == child_item.id}">{{child_item.name}}</span>
|
|
@@ -352,8 +360,15 @@ export default {
|
|
|
this.$axiosUser('get','/api/pro/integral/rule/trees/scope',data)
|
|
|
.then((res)=>{
|
|
|
this.category_list = []
|
|
|
- this.rule_tree = res.data.data.rule_tree
|
|
|
- this.parse_tree(res.data.data.rule_tree, this.pid)
|
|
|
+ // this.rule_tree = res.data.data.rule_tree
|
|
|
+ let ruleSet = new Set(this.rule_tree.map(item => item.id))
|
|
|
+ this.rule_tree = res.data.data.rule_tree.map(item => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ isRoot:item.pid === 0 || !ruleSet.has(item.pid)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.parse_tree(this.rule_tree, this.pid)
|
|
|
})
|
|
|
},
|
|
|
get_category_list () {
|
|
@@ -367,8 +382,15 @@ export default {
|
|
|
params['cycle_type'] = this.cycle_type
|
|
|
this.$axiosUser('get', '/api/pro/integral/rule/trees', params).then((res) => {
|
|
|
this.category_list = []
|
|
|
- this.rule_tree = res.data.data.rule_tree
|
|
|
- this.parse_tree(res.data.data.rule_tree, this.pid)
|
|
|
+ // this.rule_tree = res.data.data.rule_tree
|
|
|
+ let ruleSet = new Set(this.rule_tree.map(item => item.id))
|
|
|
+ this.rule_tree = res.data.data.rule_tree.map(item => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ isRoot:item.pid === 0 || !ruleSet.has(item.pid)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.parse_tree(this.rule_tree, this.pid)
|
|
|
})
|
|
|
},
|
|
|
},
|