home.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. <!--
  2. * @Title:
  3. * @Description: 首页
  4. * @Author: swp
  5. * @Date: 2022-08-24 10:49:21
  6. * @LastEditors:
  7. * @LastEditTime: 2022-08-24 10:49:21
  8. -->
  9. <template>
  10. <view class="container">
  11. <!-- 导航栏 #3F9EFF-->
  12. <uni-nav-bar :fixed="true" backgroundColor="#f7f7f7" statusBar="false" height="75px">
  13. <block slot="left">
  14. <view class="view-flex-block-center">
  15. <image src="/static/images/logo_start.png"
  16. style="width: 100rpx;height: 100rpx;background: lightgray;border-radius: 50%;" mode="widthFix">
  17. </image>
  18. </view>
  19. </block>
  20. <view class="view-flex-inline">
  21. <uni-list style="background-color: #f7f7f7;" :border="false">
  22. <uni-list-item v-if="isLogin" :border="false" style="background-color: #f7f7f7;" showArrow
  23. :title="userName" :note="userNote" :clickable="true" @click="onUserInfoClick()" />
  24. <uni-list-item v-else :border="false" style="background-color: #f7f7f7;" showArrow title="登录/注册"
  25. note="快速登录 注册体验更多功能" :clickable="true" @click="onLoginClick()" />
  26. </uni-list>
  27. </view>
  28. <block slot="right">
  29. <view style="margin-right:0rpx" @click="onNoticeMoreClick">
  30. <uni-badge class="uni-badge-left-margin" absolute="rightTop" :is-dot="noticeDot" :text="noticeValue"
  31. size="small">
  32. <uni-icons class="input-uni-icon" type="email" size="24" color="#000000" />
  33. </uni-badge>
  34. </view>
  35. <view style="margin-right:10rpx;margin-left: 10px;" @click="onNoticeMoreClick">
  36. <uni-badge class="uni-badge-left-margin" absolute="rightTop" size="small">
  37. <uni-icons class="input-uni-icon" type="scan" size="24" color="#000000" />
  38. </uni-badge>
  39. </view>
  40. </block>
  41. </uni-nav-bar>
  42. <uni-card title="快捷操作">
  43. <view class="view-flex-inline">
  44. <!-- <uni-icons class="input-uni-icon" type="phone" size="18" color="coral" /> -->
  45. <text class="text-under-line" style="color: coral;font-size: 1rem;"
  46. @click="toShortcutCreateOrder">发起工单</text>
  47. <text class="text-under-line" style="color: coral;font-size: 1rem;margin-left: 40px;"
  48. @click="toShortcutCreateOrder">创建巡检保养计划</text>
  49. </view>
  50. </uni-card>
  51. <uni-card title="待办工单" :thumbnail="orderLogo">
  52. <uni-list>
  53. <uni-list-item v-for="item in todoOrderList" :key="item.id">
  54. <template v-slot:body>
  55. <view class="list-item-block">
  56. <view class="line">
  57. <uni-icons type="gear" size="18" color="lightblue" />
  58. <view v-if="item.orderType==1" class="text" style="width: 90%;color: gray;">
  59. 工单类型: <span style="margin-left: 5px;color: cornflowerblue;">维修工单</span>
  60. </view>
  61. <view v-else class="text" style="width: 90%;color: gray;">
  62. 工单类型: <span style="margin-left: 5px;color: cornflowerblue;">服务工单</span>
  63. </view>
  64. </view>
  65. <view class="line">
  66. <uni-icons type="personadd" size="18" color="lightblue" />
  67. <view class="text" style="width: 90%;color: gray;">
  68. 工单发起人: <span
  69. style="margin-left: 5px;color: cornflowerblue;">{{item.createOrderPersonName}}</span>
  70. </view>
  71. </view>
  72. <view class="line">
  73. <uni-icons type="calendar" size="18" color="lightblue" />
  74. <view class="text" style="width: 90%;color: gray;">
  75. 发起时间: <span
  76. style="margin-left: 5px;color: cornflowerblue;">{{item.createTime}}</span>
  77. </view>
  78. </view>
  79. <view class="line">
  80. <uni-icons type="help" size="18" color="lightblue" />
  81. <view class="text text-ellipsis" style="width: 90%;color: gray;">
  82. 问题描述: <span
  83. style="margin-left: 5px;color: cornflowerblue;">{{item.orderDesc}}</span>
  84. </view>
  85. </view>
  86. <view class="line">
  87. <view class="block">
  88. <uni-icons type="arrow-right" size="20" color="coral" />
  89. </view>
  90. <view class="text text-underline" style="color: coral;margin-left: 2px;font-size: 1rem;"
  91. @click="toDo(item)">
  92. 去处理
  93. </view>
  94. </view>
  95. </view>
  96. </template>
  97. </uni-list-item>
  98. </uni-list>
  99. </uni-card>
  100. <uni-card title="巡检保养任务" :thumbnail="checkLogo">
  101. <!-- <uni-list>
  102. <uni-list-item showArrow title="1-10号门禁查看" note="2024年3月1日 12时10分" :clickable="true" rightText="去处理" />
  103. </uni-list> -->
  104. </uni-card>
  105. <uni-card :isFull="true">
  106. <swiper style="height: 200px;" circular :indicator-dots="false" :autoplay="true" :interval="2000"
  107. :duration="500">
  108. <swiper-item style="height: 200px;line-height: 300rpx;">
  109. <view style="background-color: lavenderblush;">A</view>
  110. </swiper-item>
  111. <swiper-item style="height: 200px;line-height: 300rpx;">
  112. <view style="background-color: darkcyan;">B</view>
  113. </swiper-item>
  114. <swiper-item style="height: 200px;line-height: 300rpx;">
  115. <view style="background-color: darkgoldenrod;">C</view>
  116. </swiper-item>
  117. </swiper>
  118. </uni-card>
  119. </view>
  120. </template>
  121. <script>
  122. import
  123. navBtns
  124. from "@/api/home.js";
  125. import {
  126. role
  127. } from "@/api/role.js";
  128. import {
  129. oss
  130. } from '@/common/setting';
  131. import http from '@/http/api.js';
  132. export default {
  133. components: {},
  134. data() {
  135. return {
  136. title: '泰山电教维护服务',
  137. permission: {
  138. 'admin': false,
  139. 'orgAdmin': false,
  140. 'companyAdmin': false,
  141. 'companyServciePerson': false,
  142. 'yjServicePerson': false,
  143. },
  144. userLoginStatus: 0,
  145. userName: 'guest',
  146. userNote: '泰山云服务已服务您180天',
  147. postName: '',
  148. currentRole: '',
  149. current: 0,
  150. navButton: [],
  151. navButtonIndex: [],
  152. //more/loading/noMore
  153. loadMoreStatus: "noMore",
  154. timer: false,
  155. pageSize: 10,
  156. pageCurrent: 1,
  157. total: 0,
  158. noticeDot: false,
  159. noticeValue: 0,
  160. todoOrderCount: 0,
  161. todoOrderList: [],
  162. costsApproveOrderCount: 0,
  163. costsApproveOrderList: [],
  164. closeApproveOrderCount: 0,
  165. closeApproveOrderList: [],
  166. orderLogo: "/static/images/logo_pc.png",
  167. checkLogo: "/static/images/home/inspection.png",
  168. };
  169. },
  170. computed: {},
  171. onLoad() {
  172. console.log(JSON.stringify(this.userInfo))
  173. this.permission.admin = false;
  174. this.permission.orgAdmin = false;
  175. this.permission.companyAdmin = false;
  176. this.permission.companyServciePerson = false;
  177. this.permission.yjServicePerson = false;
  178. this.navButton = navBtns.navButtons;
  179. if (this.userInfo.role_name === role.admin) {
  180. this.permission.admin = true;
  181. this.navButtonIndex = navBtns.sysAdminNavButton;
  182. this.currentRole = role.admin;
  183. } else if (this.userInfo.role_name === role.orgAdmin) {
  184. this.permission.orgAdmin = true;
  185. this.currentRole = role.orgAdmin;
  186. this.navButtonIndex = navBtns.orgAdminNavButton;
  187. } else if (this.userInfo.role_name === role.companyAdmin) {
  188. this.permission.companyAdmin = true;
  189. this.currentRole = role.companyAdmin;
  190. this.navButtonIndex = navBtns.companyAdminNavButton;
  191. } else if (this.userInfo.role_name === role.companyServciePerson) {
  192. this.permission.companyServciePerson = true;
  193. this.currentRole = role.companyServciePerson;
  194. this.navButtonIndex = navBtns.companyServicePersonNavButton;
  195. if (this.userInfo.post_id == '1706859505948098562') {
  196. this.postName = "engineer";
  197. } else if (this.userInfo.post_id == '1730535542909140993') {
  198. this.postName = "servicePerson";
  199. }
  200. }
  201. // if (this.$u.func.checkLogin()) {
  202. // console.log("timer start +++++++ ")
  203. // this.timer = true;
  204. // setTimeout(this.timeCall, 10);
  205. // }
  206. this.getTodoOrderList();
  207. },
  208. onUnload() {
  209. //this.timer = false;
  210. },
  211. onReady() {
  212. // if (this.$u.func.checkLogin()) {} else {
  213. // this.$u.func.logout();
  214. // }
  215. },
  216. onShow() {
  217. // if (this.$u.func.checkLogin()) {
  218. // if (this.userInfo.role_name !== this.currentRole) {
  219. // this.permission.admin = false;
  220. // this.permission.orgAdmin = false;
  221. // this.permission.companyAdmin = false;
  222. // this.permission.companyServciePerson = false;
  223. // this.permission.yjServicePerson = false;
  224. // this.navButton = navBtns.navButtons;
  225. // if (this.userInfo.role_name === role.admin) {
  226. // this.permission.admin = true;
  227. // this.navButtonIndex = navBtns.sysAdminNavButton;
  228. // this.currentRole = role.admin;
  229. // } else if (this.userInfo.role_name === role.orgAdmin) {
  230. // this.permission.orgAdmin = true;
  231. // this.currentRole = role.orgAdmin;
  232. // this.navButtonIndex = navBtns.orgAdminNavButton;
  233. // } else if (this.userInfo.role_name === role.companyAdmin) {
  234. // this.permission.companyAdmin = true;
  235. // this.currentRole = role.companyAdmin;
  236. // this.navButtonIndex = navBtns.companyAdminNavButton;
  237. // } else if (this.userInfo.role_name === role.companyServciePerson) {
  238. // this.permission.companyServciePerson = true;
  239. // this.currentRole = role.companyServciePerson;
  240. // this.navButtonIndex = navBtns.companyServicePersonNavButton;
  241. // if (this.userInfo.post_id == '1706859505948098562') {
  242. // this.postName = "engineer";
  243. // } else if (this.userInfo.post_id == '1730535542909140993') {
  244. // this.postName = "servicePerson";
  245. // }
  246. // }
  247. // }
  248. // if (this.timer == false) {
  249. // this.timer = true;
  250. // setTimeout(this.timeCall, 10);
  251. // }
  252. // } else {
  253. // this.$u.func.logout();
  254. // }
  255. },
  256. onHide() {
  257. //this.timer = false;
  258. },
  259. methods: {
  260. toOss(path) {
  261. return oss + path;
  262. },
  263. onLoginClick() {
  264. console.log("onLoginClick")
  265. var url = '/pages/login/login-account';
  266. uni.navigateTo({
  267. url: url
  268. })
  269. },
  270. onUserInfoClick() {
  271. console.log("onUserInfoClick")
  272. var url = '/pages/user/center-simple';
  273. uni.navigateTo({
  274. url: url
  275. })
  276. },
  277. timeCall() {
  278. if (this.timer == true) {
  279. this.getHomeInfo();
  280. setTimeout(this.timeCall, 10000);
  281. }
  282. },
  283. toDo(item) {
  284. var url = '/pages/check-order/orderconfirm?orderType=' + item.orderType + '&orderId=' + item.id;
  285. uni.navigateTo({
  286. url: url
  287. })
  288. },
  289. toOrderProcess(item) {
  290. var url = '/pages/check-order/orderprocessreport?skipPage=1&costsApprove=2&orderType=' + item.orderType +
  291. '&orderProcessId=' + item
  292. .orderProcessId + '&orderId=' + item.id;
  293. uni.navigateTo({
  294. url: url
  295. })
  296. },
  297. toOrderCostsApprove(item) {
  298. var url = '/pages/check-order/ordercostsapprove?orderType=' + item.orderType + '&orderId=' + item.id;
  299. uni.navigateTo({
  300. url: url
  301. })
  302. },
  303. toOrderCloseApprove(item) {
  304. console.log("toOrderCloseApprove")
  305. var url = '/pages/check-order/ordercloseapprove?orderType=' + item.orderType + '&orderId=' + item.id;
  306. uni.navigateTo({
  307. url: url
  308. })
  309. },
  310. toShortcutCreateOrder() {
  311. let url = '/pages/check-order/orderadd';
  312. uni.navigateTo({
  313. url: url
  314. })
  315. },
  316. onNoticeMoreClick() {
  317. uni.navigateTo({
  318. url: '/pages/news/noticelist'
  319. })
  320. },
  321. getHomeInfo() {
  322. this.getTodoOrderList();
  323. this.getTodoCostsApproveOrderList();
  324. this.getTodoCloseOrderList();
  325. },
  326. getTodoOrderList() {
  327. let that = this;
  328. let postData = {};
  329. http.request({
  330. url: '/galaxy-business/order/todo/list',
  331. method: 'GET',
  332. data: postData,
  333. }).then(res => {
  334. console.log(JSON.stringify(res))
  335. that.todoOrderCount = 0;
  336. if (res.data != null) {
  337. that.todoOrderCount = res.data.length;
  338. that.todoOrderList = res.data;
  339. }
  340. }).catch(err => {
  341. console.log(JOSN.stringify(err))
  342. })
  343. },
  344. getTodoCostsApproveOrderList() {
  345. let that = this;
  346. let postData = {};
  347. http.request({
  348. url: '/galaxy-business/order/todo/costsapprove/list',
  349. method: 'GET',
  350. data: postData,
  351. }).then(res => {
  352. that.costsApproveOrderCount = 0;
  353. if (res.data != null) {
  354. that.costsApproveOrderCount = res.data.length;
  355. that.costsApproveOrderList = res.data;
  356. }
  357. }).catch(err => {
  358. console.log(JOSN.stringify(err))
  359. })
  360. },
  361. getTodoCloseOrderList() {
  362. let that = this;
  363. let postData = {};
  364. http.request({
  365. url: '/galaxy-business/order/todo/closeapprove/list',
  366. method: 'GET',
  367. data: postData,
  368. }).then(res => {
  369. that.closeApproveOrderCount = 0;
  370. if (res.data != null) {
  371. that.closeApproveOrderCount = res.data.length;
  372. that.closeApproveOrderList = res.data;
  373. }
  374. }).catch(err => {
  375. console.log(JOSN.stringify(err))
  376. })
  377. },
  378. }
  379. };
  380. </script>
  381. <style lang="scss" scoped>
  382. $nav-height: 75px;
  383. .user-box {
  384. display: flex;
  385. justify-content: space-between;
  386. padding: 0 20rpx 0 64rpx;
  387. margin-top: 36rpx;
  388. .left {
  389. display: flex;
  390. flex-direction: column;
  391. align-items: center;
  392. .avatar {
  393. width: 128rpx;
  394. height: 128rpx;
  395. background: #ffffff;
  396. border-radius: 50%;
  397. }
  398. .user-name {
  399. margin-top: 20rpx;
  400. font-size: 36rpx;
  401. font-family: Source Han Sans CN;
  402. font-weight: 500;
  403. color: #ffffff;
  404. }
  405. .tag {
  406. margin-top: 20rpx;
  407. display: flex;
  408. justify-content: center;
  409. align-items: center;
  410. padding: 5rpx 16rpx;
  411. border: 1px solid #f5f5f5;
  412. border-radius: 7rpx;
  413. font-size: 19rpx;
  414. font-family: Source Han Sans CN;
  415. font-weight: 300;
  416. color: #ffffff;
  417. }
  418. }
  419. .edit-btn {
  420. margin-top: 20rpx;
  421. margin-bottom: 10px;
  422. flex-shrink: 0;
  423. display: flex;
  424. justify-content: center;
  425. align-items: center;
  426. width: 165rpx;
  427. height: 54rpx;
  428. border: 2rpx solid #f5f5f5;
  429. border-radius: 11rpx;
  430. font-size: 27rpx;
  431. font-family: Source Han Sans CN;
  432. font-weight: 400;
  433. color: #ffffff;
  434. }
  435. }
  436. .decoration {
  437. width: 6px;
  438. height: 6px;
  439. margin-right: 4px;
  440. border-radius: 50%;
  441. background-color: cadetblue;
  442. }
  443. .input-uni-icon {
  444. line-height: $nav-height;
  445. }
  446. .item-block {
  447. display: flex;
  448. flex-direction: column;
  449. justify-content: flex-start;
  450. width: 100%;
  451. }
  452. .line {
  453. display: flex;
  454. flex-direction: row;
  455. justify-content: flex-start;
  456. width: 100%;
  457. }
  458. .line .block {
  459. display: flex;
  460. flex-direction: column;
  461. justify-content: center;
  462. }
  463. .line-end {
  464. display: flex;
  465. flex-direction: row;
  466. justify-content: flex-end;
  467. width: 100%;
  468. }
  469. .line-end .block {
  470. display: flex;
  471. flex-direction: column;
  472. justify-content: center;
  473. }
  474. .line-center {
  475. display: flex;
  476. flex-direction: row;
  477. justify-content: center;
  478. width: 100%;
  479. height: 100%;
  480. }
  481. .line-center .block {
  482. display: flex;
  483. flex-direction: column;
  484. justify-content: center;
  485. }
  486. .rtu-name {
  487. margin-left: 5rpx;
  488. font-size: 0.7rem;
  489. font-weight: bold;
  490. }
  491. .rtu-code {
  492. margin-left: 5rpx;
  493. font-size: 0.6rem;
  494. color: gray;
  495. }
  496. .item-text-line {
  497. width: 100%;
  498. display: flex;
  499. flex-direction: row;
  500. align-items: flex-start;
  501. padding-left: 0px;
  502. padding-right: 0px;
  503. .block {
  504. height: 100%;
  505. display: flex;
  506. flex-direction: column;
  507. justify-content: center;
  508. align-items: center;
  509. }
  510. .item-title {
  511. font-size: 0.7rem;
  512. }
  513. .item-text {
  514. padding-left: 2px;
  515. padding-right: 5px;
  516. font-size: 0.7rem;
  517. }
  518. .item-text-ell {
  519. width: 100%;
  520. overflow: hidden;
  521. font-size: 0.7rem;
  522. white-space: nowrap;
  523. text-overflow: ellipsis;
  524. }
  525. .item-number {
  526. font-size: 0.7rem;
  527. margin-left: 2px;
  528. margin-right: 5px;
  529. }
  530. }
  531. .item-title-image {
  532. /* #ifndef APP-NVUE */
  533. display: block;
  534. /* #endif */
  535. margin-right: 5px;
  536. width: 20px;
  537. height: 20px;
  538. border-radius: 50%;
  539. }
  540. .uni-badge-left-margin {
  541. margin-left: 0px;
  542. }
  543. .logo {
  544. flex-shrink: 0;
  545. width: 80rpx;
  546. height: auto;
  547. }
  548. .container {
  549. // background-color: #f7f7f7;
  550. // min-height: 100vh;
  551. overflow: hidden;
  552. padding: 0 0 75rpx;
  553. }
  554. .nav {
  555. margin: 0rpx 0;
  556. box-sizing: border-box;
  557. padding: 0 10rpx;
  558. &-item {
  559. width: 100%;
  560. box-sizing: border-box;
  561. display: flex;
  562. flex-direction: column;
  563. align-items: center;
  564. justify-content: space-between;
  565. height: 130rpx;
  566. &-img {
  567. width: 80rpx;
  568. height: 80rpx;
  569. }
  570. &-name {
  571. font-size: 0.7rem;
  572. font-family: PingFang SC;
  573. font-weight: 500;
  574. color: #585b61;
  575. }
  576. }
  577. }
  578. </style>