index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. <template>
  2. <view class="index-page ">
  3. <view class="header custom_status_bar">
  4. <view class="status_bar">
  5. <div class="name">工作台</div>
  6. <div class="actions">
  7. <div class="message" @click="linkToMessage">
  8. <image v-if="user.userAvatar" class="icon" src="/static/index/message.png" mode="widthFix"></image>
  9. </div>
  10. <div class="scan" @click="scanQrcode">
  11. <image class="icon" src="/static/index/scanner.png" mode="widthFix"></image>
  12. <text class="icon-name">扫一扫</text>
  13. </div>
  14. </div>
  15. </view>
  16. <view class="user-info">
  17. <div class="company">
  18. <text class="company-name">{{user.ocName}}</text>
  19. <image class="icon" src="/static/index/company.png" mode="widthFix"></image>
  20. </div>
  21. <div class="user">
  22. <view class="avatar-box">
  23. <image v-if="user.userAvatar" class="avatar" :src="user.userAvatar" mode="widthFix" @error="userAvatar=defaultAvatar"></image>
  24. <image v-else class="avatar" :src="defaultAvatar" mode="widthFix"></image>
  25. </view>
  26. <view class="info">
  27. <view class="user-name">
  28. {{user.userName}}
  29. </view>
  30. <view class="user-position">
  31. {{user.positionName}}
  32. </view>
  33. </view>
  34. </div>
  35. </view>
  36. </view>
  37. <view class="container">
  38. <view class="cont">
  39. <div class="container-wrap">
  40. <div class="notice">
  41. <div class="notice-name">
  42. <image class="icon" src="/static/index/notice.png" mode="widthFix"></image>
  43. <text>最近动态</text>
  44. </div>
  45. <div class="notice-cont">
  46. <uni-notice-bar
  47. scrollable :text="notice"
  48. background-color="#fff0"
  49. :speed="20"
  50. color="#333" />
  51. </div>
  52. </div>
  53. <view class="tab">
  54. <div class="tab-item">
  55. <image class="icon" src="/static/index/tab1.png" mode="widthFix"></image>
  56. <view class="tab-name">待办任务 {{taskTotal>99?'99+':taskTotal}} 个</view>
  57. </div>
  58. <div class="tab-item">
  59. <image class="icon" src="/static/index/tab2.png" mode="widthFix"></image>
  60. <view class="tab-name">告警事件 {{alertTotal>99?'99+':alertTotal}}个</view>
  61. </div>
  62. <div class="tab-item">
  63. <image class="icon" src="/static/index/tab3.png" mode="widthFix"></image>
  64. <view class="tab-name">待处理隐患 {{dangerTotal>99?'99+':dangerTotal}}个</view>
  65. </div>
  66. </view>
  67. <view class="tab-cont">
  68. <div class="part">
  69. <div class="head">
  70. <text class="head-name">待办任务</text>
  71. <view class="more" @click="linkTo('task','待办任务')">更多</view>
  72. </div>
  73. <div class="part-cont">
  74. <div class="item" v-for="item in taskList" :key="item.taskId">
  75. <div class="title">
  76. <div class="name">{{item.taskTitle}}</div>
  77. <view class="state">{{taskStatus(item.status)}}</view>
  78. </div>
  79. <div class="tags">
  80. <text class="tag">{{taskPriority(item.taskPriority)}}</text>
  81. <text class="tag">{{item.taskCatTitle}}</text>
  82. <text class="tag">{{taskType(item.taskTypeId)}}</text>
  83. </div>
  84. <view class="time">
  85. 预期结束时间:{{item.expectedEndTime}}
  86. </view>
  87. <div class="bottom">
  88. <view class="user">
  89. <image class="avatar" src="/static/index/user.png" mode="widthFix"></image>
  90. 处理人:{{item.handleAccountName}}
  91. </view>
  92. <view class="hand-time">
  93. {{item.launchTime}}
  94. </view>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. <div class="part">
  100. <div class="head">
  101. <text class="head-name">告警事件</text>
  102. <view class="more" @click="linkTo('alert','告警事件')">更多</view>
  103. </div>
  104. <div class="part-cont">
  105. <div class="item" v-for="item in alertList" :key="item.alertId">
  106. <div class="title">
  107. <div class="name">{{item.alertTitle}}</div>
  108. <view class="state">{{alertStatus(item.status)}}</view>
  109. </div>
  110. <div class="tags">
  111. <text class="tag">{{alertLevel(item.alertLevel)}}</text>
  112. </div>
  113. <view class="time">
  114. 发生时间:{{item.alertTime}}
  115. </view>
  116. <div class="bottom">
  117. <view class="user">
  118. <image class="avatar" src="/static/index/user.png" mode="widthFix"></image>
  119. 处理人:{{item.handleAccountName}}
  120. </view>
  121. <view class="hand-time">
  122. {{item.handleTime}}
  123. </view>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. <div class="part">
  129. <div class="head">
  130. <text class="head-name">待处理隐患</text>
  131. <view class="more" @click="linkTo('danger','待处理隐患')">更多</view>
  132. </div>
  133. <div class="part-cont">
  134. <div class="item" v-for="item in dangerList" :key="item.dangerId">
  135. <div class="title">
  136. <div class="name">{{item.dangerTitle}}</div>
  137. <view class="state">{{dangerStatus(item.status)}}</view>
  138. </div>
  139. <div class="tags">
  140. <text class="tag">{{dangerLevel(item.dangerLevel)}}</text>
  141. <text class="tag">{{item.dangerCatTitle}}</text>
  142. </div>
  143. <view class="time">
  144. 预期结束时间:{{item.dangerDeadLine}}
  145. </view>
  146. <div class="bottom">
  147. <view class="user">
  148. <image class="avatar" src="/static/index/user.png" mode="widthFix"></image>
  149. 处理人:{{item.curAccountName}}
  150. </view>
  151. <view class="hand-time">
  152. {{item.submitTime}}
  153. </view>
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. </view>
  159. </div>
  160. </view>
  161. </view>
  162. </view>
  163. </template>
  164. <script>
  165. import {getNotices} from '@/api/system/art.js'
  166. import { getAlertByPage } from '@/api/aqpt/alertApi.js';
  167. import { getDangerByPage } from '@/api/aqpt/dangerApi.js';
  168. import { getTaskByPage } from '@/api/aqpt/taskApi.js';
  169. import{
  170. taskStatus,taskPriority,taskType,
  171. alertLevel,alertStatus,
  172. dangerStatus,dangerLevel,
  173. } from '@/libs/enum.js';
  174. export default {
  175. data() {
  176. return {
  177. applist: [],
  178. defaultAvatar:"/static/components/avatar.png",
  179. notice:"",
  180. user:{
  181. groupName: "",
  182. ocName: "",
  183. positionName: "",
  184. roleName: "",
  185. userAvatar: "",
  186. userIntro: "",
  187. userName: "",
  188. userPhone: "",
  189. userPhoto: "",
  190. userRealName: ""
  191. },
  192. alertList:[],
  193. dangerList:[],
  194. taskList:[],
  195. alertTotal:0,
  196. dangerTotal:0,
  197. taskTotal:0
  198. }
  199. },
  200. onShow() {
  201. this.getData()
  202. },
  203. methods: {
  204. taskStatus,taskPriority,taskType,
  205. alertLevel,alertStatus,
  206. dangerStatus,dangerLevel,
  207. scanQrcode(){
  208. uni.scanCode({
  209. onlyFromCamera: true,
  210. success: function (res) {
  211. console.log('条码类型:' + res.scanType);
  212. console.log('条码内容:' + res.result);
  213. },
  214. fail() {
  215. uni.showToast({
  216. icon:'none',
  217. title:"扫码失败"
  218. })
  219. }
  220. });
  221. },
  222. linkToMessage(){
  223. uni.navigateTo({
  224. url:"/pages/message/message"
  225. })
  226. },
  227. getData(){
  228. let user=uni.getStorageSync('accountInfo');
  229. if(user){this.user=user}
  230. let notice=""
  231. getNotices({
  232. page: 1,
  233. limit: 10,
  234. artCatId: 2,
  235. artCatTitle: "最新动态"
  236. }).then((res)=>{
  237. for(let i=0;i<res.data.length;i++){
  238. notice+=`${res.data[i].artTitle} 发布时间:${res.data[i].issuedAt};`
  239. }
  240. this.notice=notice
  241. })
  242. let params={
  243. page: 1,
  244. limit: 5,
  245. status: 0,
  246. handleAccountId: user.userId
  247. }
  248. getAlertByPage(params).then((res)=>{
  249. this.alertList=res.data
  250. this.alertTotal=res.total
  251. })
  252. getDangerByPage({
  253. page: 1,
  254. limit: 5,
  255. curAccountId: user.userId
  256. }).then((res)=>{
  257. this.dangerList=res.data
  258. this.dangerTotal=res.total
  259. })
  260. getTaskByPage(params).then((res)=>{
  261. this.taskList=res.data
  262. this.taskTotal=res.total
  263. })
  264. },
  265. linkTo(type,name){
  266. uni.navigateTo({
  267. url:`/pages/index/detail/detail?type=${type}&name=${name}`
  268. })
  269. }
  270. }
  271. }
  272. </script>
  273. <style lang="scss" scoped>
  274. .index-page {
  275. min-height: 100vh;
  276. background-color: rgba(245, 246, 248, 1);
  277. .header{
  278. height: 400rpx;
  279. background-image: url('/static/index/bg.png');
  280. background-repeat: no-repeat;
  281. background-size: 100% 100%;
  282. /* #ifdef MP-WEIXIN */
  283. padding-top: 28px;
  284. /* #endif */
  285. .status_bar{
  286. padding: 0 32rpx;
  287. height: 88rpx;
  288. display: flex;
  289. justify-content: space-between;
  290. align-items: center;
  291. .name{
  292. font-size: 40rpx;
  293. font-weight: 600;
  294. color: #000;
  295. }
  296. .actions{
  297. display: flex;
  298. align-items: center;
  299. .message{
  300. .icon{
  301. display: inline-block;
  302. width: 32rpx;
  303. }
  304. }
  305. .scan{
  306. width: 144rpx;
  307. height: 48rpx;
  308. border-radius: 20rpx;
  309. background-color: #fff;
  310. display: flex;
  311. justify-content: center;
  312. align-items: center;
  313. margin-left: 32rpx;
  314. .icon{
  315. display: inline-block;
  316. width: 28rpx;
  317. }
  318. .icon-name{
  319. font-size: 24rpx;
  320. color: #000;
  321. padding-left: 10rpx;
  322. }
  323. }
  324. }
  325. }
  326. .user-info{
  327. width: 686rpx;
  328. height: 228rpx;
  329. background: linear-gradient(180deg, #7AB2FF 0%, #808EFF 100%);
  330. margin: 0 auto;
  331. border-radius: 16px;
  332. margin-top: 24rpx;
  333. padding: 24px 22rpx 0 30rpx;
  334. box-sizing: border-box;
  335. .company{
  336. display: flex;
  337. justify-content: flex-end;
  338. align-items: center;
  339. .company-name{
  340. padding-right: 10rpx;
  341. font-size: 28rpx;
  342. color: #fff;
  343. }
  344. .icon{
  345. display: block;
  346. width: 40rpx;
  347. height: 40rpx;
  348. }
  349. }
  350. .user{
  351. display: flex;
  352. align-items: center;
  353. .avatar-box{
  354. width: 72rpx;
  355. height: 72rpx;
  356. border-radius: 50%;
  357. .avatar{
  358. display: block;
  359. width: 72rpx;
  360. height: 72rpx;
  361. border-radius: 50%;
  362. }
  363. }
  364. .info{
  365. padding-left: 24rpx;
  366. .user-name{
  367. font-size: 32rpx;
  368. color: #fff;
  369. }
  370. .user-position{
  371. font-size: 24rpx;
  372. color: #fff;
  373. opacity: 0.6;
  374. padding-top: 8rpx;
  375. }
  376. }
  377. }
  378. }
  379. }
  380. .container{
  381. position: relative;
  382. width: 750rpx;
  383. .cont{
  384. width: 750rpx;
  385. min-height: 1200px;
  386. position: absolute;
  387. overflow: auto;
  388. background-image: url('/static/index/bg-bottom.png');
  389. background-repeat: no-repeat;
  390. background-size: 100% 1200px;
  391. background-position: 0 0;
  392. box-sizing: border-box;
  393. top: -45px;
  394. margin-top: var(--status-bar-height);
  395. left: 0;
  396. .container-wrap{
  397. padding: 0 32rpx;
  398. background-color: rgba(245, 246, 248, 1);
  399. padding-bottom: 180rpx;
  400. }
  401. .notice{
  402. height: 84rpx;
  403. background-color:rgba(245, 246, 248, 1);
  404. margin-top: 48rpx;
  405. border-radius: 8rpx;
  406. display: flex;
  407. justify-content: space-between;
  408. align-items: center;
  409. box-shadow: 0px 10px 10px -4px rgba(45, 54, 67, 0.2);
  410. padding: 0 32rpx;
  411. .notice-name{
  412. font-weight: 600;
  413. font-size: 24rpx;
  414. color: rgba(0, 0, 0, 0.9);
  415. .icon{
  416. width: 22rpx;
  417. margin-right: 8rpx;
  418. }
  419. }
  420. .notice-cont{
  421. width: 500rpx;
  422. height: 80rpx;
  423. flex: 1;
  424. font-size: 28rpx;
  425. color: rgba(0, 0, 0, 0.9);
  426. // background-color: #fff;
  427. }
  428. }
  429. .tab{
  430. display: flex;
  431. justify-content: center;
  432. align-items: center;
  433. padding: 40rpx 0 20rpx 0;
  434. .tab-item{
  435. width: 33.33%;
  436. height: 150rpx;
  437. display: flex;
  438. justify-content: center;
  439. align-items: center;
  440. flex-direction: column;
  441. .icon{
  442. width: 96rpx;
  443. }
  444. .tab-name{
  445. font-size: 28rpx;
  446. color: rgba(0, 0, 0, 0.9);
  447. padding-top: 12rpx;
  448. }
  449. }
  450. }
  451. .tab-cont{
  452. .part{
  453. .head{
  454. padding-top: 20rpx;
  455. display: flex;
  456. justify-content: space-between;
  457. align-items: center;
  458. .head-name{
  459. font-size: 32rpx;
  460. font-weight: 600;
  461. color: rgba(0, 0, 0, 0.9);
  462. }
  463. .more{
  464. font-size: 24rpx;
  465. color: rgba(110, 116, 128, 1);
  466. }
  467. }
  468. .part-cont{
  469. .item{
  470. background-color: #fff;
  471. border-radius: 12rpx;
  472. margin-top: 16rpx;
  473. padding: 24rpx 20rpx;
  474. .title{
  475. display: flex;
  476. justify-content: space-between;
  477. align-items: center;
  478. .name{
  479. font-size: 36rpx;
  480. color: rgba(0, 0, 0, 0.8);
  481. }
  482. .state{
  483. font-size: 32rpx;
  484. color: rgba(250, 139, 55, 1);
  485. }
  486. }
  487. .tags{
  488. padding-top: 24rpx;
  489. .tag{
  490. background: rgba(245, 246, 248, 1);
  491. font-size: 20rpx;
  492. margin-left: 10rpx;
  493. padding: 10rpx 20rpx;
  494. &:nth-child(1){
  495. color: rgba(234, 130, 89, 1);
  496. background: rgba(251, 241, 237, 1);
  497. }
  498. }
  499. }
  500. .time{
  501. padding-top: 20rpx;
  502. font-size: 28rpx;
  503. color:rgba(241, 57, 57, 0.8);
  504. }
  505. .bottom{
  506. display: flex;
  507. justify-content: space-between;
  508. align-items: center;
  509. padding-top: 20rpx;
  510. .user{
  511. display: flex;
  512. align-items: center;
  513. font-size: 24rpx;
  514. color: rgba(0, 0, 0, 1);
  515. .avatar{
  516. width: 44rpx;
  517. margin-right: 10rpx;
  518. }
  519. }
  520. .hand-time{
  521. font-size: 24rpx;
  522. color: rgba(0, 0, 0, 1);
  523. }
  524. }
  525. }
  526. }
  527. }
  528. }
  529. }
  530. }
  531. }
  532. </style>