index.vue 14 KB

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