index.vue 17 KB

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