repair-detail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  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. <!-- 派工:仅维修主管(MM)可见,且工单尚未被接收处理(待分配1/已驳回5),与 PC 端一样选人下发 -->
  95. <u-grid-item
  96. v-show="(infoData.status === 1 || infoData.status === 5) && isMMRole"
  97. @tap="handleDispatch()">
  98. <view class="iconfont icon-baoxiu" style="color: #0f6fb9"></view>
  99. <view class="grid-text">派工</view>
  100. </u-grid-item>
  101. <!-- 接收:维修人员/主管可见,且工单尚未被接收处理(待分配1/已驳回5) -->
  102. <u-grid-item
  103. v-show="(infoData.status === 1 || infoData.status === 5) && isRepairRole"
  104. @tap="handleReceive()">
  105. <view class="iconfont icon-baoxiu" style="color: #0f6fb9"></view>
  106. <view class="grid-text">接收</view>
  107. </u-grid-item>
  108. <!-- <u-grid-item v-if="infoData.status != 7" @tap="handleStop()">
  109. <view class="iconfont icon-stop1 main-color-text"></view>
  110. <view class="grid-text">派工</view>
  111. </u-grid-item>-->
  112. <!-- <u-grid-item v-if="infoData.status != 2" @tap="handleStart()">
  113. <view class="iconfont icon-start main-color-text"></view>
  114. <view class="grid-text">更换备件</view>
  115. </u-grid-item>
  116. <u-grid-item v-if="infoData.status != 7" @tap="handleStop()">
  117. <view class="iconfont icon-stop1 main-color-text"></view>
  118. <view class="grid-text">原因分析</view>
  119. </u-grid-item>-->
  120. </u-grid>
  121. </view>
  122. <view class="divider"></view>
  123. <!-- <view class="px3">
  124. <my-card
  125. title="备件更换历史"
  126. @handleLubrication="handleModel"
  127. ></my-card>
  128. <my-card
  129. title="原因分析记录"
  130. @handleLubrication="handleUse"
  131. ></my-card>
  132. </view>
  133. <view class="divider"></view>-->
  134. </view>
  135. </template>
  136. <script>
  137. export default {
  138. data() {
  139. return {
  140. detailId: '',
  141. infoData: {},
  142. sbInfo: {},
  143. statusMap: {},
  144. imgSrc: '',
  145. dispatchList: [],
  146. id: '',
  147. imagesList: [],
  148. repairImagesList: [],
  149. zjList: [],
  150. // 角色标志:控制派工/接收按钮显示
  151. isMMRole: false,
  152. isRepairRole: false
  153. }
  154. },
  155. onLoad(options) {
  156. this.detailId = options.detailId
  157. this.statusMap = this.$DictCache.getLabelByValueMapByType(this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
  158. this.$Http
  159. .queryUserDept({
  160. deptCode: this.$DictCache.VALUE.SYS_DEPT_CODE.SYS_DEPT_CODE_XIAN_CHANG_WEI_XIU_ZU,
  161. userStatus: 1
  162. })
  163. .then((res) => {
  164. console.log(res.data);
  165. const temp = []
  166. res.data.forEach((item, index) => {
  167. temp.push({
  168. label: item.realName,
  169. value: item.userId
  170. })
  171. })
  172. this.zjList.push(...temp)
  173. });
  174. this.$Http
  175. .queryUserDept({
  176. deptCode: this.$DictCache.VALUE.SYS_DEPT_CODE.SYS_DEPT_CODE_CHANG_NEI_WEI_XIU_ZU,
  177. userStatus: 1
  178. })
  179. .then((res) => {
  180. console.log(res.data);
  181. const temp = []
  182. res.data.forEach((item, index) => {
  183. temp.push({
  184. label: item.realName,
  185. value: item.userId
  186. })
  187. })
  188. this.zjList.push(...temp)
  189. });
  190. },
  191. onShow() {
  192. this.isMMRole = this.$BaseTool.UserUtil.hasRoleCode('MM')
  193. this.isRepairRole = this.$BaseTool.UserUtil.isRepairRole()
  194. this.getInfo()
  195. },
  196. methods: {
  197. getInfo() {
  198. this.$Http
  199. .fetchRepairApplicationForm({
  200. id: this.detailId
  201. })
  202. .then(res => {
  203. console.log(res)
  204. this.infoData = res.data
  205. this.imagesList = res.data.applicationFileList.map(item => {
  206. return this.$BaseTool.UserUtil.getFileUrl(item.url)
  207. })
  208. this.repairImagesList = res.data.repairFileList.map(item => {
  209. return this.$BaseTool.UserUtil.getFileUrl(item.url)
  210. })
  211. this.dispatchList = JSON.parse(res.data.repairDispatchList)
  212. this.$Http
  213. .fetchSbInfo({
  214. id: res.data.sbId
  215. })
  216. .then(res => {
  217. this.sbInfo = res.data
  218. if (this.infoData.sbFileList != null) {
  219. this.imgSrc = this.$BaseTool.UserUtil.getFileUrl(this.infoData.sbFileList[0].url)
  220. } else {
  221. this.imgSrc = this.$BaseTool.UserUtil.getFileUrl(this.infoData.qrCode)
  222. }
  223. uni.setNavigationBarTitle({
  224. title: this.infoData.name
  225. })
  226. })
  227. })
  228. },
  229. // 转派记录审批状态文字:老数据无 status 字段时按已通过展示(早期转派无审批流程)
  230. getTransferStatusText(status) {
  231. if (status === 'pending') return '待审批'
  232. if (status === 'rejected') return '已驳回'
  233. return '已通过'
  234. },
  235. getUserName(userId) {
  236. var name = ''
  237. this.zjList.forEach(item => {
  238. if (item.value == userId) {
  239. name = item.label
  240. }
  241. })
  242. return name
  243. },
  244. handlePre(index) {
  245. uni.previewImage({
  246. urls: this.imagesList,
  247. current: this.imagesList[index],
  248. success() { }
  249. })
  250. },
  251. handlePreRepair(index) {
  252. uni.previewImage({
  253. urls: this.repairImagesList,
  254. current: this.repairImagesList[index],
  255. success() { }
  256. })
  257. },
  258. // 派工:跳转到派工页,与 PC 端一样选择维修人下发
  259. handleDispatch() {
  260. uni.navigateTo({
  261. url: '/pages/deliver-add/deliver-add?id=' + this.detailId
  262. })
  263. },
  264. // 接收
  265. handleReceive() {
  266. var that = this
  267. uni.showModal({
  268. title: '提示',
  269. content: '确认接收该维修单?',
  270. success: function (res) {
  271. if (res.confirm) {
  272. that.$Http
  273. .repairFormDeal({
  274. id: that.detailId
  275. })
  276. .then(res => {
  277. that.infoData.status = this.$DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING
  278. that.$refs.uToast.show({
  279. title: '已接收,请及时完成维修',
  280. type: 'default',
  281. icon: false
  282. })
  283. })
  284. }
  285. }
  286. })
  287. },
  288. handleReject() {
  289. uni.navigateTo({
  290. url: '/pages/repair-detail/reject?id=' + this.detailId
  291. })
  292. },
  293. // 提交审批验收
  294. handleExamine() {
  295. var that = this
  296. uni.showModal({
  297. title: '提示',
  298. content: '确认提交审核?',
  299. success: function (res) {
  300. if (res.confirm) {
  301. that.$Http
  302. .examine({
  303. id: that.detailId
  304. })
  305. .then(res => {
  306. that.infoData.status = this.$DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.WAIT_SUBMIT
  307. that.$refs.uToast.show({
  308. title: '已提交,请等待审核',
  309. type: 'default',
  310. icon: false
  311. })
  312. })
  313. }
  314. }
  315. })
  316. },
  317. // 完成维修任务
  318. handleFinish() {
  319. uni.navigateTo({
  320. url: '/pages/service-add/service-add?id=' + this.detailId
  321. })
  322. },
  323. handleTransfer() {
  324. uni.navigateTo({
  325. url: '/pages/repair-detail/transfer?id=' + this.detailId
  326. })
  327. },
  328. handleStart() {
  329. this.infoData.status = this.$DictCache.VALUE.SB_INFO_STATUS.IN_USE
  330. var that = this
  331. this.$Http.updateSbInfo(this.infoData).then(res => {
  332. that.$refs.uToast.show({
  333. title: '已启用',
  334. type: 'default',
  335. icon: false
  336. })
  337. })
  338. },
  339. handleStop() {
  340. this.infoData.status = this.$DictCache.VALUE.SB_INFO_STATUS.IN_STOP
  341. var that = this
  342. this.$Http.updateSbInfo(this.infoData).then(res => {
  343. that.$refs.uToast.show({
  344. title: '已停用',
  345. type: 'default',
  346. icon: false
  347. })
  348. })
  349. }
  350. }
  351. }
  352. </script>
  353. <style lang="less">
  354. .iconfont {
  355. font-size: 50rpx;
  356. }
  357. .col2 view:first-child {
  358. // width: 130rpx;
  359. }
  360. .col2 view:last-child {
  361. flex: 1;
  362. }
  363. .top {
  364. .img {
  365. width: 168rpx;
  366. height: 168rpx;
  367. border-radius: 50%;
  368. image {
  369. width: 168rpx;
  370. height: 168rpx;
  371. border-radius: 50%;
  372. background-color: #eee;
  373. }
  374. }
  375. }
  376. .d-flex.mb-2 {
  377. align-items: center;
  378. }
  379. .state-r {
  380. padding: 8rpx 20rpx;
  381. border-radius: 30rpx;
  382. }
  383. .state-g {
  384. padding: 8rpx 20rpx;
  385. border-radius: 30rpx;
  386. background-color: #e7e8f2;
  387. color: #949dad;
  388. }
  389. </style>