repair-detail.vue 13 KB

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