shopTourDetails.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view class="shopTourDetails">
  3. <view class="shopTourDetails-wrap">
  4. <scroll-view scroll-y class="scroll-con-l">
  5. <view class="item-con" v-for="(item, index) in itemList" :key="index">
  6. <view :class="['item-tit', nowInd==index ? 'active' : '']" @click="changeType(index)">{{item.assessItemName}}</view>
  7. </view>
  8. </scroll-view>
  9. <scroll-view scroll-y class="scroll-con-r">
  10. <view class="item-con" v-for="(item, index) in evaluationItemsList" :key="index">
  11. <view class="item-tit">{{item.assessTargetName}}</view>
  12. <view class="item-main">
  13. <view class="item-state">状态:
  14. <text :class="item.result == 'PASS' ? 'green' : item.result == 'NOT_PASS' ? 'red' : item.result == 'NOT_WORK' ? 'yellow' : ''">{{item.resultDictValue}}</text>
  15. </view>
  16. <text v-if="item.comments || item.taskTargetPhotoList" class="item-btn" @click="getComments(item)">查看评论</text>
  17. </view>
  18. <!-- <view class="item-footer">
  19. 考核时间:2020-09-09 14:29
  20. </view> -->
  21. </view>
  22. </scroll-view>
  23. </view>
  24. <view style="width: 100%;padding-top: 10vh;">
  25. <u-empty text="暂无数据" img-width="120" v-if="itemList.length == 0" mode="list"></u-empty>
  26. </view>
  27. <!-- 查看评论 -->
  28. <comment-popup :openPopup="openPopup" :comments="comments" :taskTargetPhotoList="taskTargetPhotoList" @close="closePopup" />
  29. </view>
  30. </template>
  31. <script>
  32. import CommentPopup from './commentPopup.vue'
  33. import { getTaskItem } from '@/api/taskItem.js'
  34. export default{
  35. components: { CommentPopup },
  36. data(){
  37. return{
  38. itemList: [], // 考评项目
  39. evaluationItemsList: [], // 考评项
  40. nowInd: 0, // 当前考评分类
  41. openPopup: false, // 查看评论
  42. detail: null, // 详情
  43. taskId: '', // 任务id
  44. comments: '', // 评论
  45. taskTargetPhotoList: [], // 评论图片
  46. }
  47. },
  48. onLoad(opts) {
  49. this.taskId = opts.taskId
  50. this.getTaskItem()
  51. },
  52. methods: {
  53. // 获取详情
  54. getTaskItem(){
  55. getTaskItem({ id: this.taskId }).then(res => {
  56. if(res.status == 200&&res.data){
  57. this.itemList = res.data
  58. this.nowInd = 0
  59. if(this.itemList.length){
  60. this.evaluationItemsList = this.itemList[this.nowInd].taskTargetVOList ? this.itemList[this.nowInd].taskTargetVOList : []
  61. }
  62. }
  63. })
  64. },
  65. // 切换分类
  66. changeType(ind){
  67. this.nowInd = ind
  68. this.evaluationItemsList = this.itemList[this.nowInd].taskTargetVOList ? this.itemList[this.nowInd].taskTargetVOList : []
  69. },
  70. // 查看评论
  71. getComments(item){
  72. this.comments = item.comments ? item.comments : ''
  73. if(item.taskTargetPhotoList){
  74. let arr = []
  75. item.taskTargetPhotoList.map(params => {
  76. arr.push(params.photoPath)
  77. })
  78. this.taskTargetPhotoList = arr
  79. }else{
  80. this.taskTargetPhotoList = []
  81. }
  82. this.openPopup = true
  83. },
  84. // 关闭 查看评论
  85. closePopup(){
  86. this.openPopup = false
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. page {
  93. background-color: #f8f8f8;
  94. height: calc(100vh - 48px);
  95. }
  96. .shopTourDetails-wrap{
  97. height: 100%;
  98. background-color: #f8f8f8;
  99. display: flex;
  100. justify-content: space-between;
  101. .scroll-con-l{
  102. display: inline-block;
  103. width: 28%;
  104. height: 99%;
  105. margin: 1% 1% 0;
  106. box-sizing: border-box;
  107. .item-con{
  108. .item-tit{
  109. text-align: center;
  110. padding: 26upx 0;
  111. margin-bottom: 12upx;
  112. background-color: #fff;
  113. position: relative;
  114. }
  115. .item-tit.active{
  116. border-right: 1px solid #00aaff;
  117. color: #00aaff;
  118. }
  119. }
  120. }
  121. .scroll-con-r{
  122. display: inline-block;
  123. width: 68%;
  124. height: 99%;
  125. margin: 1% 1% 0 0;
  126. .item-con{
  127. padding: 14upx 30upx;
  128. margin-bottom: 18upx;
  129. border-radius: 12upx;
  130. background-color: #fff;
  131. .item-tit{
  132. font-weight: bold;
  133. }
  134. .item-main{
  135. padding: 14upx 0;
  136. display: flex;
  137. justify-content: space-between;
  138. .item-state{
  139. font-size: 26upx;
  140. text.green{
  141. color: #19be6b;
  142. }
  143. text.yellow{
  144. color: #ff9900;
  145. }
  146. text.red{
  147. color: #fa3534;
  148. }
  149. }
  150. .item-btn{
  151. font-size: 24upx;
  152. color: #2979ff;
  153. }
  154. }
  155. .item-footer{
  156. font-size: 24upx;
  157. color: #464646;
  158. }
  159. }
  160. }
  161. }
  162. </style>