planDetail.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="kp-details">
  3. <!-- 考评项 -->
  4. <view class="kp-tabsBox" v-if="list.length">
  5. <view class="kp-tabs">
  6. <view
  7. v-for="(item,index) in list"
  8. :key="item.id"
  9. @click="onTab(index)"
  10. :class="activeIndx==index?'active':''">
  11. <view>{{item.name}}</view>
  12. <view>({{item.assessTargetNum}}项)</view>
  13. </view>
  14. </view>
  15. <view class="kp-items">
  16. <view v-for="(item,index) in list[activeIndx].assessTargetList" :key="item.id">
  17. {{item.name}}
  18. </view>
  19. </view>
  20. </view>
  21. <view class="kp-tabsBox" v-if="noDateText!=''">
  22. <u-empty style="width: 100%;padding-top: 10vh;" :text="noDateText" img-width="120" mode="list"></u-empty>
  23. </view>
  24. <!-- 选择按钮 -->
  25. <view class="kp-ok" @click="kpOk">
  26. 确认选择该考评方案
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import {queryItemBySchemeId} from '@/api/assess'
  32. export default {
  33. data() {
  34. return {
  35. list: [],
  36. activeIndx:0,
  37. item:'',
  38. noDateText:''
  39. }
  40. },
  41. onLoad(opts) {
  42. this.item = JSON.parse(opts.item)
  43. console.log({schemeId:this.item.id})
  44. // 查询方案的项
  45. queryItemBySchemeId({schemeId:this.item.id}).then(res=>{
  46. console.log(res)
  47. if(res.status == 200){
  48. this.list = res.data
  49. this.noDateText = this.list.length?'':'暂无考评项'
  50. }else{
  51. this.noDateText = res.message
  52. }
  53. })
  54. },
  55. methods: {
  56. // 选中方案
  57. kpOk(item) {
  58. uni.$emit("resetTaskKpItem",this.item)
  59. uni.navigateBack({
  60. delta:2
  61. })
  62. },
  63. // onTab
  64. onTab(index){
  65. this.activeIndx = index
  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. display: flex;
  82. .kp-tabs{
  83. width: 30%;
  84. text-align: center;
  85. margin: 15upx;
  86. overflow: auto;
  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. overflow: auto;
  113. > view{
  114. padding: 20upx;
  115. background: #fff;
  116. border-bottom: 5px solid #F8F8F8;
  117. }
  118. }
  119. }
  120. .kp-ok{
  121. text-align: center;
  122. padding: 26upx;
  123. background: #55aaff;
  124. color: #fff;
  125. font-size: 18px;
  126. }
  127. }
  128. </style>