equipment-detail.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  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(infoData.qrCode)
  10. " mode="widthFix"></image>
  11. </view>
  12. <view class="pl-3">
  13. <view class="f-size-36 text-color-3 one-ellipsis">{{
  14. infoData.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">{{
  20. statusMap[infoData.status] }}</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="infoData.no" />
  31. <!-- <equipment-line title="财务编码" :content="infoData.financingNo"/>-->
  32. <equipment-line title="设备类型" :content="infoData.typeName" />
  33. <equipment-line title="规格型号" :content="infoData.model" />
  34. <!-- 使用位置优先取设备位置树名称(positionName),cph 仅在报修回写后才有值,兜底兼容老数据 -->
  35. <equipment-line title="使用位置" :content="infoData.positionName ? infoData.positionName : (infoData.cph ? infoData.cph : '')" />
  36. <equipment-line title="上次保养完成时间" :content="infoData.lastMaintainFinishTime ? infoData.lastMaintainFinishTime : '暂无'" />
  37. </view>
  38. <!-- <view class="mt-3">
  39. <view class="d-flex mb-2">
  40. <view class="col2 d-flex">
  41. <view class="mr-2 text-color-6">设备编号</view>
  42. <view class="one-ellipsis">{{ infoData.no }}</view>
  43. </view>
  44. <view class="col2 d-flex">
  45. <view class="mr-2 text-color-6">财务编码</view>
  46. <view>{{ infoData.financingNo }}</view>
  47. </view>
  48. </view>
  49. <view class="d-flex mb-2">
  50. <view class="col2 d-flex">
  51. <view class="mr-2 text-color-6">卡片编号</view>
  52. <view>{{ infoData.cardNo }}</view>
  53. </view>
  54. </view>
  55. <view class="d-flex">
  56. <view class="mr-2 text-color-6">制造号(车架号)</view>
  57. <view>{{ infoData.zzh }}</view>
  58. </view>
  59. <view class="d-flex mb-2">
  60. <view class="col2 d-flex">
  61. <view class="mr-2 text-color-6">发动机型号</view>
  62. <view>{{ infoData.fdjxh }}</view>
  63. </view>
  64. <view class="col2 d-flex">
  65. <view class="mr-2 text-color-6">发动机号</view>
  66. <view>{{ infoData.fdjh }}</view>
  67. </view>
  68. </view>
  69. <view class="d-flex mb-2">
  70. <view class="col2 d-flex">
  71. <view class="mr-2 text-color-6">车牌号</view>
  72. <view>{{ infoData.cph }}</view>
  73. </view>
  74. <view class="col2 d-flex">
  75. <view class="mr-2 text-color-6">底盘号</view>
  76. <view>{{ infoData.dph }}</view>
  77. </view>
  78. </view>
  79. <view class="d-flex mb-2">
  80. <view class="col2 d-flex">
  81. <view class="mr-2 text-color-6">自重</view>
  82. <view>{{ infoData.zz }}</view>
  83. </view>
  84. <view class="col2 d-flex">
  85. <view class="mr-2 text-color-6">燃料类别</view>
  86. <view>{{
  87. $BaseTool.Object.getField(rlTypeMap, infoData.rlType)
  88. }}</view>
  89. </view>
  90. </view>
  91. <view class="d-flex mb-2">
  92. <view class="col2 d-flex">
  93. <view class="mr-2 text-color-6">颜色</view>
  94. <view>{{
  95. $BaseTool.Object.getField(colorMap, infoData.color)
  96. }}</view>
  97. </view>
  98. <view class="col2 d-flex">
  99. <view class="mr-2 text-color-6">座位数</view>
  100. <view>{{ infoData.seatNumber }}</view>
  101. </view>
  102. </view>
  103. <view class="d-flex mb-2">
  104. <view class="col2 d-flex">
  105. <view class="mr-2 text-color-6">助记码</view>
  106. <view>{{ infoData.zjm }}</view>
  107. </view>
  108. <view class="col2 d-flex">
  109. <view class="mr-2 ">状态</view>
  110. <view>
  111. <my-badge
  112. :text="statusMap[infoData.status]"
  113. :status="$DictCache.COLOR.SB_INFO_STATUS[infoData.status]"
  114. />
  115. </view>
  116. </view>
  117. </view>
  118. <view class="d-flex mb-2">
  119. <view class="col2 d-flex">
  120. <view class="mr-2 text-color-6">备注</view>
  121. <view>{{ infoData.remark }}</view>
  122. </view>
  123. </view>
  124. </view> -->
  125. </view>
  126. <view class="divider"></view>
  127. <view class="px3">
  128. <view class="f-size-30 f-weight-bold py2 border-bottom">常用操作</view>
  129. <u-grid :col="3" :border="false">
  130. <u-grid-item @tap="handleAdd(1)">
  131. <view class="iconfont icon-baoxiu" style="color: #0f6fb9"></view>
  132. <view class="grid-text">报修</view>
  133. </u-grid-item>
  134. <!-- <u-grid-item @tap="handleAdd(2)">
  135. <view
  136. class="iconfont icon-icon-GIS_yunhangguanli main-color-text"
  137. ></view>
  138. <view class="grid-text">运行填报</view>
  139. </u-grid-item>
  140. <u-grid-item @tap="handleAdd(3)">
  141. <view
  142. class="iconfont icon-xunjianguanli main-color-text"
  143. ></view>
  144. <view class="grid-text">巡检填报</view>
  145. </u-grid-item>-->
  146. <u-grid-item v-if="infoData.status != 2" @tap="handleStart()">
  147. <view class="iconfont icon-start main-color-text"></view>
  148. <view class="grid-text">启用</view>
  149. </u-grid-item>
  150. <!-- 近期点检日历:只看历史已完成记录,扫码免登录即可查看 -->
  151. <u-grid-item @tap="handleCheckCalendar">
  152. <view class="iconfont icon-xunjianguanli main-color-text"></view>
  153. <view class="grid-text">近期点检日历</view>
  154. </u-grid-item>
  155. <!-- 扫码进入的设备详情页隐藏停用按钮 -->
  156. <!--<u-grid-item v-if="infoData.status != 7" @tap="handleStop()">
  157. <view class="iconfont icon-stop1 main-color-text"></view>
  158. <view class="grid-text">停用</view>
  159. </u-grid-item>-->
  160. </u-grid>
  161. </view>
  162. <view class="divider"></view>
  163. <view class="px3">
  164. <my-card title="设备图片" @handleLubrication="handleImg"></my-card>
  165. </view>
  166. <!-- <view class="divider"></view>
  167. <view class="px3">
  168. <my-card
  169. title="设备型号信息"
  170. @handleLubrication="handleModel"
  171. ></my-card>
  172. <my-card
  173. title="设备使用信息"
  174. @handleLubrication="handleUse"
  175. ></my-card>
  176. <my-card
  177. title="厂商信息"
  178. @handleLubrication="handleInsure"
  179. ></my-card>
  180. <my-card title="日期信息" @handleLubrication="handleDate"></my-card>
  181. </view>-->
  182. <view class="divider"></view>
  183. <view class="px3">
  184. <!-- <my-card
  185. icon="icon-tubiaozhizuomoban-135"
  186. title="今日现场保养任务"
  187. :tipNum="gatherTask.lubricationTask"
  188. @handleLubrication="handleMaintain(1)"
  189. ></my-card>
  190. <my-card
  191. icon="icon-tubiaozhizuomoban-135"
  192. title="本周保养任务"
  193. :tipNum="gatherTask.lubricationTaskWeek"
  194. @handleLubrication="handleMaintain(2)"
  195. ></my-card> -->
  196. <my-card icon="icon-tubiaozhizuomoban-135" title="本月保养任务" :tipNum="gatherTask.lubricationTaskMonth"
  197. @handleLubrication="handleMaintain(3)"></my-card>
  198. <!-- <my-card-->
  199. <!-- v-show="$BaseTool.UserUtil.getUserInfo() != null && ($BaseTool.UserUtil.isRepairRole() || $BaseTool.UserUtil.isManagerRole())"-->
  200. <!-- icon="icon-tubiaozhizuomoban-135"-->
  201. <!-- title="今日保养任务"-->
  202. <!-- :tipNum="gatherTask.lubricationTaskMyDay"-->
  203. <!-- @handleLubrication="handleMaintainAll(0,1)"-->
  204. <!-- ></my-card>-->
  205. <!-- <my-card-->
  206. <!-- v-show="$BaseTool.UserUtil.getUserInfo() != null && ($BaseTool.UserUtil.isRepairRole() || $BaseTool.UserUtil.isManagerRole())"-->
  207. <!-- icon="icon-tubiaozhizuomoban-135"-->
  208. <!-- title="本周保养任务"-->
  209. <!-- :tipNum="gatherTask.lubricationTaskMyDay"-->
  210. <!-- @handleLubrication="handleMaintainAll(0,2)"-->
  211. <!-- ></my-card>-->
  212. <!-- <my-card-->
  213. <!-- v-show="$BaseTool.UserUtil.getUserInfo() != null && ($BaseTool.UserUtil.isRepairRole() || $BaseTool.UserUtil.isManagerRole())"-->
  214. <!-- icon="icon-tubiaozhizuomoban-135"-->
  215. <!-- title="本月保养任务"-->
  216. <!-- :tipNum="gatherTask.lubricationTaskMyDay"-->
  217. <!-- @handleLubrication="handleMaintainAll(0,3)"-->
  218. <!-- ></my-card>-->
  219. <my-card icon="icon-weixiu" title="维修任务" :tipNum="gatherTask.repairTask"
  220. @handleLubrication="handleService"></my-card>
  221. <!-- <my-card
  222. icon="icon-runhuaguanli"
  223. title="点检任务"
  224. @handleLubrication="handleLubrication"
  225. ></my-card>
  226. <my-card
  227. icon="icon-jiayou"
  228. title="加油任务"
  229. @handleLubrication="handleOiling"
  230. iColor="#F1650C"
  231. ></my-card>-->
  232. </view>
  233. </view>
  234. </template>
  235. <script>
  236. import DictCache from '@/utils/dict';
  237. export default {
  238. data() {
  239. return {
  240. list: [
  241. {
  242. name: '维修记录'
  243. },
  244. {
  245. name: '运行记录'
  246. },
  247. {
  248. name: '巡检记录'
  249. }
  250. ],
  251. current: 0,
  252. detailId: '',
  253. infoData: {},
  254. statusMap: {},
  255. rlTypeMap: null,
  256. colorMap: null,
  257. imgSrc: '',
  258. gatherTask: {
  259. checkTask: 0,
  260. maintainTask: 0,
  261. lubricationTask: 0,
  262. lubricationTaskWeek: 0,
  263. lubricationTaskMonth: 0,
  264. oilTask: 0,
  265. repairTask: 0,
  266. repairCheckTask: 0
  267. }
  268. };
  269. },
  270. onLoad(options) {
  271. // 获取词典
  272. this.detailId = options.detailId;
  273. this.$Http.getDictData().then(response => {
  274. uni.setStorage({
  275. key: DictCache.BASE_DATA_CACHE,
  276. data: response.data,
  277. success: function () { }
  278. });
  279. this.statusMap = this.$DictCache.getLabelByValueMapByType(
  280. this.$DictCache.TYPE.SB_INFO_STATUS
  281. );
  282. this.rlTypeMap = this.$DictCache.getLabelByValueMapByType(
  283. this.$DictCache.TYPE.RANLIAO_TYPE
  284. );
  285. this.colorMap = this.$DictCache.getLabelByValueMapByType(
  286. this.$DictCache.TYPE.SB_COLOR
  287. );
  288. this.$Http
  289. .fetchSbInfoIgnores({
  290. id: this.detailId
  291. })
  292. .then((res) => {
  293. this.infoData = res.data;
  294. if (this.infoData.sbFileList != null && this.infoData.sbFileList.length > 0) {
  295. this.imgSrc = this.$BaseTool.UserUtil.getFileUrl(this.infoData.sbFileList[0].url)
  296. } else {
  297. this.imgSrc = this.$BaseTool.UserUtil.getFileUrl(this.infoData.qrCode)
  298. }
  299. uni.setNavigationBarTitle({
  300. title: this.infoData.name
  301. });
  302. });
  303. this.$Http.getSbTaskIgnores({
  304. id: this.detailId
  305. }).then((res) => {
  306. this.gatherTask = res.data;
  307. });
  308. if (this.$BaseTool.UserUtil.getUserInfo() != null && (this.$BaseTool.UserUtil.isRepairRole() || this.$BaseTool.UserUtil.isManagerRole())) {
  309. this.$Http.getGatherTaskRole(this.detailId).then((res) => {
  310. this.gatherTask = res.data;
  311. });
  312. } else {
  313. this.$Http.getSbTaskIgnores({ id: this.detailId }).then((res) => {
  314. this.gatherTask = res.data;
  315. });
  316. }
  317. });
  318. },
  319. onShow() {
  320. },
  321. methods: {
  322. // 文件
  323. handleImg() {
  324. uni.navigateTo({
  325. url:
  326. '/pages/equipment-file/equipment-img?detailId=' +
  327. this.detailId
  328. });
  329. },
  330. // 文件
  331. handleFile() {
  332. uni.navigateTo({
  333. url:
  334. '/pages/equipment-file/equipment-file?detailId=' +
  335. this.detailId
  336. });
  337. },
  338. // 日期
  339. handleDate() {
  340. uni.navigateTo({
  341. url:
  342. '/pages/equipment-date/equipment-date?detailId=' +
  343. this.detailId
  344. });
  345. },
  346. // 厂商
  347. handleInsure() {
  348. uni.navigateTo({
  349. url:
  350. '/pages/equipment-insure/equipment-insure?detailId=' +
  351. this.infoData.producerId
  352. });
  353. },
  354. // 设备使用信息
  355. handleUse() {
  356. uni.navigateTo({
  357. url:
  358. '/pages/equipment-use/equipment-use?detailId=' +
  359. this.detailId
  360. });
  361. },
  362. // 设备型号信息
  363. handleModel() {
  364. uni.navigateTo({
  365. url:
  366. '/pages/equipment-model/equipment-model?detailId=' +
  367. this.detailId
  368. });
  369. },
  370. // 相关任务跳转
  371. // 维修任务
  372. handleService() {
  373. uni.navigateTo({
  374. url: '/pages/service/service?sbId=' + this.detailId
  375. });
  376. },
  377. // 加油任务
  378. handleOiling() {
  379. uni.navigateTo({
  380. url: '/pages/oiling/oiling?sbId=' + this.detailId
  381. });
  382. },
  383. // 当日现场保养任务
  384. handleMaintain(searchType) {
  385. uni.navigateTo({
  386. url: '/pages/maintain/maintain?sbId=' + this.detailId + '&filter=2&searchType=' + searchType
  387. });
  388. },
  389. // 我的保养任务:今日
  390. handleMaintainMy() {
  391. uni.navigateTo({
  392. url: '/pages/maintain/maintain?sbId=' + this.detailId + '&filter=0&searchType=1'
  393. });
  394. },
  395. // 所有保养任务:今日
  396. handleMaintainAll(filter, searchType) {
  397. uni.navigateTo({
  398. url: '/pages/maintain/maintain?sbId=' + this.detailId + '&searchType=1&filter=' + filter
  399. });
  400. },
  401. // 点检任务
  402. handleLubrication(e) {
  403. uni.navigateTo({
  404. url: '/pages/check/check?sbId=' + this.infoData.id
  405. });
  406. },
  407. // 近期点检日历(数据源为保养任务,已完成的日期标绿打勾)
  408. handleCheckCalendar() {
  409. // 带上设备“上次保养完成时间”,当月未做保养时日历仍然能看到最近一次记录
  410. const last = this.infoData.lastMaintainFinishTime
  411. ? encodeURIComponent(this.infoData.lastMaintainFinishTime)
  412. : '';
  413. uni.navigateTo({
  414. url:
  415. '/pages/equipment-calendar/equipment-calendar?sbId=' +
  416. this.detailId +
  417. '&last=' + last
  418. });
  419. },
  420. // 常用操作跳转(报修/运行填报/巡检填报均会提交数据,未登录先弹登录)
  421. handleAdd(index) {
  422. this.$Http.requireLogin(() => {
  423. if (index === 1) {
  424. uni.navigateTo({
  425. url:
  426. '/pages/repair-add/repair-add?detailId=' +
  427. this.detailId
  428. });
  429. } else if (index === 2) {
  430. uni.navigateTo({
  431. url: '/pages/running/running-edit?sbId=' + this.detailId
  432. });
  433. } else if (index === 3) {
  434. uni.navigateTo({
  435. url:
  436. '/pages/inspection/inspection-edit?sbId=' +
  437. this.detailId
  438. });
  439. }
  440. }, '发起报修/填报需要先登录,是否登录?');
  441. },
  442. change(index) {
  443. this.current = index;
  444. },
  445. handleStart() {
  446. // this.infoData.status = 2;
  447. this.$Http.requireLogin(() => {
  448. uni.navigateTo({
  449. url:
  450. '/pages/equipment-detail/equipment-status?sbId=' +
  451. this.detailId + '&sbNo=' + this.infoData.no +
  452. '&sbName=' + this.infoData.name +
  453. '&preStatus=' + this.infoData.status +
  454. '&afterStatus=' + 2
  455. });
  456. }, '启用设备需要先登录,是否登录?');
  457. /* this.$Http.updateSbInfo(this.infoData).then((res) => {
  458. that.$refs.uToast.show({
  459. title: '已启用',
  460. type: 'default',
  461. icon: false
  462. });
  463. }); */
  464. },
  465. handleStop() {
  466. this.$Http.requireLogin(() => {
  467. this.infoData.status = 7;
  468. var that = this;
  469. this.$Http.updateSbInfo(this.infoData).then((res) => {
  470. that.$refs.uToast.show({
  471. title: '已停用',
  472. type: 'default',
  473. icon: false
  474. });
  475. });
  476. }, '停用设备需要先登录,是否登录?');
  477. }
  478. }
  479. };
  480. </script>
  481. <style lang="less">
  482. .iconfont {
  483. font-size: 50rpx;
  484. }
  485. .col2 view:first-child {
  486. // width: 130rpx;
  487. }
  488. .col2 view:last-child {
  489. flex: 1;
  490. }
  491. .top {
  492. .img {
  493. width: 168rpx;
  494. height: 168rpx;
  495. border-radius: 50%;
  496. image {
  497. width: 168rpx;
  498. height: 168rpx;
  499. border-radius: 50%;
  500. background-color: #eee;
  501. }
  502. }
  503. }
  504. .d-flex.mb-2 {
  505. align-items: center;
  506. }
  507. .state-r {
  508. padding: 8rpx 20rpx;
  509. border-radius: 30rpx;
  510. }
  511. .state-g {
  512. padding: 8rpx 20rpx;
  513. border-radius: 30rpx;
  514. background-color: #e7e8f2;
  515. color: #949dad;
  516. }
  517. </style>