#
whycq
2023-10-26 e7de9d5191399fc03b9905684282dfd0dd429f84
pages/tzsk/pakin/locPick.vue
@@ -26,15 +26,15 @@
               </view>
               
               <view class="sub2" v-for="it in sub.children" style="margin-left: 1em;" v-show="sub.switch">
                  <view :class="it.key" class="title sub-title" >{{it.title}}</view>
                  <view :class="it.key" class="name" v-show="it.key == 'user_id'" @click="back()">
                  <!-- <view :class="it.key" class="title sub-title" >{{it.title}}</view> -->
                  <view :class="it.key" class="locarea name"  @click="chose(it)">
                     <view>{{it.title}}</view>
                  </view>
               </view>
            </view>
         </view>
      </view>
      <view style="height: 100rpx;"></view>
   </view>
</template>
@@ -63,18 +63,18 @@
                  // console.log(res.data[0].children);
                  if (res.data[0].children[0]) {
                     for (let k of res.data[0].children) {
                        console.log(k);
                        // console.log(k);
                        if (k.children && k.children.length > 0) {
                           for (let i of k.children) {
                              i['switch'] = true
                              console.log(i);
                              // console.log(i);
                           }
                        }
                        // console.log(k);
                        k['switch'] = true
                        _this.tree.push(k)
                     }
                     console.log(_this.tree);
                     // console.log(_this.tree);
                  } else {
                     this.tree.push(res.data[0])
                  }
@@ -85,14 +85,14 @@
            let res = await user.getUserTree()
            if (res.code === 200) {
               this.tree = []
               console.log(res.data[0]);
               // console.log(res.data[0]);
               if (res.data[0].children) {
                  for (let k of res.data[0].children) {
                     
                     if (k.children && k.children.length > 0) {
                        for (let i of k.children) {
                           i['switch'] = true
                           console.log(i);
                           // console.log(i);
                        }
                     }
                     // console.log(k);
@@ -108,7 +108,7 @@
            console.log(this.tree);
         },
         switchbtn(item) {
            console.log(item);
            // console.log(item);
            item.switch = item.switch ? false : true
         },
         open(e) {
@@ -133,7 +133,12 @@
            uni.navigateBack({
               
            })
         },
         chose(data) {
            console.log(data);
            this.tree = []
         }
      }
   }
</script>
@@ -167,5 +172,7 @@
      justify-content: space-between;
      align-items: center;
   }
   .locarea:active {
      background-color: #55aa7f;
   }
</style>