evaluateItem.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="kp-details">
  3. <!-- 考评项 -->
  4. <view class="kp-tabsBox">
  5. <view class="kp-tabs">
  6. <view @click="onTab(index)" :class="activeIndex == index ? 'active':''" v-for="(item,index) in items" :key="item.id">
  7. <view>{{item.name}}</view>
  8. <view>({{item.assessTargetNum}}项)</view>
  9. </view>
  10. </view>
  11. <view class="kp-items">
  12. <view>
  13. <checkbox-group @change="checkboxChange" class="checkbox-group">
  14. <label v-for="item in childItems" :key="item.id" >
  15. <view class="checkbox-item">
  16. <view class="item-name">{{item.name}}</view>
  17. <view>
  18. <checkbox :value="item.id" :checked="item.checked" />
  19. </view>
  20. </view>
  21. </label>
  22. </checkbox-group>
  23. </view>
  24. </view>
  25. </view>
  26. <!-- 选择按钮 -->
  27. <view class="kp-ok">
  28. 确定选择
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import {findAllItem} from '@/api/assess'
  34. export default{
  35. data(){
  36. return{
  37. items: [],
  38. activeIndex:0,
  39. childItems:[]
  40. }
  41. },
  42. onLoad() {
  43. findAllItem().then(res=>{
  44. if(res.status == 200){
  45. this.items = res.data
  46. this.onTab(0)
  47. }
  48. })
  49. },
  50. methods:{
  51. onTab(index){
  52. this.activeIndex = index
  53. this.childItems = this.items[index].assessTargetList
  54. },
  55. checkboxChange: function (e) {
  56. var items = this.items,
  57. values = e.detail.value;
  58. for (var i = 0, lenI = items.length; i < lenI; ++i) {
  59. const item = items[i]
  60. if(values.includes(item.value)){
  61. this.$set(item,'checked',true)
  62. }else{
  63. this.$set(item,'checked',false)
  64. }
  65. }
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss">
  71. page{
  72. height: 100%;
  73. background: #F8F8F8;
  74. }
  75. .kp-details{
  76. height: 100%;
  77. display: flex;
  78. flex-direction: column;
  79. .kp-tabsBox{
  80. flex-grow: 1;
  81. overflow: auto;
  82. display: flex;
  83. .kp-tabs{
  84. width: 30%;
  85. text-align: center;
  86. margin: 15upx;
  87. > view{
  88. padding: 15upx;
  89. background: #fff;
  90. border-radius: 6upx;
  91. box-shadow: 1px 2px 3px #eee;
  92. margin-bottom: 15upx;
  93. > view{
  94. &:last-child{
  95. color: #666;
  96. }
  97. }
  98. }
  99. > view.active{
  100. background: #00aaff;
  101. color: #fff;
  102. > view{
  103. &:last-child{
  104. color: #fff;
  105. }
  106. }
  107. }
  108. }
  109. .kp-items{
  110. width: 70%;
  111. margin: 15upx 15upx 15upx 6upx;
  112. > view{
  113. .checkbox-group{
  114. .checkbox-item{
  115. width:100%;
  116. padding: 15upx;
  117. border-radius: 6upx;
  118. box-shadow: 1px 2px 3px #eee;
  119. background: #fff;
  120. display: flex;
  121. justify-content: space-between;
  122. margin-bottom: 15upx;
  123. }
  124. }
  125. }
  126. }
  127. }
  128. .kp-ok{
  129. text-align: center;
  130. padding: 26upx;
  131. background: #55aaff;
  132. color: #fff;
  133. font-size: 18px;
  134. }
  135. }
  136. </style>