index.vue 16 KB

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