tree.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view>
  3. <view class="header">
  4. <search v-if="searchIf" ref="sea" @confirm="confirmSearch" />
  5. <view class="title">
  6. <scroll-view scroll-x style="width: 100%;white-space: nowrap;" :scroll-left="scrollLeft">
  7. <view v-for="(item,index) in tree_stack" class="inline-item" :key="index">
  8. <view class="inline-item" v-if="index==0" @click="backTree(item,-1)">
  9. <text v-if="index==tree_stack.length-1&&!isre" class="none">全部</text>
  10. <text v-else class="active">全部</text>
  11. </view>
  12. <view v-if="index==0&&isre" @click="backTree(item,-2)" :class="[index==tree_stack.length-1&&isre]?'none inline-item':'active inline-item'">
  13. <i class="iconfont icon-z043 iconclass"/>
  14. 搜索结果
  15. </view>
  16. <view class="inline-item" @click="backTree(item,index)" v-if="index!=0">
  17. <i v-if="index!=0" class="iconfont icon-z043 iconclass"/>
  18. <text v-if="index==tree_stack.length-1" class="none inline-item">
  19. {{item[props.label]}}
  20. </text>
  21. <text v-else class="active">
  22. {{item[props.label]}}
  23. </text>
  24. </view>
  25. </view>
  26. </scroll-view>
  27. </view>
  28. </view>
  29. <view>
  30. <view class="container-list">
  31. <view class="common" v-for="(item, index) in tree" @click="toChildren(item)" :key="index">
  32. <label class="content">
  33. <view class="checkbox" v-if="isCheck&&props.multiple" @click.stop="checkboxChange(item,index,item.bx,item.qx)">
  34. <span v-if="(newCheckList.findIndex(e=>{return item.id==e.id}))>-1&&!item.qx">
  35. <i v-if="item.bx&&props.multiple" class="iconfont icon-banxuanzhongshousuo1-shi icons"/>
  36. <i v-else class="iconfont icon-xuanzhong txt icon-selected"/>
  37. </span>
  38. <i v-else-if="props.multiple&&item.qx" class="iconfont icon-xuanzhong txt icon-selected"/>
  39. <i v-else-if="item.bx&&props.multiple" class="iconfont icon-banxuanzhongshousuo1-shi icons"/>
  40. <i style="color: #b8b8b8;" v-else class="iconfont icon-weixuanzhong txt"/>
  41. </view>
  42. <view class="checkbox" v-if="isCheck&&!props.multiple&&props.nodes&&item.user" @click.stop="checkbox(item,index)">
  43. <i v-if="newCheckList.length>0&&item.id == newCheckList[0].id" class="txt iconfont icon-selected"/>
  44. <i style="color: #b8b8b8;" v-else class="txt iconfont icon-weixuanzhong1"/>
  45. </view>
  46. <view class="checkbox" v-if="isCheck&&!props.multiple&&!props.nodes" @click.stop="checkbox(item,index)">
  47. <i v-if="newCheckList.length>0&&item.id == newCheckList[0].id" class="txt iconfont icon-selected"/>
  48. <i style="color: #b8b8b8;" v-else class="txt iconfont icon-weixuanzhong1"/>
  49. </view>
  50. <view v-if="item.user" @click.stop="checkboxChange(item,index,item.bx,item.qx)"><slot v-bind:item="item"></slot></view>
  51. <slot v-else v-bind:item="item"></slot>
  52. <view class="right"><i v-if="!item.user&&item.children.length>0" class="iconfont icon-z043"></i></view>
  53. </label>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="btn box_sizing">
  58. <button class="sureBtn" type="primary" @click="backConfirm">确认</button>
  59. </view>
  60. </view>
  61. </template>
  62. <script src="./code.js" type="text/javascript"></script>
  63. <style lang="scss" scoped>
  64. @import './css/style.scss';
  65. @import url("./css/icon.css");
  66. </style>