repair-detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  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. </view>
  98. </view>
  99. </view>
  100. <view class="divider"></view>
  101. <view class="px3">
  102. <view
  103. class="f-size-30 f-weight-bold py2 border-bottom"
  104. >维修处理</view
  105. >
  106. <u-grid :col="3" :border="false">
  107. <u-grid-item v-if="infoData.status === 1" @tap="handleReceive()">
  108. <view class="iconfont icon-baoxiu" style="color: #0f6fb9"></view>
  109. <view class="grid-text">接收</view>
  110. </u-grid-item>
  111. <u-grid-item v-if="infoData.status === 2" @tap="handleFinish()">
  112. <view class="iconfont icon-start main-color-text"></view>
  113. <view class="grid-text">完成</view>
  114. </u-grid-item>
  115. <u-grid-item v-if="infoData.status === 3 || infoData.status === 5" @tap="handleExamine()">
  116. <view class="iconfont icon-start main-color-text"></view>
  117. <view class="grid-text">提交审核</view>
  118. </u-grid-item>
  119. <!-- <u-grid-item v-if="infoData.status != 7" @tap="handleStop()">
  120. <view class="iconfont icon-stop1 main-color-text"></view>
  121. <view class="grid-text">派工</view>
  122. </u-grid-item>-->
  123. <!-- <u-grid-item v-if="infoData.status != 2" @tap="handleStart()">
  124. <view class="iconfont icon-start main-color-text"></view>
  125. <view class="grid-text">更换备件</view>
  126. </u-grid-item>
  127. <u-grid-item v-if="infoData.status != 7" @tap="handleStop()">
  128. <view class="iconfont icon-stop1 main-color-text"></view>
  129. <view class="grid-text">原因分析</view>
  130. </u-grid-item>-->
  131. </u-grid>
  132. </view>
  133. <view class="divider"></view>
  134. <!-- <view class="px3">
  135. <my-card
  136. title="备件更换历史"
  137. @handleLubrication="handleModel"
  138. ></my-card>
  139. <my-card
  140. title="原因分析记录"
  141. @handleLubrication="handleUse"
  142. ></my-card>
  143. </view>
  144. <view class="divider"></view>-->
  145. </view>
  146. </template>
  147. <script>
  148. export default {
  149. data() {
  150. return {
  151. detailId: '',
  152. infoData: {},
  153. sbInfo: {},
  154. statusMap: {},
  155. imgSrc: '',
  156. dispatchList: [],
  157. id: '',
  158. imagesList: []
  159. };
  160. },
  161. onLoad(options) {
  162. this.detailId = options.detailId;
  163. this.$Http
  164. .fetchRepairApplicationForm({
  165. id: this.detailId
  166. })
  167. .then((res) => {
  168. console.log(res);
  169. this.infoData = res.data;
  170. this.imagesList = res.data.applicationFileList.map(item => {
  171. return this.$BaseTool.UserUtil.getFileUrl(item.url);
  172. })
  173. console.log(this.imagesList);
  174. this.dispatchList = JSON.parse(res.data.repairDispatchList)
  175. this.$Http
  176. .fetchSbInfo({
  177. id: res.data.sbId
  178. })
  179. .then((res) => {
  180. this.sbInfo = res.data;
  181. if (this.infoData.sbFileList != null) {
  182. this.imgSrc = this.$BaseTool.UserUtil.getFileUrl(this.infoData.sbFileList[0].url)
  183. } else {
  184. this.imgSrc = this.$BaseTool.UserUtil.getFileUrl(this.infoData.qrCode)
  185. }
  186. uni.setNavigationBarTitle({
  187. title: this.infoData.name
  188. });
  189. });
  190. });
  191. this.statusMap = this.$DictCache.getLabelByValueMapByType(
  192. this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS
  193. );
  194. },
  195. methods: {
  196. handlePre(index) {
  197. uni.previewImage({
  198. urls: this.imagesList,
  199. current: this.imagesList[index],
  200. success() {
  201. }
  202. });
  203. },
  204. // 接收
  205. handleReceive() {
  206. var that = this;
  207. uni.showModal({
  208. title: '提示',
  209. content: '确认接收该维修单?',
  210. success: function (res) {
  211. if (res.confirm) {
  212. that.$Http
  213. .repairFormDeal({
  214. id: that.detailId
  215. })
  216. .then((res) => {
  217. that.infoData.status = $DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING
  218. that.$refs.uToast.show({
  219. title: '已接收,请及时完成维修',
  220. type: 'default',
  221. icon: false
  222. });
  223. });
  224. }
  225. }
  226. });
  227. },
  228. // 提交审批验收
  229. handleExamine() {
  230. var that = this;
  231. uni.showModal({
  232. title: '提示',
  233. content: '确认提交审核?',
  234. success: function (res) {
  235. if (res.confirm) {
  236. that.$Http
  237. .examine({
  238. id: that.detailId
  239. })
  240. .then((res) => {
  241. that.infoData.status = $DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING
  242. that.$refs.uToast.show({
  243. title: '已提交,请等待审核',
  244. type: 'default',
  245. icon: false
  246. });
  247. });
  248. }
  249. }
  250. });
  251. },
  252. // 完成维修任务
  253. handleFinish() {
  254. uni.navigateTo({
  255. url: '/pages/service-add/service-add?id=' + this.detailId
  256. })
  257. },
  258. handleStart() {
  259. this.infoData.status = 2;
  260. var that = this;
  261. this.$Http.updateSbInfo(this.infoData).then((res) => {
  262. that.$refs.uToast.show({
  263. title: '已启用',
  264. type: 'default',
  265. icon: false
  266. });
  267. });
  268. },
  269. handleStop() {
  270. this.infoData.status = 7;
  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. }
  281. };
  282. </script>
  283. <style lang="less">
  284. .iconfont {
  285. font-size: 50rpx;
  286. }
  287. .col2 view:first-child {
  288. // width: 130rpx;
  289. }
  290. .col2 view:last-child {
  291. flex: 1;
  292. }
  293. .top {
  294. .img {
  295. width: 168rpx;
  296. height: 168rpx;
  297. border-radius: 50%;
  298. image {
  299. width: 168rpx;
  300. height: 168rpx;
  301. border-radius: 50%;
  302. background-color: #eee;
  303. }
  304. }
  305. }
  306. .d-flex.mb-2 {
  307. align-items: center;
  308. }
  309. .state-r {
  310. padding: 8rpx 20rpx;
  311. border-radius: 30rpx;
  312. }
  313. .state-g {
  314. padding: 8rpx 20rpx;
  315. border-radius: 30rpx;
  316. background-color: #e7e8f2;
  317. color: #949dad;
  318. }
  319. </style>