adminhome.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. <template>
  2. <view class="container">
  3. <!-- 头部 start -->
  4. <view class="head">
  5. <u-navbar :is-fixed="false" :border-bottom="false" :is-back="false" title=""
  6. :background="{ background: '#0BB9C8' }">
  7. <view class="nav-wrap">
  8. <!-- <picker mode="selector" :range="positionArr" range-key="name" @change="changePicker"
  9. class="picker-box">
  10. {{ position }}
  11. <u-icon name="arrow-down" class="arrow" size="18" color="#C9C9C9"></u-icon>
  12. </picker> -->
  13. <view style="width: 100%;height: auto;align-items: center;text-align: center;" v-if="!focus">
  14. <text style="color: #ffffff; font-size: 20px;">运维系统</text>
  15. </view>
  16. <!-- <image src="/static/images/rider.png" class="rider" mode="widthFix" v-if="!focus"></image>
  17. -->
  18. <!-- <view class="search-input" v-else>
  19. <u-search height="50" placeholder="关键字" @blur="handleSearchBlur" :show-action="false"
  20. v-model="keyword"></u-search>
  21. </view> -->
  22. <!-- <view class="tool">
  23. <image src="/static/images/home/search.png" class="icon search-icon" mode="widthFix"
  24. @click="handleFocus" v-if="!focus"></image>
  25. <image src="/static/images/home/message.png" class="icon message-icon" mode="widthFix"></image>
  26. <image src="/static/images/home/qr.png" class="icon qr-icon" mode="widthFix"></image>
  27. </view> -->
  28. </view>
  29. </u-navbar>
  30. <!-- <view class="head-bg"></view>
  31. <swiper class="swiper-box" :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000">
  32. <swiper-item v-for="(item, index) in bannerList" :key="index">
  33. <navigator :url="item.url" hover-class="none" class="swiper-item">
  34. <image :src="item.img" class="banner"></image>
  35. </navigator>
  36. </swiper-item>
  37. </swiper> -->
  38. </view>
  39. <!-- 头部 end -->
  40. <!-- 头部按钮 start -->
  41. <view class="nav">
  42. <u-grid :col="4" :border="false">
  43. <u-grid-item bg-color="transparent" v-for="(item, index) in navButton" :key="index">
  44. <navigator :url="item.url" hover-class="none" class="nav-item" open-type="navigate">
  45. <image :src="item.img" mode="widthFix" class="nav-item-img"></image>
  46. <view class="nav-item-name">{{ item.name }}</view>
  47. </navigator>
  48. </u-grid-item>
  49. </u-grid>
  50. </view>
  51. <!-- 头部按钮 end -->
  52. <!-- <view class="video-box">
  53. <view class="video-body">
  54. <video style="width: 640rpx; height: 480rpx;" src="/static/video/test.mp4"></video>
  55. </view>
  56. <view class="video-title" style="margin-top: 5px;">
  57. <view class="text">新闻视频提要:据报道....</view>
  58. </view>
  59. </view> -->
  60. <!-- 公告 start -->
  61. <view class="notice-box">
  62. <image src="/static/images/home/notice.png" class="img" mode="widthFix"></image>
  63. <view class="notice-info">
  64. <navigator hover-class="none" class="notice-cell" v-for="(item, index) in noticeList" :key="index">
  65. <!-- <image :src="item.img" class="icon" mode="widthFix"></image> -->
  66. <view class="text">{{item.title}}</view>
  67. <u-icon name="arrow-right" size="12" color="#C9C9C9"></u-icon>
  68. </navigator>
  69. </view>
  70. </view>
  71. <!-- 公告 end -->
  72. <!-- 服务按钮 start -->
  73. <!-- <view class="service-box">
  74. <u-grid :col="4" :border="false">
  75. <u-grid-item bg-color="transparent" v-for="(item, index) in serviceButton" :key="index">
  76. <navigator url="" hover-class="none" class="service-item">
  77. <image :src="item.img" mode="widthFix" class="img"></image>
  78. <view class="name">{{ item.name }}</view>
  79. </navigator>
  80. </u-grid-item>
  81. <u-grid-item bg-color="transparent" key="8">
  82. <navigator url="/pages/service/service" hover-class="none" class="service-item">
  83. <image src="/static/images/home/s8.png" mode="widthFix" class="img"></image>
  84. <view class="name">更多</view>
  85. </navigator>
  86. </u-grid-item>
  87. </u-grid>
  88. </view> -->
  89. <!-- 服务按钮 end -->
  90. <!-- 新闻模块 start -->
  91. <view class="news">
  92. <navigator hover-class="none" url="/pages/check-order/checkorderlist" class="cell">
  93. <view class="ctitle">工单动态</view>
  94. <view class="more">
  95. 更多
  96. <u-icon name="arrow-right" color="#A6ABB5" size="16"></u-icon>
  97. </view>
  98. </navigator>
  99. <view class="news-list">
  100. <navigator url="/pages/news/detail" hover-class="none" class="news-item"
  101. v-for="(item, index) in lastCheckOrderList" :key="index">
  102. <view class="left">
  103. <view class="info">
  104. <text>{{item.orderDesc}}</text>
  105. </view>
  106. <view class="date">
  107. <image src="/static/images/home/date.png" class="icon" mode=""></image>
  108. <text>{{item.updateTime}}</text>
  109. </view>
  110. </view>
  111. <!-- <image src="" mode="" class="img"></image> -->
  112. </navigator>
  113. <!-- <u-loadmore :status="status" /> -->
  114. </view>
  115. </view>
  116. <!-- 新闻模块 end -->
  117. <view class="news">
  118. <navigator hover-class="none" url="/pages/equipment-inspection/equipmentinspectionplanlist" class="cell">
  119. <view class="ctitle">巡检动态</view>
  120. <view class="more">
  121. 更多
  122. <u-icon name="arrow-right" color="#A6ABB5" size="16"></u-icon>
  123. </view>
  124. </navigator>
  125. <view class="news-list">
  126. <navigator url="/pages/news/detail" hover-class="none" class="news-item"
  127. v-for="(item, index) in lastEquipmentInspectionList" :key="index">
  128. <view class="left">
  129. <view class="info">
  130. <text>{{item.reportDesc}}</text>
  131. </view>
  132. <view class="date">
  133. <image src="/static/images/home/date.png" class="icon" mode=""></image>
  134. <text>{{item.createTime}}</text>
  135. </view>
  136. </view>
  137. <!-- <image src="" mode="" class="img"></image> -->
  138. </navigator>
  139. <!-- <u-loadmore :status="status" /> -->
  140. </view>
  141. </view>
  142. </view>
  143. </template>
  144. <script>
  145. import {
  146. fakePosition,
  147. fakeBannerList,
  148. fakeNavButton,
  149. fakeServiceButton
  150. } from "@/api/mock/home.js";
  151. import http from '@/http/api.js';
  152. export default {
  153. components: {
  154. },
  155. data() {
  156. return {
  157. position: '',
  158. positionArr: [],
  159. status: 'loadmore',
  160. list: 15,
  161. page: 0,
  162. keyword: '',
  163. focus: false,
  164. bannerList: [],
  165. noticeList: [],
  166. warningList: [],
  167. newsList: [{}, {}],
  168. navButton: [],
  169. serviceButton: [],
  170. lastCheckOrderList: [],
  171. lastEquipmentInspectionList: [],
  172. role: {
  173. 'admin': '系统管理员',
  174. 'orgAdmin': '运维单位管理员',
  175. 'orgServicePerson': '运维单位技术员',
  176. },
  177. showHome: {
  178. 'admin': false,
  179. 'orgAdmin': false,
  180. 'orgServicePerson': false,
  181. }
  182. };
  183. },
  184. onLoad() {
  185. if (this.userInfo.role_name === this.role['admin']) {
  186. this.showHome.admin = true;
  187. this.showHome.orgAdmin = false;
  188. this.showHome.orgServicePerson = false;
  189. this.adminhome.onLoad();
  190. } else if (this.userInfo.role_name === this.role['orgAdmin']) {
  191. this.showHome.admin = false;
  192. this.showHome.orgAdmin = true;
  193. this.showHome.orgServicePerson = false;
  194. } else if (this.userInfo.role_name === this.role['orgServicePerson']) {
  195. this.showHome.admin = false;
  196. this.showHome.orgAdmin = false;
  197. this.showHome.orgServicePerson = true;
  198. } else {
  199. this.$u.route({
  200. url: '/pages/login/login-account'
  201. })
  202. }
  203. // 后续将改为与后端联动
  204. // 加载banner数据
  205. fakePosition().then(data => {
  206. this.position = data.position;
  207. this.positionArr = data.positionArr;
  208. });
  209. // 加载banner数据
  210. fakeBannerList().then(data => {
  211. this.bannerList = data;
  212. });
  213. // 加载通知公告数据
  214. // fakeNoticeList().then(data => {
  215. // this.noticeList = data;
  216. // });
  217. // const noticeListTmp = [{
  218. // id: '1',
  219. // title: '2022年度巡检计划已经发布'
  220. // }];
  221. // this.noticeList = noticeListTmp;
  222. this.getLastNotice();
  223. this.getLastCheckOrder();
  224. this.getLastEquipmentInspectionReport();
  225. // const lastCheckOrderListTmp = [{
  226. // id: '1',
  227. // processDesc: '河道 45222222维修工单创建',
  228. // reportDate: '2022年8月20日 12时'
  229. // }];
  230. // this.lastCheckOrderList=lastCheckOrderListTmp;
  231. // const lastEquipmentInspectionListTmp = [{
  232. // id: '1',
  233. // equipmentInspectionDesc: '测站河道 45222222 已经完成巡检填报',
  234. // reportDate: '2022年8月20日 15时'
  235. // }];
  236. // this.lastEquipmentInspectionList=lastEquipmentInspectionListTmp;
  237. // 加载顶部按钮数据
  238. fakeNavButton().then(data => {
  239. this.navButton = data;
  240. });
  241. // 加载服务按钮数据
  242. fakeServiceButton().then(data => {
  243. this.serviceButton = data;
  244. });
  245. },
  246. onReachBottom() {
  247. // 后续将改为与后端联动
  248. if (this.page >= 3) return;
  249. this.status = 'loading';
  250. this.page = ++this.page;
  251. setTimeout(() => {
  252. this.list += 10;
  253. if (this.page >= 3) this.status = 'nomore';
  254. else this.status = 'loading';
  255. this.newsList.push(...[{}, {}]);
  256. }, 2000);
  257. },
  258. methods: {
  259. getLastNotice(){
  260. const that = this;
  261. http.request({
  262. url: '/galaxy-test/notice/last/list',
  263. method: 'GET'
  264. }).then(res => {
  265. console.log(res.data)
  266. if (res.data != null) {
  267. const len = res.data['length'];
  268. var list = [];
  269. for (var i = 0; i < len; i++) {
  270. let dict = res.data['' + i];
  271. list.push(dict);
  272. }
  273. that.noticeList = list;
  274. }
  275. }).catch(err => {
  276. console.log(err)
  277. })
  278. },
  279. getLastCheckOrder() {
  280. const that = this;
  281. http.request({
  282. url: '/galaxy-test/rtu/check/order/last/list',
  283. method: 'GET'
  284. }).then(res => {
  285. console.log(res.data)
  286. if (res.data != null) {
  287. const len = res.data['length'];
  288. var list = [];
  289. for (var i = 0; i < len; i++) {
  290. let dict = res.data['' + i];
  291. list.push(dict);
  292. }
  293. that.lastCheckOrderList = list;
  294. }
  295. }).catch(err => {
  296. console.log(err)
  297. })
  298. },
  299. getLastEquipmentInspectionReport() {
  300. const that = this;
  301. http.request({
  302. url: '/galaxy-test/equipment/inspection/report/last/list',
  303. method: 'GET'
  304. }).then(res => {
  305. console.log(res.data)
  306. if (res.data != null) {
  307. const len = res.data['length'];
  308. var list = [];
  309. for (var i = 0; i < len; i++) {
  310. let dict = res.data['' + i];
  311. list.push(dict);
  312. }
  313. that.lastEquipmentInspectionList = list;
  314. }
  315. }).catch(err => {
  316. console.log(err)
  317. })
  318. },
  319. changePicker(e) {
  320. console.log(this.pickerArr[e.detail.value].name);
  321. this.position = this.pickerArr[e.detail.value].name;
  322. },
  323. handleFocus() {
  324. this.focus = !this.focus;
  325. },
  326. handleSearchBlur() {
  327. this.focus = false;
  328. }
  329. }
  330. };
  331. </script>
  332. <style lang="scss">
  333. .container {
  334. background-color: #f7f7f7;
  335. min-height: 100vh;
  336. overflow: hidden;
  337. }
  338. .head {
  339. position: relative;
  340. top: 0;
  341. left: 0;
  342. z-index: 1;
  343. }
  344. .head-bg {
  345. position: absolute;
  346. left: 0px;
  347. top: 0px;
  348. z-index: -1;
  349. width: 750rpx;
  350. height: 270rpx;
  351. background: #0bb9c8;
  352. }
  353. .nav-wrap {
  354. width: 100%;
  355. padding: 0 22rpx;
  356. display: flex;
  357. justify-content: space-between;
  358. align-items: center;
  359. .picker-box {
  360. flex: 1;
  361. display: flex;
  362. align-items: center;
  363. justify-content: flex-start;
  364. font-size: 32rpx;
  365. font-family: Microsoft YaHei;
  366. font-weight: bold;
  367. color: #ffffff;
  368. .arrow {
  369. margin-left: 10rpx;
  370. }
  371. }
  372. .rider {
  373. flex-shrink: 0;
  374. width: 131rpx;
  375. height: auto;
  376. }
  377. .search-input {
  378. width: 300rpx;
  379. height: 50rpx;
  380. }
  381. .tool {
  382. flex: 1;
  383. display: flex;
  384. align-items: center;
  385. justify-content: flex-end;
  386. .icon {
  387. height: auto;
  388. }
  389. .search-icon {
  390. width: 40rpx;
  391. margin-right: 34rpx;
  392. }
  393. .message-icon {
  394. width: 32rpx;
  395. margin-right: 27rpx;
  396. }
  397. .qr-icon {
  398. width: 37rpx;
  399. }
  400. }
  401. }
  402. .swiper-box {
  403. margin: 50rpx auto 0;
  404. width: 710rpx;
  405. height: 253rpx;
  406. .swiper-item {
  407. width: 100%;
  408. height: 100%;
  409. .banner {
  410. width: 100%;
  411. height: 100%;
  412. }
  413. }
  414. }
  415. .nav {
  416. margin: 0rpx 0;
  417. box-sizing: border-box;
  418. padding: 0 10rpx;
  419. &-item {
  420. width: 100%;
  421. box-sizing: border-box;
  422. display: flex;
  423. flex-direction: column;
  424. align-items: center;
  425. justify-content: space-between;
  426. height: 130rpx;
  427. &-img {
  428. width: 80rpx;
  429. height: 80rpx;
  430. }
  431. &-name {
  432. font-size: 26rpx;
  433. font-family: PingFang SC;
  434. font-weight: 400;
  435. color: #585b61;
  436. }
  437. }
  438. }
  439. .video-box {
  440. display: flex;
  441. justify-content: flex-start;
  442. flex-direction: column;
  443. width: 100%;
  444. .video-body {
  445. display: flex;
  446. justify-content: center;
  447. flex-direction: row;
  448. }
  449. .video-title {
  450. display: flex;
  451. justify-content: center;
  452. flex-direction: row;
  453. .text {
  454. margin-top: 10rpx;
  455. margin-bottom: 10rpx;
  456. width: 640rpx;
  457. // flex: 1;
  458. min-width: 0;
  459. overflow: hidden;
  460. text-overflow: ellipsis;
  461. display: -webkit-box;
  462. -webkit-line-clamp: 1;
  463. -webkit-box-orient: vertical;
  464. }
  465. }
  466. }
  467. .notice-box {
  468. display: flex;
  469. align-items: center;
  470. background: #ffffff;
  471. border-radius: 20px 20px 20px 20px;
  472. margin: 0 20rpx;
  473. padding: 30rpx 20rpx;
  474. .img {
  475. width: 75rpx;
  476. height: auto;
  477. margin-right: 36rpx;
  478. margin-left: 10rpx;
  479. }
  480. .notice-info {
  481. flex: 1;
  482. .notice-cell:first-of-type {
  483. margin-bottom: 15rpx;
  484. }
  485. }
  486. .notice-cell {
  487. display: flex;
  488. align-items: center;
  489. font-size: 24rpx;
  490. font-family: PingFang SC;
  491. font-weight: 500;
  492. color: #585b61;
  493. .icon {
  494. width: 63rpx;
  495. margin-right: 18rpx;
  496. }
  497. .text {
  498. flex: 1;
  499. min-width: 0;
  500. overflow: hidden;
  501. text-overflow: ellipsis;
  502. display: -webkit-box;
  503. -webkit-line-clamp: 1;
  504. -webkit-box-orient: vertical;
  505. }
  506. }
  507. }
  508. .service-box {
  509. background: #ffffff;
  510. border-radius: 20px 20px 20px 20px;
  511. margin: 30rpx 20rpx 0;
  512. padding: 0rpx 20rpx;
  513. .service-item {
  514. display: flex;
  515. flex-direction: column;
  516. justify-content: space-between;
  517. align-items: center;
  518. width: 100%;
  519. height: 120rpx;
  520. font-size: 26rpx;
  521. font-family: PingFang SC;
  522. font-weight: 500;
  523. color: #585b61;
  524. .img {
  525. width: 70rpx;
  526. height: auto;
  527. }
  528. }
  529. }
  530. .news {
  531. background: #ffffff;
  532. border-radius: 20px 20px 20px 20px;
  533. margin: 30rpx 20rpx 60rpx;
  534. padding: 30rpx 20rpx;
  535. .cell {
  536. display: flex;
  537. justify-content: space-between;
  538. align-items: center;
  539. .ctitle {
  540. font-size: 32rpx;
  541. font-family: PingFang SC;
  542. font-weight: bold;
  543. color: #585b61;
  544. }
  545. .more {
  546. display: flex;
  547. align-items: center;
  548. font-size: 26rpx;
  549. font-family: PingFang SC;
  550. font-weight: 500;
  551. color: #a6abb5;
  552. }
  553. }
  554. .news-list {
  555. margin-top: 30rpx;
  556. .news-item {
  557. &:not(:last-of-type) {
  558. padding: 0 0 30rpx;
  559. margin-bottom: 30rpx;
  560. border-bottom: 1px solid #eeeeee;
  561. }
  562. display: flex;
  563. align-items: center;
  564. justify-content: space-between;
  565. .left {
  566. flex: 1;
  567. height: 160rpx;
  568. display: flex;
  569. flex-direction: column;
  570. justify-content: space-around;
  571. .info {
  572. min-width: 0;
  573. overflow: hidden;
  574. text-overflow: ellipsis;
  575. display: -webkit-box;
  576. -webkit-line-clamp: 2;
  577. -webkit-box-orient: vertical;
  578. font-size: 28rpx;
  579. font-family: PingFang SC;
  580. font-weight: 500;
  581. color: #585b61;
  582. line-height: 36rpx;
  583. }
  584. .date {
  585. display: flex;
  586. align-items: center;
  587. .icon {
  588. width: 21rpx;
  589. height: 21rpx;
  590. margin-right: 9rpx;
  591. }
  592. font-size: 26rpx;
  593. font-family: PingFang SC;
  594. font-weight: 500;
  595. color: #a6abb5;
  596. }
  597. }
  598. .img {
  599. flex-shrink: 0;
  600. width: 252rpx;
  601. height: 160rpx;
  602. border-radius: 20rpx;
  603. background-color: #82848a;
  604. }
  605. }
  606. }
  607. }
  608. </style>