maintain-detail.vue 8.1 KB

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