index.vue 18 KB

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