repair-detail.vue 13 KB

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