repair-detail.vue 14 KB

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