repair-detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <view>
  3. <u-toast ref="uToast" />
  4. <view class="d-flex px3 py2">
  5. <view class="top d-flex a-center bg-color-white flex1 one-ellipsis">
  6. <view class="img" style="cursor:pointer">
  7. <image
  8. :src="
  9. imgSrc
  10. ? imgSrc
  11. : $BaseTool.UserUtil.getFileUrl(sbInfo.qrCode)
  12. "
  13. mode="widthFix"
  14. ></image>
  15. </view>
  16. <view class="pl-3">
  17. <view class="f-size-36 text-color-3 one-ellipsis">{{
  18. sbInfo.name
  19. }}</view>
  20. <view
  21. class="d-flex f-size-28 f-weight-6 f-wrap"
  22. style="margin: 20rpx 0"
  23. >
  24. </view>
  25. <view class="d-flex">
  26. <text
  27. class="f-size-26 mr-3 state-r main-color-bg text-color-white"
  28. >{{ statusMap[infoData.status] }}</text
  29. >
  30. <!-- <text class="f-size-26 state-g">报修</text> -->
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="divider"></view>
  36. <!-- 基本信息 -->
  37. <view class="mt-3 px3">
  38. <view
  39. class="f-size-30 f-weight-bold py2 border-bottom"
  40. >报修信息</view
  41. >
  42. <view
  43. class="mx3 my2 p3 bg-color-white"
  44. style="border-radius: 16rpx; border: 1px solid #eee"
  45. >
  46. <equipment-line title="设备编号" :content="sbInfo.no" />
  47. <equipment-line title="设备型号" :content="sbInfo.model" />
  48. <equipment-line title="报修单编号" :content="infoData.no" />
  49. <equipment-line title="使用位置" :content="sbInfo.cph" />
  50. <equipment-line title="报修人" :content="infoData.actualUser" />
  51. <equipment-line title="故障描述" :content="infoData.content" />
  52. <equipment-line title="报修时间" :content="infoData.applyTime" />
  53. <view class="d-flex py3 border-bottom">
  54. <view class="f-size-26 text-color-9 w200">报修图片</view>
  55. <view class="f-size-26 text-color-3 d-flex ">
  56. <block v-for="(item,index) in imagesList" :key="index">
  57. <u-image width="100" class="mr-2" :src="$BaseTool.UserUtil.getFileUrl(item)" @click="handlePre(index)" mode="widthFix"><u-loading slot="loading"></u-loading></u-image>
  58. </block>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="divider"></view>
  64. <view class="mt-3 px3" v-show="infoData.status>3">
  65. <view
  66. class="f-size-30 f-weight-bold py2 border-bottom"
  67. >维修信息</view
  68. >
  69. <view
  70. class="mx3 my2 p3 bg-color-white"
  71. style="border-radius: 16rpx; border: 1px solid #eee"
  72. >
  73. <equipment-line title="故障类别" :content="infoData.repairErrorTypeName" />
  74. <equipment-line title="维修开始" :content="infoData.repairStartTime" />
  75. <equipment-line title="维修结束" :content="infoData.repairEndTime" />
  76. <equipment-line title="维修耗时" :content="infoData.repairMinutes" />
  77. <equipment-line title="维修人员" :content="infoData.repairUserName" />
  78. <equipment-line title="维修描述" :content="infoData.repairContent" />
  79. <equipment-line title="备注" :content="infoData.repairRemark" />
  80. <view class="d-flex py3 border-bottom">
  81. <view class="f-size-26 text-color-9 w200">维修图片</view>
  82. <view class="f-size-26 text-color-3 d-flex ">
  83. <block v-for="(item,index) in imagesList" :key="index">
  84. <u-image width="100" class="mr-2" :src="$BaseTool.UserUtil.getFileUrl(item)" @click="handlePre(index)" mode="widthFix"><u-loading slot="loading"></u-loading></u-image>
  85. </block>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. <view class="divider"></view>
  91. <view class="mt-3 px3">
  92. <view v-for="(item,index) in dispatchList" :key="index" class="mx3 my2 p3 bg-color-white" style="border-radius: 16rpx">
  93. <view>
  94. <equipment-line title="转派人" :content="item.username" />
  95. <equipment-line title="转派时间" :content="item.time" />
  96. <equipment-line title="转派备注" :content="item.repairDispatchRemark" />
  97. <!-- 转派审批状态:pending-待审批 approved-已通过 rejected-已驳回 -->
  98. <equipment-line v-if="item.type === 'transfer'" title="审批状态" :content="getTransferStatusText(item.status)" />
  99. <equipment-line v-if="item.approverName" title="审批人" :content="item.approverName" />
  100. <equipment-line v-if="item.approveTime" title="审批时间" :content="item.approveTime" />
  101. <equipment-line v-if="item.approveRemark" title="审批意见" :content="item.approveRemark" />
  102. </view>
  103. </view>
  104. </view>
  105. <view class="divider"></view>
  106. <view class="px3">
  107. <view
  108. class="f-size-30 f-weight-bold py2 border-bottom"
  109. >维修处理</view
  110. >
  111. <u-grid :col="3" :border="false">
  112. <u-grid-item v-if="infoData.status === 1" @tap="handleReceive()">
  113. <view class="iconfont icon-baoxiu" style="color: #0f6fb9"></view>
  114. <view class="grid-text">接收</view>
  115. </u-grid-item>
  116. <u-grid-item v-if="infoData.status === 2" @tap="handleFinish()">
  117. <view class="iconfont icon-start main-color-text"></view>
  118. <view class="grid-text">完成</view>
  119. </u-grid-item>
  120. <u-grid-item v-if="infoData.status === 3 || infoData.status === 5" @tap="handleExamine()">
  121. <view class="iconfont icon-start main-color-text"></view>
  122. <view class="grid-text">提交审核</view>
  123. </u-grid-item>
  124. <!-- <u-grid-item v-if="infoData.status != 7" @tap="handleStop()">
  125. <view class="iconfont icon-stop1 main-color-text"></view>
  126. <view class="grid-text">派工</view>
  127. </u-grid-item>-->
  128. <!-- <u-grid-item v-if="infoData.status != 2" @tap="handleStart()">
  129. <view class="iconfont icon-start main-color-text"></view>
  130. <view class="grid-text">更换备件</view>
  131. </u-grid-item>
  132. <u-grid-item v-if="infoData.status != 7" @tap="handleStop()">
  133. <view class="iconfont icon-stop1 main-color-text"></view>
  134. <view class="grid-text">原因分析</view>
  135. </u-grid-item>-->
  136. </u-grid>
  137. </view>
  138. <view class="divider"></view>
  139. <!-- <view class="px3">
  140. <my-card
  141. title="备件更换历史"
  142. @handleLubrication="handleModel"
  143. ></my-card>
  144. <my-card
  145. title="原因分析记录"
  146. @handleLubrication="handleUse"
  147. ></my-card>
  148. </view>
  149. <view class="divider"></view>-->
  150. </view>
  151. </template>
  152. <script>
  153. export default {
  154. data() {
  155. return {
  156. detailId: '',
  157. infoData: {},
  158. sbInfo: {},
  159. statusMap: {},
  160. imgSrc: '',
  161. dispatchList: [],
  162. id: '',
  163. imagesList: []
  164. };
  165. },
  166. onLoad(options) {
  167. this.detailId = options.detailId;
  168. this.$Http
  169. .fetchRepairApplicationForm({
  170. id: this.detailId
  171. })
  172. .then((res) => {
  173. console.log(res);
  174. this.infoData = res.data;
  175. this.imagesList = res.data.applicationFileList.map(item => {
  176. return this.$BaseTool.UserUtil.getFileUrl(item.url);
  177. })
  178. console.log(this.imagesList);
  179. this.dispatchList = JSON.parse(res.data.repairDispatchList)
  180. this.$Http
  181. .fetchSbInfo({
  182. id: res.data.sbId
  183. })
  184. .then((res) => {
  185. this.sbInfo = res.data;
  186. if (this.infoData.sbFileList != null) {
  187. this.imgSrc = this.$BaseTool.UserUtil.getFileUrl(this.infoData.sbFileList[0].url)
  188. } else {
  189. this.imgSrc = this.$BaseTool.UserUtil.getFileUrl(this.infoData.qrCode)
  190. }
  191. uni.setNavigationBarTitle({
  192. title: this.infoData.name
  193. });
  194. });
  195. });
  196. this.statusMap = this.$DictCache.getLabelByValueMapByType(
  197. this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS
  198. );
  199. },
  200. methods: {
  201. // 转派记录审批状态文字:老数据无 status 字段时按已通过展示(早期转派无审批流程)
  202. getTransferStatusText(status) {
  203. if (status === 'pending') return '待审批'
  204. if (status === 'rejected') return '已驳回'
  205. return '已通过'
  206. },
  207. handlePre(index) {
  208. uni.previewImage({
  209. urls: this.imagesList,
  210. current: this.imagesList[index],
  211. success() {
  212. }
  213. });
  214. },
  215. // 接收
  216. handleReceive() {
  217. var that = this;
  218. uni.showModal({
  219. title: '提示',
  220. content: '确认接收该维修单?',
  221. success: function (res) {
  222. if (res.confirm) {
  223. that.$Http
  224. .repairFormDeal({
  225. id: that.detailId
  226. })
  227. .then((res) => {
  228. that.infoData.status = $DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING
  229. that.$refs.uToast.show({
  230. title: '已接收,请及时完成维修',
  231. type: 'default',
  232. icon: false
  233. });
  234. });
  235. }
  236. }
  237. });
  238. },
  239. // 提交审批验收
  240. handleExamine() {
  241. var that = this;
  242. uni.showModal({
  243. title: '提示',
  244. content: '确认提交审核?',
  245. success: function (res) {
  246. if (res.confirm) {
  247. that.$Http
  248. .examine({
  249. id: that.detailId
  250. })
  251. .then((res) => {
  252. that.infoData.status = $DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING
  253. that.$refs.uToast.show({
  254. title: '已提交,请等待审核',
  255. type: 'default',
  256. icon: false
  257. });
  258. });
  259. }
  260. }
  261. });
  262. },
  263. // 完成维修任务
  264. handleFinish() {
  265. uni.navigateTo({
  266. url: '/pages/service-add/service-add?id=' + this.detailId
  267. })
  268. },
  269. handleStart() {
  270. this.infoData.status = 2;
  271. var that = this;
  272. this.$Http.updateSbInfo(this.infoData).then((res) => {
  273. that.$refs.uToast.show({
  274. title: '已启用',
  275. type: 'default',
  276. icon: false
  277. });
  278. });
  279. },
  280. handleStop() {
  281. this.infoData.status = 7;
  282. var that = this;
  283. this.$Http.updateSbInfo(this.infoData).then((res) => {
  284. that.$refs.uToast.show({
  285. title: '已停用',
  286. type: 'default',
  287. icon: false
  288. });
  289. });
  290. }
  291. }
  292. };
  293. </script>
  294. <style lang="less">
  295. .iconfont {
  296. font-size: 50rpx;
  297. }
  298. .col2 view:first-child {
  299. // width: 130rpx;
  300. }
  301. .col2 view:last-child {
  302. flex: 1;
  303. }
  304. .top {
  305. .img {
  306. width: 168rpx;
  307. height: 168rpx;
  308. border-radius: 50%;
  309. image {
  310. width: 168rpx;
  311. height: 168rpx;
  312. border-radius: 50%;
  313. background-color: #eee;
  314. }
  315. }
  316. }
  317. .d-flex.mb-2 {
  318. align-items: center;
  319. }
  320. .state-r {
  321. padding: 8rpx 20rpx;
  322. border-radius: 30rpx;
  323. }
  324. .state-g {
  325. padding: 8rpx 20rpx;
  326. border-radius: 30rpx;
  327. background-color: #e7e8f2;
  328. color: #949dad;
  329. }
  330. </style>