maintain-detail.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="container py2">
  3. <view class="mx3 p3 bg-color-white" style="border-radius: 16rpx">
  4. <equipment-line title="状态" :content="statusMap[infoData.status]" />
  5. <equipment-line title="要求" :content="infoData.requirement" />
  6. <equipment-line title="执行标准" :content="infoData.remark" />
  7. <equipment-line title="实际开始" :content="infoData.actualStartTime" />
  8. <equipment-line title="完成时间" :content="infoData.actualEndTime" />
  9. </view>
  10. <view class="m3 p3 bg-color-white" style="border-radius: 16rpx">
  11. <view class="pb-3 border-bottom">
  12. <view class="f-size-30 main-color-text w200">检查项目</view>
  13. <view class="f-size-26 text-color-3 border-bottom py2" v-for="(item, index) in requirementList" :key="index">
  14. <view class="d-flex text-color-6">
  15. <view class="w180">保养周期:</view>
  16. <view class="text-color-3">{{ item.period }}</view>
  17. </view>
  18. <view class="d-flex text-color-6">
  19. <view class="w180">管理项目:</view>
  20. <view class="text-color-3">{{ item.manageItem }}</view>
  21. </view>
  22. <view class="d-flex text-color-6">
  23. <view class="w180">检查项目:</view>
  24. <view class="text-color-3">{{ item.checkItem }}</view>
  25. </view>
  26. <view class="d-flex text-color-6">
  27. <view class="w160">方法工具:</view>
  28. <view class="text-color-3">{{ item.method }}</view>
  29. </view>
  30. <view class="d-flex text-color-6">
  31. <view class="w160">保养级别:</view>
  32. <view class="text-color-3">{{ item.checkLevel }}</view>
  33. </view>
  34. <view class="d-flex text-color-6">
  35. <view class="w160">标准类型:</view>
  36. <view class="text-color-3">{{ item.sbTypeName }}</view>
  37. </view>
  38. <view class="d-flex text-color-6">
  39. <view class="w160">内容:</view>
  40. <view class="text-color-3">{{ item.remark }}</view>
  41. </view>
  42. <view class="d-flex text-color-6">
  43. <view class="w160">填报信息:</view>
  44. <view class="text-color-3 bold">{{ item.value }}</view>
  45. </view>
  46. <view class="d-flex text-color-6">
  47. <view class="w160">备注:</view>
  48. <view class="text-color-3">{{ item.text }}</view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="m3 p3 bg-color-white" style="border-radius: 16rpx">
  54. <view class="d-flex py3 border-bottom">
  55. <view class="f-size-26 text-color-9 w200">标准图片</view>
  56. <view class="f-size-26 text-color-3 d-flex ">
  57. <block v-for="(item, index) in checkImgList" :key="index">
  58. <u-image width="100" class="mr-2" :src="item" @click="handlePre(index)" mode="widthFix"><u-loading
  59. slot="loading"></u-loading></u-image>
  60. </block>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="m3 p3 bg-color-white" style="border-radius: 16rpx">
  65. <equipment-line title="检查结果" :content="infoData.feedback" />
  66. </view>
  67. <view class="p-fixed d-flex j-around a-center footer">
  68. <view v-if="infoData.status ===
  69. 1 ||
  70. infoData.status ===
  71. 4" class="main-color-bg text-color-white common" @tap="handleExecute">接收</view>
  72. <view v-if="infoData.status === 2 && displayTime === 0" class="main-color-bg text-color-white common2"
  73. @tap="handleStart">
  74. <u-icon name="play-circle-fill"></u-icon> 开始计时
  75. </view>
  76. <view v-if="infoData.status === 2 && displayTime > 0" class="main-color-bg text-color-white common2"
  77. @tap="handlePause">
  78. <u-icon name="play-circle-fill" v-if="timerStatus === 2"></u-icon><u-icon name="pause-circle-fill"
  79. v-else></u-icon> {{ time }}
  80. </view>
  81. <view v-if="infoData.status === 2" class="main-color-bg text-color-white common" @tap="handleFinish">完成</view>
  82. <view v-if="infoData.status === 3" class="main-color-bg text-color-white common" @tap="handleRepair">发起报修</view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. export default {
  88. data() {
  89. return {
  90. infoData: {},
  91. detailId: '',
  92. statusMap: null,
  93. sbStatusMap: null,
  94. filter: 0,
  95. searchType: null,
  96. checkImgList: [],
  97. requirementList: [],
  98. displayTime: 0,
  99. timer: null,
  100. timerStatus: 0,
  101. time: '00:00:00'
  102. }
  103. },
  104. onLoad(options) {
  105. this.detailId = options.detailId
  106. this.searchType = options.searchType
  107. this.filter = options.filter
  108. this.statusMap = this.$DictCache.getLabelByValueMapByType(this.$DictCache.TYPE.CHECK_JOB_STATUS)
  109. this.sbStatusMap = this.$DictCache.getLabelByValueMapByType(this.$DictCache.TYPE.SB_INFO_STATUS)
  110. },
  111. onShow() {
  112. this.initData()
  113. },
  114. methods: {
  115. handlePre(index) {
  116. uni.previewImage({
  117. urls: this.checkImgList,
  118. current: this.checkImgList[index],
  119. success() { }
  120. })
  121. },
  122. handleExecute() {
  123. this.$Http.execute(this.infoData).then(res => {
  124. this.initData()
  125. uni.showToast({ title: '已接收,请及时完成任务' })
  126. })
  127. },
  128. handleFinish() {
  129. uni.navigateTo({
  130. url: `/pages/maintain/finish?id=${this.infoData.id}&standardId=${this.infoData.standardId}`
  131. })
  132. },
  133. handleRepair() {
  134. uni.navigateTo({
  135. url: '/pages/repair-add/repair-add?detailId=' + this.infoData.sbId
  136. })
  137. },
  138. initData() {
  139. const that = this
  140. this.$Http
  141. .fetchCheckJob({
  142. id: this.detailId
  143. })
  144. .then(res => {
  145. this.infoData = res.data
  146. this.$Http.fetchCheckStandard({ id: res.data.standardId }).then(response => {
  147. if (res.data.conTask) {
  148. console.log(2)
  149. that.requirementList = JSON.parse(res.data.conTask)
  150. } else {
  151. that.requirementList = response.data.requirementList
  152. }
  153. })
  154. if (res.data.checkImgList.length > 0) {
  155. this.checkImgList = res.data.checkImgList.map(item => {
  156. return this.$BaseTool.UserUtil.getFileUrl(item.url)
  157. })
  158. }
  159. this.$Http.timerStatus({ referenceId: this.infoData.id }).then(resp => {
  160. this.timerStatus = resp.data.timerStatus
  161. this.$Http.timerAccumulatedTime({ referenceId: this.infoData.id }).then(res => {
  162. this.displayTime = res.data
  163. this.updateDisplay()
  164. if (resp.data.timerStatus === 1) {
  165. that.startLocalTimer()
  166. }
  167. })
  168. })
  169. })
  170. },
  171. handleStart() {
  172. this.$Http.timerStart({ referenceId: this.infoData.id }).then(res => {
  173. uni.showToast({ title: '已开始计时' })
  174. this.startLocalTimer()
  175. })
  176. },
  177. handlePause() {
  178. if (this.timerStatus === 2) {
  179. this.$Http.timerResume({ referenceId: this.infoData.id }).then(res => {
  180. this.timerStatus = res.data.timerStatus
  181. this.startLocalTimer()
  182. })
  183. return
  184. }
  185. this.$Http.timerPause({ referenceId: this.infoData.id }).then(res => {
  186. this.timerStatus = res.data.timerStatus
  187. clearInterval(this.timer)
  188. })
  189. },
  190. // 本地计时器(用于实时显示)
  191. startLocalTimer() {
  192. this.timer = setInterval(() => {
  193. this.displayTime += 1000
  194. this.updateDisplay()
  195. }, 1000)
  196. },
  197. updateDisplay() {
  198. const minutes = Math.floor(this.displayTime / 60000)
  199. const seconds = Math.floor((this.displayTime % 60000) / 1000)
  200. this.time = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`
  201. }
  202. }
  203. }
  204. </script>
  205. <style lang="less">
  206. page {
  207. background-color: #f4f4f4;
  208. }
  209. .container {
  210. padding-bottom: 100rpx;
  211. .footer {
  212. bottom: 0;
  213. left: 0;
  214. right: 0;
  215. background-color: #fff;
  216. z-index: 10000;
  217. }
  218. .title {
  219. border-bottom: 1rpx solid #f4f4f4;
  220. }
  221. .img {
  222. width: 100rpx;
  223. height: 100rpx;
  224. }
  225. .p-fixed {
  226. border-top: 1rpx solid #f4f4f4;
  227. height: 100rpx;
  228. .common {
  229. padding: 15rpx 100rpx;
  230. border-radius: 30rpx;
  231. background-color: #0082ff;
  232. color: #fff;
  233. }
  234. .common2 {
  235. padding: 15rpx 50rpx;
  236. border-radius: 30rpx;
  237. background-color: #0082ff;
  238. color: #fff;
  239. }
  240. }
  241. }
  242. </style>