info.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  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.repair_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.repair_username || '-'}}</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.assigntime || '-'}}</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.status_text || '-'}}</view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="card cu-list menu margin-top bg-white shadow-warp">
  25. <view class="sub-title">报修信息</view>
  26. <view class="info margin-sm">
  27. <view class="flex flex-wrap">
  28. <view class="basis-sm padding-sm">报修日期</view>
  29. <view class="basis-lg padding-sm">{{info.registertime || '-'}}</view>
  30. </view>
  31. <view class="flex flex-wrap">
  32. <view class="basis-sm padding-sm">报修人员</view>
  33. <view class="basis-lg padding-sm">{{info.register_name || '-'}}</view>
  34. </view>
  35. <view class="flex flex-wrap">
  36. <view class="basis-sm padding-sm">联系电话</view>
  37. <view class="basis-lg padding-sm" @click="call(info.register_mobile)">
  38. {{info.register_mobile || '-'}}
  39. </view>
  40. </view>
  41. <view class="flex flex-wrap">
  42. <view class="basis-sm padding-sm">报修登记</view>
  43. <view class="basis-lg padding-sm">{{info.register_content != null ? info.register_content : '-'}}
  44. </view>
  45. </view>
  46. <view class="flex flex-wrap">
  47. <view class="basis-sm padding-sm">现场照片</view>
  48. <view class="basis-lg padding-sm" @click="viewDocument(info.register_image)">
  49. <image :src="info.register_image" mode="widthFix" style="width: 100%;"
  50. v-if="info.register_image != ''"></image>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="card cu-list menu margin-top bg-white shadow-warp"
  56. v-if="info.status == 'repaired' || info.status == 'scrapped'">
  57. <view class="sub-title">维修结果</view>
  58. <view class="info margin-sm">
  59. <view class="flex flex-wrap">
  60. <view class="basis-sm padding-sm">维修日期</view>
  61. <view class="basis-lg padding-sm">{{info.repairtime || '-'}}</view>
  62. </view>
  63. <view class="flex flex-wrap">
  64. <view class="basis-sm padding-sm">维修耗时</view>
  65. <view class="basis-lg padding-sm">{{info.consuming || '-'}}</view>
  66. </view>
  67. <view class="flex flex-wrap">
  68. <view class="basis-sm padding-sm">故障原因</view>
  69. <view class="basis-lg padding-sm">{{info.failure_cause || '-'}}</view>
  70. </view>
  71. <view class="flex flex-wrap">
  72. <view class="basis-sm padding-sm">维修说明</view>
  73. <view class="basis-lg padding-sm">{{info.repair_content || '-'}}</view>
  74. </view>
  75. <view class="flex flex-wrap">
  76. <view class="basis-sm padding-sm">现场照片</view>
  77. <view class="basis-lg padding-sm" @click="viewDocument(info.repair_image)">
  78. <image :src="info.repair_image" mode="widthFix" style="width: 100%;"
  79. v-if="info.repair_image != ''"></image>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="card cu-list menu margin-top bg-white shadow-warp">
  85. <view class="sub-title">设备信息</view>
  86. <view class="info margin-sm">
  87. <view class="flex flex-wrap">
  88. <view class="basis-sm padding-sm">设备编号</view>
  89. <view class="basis-lg padding-sm">{{info.equipment_code || ''}}</view>
  90. </view>
  91. <view class="flex flex-wrap">
  92. <view class="basis-sm padding-sm">设备型号</view>
  93. <view class="basis-lg padding-sm">{{info.archive_model || ''}}</view>
  94. </view>
  95. <view class="flex flex-wrap">
  96. <view class="basis-sm padding-sm">设备名称</view>
  97. <view class="basis-lg padding-sm">{{info.archive_name || ''}}</view>
  98. </view>
  99. <view class="flex flex-wrap">
  100. <view class="basis-sm padding-sm">所在区域</view>
  101. <view class="basis-lg padding-sm">{{info.archive_region || ''}}</view>
  102. </view>
  103. <view class="flex flex-wrap">
  104. <view class="basis-sm padding-sm">设备详情</view>
  105. <view class="basis-lg padding-sm text-blue" @click="goEquipmentInfo(info.equipment_coding)">查看
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. <view style="height: 80px;"></view>
  111. <view class="cu-bar bg-white tabbar flex flex-wrap" @click="register()" v-if="info.status == 'registered'">
  112. <button class="bg-black submit basis-sm" style="border-radius: 0;">维修登记</button>
  113. </view>
  114. <view class="cu-bar bg-white tabbar flex flex-wrap" @click="receive()" v-if="info.status == 'pending'">
  115. <button class="bg-black submit basis-sm" style="border-radius: 0;">我要接单</button>
  116. </view>
  117. </view>
  118. </template>
  119. <script>
  120. var _self
  121. var repair_id = 0
  122. var flag = false
  123. export default {
  124. data() {
  125. return {
  126. info: {}
  127. };
  128. },
  129. onLoad(e) {
  130. _self = this
  131. if (!e.id) {
  132. _self.tui.toast("未知维修工单");
  133. setTimeout(function() {
  134. uni.navigateBack();
  135. }, 1500);
  136. return;
  137. }
  138. repair_id = e.id
  139. _self.getInfo()
  140. },
  141. methods: {
  142. getInfo() {
  143. uni.showLoading({
  144. title: '查询中...'
  145. });
  146. _self.$api.repairInfo({
  147. id: repair_id
  148. }).then((res) => {
  149. uni.hideLoading();
  150. _self.info = res.data;
  151. }).catch((err) => {
  152. uni.hideLoading()
  153. _self.tui.toast(err.msg)
  154. });
  155. },
  156. viewDocument(url) {
  157. if (url == '') return;
  158. let suffix = url.slice(-4);
  159. if (suffix == '.pdf') {
  160. uni.showLoading({
  161. title: '加载中...',
  162. mask: true
  163. });
  164. uni.downloadFile({
  165. url,
  166. success: function(res) {
  167. if (res.statusCode === 200) {
  168. let filePath = res.tempFilePath
  169. uni.openDocument({
  170. filePath,
  171. fileType: 'pdf',
  172. success: function(res) {},
  173. fail: function(err) {
  174. _self.tui.toast('文档加载失败');
  175. },
  176. complete: function() {
  177. uni.hideLoading();
  178. }
  179. })
  180. } else {
  181. uni.hideLoading();
  182. _self.tui.toast('文档加载失败');
  183. }
  184. },
  185. fail: function(err) {
  186. uni.hideLoading();
  187. _self.tui.toast('文档加载失败');
  188. }
  189. });
  190. } else {
  191. uni.previewImage({
  192. urls: [url],
  193. });
  194. }
  195. },
  196. register() {
  197. uni.navigateTo({
  198. url: '/pages/repair/register?repair_id=' + _self.info.repair_id
  199. })
  200. },
  201. receive() {
  202. if (flag) return
  203. if (!repair_id) {
  204. _self.tui.toast('未知维修工单')
  205. return
  206. }
  207. uni.showModal({
  208. title: '提示',
  209. content: '是否确认接单?',
  210. cancelText: '再看看',
  211. confirmText: '确定',
  212. cancelColor: '#8799a3',
  213. confirmColor: '#333333',
  214. success: res => {
  215. if (res.confirm) {
  216. _self.doReceive()
  217. }
  218. }
  219. })
  220. },
  221. doReceive() {
  222. uni.showLoading({
  223. title: '接单中...'
  224. })
  225. _self.$api.receiveRepairs({
  226. repair_id
  227. }).then((res) => {
  228. flag = false
  229. uni.hideLoading()
  230. _self.tui.toast('接单成功', '', 'success')
  231. setTimeout(function() {
  232. uni.$emit('repairChange', {
  233. ischange: true,
  234. type: 'repair'
  235. })
  236. _self.getInfo()
  237. }, 1500)
  238. }).catch((err) => {
  239. flag = false
  240. uni.hideLoading()
  241. _self.tui.toast(err.msg)
  242. })
  243. },
  244. goEquipmentInfo(coding) {
  245. uni.navigateTo({
  246. url: '/pages/equipment/info?coding=' + coding
  247. })
  248. }
  249. }
  250. }
  251. </script>
  252. <style lang="scss">
  253. .sub-title {
  254. color: #333333;
  255. font-size: 28rpx;
  256. padding: 10rpx 20rpx;
  257. font-weight: bold;
  258. }
  259. .info {
  260. margin-top: 10rpx;
  261. border: 1px #F1F1F1 solid;
  262. border-bottom: 0;
  263. font-size: 26rpx;
  264. color: #606266;
  265. .flex {
  266. border-bottom: 1px #F1F1F1 solid;
  267. background-color: #FFFFFF;
  268. view {
  269. padding: 8px 10px;
  270. box-sizing: border-box;
  271. }
  272. .basis-sm {
  273. border-right: 1px #F1F1F1 solid;
  274. }
  275. }
  276. }
  277. .cu-bar.tabbar {
  278. position: fixed;
  279. width: 100%;
  280. left: 0;
  281. bottom: 0;
  282. }
  283. .cu-list+.cu-list {
  284. margin-top: 20rpx;
  285. }
  286. .card {
  287. margin: 20rpx;
  288. border-radius: 10rpx;
  289. padding: 20rpx 0;
  290. }
  291. </style>