tree.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view class="">
  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&&!item.hasChildren" @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.hasChildren" @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.hasChildren" @click.stop="checkboxChange(item,index,item.bx,item.qx)">
  51. <view class="content-item">
  52. <view class="word">{{item.dictKey}}</view>
  53. </view>
  54. </view>
  55. <view v-else class="content-item">
  56. <view class="word">{{item.dictKey}}</view>
  57. </view>
  58. <view class="right"><i v-if="item.hasChildren&&item.children.length>0" class="iconfont icon-z043"></i></view>
  59. </label>
  60. </view>
  61. </view>
  62. </view>
  63. <view v-if="tochild" class="btn box_sizing" style="margin-bottom: 4rpx;">
  64. <button class="sureBtn" type="primary" @click="backConfirm">确认</button>
  65. </view>
  66. </view>
  67. </template>
  68. <script src="./code.js" type="text/javascript"></script>
  69. <style lang="scss" scoped>
  70. @import './css/style.scss';
  71. @import url("./css/icon.css");
  72. .safe-area-inset-bottom{
  73. margin-bottom: calc(env(safe-area-inset-bottom) - 20rpx);
  74. }
  75. .content-item {
  76. display: flex;
  77. position: relative;
  78. align-items: center;
  79. .person {
  80. height: 64rpx;
  81. min-width: 64rpx;
  82. border-radius: 50%;
  83. border: 1rpx solid rgba(0, 149, 235, 0.15);
  84. background-color: rgba(0, 149, 235, 0.1);
  85. margin-left: 0px;
  86. color: #0095F2;
  87. line-height: 64rpx;
  88. font-size: 22rpx;
  89. text-align: center;
  90. margin-left: 20rpx;
  91. }
  92. .word {
  93. margin-left: 20rpx;
  94. font-size: 30rpx;
  95. color: #5b5757;
  96. width: 500rpx;
  97. word-break: break-all;
  98. }
  99. }
  100. </style>