index.vue 17 KB

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