patrol.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <!-- 巡检进度页 -->
  3. <view class="m-w partol">
  4. <view class="logo-back"></view>
  5. <view class="title-font m-w u-p-l-30 u-p-r-30">
  6. <view class="m-w u-m-t-10">
  7. <view class="u-f-32 f-w-b">{{ parobj.name }}</view>
  8. <view class="u-m-t-16 u-flex">
  9. <view class="u-m-r-14">开始时间:{{ beginTime.slice(0, -3) }}</view>
  10. <view class="u-m-r-14">
  11. <u-tag :text="status[statusType].text" :color="status[statusType].color" />
  12. </view>
  13. </view>
  14. <view class="u-m-t-16">截至时间:{{ endTime.slice(0, -3) }}</view>
  15. <view class="u-m-t-20" v-if="parobj.total">今日巡查:{{ parobj.completed }}/{{ parobj.total }}</view>
  16. <view class="u-m-t-20 u-flex" v-if="parobj.total">
  17. <view>完成进度:</view>
  18. <view style="width: 255rpx; height: 30rpx">
  19. <u-line-progress
  20. :show-percent="false"
  21. active-color="#ffffff"
  22. :round="true"
  23. inactive-color="rgba(255, 255, 255, .3)"
  24. :percent="Math.round((parobj.completed / parobj.total) * 100)"
  25. ></u-line-progress>
  26. </view>
  27. <view class="u-m-l-20">{{ Math.round((parobj.completed / parobj.total) * 100) }}%</view>
  28. </view>
  29. </view>
  30. <scroll-view :scroll-y="true" class="cell-item u-m-t-40 u-p-l-20 u-p-r-20">
  31. <view @click="checkdeatal(index, parobj.id)" class="u-flex menu-list" v-for="(index, key) in parobj.rooms" :key="key">
  32. <view class="item-left-title">{{ key + 1 }}</view>
  33. <block v-if="!index.completed">
  34. <u-image :src="imgstatus[3]" width="80" height="80"></u-image>
  35. </block>
  36. <block v-else>
  37. <u-image :src="imgstatus[index.qualified == true ? 1 : 2]" width="80" height="80"></u-image>
  38. </block>
  39. <view class="item-right-font">
  40. <view>点编号:{{ index.name }}</view>
  41. <view class="u-m-t-20">设备名称:{{ index.number }}</view>
  42. </view>
  43. <view class="uicon">
  44. <u-icon name="arrow-right" size="30" color="rgba(153, 153, 153, 1)"></u-icon>
  45. </view>
  46. </view>
  47. </scroll-view>
  48. </view>
  49. <view class="sumit" @click="saoma(1)">扫码巡检</view>
  50. </view>
  51. </template>
  52. <script>
  53. import dayjs from 'dayjs'
  54. import backtitle from '@/static/img/partrol/back.png'
  55. import hege from '@/static/img/hege.png'
  56. import bhg from '@/static/img/bhg.png'
  57. import wks from '@/static/img/wks.png'
  58. import { patrolTaskinfo, pointDetailForMobile, getPointInfoOfScanaa } from '@/api/index.js'
  59. export default {
  60. data() {
  61. return {
  62. backtitle,
  63. imgstatus: ['', hege, bhg, wks],
  64. parobj: '',
  65. status: [
  66. '',
  67. {
  68. text: '暂未巡检',
  69. color: '#002AC5'
  70. },
  71. {
  72. text: '进行中',
  73. color: '#CF6100'
  74. },
  75. {
  76. text: '已结束',
  77. color: '#009C33'
  78. },
  79. {
  80. text: '超时漏检',
  81. color: 'red'
  82. },
  83. {
  84. text: '超时完成',
  85. color: 'yellow'
  86. }
  87. ],
  88. taskId: -1,
  89. statusType: ''
  90. }
  91. },
  92. onLoad({ taskId, status }) {
  93. this.taskId = taskId
  94. this.statusType = status
  95. this.init(taskId)
  96. },
  97. methods: {
  98. saoma(id) {
  99. if (id == 1) {
  100. this.$store.dispatch('user/gettasklist')
  101. return false
  102. } else {
  103. return true
  104. }
  105. },
  106. checkdeatal(row, renwuid) {
  107. const { completed, id, qualified } = row
  108. if (completed) {
  109. uni.navigateTo({
  110. url: `../patroldetail/patroldetail?roomId=${id}&taskId=${renwuid}`
  111. })
  112. } else {
  113. uni.navigateTo({
  114. url: `../checkdetail/checkdetail?roomId=${id}&taskId=${renwuid}`
  115. })
  116. }
  117. },
  118. async init(id) {
  119. let { data } = await patrolTaskinfo(id)
  120. this.parobj = data
  121. }
  122. },
  123. computed: {
  124. beginTime() {
  125. return dayjs(this.parobj.beginTime).format('YYYY-MM-DD HH:mm:ss')
  126. },
  127. endTime() {
  128. return dayjs(this.parobj.endTime).format('YYYY-MM-DD HH:mm:ss')
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss">
  134. .partol {
  135. height: 100vh;
  136. background: #f0f2f5;
  137. .logo-back {
  138. width: 751rpx;
  139. height: 350rpx;
  140. position: relative;
  141. &::after {
  142. content: '';
  143. width: 140%;
  144. height: 350rpx;
  145. position: absolute;
  146. left: -20%;
  147. top: 0;
  148. border-radius: 0 0 45% 45%;
  149. background: #4a8bff !important;
  150. }
  151. }
  152. .title-font {
  153. height: 100rpx;
  154. font-size: 28rpx;
  155. font-weight: 400;
  156. color: #ffffff;
  157. position: absolute;
  158. top: 0;
  159. display: flex;
  160. flex-direction: column;
  161. align-items: center;
  162. .cell-item {
  163. width: 690rpx;
  164. height: calc(100vh - 347rpx);
  165. background: #ffffff;
  166. border-radius: 20rpx 20rpx 0px 0px;
  167. padding: 1rpx;
  168. box-sizing: border-box;
  169. }
  170. .menu-list {
  171. margin-top: 28rpx;
  172. align-items: center;
  173. padding-bottom: 30rpx;
  174. border-bottom: 1rpx solid #e6e6e6;
  175. .item-left-title {
  176. width: 40rpx;
  177. height: 40rpx;
  178. background: #4a8bff;
  179. border-radius: 50%;
  180. text-align: center;
  181. line-height: 40rpx;
  182. margin-right: 40rpx;
  183. }
  184. .item-right-font {
  185. margin-left: 21rpx;
  186. font-size: 28rpx;
  187. font-family: Microsoft YaHei-3970(82674968);
  188. font-weight: 400;
  189. color: #333333;
  190. }
  191. .uicon {
  192. position: absolute;
  193. right: 23rpx;
  194. }
  195. }
  196. }
  197. view {
  198. line-height: 1;
  199. }
  200. .sumit {
  201. position: fixed;
  202. bottom: 20rpx;
  203. width: 600rpx;
  204. height: 88rpx;
  205. margin-top: 98rpx;
  206. color: white;
  207. background-color: #2a82e4;
  208. border-radius: 5px;
  209. font-size: 16px;
  210. line-height: 88rpx;
  211. text-align: center;
  212. left: 75rpx;
  213. }
  214. }
  215. </style>