record.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view class="container">
  3. <view class="card cu-list menu margin-top bg-white shadow-warp">
  4. <view class="sub-title">基础信息</view>
  5. <view class="info margin-sm">
  6. <view class="flex flex-wrap">
  7. <view class="basis-sm padding-sm">设备编号</view>
  8. <view class="basis-lg padding-sm">{{info.equipment_code || ''}}</view>
  9. </view>
  10. <view class="flex flex-wrap">
  11. <view class="basis-sm padding-sm">设备型号</view>
  12. <view class="basis-lg padding-sm">{{info.archive_model || ''}}</view>
  13. </view>
  14. <view class="flex flex-wrap">
  15. <view class="basis-sm padding-sm">设备名称</view>
  16. <view class="basis-lg padding-sm">{{info.archive_name || ''}}</view>
  17. </view>
  18. <view class="flex flex-wrap">
  19. <view class="basis-sm padding-sm">维修人员</view>
  20. <view class="basis-lg padding-sm">{{info.repair_user || ''}}</view>
  21. </view>
  22. <view class="flex flex-wrap">
  23. <view class="basis-sm padding-sm">维修时间</view>
  24. <view class="basis-lg padding-sm">{{info.repairtime || ''}}</view>
  25. </view>
  26. <view class="flex flex-wrap">
  27. <view class="basis-sm padding-sm">维修时长</view>
  28. <view class="basis-lg padding-sm">{{info.consuming || ''}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="card cu-list menu margin-top bg-white shadow-warp">
  33. <view class="sub-title marin-top-sm">维修结果</view>
  34. <view class="info margin-sm">
  35. <view class="flex flex-wrap">
  36. <view class="basis-sm padding-sm">维修结果</view>
  37. <view class="basis-lg padding-sm text-red text-bold">{{info.status_text || ''}}</view>
  38. </view>
  39. <view class="flex flex-wrap">
  40. <view class="basis-sm padding-sm">故障原因</view>
  41. <view class="basis-lg padding-sm">{{info.failure_cause || ''}}</view>
  42. </view>
  43. <view class="flex flex-wrap">
  44. <view class="basis-sm padding-sm">维修内容</view>
  45. <view class="basis-lg padding-sm">{{info.repair_content || ''}}</view>
  46. </view>
  47. <view class="flex flex-wrap">
  48. <view class="basis-sm padding-sm">现场照片</view>
  49. <view class="basis-lg padding-sm" @click="viewDocument(info.repair_image)">
  50. <image :src="info.repair_image" mode="widthFix" style="width: 100%;"
  51. v-if="info.repair_image != ''">
  52. </image>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="card cu-list menu margin-top bg-white shadow-warp">
  58. <view class="sub-title marin-top-sm">报修登记</view>
  59. <view class="info margin-sm">
  60. <view class="flex flex-wrap">
  61. <view class="basis-sm padding-sm">报修人员</view>
  62. <view class="basis-lg padding-sm">{{info.register_user || ''}}</view>
  63. </view>
  64. <view class="flex flex-wrap">
  65. <view class="basis-sm padding-sm">报修时间</view>
  66. <view class="basis-lg padding-sm">{{info.registertime || ''}}</view>
  67. </view>
  68. <view class="flex flex-wrap">
  69. <view class="basis-sm padding-sm">报修内容</view>
  70. <view class="basis-lg padding-sm">{{info.register_content || ''}}</view>
  71. </view>
  72. <view class="flex flex-wrap">
  73. <view class="basis-sm padding-sm">现场照片</view>
  74. <view class="basis-lg padding-sm" @click="viewDocument(info.register_image)">
  75. <image :src="info.register_image" mode="widthFix" style="width: 100%;"
  76. v-if="info.register_image != ''"></image>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <view style="height: 20rpx;"></view>
  82. </view>
  83. </template>
  84. <script>
  85. var _self;
  86. export default {
  87. data() {
  88. return {
  89. info: {}
  90. };
  91. },
  92. onLoad(e) {
  93. _self = this;
  94. if (!e.id) {
  95. _self.tui.toast("未知记录");
  96. setTimeout(function() {
  97. uni.navigateBack();
  98. }, 1500);
  99. return;
  100. }
  101. _self.getInfo(e.id);
  102. },
  103. methods: {
  104. getInfo(id) {
  105. uni.showLoading({
  106. title: '查询中...'
  107. });
  108. _self.$api.getRecordInfo({
  109. id
  110. }).then((res) => {
  111. uni.hideLoading();
  112. _self.info = res.data;
  113. }).catch((err) => {
  114. uni.hideLoading()
  115. _self.tui.toast(err.msg)
  116. });
  117. },
  118. viewDocument(url) {
  119. if (url == '') return;
  120. let suffix = url.slice(-4);
  121. if (suffix == '.pdf') {
  122. uni.showLoading({
  123. title: '加载中...',
  124. mask: true
  125. });
  126. uni.downloadFile({
  127. url,
  128. success: function(res) {
  129. if (res.statusCode === 200) {
  130. let filePath = res.tempFilePath
  131. uni.openDocument({
  132. filePath,
  133. fileType: 'pdf',
  134. success: function(res) {},
  135. fail: function(err) {
  136. _self.tui.toast('文档加载失败');
  137. },
  138. complete: function() {
  139. uni.hideLoading();
  140. }
  141. })
  142. } else {
  143. uni.hideLoading();
  144. _self.tui.toast('文档加载失败');
  145. }
  146. },
  147. fail: function(err) {
  148. uni.hideLoading();
  149. _self.tui.toast('文档加载失败');
  150. }
  151. });
  152. } else {
  153. uni.previewImage({
  154. urls: [url],
  155. });
  156. }
  157. }
  158. }
  159. }
  160. </script>
  161. <style lang="scss">
  162. .sub-title {
  163. color: #333333;
  164. font-size: 28rpx;
  165. padding: 10rpx 20rpx;
  166. font-weight: bold;
  167. }
  168. .info {
  169. margin-top: 10rpx;
  170. border: 1px #F1F1F1 solid;
  171. border-bottom: 0;
  172. font-size: 26rpx;
  173. color: #606266;
  174. .flex {
  175. border-bottom: 1px #F1F1F1 solid;
  176. background-color: #FFFFFF;
  177. view {
  178. padding: 8px 10px;
  179. box-sizing: border-box;
  180. }
  181. .basis-sm {
  182. border-right: 1px #F1F1F1 solid;
  183. }
  184. }
  185. .grid {
  186. border-bottom: 1px #F1F1F1 solid;
  187. background-color: #FFFFFF;
  188. }
  189. }
  190. .cu-list+.cu-list {
  191. margin-top: 20rpx;
  192. }
  193. .card {
  194. margin: 20rpx;
  195. border-radius: 10rpx;
  196. padding: 20rpx 0;
  197. }
  198. </style>