Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

151 lignes
2.9 KiB

  1. <template>
  2. <view class="box">
  3. <!-- 顾问选择 -->
  4. <view class="nextcon">
  5. 最多选择五项
  6. </view>
  7. <view class="content">
  8. <scroll-view style="height: 1170rpx;" scroll-y="true" >
  9. <checkbox-group v-model="value" @change="checkboxChange">
  10. <view v-for="(item,index) in items" :key="index">
  11. <view class="content-tips">
  12. <view class="left">
  13. {{item.deptName}}
  14. </view>
  15. <view class="right">
  16. <radio :value="item.deptId" style="transform:scale(0.8)" color="#2671E2" :checked="item.checked" @click="addclick(index)"></radio>
  17. </view>
  18. </view>
  19. </view>
  20. </checkbox-group>
  21. </scroll-view>
  22. <view class="zhedang"></view>
  23. <view class="btn" @click="goback">
  24. 确定
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data(){
  32. return{
  33. value:[],
  34. items:[],
  35. ids:''
  36. }
  37. },
  38. onLoad(e) {
  39. // 获取项目id
  40. // console.log(e)
  41. this.ids=e.ids
  42. this.houseId = uni.getStorageSync('buildingID').id;
  43. this.getSectionList()
  44. },
  45. methods:{
  46. checkboxChange (e) {
  47. // console.log(e)
  48. },
  49. // 获取部门列表
  50. getSectionList(){
  51. this.$u.post('/cusLvStatistics/findAllDeptIdByHouseId',{houseId:this.houseId})
  52. .then(res=>{
  53. console.log(res)
  54. res.map((item,index)=>{
  55. if(index<5){
  56. item.checked=true
  57. }else{
  58. item.checked=false
  59. }
  60. })
  61. this.items=res
  62. if(this.ids){
  63. let arr=this.ids.split(',')
  64. this.items.map((item,index)=>{
  65. let idx=arr.findIndex(item1=>item1==item.deptId)
  66. if(idx!=-1){
  67. item.checked=true
  68. }else{
  69. item.checked=false
  70. }
  71. })
  72. }
  73. })
  74. },
  75. addclick(index){
  76. this.items[index].checked=!this.items[index].checked
  77. },
  78. goback(){
  79. // 循环遍历所有选定的内容
  80. let arr=[]
  81. this.items.map(item=>{
  82. if(item.checked){
  83. arr.push(item.deptId)
  84. }
  85. })
  86. uni.$emit('update',{arr})
  87. uni.navigateBack()
  88. },
  89. }
  90. }
  91. </script>
  92. <style lang="scss" scoped>
  93. .box{
  94. background: #F8F8F8;
  95. width: 100%;
  96. height: 100%;
  97. font-size: 30rpx;
  98. font-weight: 400;
  99. // line-height: 30px;
  100. .nextcon{
  101. height: 78rpx;
  102. background: #F4F8FD;
  103. color: #2671E2;
  104. text-align: center;
  105. line-height: 78rpx;
  106. }
  107. .content-tips{
  108. display: flex;
  109. justify-content: space-between;
  110. background: #fff;
  111. padding: 0 30rpx;
  112. height: 92rpx;
  113. margin-bottom: 20rpx;
  114. .left{
  115. display: flex;
  116. // margin-top: 30rpx;
  117. font-weight: 500;
  118. color: #303030;
  119. line-height: 92rpx;
  120. font-size: 30rpx;
  121. }
  122. .right{
  123. margin: 24rpx 0;
  124. }
  125. }
  126. .btn{
  127. width: 690rpx;
  128. height: 88rpx;
  129. background: #2671E2;
  130. border-radius: 8rpx;
  131. font-size: 32rpx;
  132. font-weight: 400;
  133. color: #FFFFFF;
  134. line-height: 88rpx;
  135. text-align: center;
  136. position: fixed;
  137. left: 30rpx;
  138. bottom: 80rpx;
  139. }
  140. .zhedang{
  141. height: 168rpx;
  142. opacity: 0;
  143. }
  144. }
  145. </style>