shopTourDetails.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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;" v-if="itemList.length == 0">
  25. <u-empty text="暂无数据" img-width="120" 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{
  97. height: 100%;
  98. }
  99. .shopTourDetails-wrap{
  100. height: 100%;
  101. background-color: #f8f8f8;
  102. display: flex;
  103. justify-content: space-between;
  104. .scroll-con-l{
  105. display: inline-block;
  106. width: 28%;
  107. height: 99%;
  108. margin: 1% 1% 0;
  109. box-sizing: border-box;
  110. .item-con{
  111. .item-tit{
  112. text-align: center;
  113. padding: 26upx 20upx;
  114. margin-bottom: 12upx;
  115. background-color: #fff;
  116. position: relative;
  117. }
  118. .item-tit.active{
  119. border-right: 1px solid #00aaff;
  120. color: #00aaff;
  121. }
  122. }
  123. }
  124. .scroll-con-r{
  125. display: inline-block;
  126. width: 68%;
  127. height: 99%;
  128. margin: 1% 1% 0 0;
  129. .item-con{
  130. padding: 14upx 30upx;
  131. margin-bottom: 18upx;
  132. border-radius: 12upx;
  133. background-color: #fff;
  134. .item-tit{
  135. font-weight: bold;
  136. }
  137. .item-main{
  138. padding: 14upx 0;
  139. display: flex;
  140. justify-content: space-between;
  141. .item-state{
  142. font-size: 26upx;
  143. text.green{
  144. color: #19be6b;
  145. }
  146. text.yellow{
  147. color: #ff9900;
  148. }
  149. text.red{
  150. color: #fa3534;
  151. }
  152. }
  153. .item-btn{
  154. font-size: 24upx;
  155. color: #2979ff;
  156. }
  157. }
  158. .item-footer{
  159. font-size: 24upx;
  160. color: #464646;
  161. }
  162. }
  163. }
  164. }
  165. </style>