equipment-detail.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  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 v-if="infoData.status != 7" @tap="handleStop()">
  152. <view class="iconfont icon-stop1 main-color-text"></view>
  153. <view class="grid-text">停用</view>
  154. </u-grid-item>-->
  155. </u-grid>
  156. </view>
  157. <view class="divider"></view>
  158. <view class="px3">
  159. <my-card title="设备图片" @handleLubrication="handleImg"></my-card>
  160. </view>
  161. <!-- <view class="divider"></view>
  162. <view class="px3">
  163. <my-card
  164. title="设备型号信息"
  165. @handleLubrication="handleModel"
  166. ></my-card>
  167. <my-card
  168. title="设备使用信息"
  169. @handleLubrication="handleUse"
  170. ></my-card>
  171. <my-card
  172. title="厂商信息"
  173. @handleLubrication="handleInsure"
  174. ></my-card>
  175. <my-card title="日期信息" @handleLubrication="handleDate"></my-card>
  176. </view>-->
  177. <view class="divider"></view>
  178. <view class="px3">
  179. <!-- <my-card
  180. icon="icon-tubiaozhizuomoban-135"
  181. title="今日现场保养任务"
  182. :tipNum="gatherTask.lubricationTask"
  183. @handleLubrication="handleMaintain(1)"
  184. ></my-card>
  185. <my-card
  186. icon="icon-tubiaozhizuomoban-135"
  187. title="本周保养任务"
  188. :tipNum="gatherTask.lubricationTaskWeek"
  189. @handleLubrication="handleMaintain(2)"
  190. ></my-card> -->
  191. <my-card icon="icon-tubiaozhizuomoban-135" title="本月保养任务" :tipNum="gatherTask.lubricationTaskMonth"
  192. @handleLubrication="handleMaintain(3)"></my-card>
  193. <!-- <my-card-->
  194. <!-- v-show="$BaseTool.UserUtil.getUserInfo() != null && ($BaseTool.UserUtil.isRepairRole() || $BaseTool.UserUtil.isManagerRole())"-->
  195. <!-- icon="icon-tubiaozhizuomoban-135"-->
  196. <!-- title="今日保养任务"-->
  197. <!-- :tipNum="gatherTask.lubricationTaskMyDay"-->
  198. <!-- @handleLubrication="handleMaintainAll(0,1)"-->
  199. <!-- ></my-card>-->
  200. <!-- <my-card-->
  201. <!-- v-show="$BaseTool.UserUtil.getUserInfo() != null && ($BaseTool.UserUtil.isRepairRole() || $BaseTool.UserUtil.isManagerRole())"-->
  202. <!-- icon="icon-tubiaozhizuomoban-135"-->
  203. <!-- title="本周保养任务"-->
  204. <!-- :tipNum="gatherTask.lubricationTaskMyDay"-->
  205. <!-- @handleLubrication="handleMaintainAll(0,2)"-->
  206. <!-- ></my-card>-->
  207. <!-- <my-card-->
  208. <!-- v-show="$BaseTool.UserUtil.getUserInfo() != null && ($BaseTool.UserUtil.isRepairRole() || $BaseTool.UserUtil.isManagerRole())"-->
  209. <!-- icon="icon-tubiaozhizuomoban-135"-->
  210. <!-- title="本月保养任务"-->
  211. <!-- :tipNum="gatherTask.lubricationTaskMyDay"-->
  212. <!-- @handleLubrication="handleMaintainAll(0,3)"-->
  213. <!-- ></my-card>-->
  214. <my-card icon="icon-weixiu" title="维修任务" :tipNum="gatherTask.repairTask"
  215. @handleLubrication="handleService"></my-card>
  216. <!-- <my-card
  217. icon="icon-runhuaguanli"
  218. title="点检任务"
  219. @handleLubrication="handleLubrication"
  220. ></my-card>
  221. <my-card
  222. icon="icon-jiayou"
  223. title="加油任务"
  224. @handleLubrication="handleOiling"
  225. iColor="#F1650C"
  226. ></my-card>-->
  227. </view>
  228. </view>
  229. </template>
  230. <script>
  231. import DictCache from '@/utils/dict';
  232. export default {
  233. data() {
  234. return {
  235. list: [
  236. {
  237. name: '维修记录'
  238. },
  239. {
  240. name: '运行记录'
  241. },
  242. {
  243. name: '巡检记录'
  244. }
  245. ],
  246. current: 0,
  247. detailId: '',
  248. infoData: {},
  249. statusMap: {},
  250. rlTypeMap: null,
  251. colorMap: null,
  252. imgSrc: '',
  253. gatherTask: {
  254. checkTask: 0,
  255. maintainTask: 0,
  256. lubricationTask: 0,
  257. lubricationTaskWeek: 0,
  258. lubricationTaskMonth: 0,
  259. oilTask: 0,
  260. repairTask: 0,
  261. repairCheckTask: 0
  262. }
  263. };
  264. },
  265. onLoad(options) {
  266. // 获取词典
  267. this.detailId = options.detailId;
  268. this.$Http.getDictData().then(response => {
  269. uni.setStorage({
  270. key: DictCache.BASE_DATA_CACHE,
  271. data: response.data,
  272. success: function () { }
  273. });
  274. this.statusMap = this.$DictCache.getLabelByValueMapByType(
  275. this.$DictCache.TYPE.SB_INFO_STATUS
  276. );
  277. this.rlTypeMap = this.$DictCache.getLabelByValueMapByType(
  278. this.$DictCache.TYPE.RANLIAO_TYPE
  279. );
  280. this.colorMap = this.$DictCache.getLabelByValueMapByType(
  281. this.$DictCache.TYPE.SB_COLOR
  282. );
  283. this.$Http
  284. .fetchSbInfoIgnores({
  285. id: this.detailId
  286. })
  287. .then((res) => {
  288. this.infoData = res.data;
  289. if (this.infoData.sbFileList != null && this.infoData.sbFileList.length > 0) {
  290. this.imgSrc = this.$BaseTool.UserUtil.getFileUrl(this.infoData.sbFileList[0].url)
  291. } else {
  292. this.imgSrc = this.$BaseTool.UserUtil.getFileUrl(this.infoData.qrCode)
  293. }
  294. uni.setNavigationBarTitle({
  295. title: this.infoData.name
  296. });
  297. });
  298. this.$Http.getSbTaskIgnores({
  299. id: this.detailId
  300. }).then((res) => {
  301. this.gatherTask = res.data;
  302. });
  303. if (this.$BaseTool.UserUtil.getUserInfo() != null && (this.$BaseTool.UserUtil.isRepairRole() || this.$BaseTool.UserUtil.isManagerRole())) {
  304. this.$Http.getGatherTaskRole(this.detailId).then((res) => {
  305. this.gatherTask = res.data;
  306. });
  307. } else {
  308. this.$Http.getSbTaskIgnores({ id: this.detailId }).then((res) => {
  309. this.gatherTask = res.data;
  310. });
  311. }
  312. });
  313. },
  314. onShow() {
  315. },
  316. methods: {
  317. // 文件
  318. handleImg() {
  319. uni.navigateTo({
  320. url:
  321. '/pages/equipment-file/equipment-img?detailId=' +
  322. this.detailId
  323. });
  324. },
  325. // 文件
  326. handleFile() {
  327. uni.navigateTo({
  328. url:
  329. '/pages/equipment-file/equipment-file?detailId=' +
  330. this.detailId
  331. });
  332. },
  333. // 日期
  334. handleDate() {
  335. uni.navigateTo({
  336. url:
  337. '/pages/equipment-date/equipment-date?detailId=' +
  338. this.detailId
  339. });
  340. },
  341. // 厂商
  342. handleInsure() {
  343. uni.navigateTo({
  344. url:
  345. '/pages/equipment-insure/equipment-insure?detailId=' +
  346. this.infoData.producerId
  347. });
  348. },
  349. // 设备使用信息
  350. handleUse() {
  351. uni.navigateTo({
  352. url:
  353. '/pages/equipment-use/equipment-use?detailId=' +
  354. this.detailId
  355. });
  356. },
  357. // 设备型号信息
  358. handleModel() {
  359. uni.navigateTo({
  360. url:
  361. '/pages/equipment-model/equipment-model?detailId=' +
  362. this.detailId
  363. });
  364. },
  365. // 相关任务跳转
  366. // 维修任务
  367. handleService() {
  368. uni.navigateTo({
  369. url: '/pages/service/service?sbId=' + this.detailId
  370. });
  371. },
  372. // 加油任务
  373. handleOiling() {
  374. uni.navigateTo({
  375. url: '/pages/oiling/oiling?sbId=' + this.detailId
  376. });
  377. },
  378. // 当日现场保养任务
  379. handleMaintain(searchType) {
  380. uni.navigateTo({
  381. url: '/pages/maintain/maintain?sbId=' + this.detailId + '&filter=2&searchType=' + searchType
  382. });
  383. },
  384. // 我的保养任务:今日
  385. handleMaintainMy() {
  386. uni.navigateTo({
  387. url: '/pages/maintain/maintain?sbId=' + this.detailId + '&filter=0&searchType=1'
  388. });
  389. },
  390. // 所有保养任务:今日
  391. handleMaintainAll(filter, searchType) {
  392. uni.navigateTo({
  393. url: '/pages/maintain/maintain?sbId=' + this.detailId + '&searchType=1&filter=' + filter
  394. });
  395. },
  396. // 点检任务
  397. handleLubrication(e) {
  398. uni.navigateTo({
  399. url: '/pages/check/check?sbId=' + this.infoData.id
  400. });
  401. },
  402. // 常用操作跳转(报修/运行填报/巡检填报均会提交数据,未登录先弹登录)
  403. handleAdd(index) {
  404. this.$Http.requireLogin(() => {
  405. if (index === 1) {
  406. uni.navigateTo({
  407. url:
  408. '/pages/repair-add/repair-add?detailId=' +
  409. this.detailId
  410. });
  411. } else if (index === 2) {
  412. uni.navigateTo({
  413. url: '/pages/running/running-edit?sbId=' + this.detailId
  414. });
  415. } else if (index === 3) {
  416. uni.navigateTo({
  417. url:
  418. '/pages/inspection/inspection-edit?sbId=' +
  419. this.detailId
  420. });
  421. }
  422. }, '发起报修/填报需要先登录,是否登录?');
  423. },
  424. change(index) {
  425. this.current = index;
  426. },
  427. handleStart() {
  428. // this.infoData.status = 2;
  429. this.$Http.requireLogin(() => {
  430. uni.navigateTo({
  431. url:
  432. '/pages/equipment-detail/equipment-status?sbId=' +
  433. this.detailId + '&sbNo=' + this.infoData.no +
  434. '&sbName=' + this.infoData.name +
  435. '&preStatus=' + this.infoData.status +
  436. '&afterStatus=' + 2
  437. });
  438. }, '启用设备需要先登录,是否登录?');
  439. /* this.$Http.updateSbInfo(this.infoData).then((res) => {
  440. that.$refs.uToast.show({
  441. title: '已启用',
  442. type: 'default',
  443. icon: false
  444. });
  445. }); */
  446. },
  447. handleStop() {
  448. this.$Http.requireLogin(() => {
  449. this.infoData.status = 7;
  450. var that = this;
  451. this.$Http.updateSbInfo(this.infoData).then((res) => {
  452. that.$refs.uToast.show({
  453. title: '已停用',
  454. type: 'default',
  455. icon: false
  456. });
  457. });
  458. }, '停用设备需要先登录,是否登录?');
  459. }
  460. }
  461. };
  462. </script>
  463. <style lang="less">
  464. .iconfont {
  465. font-size: 50rpx;
  466. }
  467. .col2 view:first-child {
  468. // width: 130rpx;
  469. }
  470. .col2 view:last-child {
  471. flex: 1;
  472. }
  473. .top {
  474. .img {
  475. width: 168rpx;
  476. height: 168rpx;
  477. border-radius: 50%;
  478. image {
  479. width: 168rpx;
  480. height: 168rpx;
  481. border-radius: 50%;
  482. background-color: #eee;
  483. }
  484. }
  485. }
  486. .d-flex.mb-2 {
  487. align-items: center;
  488. }
  489. .state-r {
  490. padding: 8rpx 20rpx;
  491. border-radius: 30rpx;
  492. }
  493. .state-g {
  494. padding: 8rpx 20rpx;
  495. border-radius: 30rpx;
  496. background-color: #e7e8f2;
  497. color: #949dad;
  498. }
  499. </style>