index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  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" @click="linkTo('task','待办任务')">
  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" @click="linkTo('alert','预警事件')">
  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" @click="linkTo('warn','告警事件')">
  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" @click="linkTo('danger','待处理隐患')">
  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" @click="handle('task',item)">
  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.warnId" @click="handle('warn',item)">
  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" @click="handle('danger',item)">
  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,getMyWaitingTaskTop } from '@/api/aqpt/taskApi.js';
  210. import { getMyWarningWaitingTop } from '@/api/aqpt/warning.js';
  211. import { handleCheckTask } from '@/api/aqpt/checkTaskApi'
  212. import{
  213. taskStatus,taskPriority,taskType,
  214. alertLevel,alertStatus,
  215. dangerStatus,dangerLevel,
  216. } from '@/libs/enum.js';
  217. export default {
  218. data() {
  219. return {
  220. applist: [],
  221. defaultAvatar:"/static/components/avatar.png",
  222. showNotice:false,
  223. notice:"",
  224. user:{
  225. groupName: "",
  226. ocName: "",
  227. positionName: "",
  228. roleName: "",
  229. userAvatar: "",
  230. userIntro: "",
  231. userName: "",
  232. userPhone: "",
  233. userPhoto: "",
  234. userRealName: ""
  235. },
  236. alertList:[],
  237. dangerList:[],
  238. taskList:[],
  239. warnList:[],
  240. alertTotal:0,
  241. dangerTotal:0,
  242. taskTotal:0,
  243. warnTotal:0
  244. }
  245. },
  246. // created() {
  247. // this.getData()
  248. // },
  249. onShow() {
  250. this.getData()
  251. },
  252. onPullDownRefresh() {
  253. this.getData()
  254. uni.stopPullDownRefresh()
  255. },
  256. methods: {
  257. taskStatus,taskPriority,taskType,
  258. alertLevel,alertStatus,
  259. dangerStatus,dangerLevel,
  260. warningLevelFilter(val) {
  261. const enums = { 1: 'Ⅰ级', 2: 'Ⅱ级', 3: 'Ⅲ级', 4: 'Ⅳ级' }
  262. return enums[val]
  263. },
  264. scanQrcode(){
  265. uni.scanCode({
  266. onlyFromCamera: true,
  267. success: function (res) {
  268. if(res.result.includes('ocId')&&res.result.includes('code')){
  269. uni.setStorageSync('qrcode',res.result)
  270. uni.navigateTo({
  271. url:`/pages/webview/webview?type=scan&name=扫码处理`
  272. })
  273. }else{
  274. uni.showToast({
  275. icon:'none',
  276. title:"无效的二维码"
  277. })
  278. }
  279. },
  280. fail(res) {
  281. uni.showToast({
  282. icon:'none',
  283. title:"扫码失败"
  284. })
  285. }
  286. });
  287. },
  288. linkToMessage(){
  289. uni.navigateTo({
  290. url:"/pages/message/message"
  291. })
  292. },
  293. getData(){
  294. let user=uni.getStorageSync('accountInfo');
  295. if(user){this.user=user}
  296. let notice=""
  297. getArtByList(3).then((res)=>{
  298. for(let i=0;i<res.data.length;i++){
  299. notice+=`${res.data[i].artTitle} 发布时间:${res.data[i].issuedAt};`
  300. }
  301. this.notice=notice
  302. this.showNotice=true
  303. this.$nextTick(()=>{
  304. this.$refs['uni-notice-bar'].initSize()
  305. })
  306. })
  307. let params={
  308. page: 1,
  309. limit: 5,
  310. status: 0,
  311. handleAccountId: user.userId
  312. }
  313. getMyWarningWaitingTop(5).then((res)=>{
  314. this.warnList=res.data
  315. this.warnTotal=res.total
  316. })
  317. getAlertByPage(params).then((res)=>{
  318. this.alertList=res.data
  319. this.alertTotal=res.total
  320. })
  321. getDangerByPage({
  322. page: 1,
  323. limit: 5,
  324. curAccountId: user.userId
  325. }).then((res)=>{
  326. this.dangerList=res.data
  327. this.dangerTotal=res.total
  328. })
  329. // getTaskByPage(params).then((res)=>{
  330. // this.taskList=res.data
  331. // this.taskTotal=res.total
  332. // })
  333. getMyWaitingTaskTop(5).then((res)=>{
  334. this.taskList=res.data
  335. this.taskTotal=res.total
  336. })
  337. },
  338. linkTo(type,name){
  339. uni.navigateTo({
  340. url:`/pages/index/detail/detail?type=${type}&name=${name}`
  341. })
  342. },
  343. handle(type,item){
  344. let url=""
  345. if(type==='danger'){
  346. url=`/pages/index/handle/danger/index/index?type=${type}&id=${item.dangerId}`
  347. }
  348. if(type==='task'){this.handTask(item);return};
  349. if(type==='warn'){
  350. url=`/pages/index/handle/warning/warning?id=${item.warnId}`
  351. }
  352. uni.navigateTo({
  353. url
  354. })
  355. },
  356. handTask(item){
  357. handleCheckTask(item.taskId).then((res)=>{
  358. const { checklistId, checklistTypeId } = res.data //recordId-taskId
  359. // if (checklistTypeId === 1) {// HazardRecordView
  360. // } else if (checklistTypeId === 2) {// PointRecordView
  361. // } else if (checklistTypeId === 3) {// ScoreRecordView
  362. // }
  363. uni.navigateTo({
  364. url:`/pages/index/handle/task/task?rid=${item.taskId}&cid=${checklistId}&title=${item.taskTitle}`
  365. })
  366. })
  367. }
  368. }
  369. }
  370. </script>
  371. <style lang="scss" scoped>
  372. .index-page {
  373. min-height: 100vh;
  374. background-color: rgba(245, 246, 248, 1);
  375. .header{
  376. height: 400rpx;
  377. background-image: url('/static/index/bg.png');
  378. background-repeat: no-repeat;
  379. background-size: 100% 100%;
  380. /* #ifdef MP-WEIXIN */
  381. padding-top: 28px;
  382. /* #endif */
  383. .status_bar{
  384. padding: 0 32rpx;
  385. height: 88rpx;
  386. display: flex;
  387. justify-content: space-between;
  388. align-items: center;
  389. .name{
  390. font-size: 40rpx;
  391. font-weight: 600;
  392. color: #000;
  393. }
  394. .actions{
  395. display: flex;
  396. align-items: center;
  397. .message{
  398. .icon{
  399. display: inline-block;
  400. width: 32rpx;
  401. }
  402. }
  403. .scan{
  404. width: 144rpx;
  405. height: 48rpx;
  406. border-radius: 20rpx;
  407. background-color: #fff;
  408. display: flex;
  409. justify-content: center;
  410. align-items: center;
  411. margin-left: 32rpx;
  412. .icon{
  413. display: inline-block;
  414. width: 28rpx;
  415. }
  416. .icon-name{
  417. font-size: 24rpx;
  418. color: #000;
  419. padding-left: 10rpx;
  420. }
  421. }
  422. }
  423. }
  424. .user-info{
  425. width: 686rpx;
  426. height: 228rpx;
  427. background: linear-gradient(180deg, #7AB2FF 0%, #808EFF 100%);
  428. margin: 0 auto;
  429. border-radius: 16px;
  430. margin-top: 24rpx;
  431. padding: 24px 22rpx 0 30rpx;
  432. box-sizing: border-box;
  433. .company{
  434. display: flex;
  435. justify-content: flex-end;
  436. align-items: center;
  437. .company-name{
  438. padding-right: 10rpx;
  439. font-size: 28rpx;
  440. color: #fff;
  441. }
  442. .icon{
  443. display: block;
  444. width: 40rpx;
  445. height: 40rpx;
  446. }
  447. }
  448. .user{
  449. display: flex;
  450. align-items: center;
  451. .avatar-box{
  452. width: 72rpx;
  453. height: 72rpx;
  454. border-radius: 50%;
  455. .avatar{
  456. display: block;
  457. width: 72rpx;
  458. height: 72rpx;
  459. border-radius: 50%;
  460. }
  461. }
  462. .info{
  463. padding-left: 24rpx;
  464. .user-name{
  465. font-size: 32rpx;
  466. color: #fff;
  467. }
  468. .user-position{
  469. font-size: 24rpx;
  470. color: #fff;
  471. opacity: 0.6;
  472. padding-top: 8rpx;
  473. }
  474. }
  475. }
  476. }
  477. }
  478. .container{
  479. position: relative;
  480. width: 750rpx;
  481. .cont{
  482. width: 750rpx;
  483. // max-height: 1200px;
  484. position: absolute;
  485. overflow: auto;
  486. background-image: url('/static/index/bg-bottom.png');
  487. background-repeat: no-repeat;
  488. background-size: 100% 1200px;
  489. background-position: 0 0;
  490. box-sizing: border-box;
  491. top: -45px;
  492. margin-top: var(--status-bar-height);
  493. left: 0;
  494. .container-wrap{
  495. padding: 0 32rpx;
  496. background-color: rgba(245, 246, 248, 1);
  497. padding-bottom: 180rpx;
  498. }
  499. .notice{
  500. height: 84rpx;
  501. background-color:rgba(245, 246, 248, 1);
  502. margin-top: 48rpx;
  503. border-radius: 8rpx;
  504. display: flex;
  505. justify-content: space-between;
  506. align-items: center;
  507. box-shadow: 0px 10px 10px -4px rgba(45, 54, 67, 0.2);
  508. padding: 0 32rpx;
  509. .notice-name{
  510. font-weight: 600;
  511. font-size: 24rpx;
  512. color: rgba(0, 0, 0, 0.9);
  513. .icon{
  514. width: 22rpx;
  515. margin-right: 8rpx;
  516. }
  517. }
  518. .notice-cont{
  519. width: 500rpx;
  520. height: 80rpx;
  521. flex: 1;
  522. font-size: 28rpx;
  523. color: rgba(0, 0, 0, 0.9);
  524. // background-color: #fff;
  525. }
  526. }
  527. .tab{
  528. display: flex;
  529. justify-content: center;
  530. align-items: center;
  531. padding: 40rpx 0 20rpx 0;
  532. .tab-item{
  533. width: 25%;
  534. // height: 150rpx;
  535. display: flex;
  536. justify-content: center;
  537. align-items: center;
  538. flex-direction: column;
  539. .icon{
  540. width: 96rpx;
  541. }
  542. .tab-name{
  543. font-size: 28rpx;
  544. color: rgba(0, 0, 0, 0.9);
  545. padding-top: 12rpx;
  546. }
  547. }
  548. }
  549. .tab-cont{
  550. .part{
  551. .head{
  552. padding-top: 20rpx;
  553. display: flex;
  554. justify-content: space-between;
  555. align-items: center;
  556. .head-name{
  557. font-size: 32rpx;
  558. font-weight: 600;
  559. color: rgba(0, 0, 0, 0.9);
  560. }
  561. .more{
  562. font-size: 24rpx;
  563. color: rgba(110, 116, 128, 1);
  564. }
  565. }
  566. .part-cont{
  567. .item{
  568. background-color: #fff;
  569. border-radius: 12rpx;
  570. margin-top: 16rpx;
  571. padding: 24rpx 20rpx;
  572. .title{
  573. display: flex;
  574. justify-content: space-between;
  575. align-items: center;
  576. .name{
  577. font-size: 36rpx;
  578. color: rgba(0, 0, 0, 0.8);
  579. }
  580. .state{
  581. font-size: 32rpx;
  582. color: rgba(250, 139, 55, 1);
  583. }
  584. }
  585. .tags{
  586. padding-top: 24rpx;
  587. .tag{
  588. background: rgba(245, 246, 248, 1);
  589. font-size: 20rpx;
  590. margin-left: 10rpx;
  591. padding: 10rpx 20rpx;
  592. &:nth-child(1){
  593. color: rgba(234, 130, 89, 1);
  594. background: rgba(251, 241, 237, 1);
  595. }
  596. }
  597. }
  598. .time{
  599. padding-top: 20rpx;
  600. font-size: 28rpx;
  601. color:rgba(241, 57, 57, 0.8);
  602. }
  603. .bottom{
  604. display: flex;
  605. justify-content: space-between;
  606. align-items: center;
  607. padding-top: 20rpx;
  608. .user{
  609. display: flex;
  610. align-items: center;
  611. font-size: 24rpx;
  612. color: rgba(0, 0, 0, 1);
  613. .avatar{
  614. width: 44rpx;
  615. margin-right: 10rpx;
  616. }
  617. }
  618. .hand-time{
  619. font-size: 24rpx;
  620. color: rgba(0, 0, 0, 1);
  621. }
  622. }
  623. }
  624. }
  625. }
  626. }
  627. }
  628. }
  629. }
  630. </style>