index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  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. uni.navigateTo({
  366. url:`/pages/index/handle/task/hazardRecord/hazardRecord?rid=${item.taskId}&cid=${checklistId}&title=${item.taskTitle}`
  367. })
  368. } else if (checklistTypeId === 2) {// PointRecordView
  369. uni.navigateTo({
  370. url:`/pages/index/handle/task/task?rid=${item.taskId}&cid=${checklistId}&title=${item.taskTitle}`
  371. })
  372. } else if (checklistTypeId === 3) {// ScoreRecordView
  373. uni.navigateTo({
  374. url:`/pages/index/handle/task/task?rid=${item.taskId}&cid=${checklistId}&title=${item.taskTitle}`
  375. })
  376. }
  377. })
  378. }
  379. }
  380. }
  381. </script>
  382. <style lang="scss" scoped>
  383. .index-page {
  384. min-height: 100vh;
  385. background-color: rgba(245, 246, 248, 1);
  386. .header{
  387. height: 400rpx;
  388. background-image: url('/static/index/bg.png');
  389. background-repeat: no-repeat;
  390. background-size: 100% 100%;
  391. /* #ifdef MP-WEIXIN */
  392. padding-top: 28px;
  393. /* #endif */
  394. .status_bar{
  395. padding: 0 32rpx;
  396. height: 88rpx;
  397. display: flex;
  398. justify-content: space-between;
  399. align-items: center;
  400. .name{
  401. font-size: 40rpx;
  402. font-weight: 600;
  403. color: #000;
  404. }
  405. .actions{
  406. display: flex;
  407. align-items: center;
  408. .message{
  409. .icon{
  410. display: inline-block;
  411. width: 32rpx;
  412. }
  413. }
  414. .scan{
  415. width: 144rpx;
  416. height: 48rpx;
  417. border-radius: 20rpx;
  418. background-color: #fff;
  419. display: flex;
  420. justify-content: center;
  421. align-items: center;
  422. margin-left: 32rpx;
  423. .icon{
  424. display: inline-block;
  425. width: 28rpx;
  426. }
  427. .icon-name{
  428. font-size: 24rpx;
  429. color: #000;
  430. padding-left: 10rpx;
  431. }
  432. }
  433. }
  434. }
  435. .user-info{
  436. width: 686rpx;
  437. height: 228rpx;
  438. background: linear-gradient(180deg, #7AB2FF 0%, #808EFF 100%);
  439. margin: 0 auto;
  440. border-radius: 16px;
  441. margin-top: 24rpx;
  442. padding: 24px 22rpx 0 30rpx;
  443. box-sizing: border-box;
  444. .company{
  445. display: flex;
  446. justify-content: flex-end;
  447. align-items: center;
  448. .company-name{
  449. padding-right: 10rpx;
  450. font-size: 28rpx;
  451. color: #fff;
  452. }
  453. .icon{
  454. display: block;
  455. width: 40rpx;
  456. height: 40rpx;
  457. }
  458. }
  459. .user{
  460. display: flex;
  461. align-items: center;
  462. .avatar-box{
  463. width: 72rpx;
  464. height: 72rpx;
  465. border-radius: 50%;
  466. .avatar{
  467. display: block;
  468. width: 72rpx;
  469. height: 72rpx;
  470. border-radius: 50%;
  471. }
  472. }
  473. .info{
  474. padding-left: 24rpx;
  475. .user-name{
  476. font-size: 32rpx;
  477. color: #fff;
  478. }
  479. .user-position{
  480. font-size: 24rpx;
  481. color: #fff;
  482. opacity: 0.6;
  483. padding-top: 8rpx;
  484. }
  485. }
  486. }
  487. }
  488. }
  489. .container{
  490. position: relative;
  491. width: 750rpx;
  492. .cont{
  493. width: 750rpx;
  494. // max-height: 1200px;
  495. position: absolute;
  496. overflow: auto;
  497. background-image: url('/static/index/bg-bottom.png');
  498. background-repeat: no-repeat;
  499. background-size: 100% 1200px;
  500. background-position: 0 0;
  501. box-sizing: border-box;
  502. top: -45px;
  503. margin-top: var(--status-bar-height);
  504. left: 0;
  505. .container-wrap{
  506. padding: 0 32rpx;
  507. background-color: rgba(245, 246, 248, 1);
  508. padding-bottom: 180rpx;
  509. }
  510. .notice{
  511. height: 84rpx;
  512. background-color:rgba(245, 246, 248, 1);
  513. margin-top: 48rpx;
  514. border-radius: 8rpx;
  515. display: flex;
  516. justify-content: space-between;
  517. align-items: center;
  518. box-shadow: 0px 10px 10px -4px rgba(45, 54, 67, 0.2);
  519. padding: 0 32rpx;
  520. .notice-name{
  521. font-weight: 600;
  522. font-size: 24rpx;
  523. color: rgba(0, 0, 0, 0.9);
  524. .icon{
  525. width: 22rpx;
  526. margin-right: 8rpx;
  527. }
  528. }
  529. .notice-cont{
  530. width: 500rpx;
  531. height: 80rpx;
  532. flex: 1;
  533. font-size: 28rpx;
  534. color: rgba(0, 0, 0, 0.9);
  535. // background-color: #fff;
  536. }
  537. }
  538. .tab{
  539. display: flex;
  540. justify-content: center;
  541. align-items: center;
  542. padding: 40rpx 0 20rpx 0;
  543. .tab-item{
  544. width: 25%;
  545. // height: 150rpx;
  546. display: flex;
  547. justify-content: center;
  548. align-items: center;
  549. flex-direction: column;
  550. .icon{
  551. width: 96rpx;
  552. }
  553. .tab-name{
  554. font-size: 28rpx;
  555. color: rgba(0, 0, 0, 0.9);
  556. padding-top: 12rpx;
  557. }
  558. }
  559. }
  560. .tab-cont{
  561. .part{
  562. .head{
  563. padding-top: 20rpx;
  564. display: flex;
  565. justify-content: space-between;
  566. align-items: center;
  567. .head-name{
  568. font-size: 32rpx;
  569. font-weight: 600;
  570. color: rgba(0, 0, 0, 0.9);
  571. }
  572. .more{
  573. font-size: 24rpx;
  574. color: rgba(110, 116, 128, 1);
  575. }
  576. }
  577. .part-cont{
  578. .item{
  579. background-color: #fff;
  580. border-radius: 12rpx;
  581. margin-top: 16rpx;
  582. padding: 24rpx 20rpx 24rpx 50rpx;
  583. position: relative;
  584. .index{
  585. width: 38rpx;
  586. height: 38rpx;
  587. line-height: 38rpx;
  588. text-align: center;
  589. border-radius: 50%;
  590. color:#ea8259;
  591. background-color:#fbf1ed;
  592. font-size:20rpx;
  593. position: absolute;
  594. left: 4rpx;
  595. top: 28rpx;
  596. }
  597. .title{
  598. display: flex;
  599. justify-content: space-between;
  600. align-items: center;
  601. .name{
  602. font-size: 32rpx;
  603. color: rgba(0, 0, 0, 0.8);
  604. }
  605. .state{
  606. font-size: 30rpx;
  607. color: rgba(250, 139, 55, 1);
  608. }
  609. }
  610. .tags{
  611. padding-top: 24rpx;
  612. .tag{
  613. background: rgba(245, 246, 248, 1);
  614. font-size: 20rpx;
  615. margin-left: 10rpx;
  616. padding: 10rpx 20rpx;
  617. &:nth-child(1){
  618. color: rgba(234, 130, 89, 1);
  619. background: rgba(251, 241, 237, 1);
  620. }
  621. }
  622. }
  623. .time{
  624. padding-top: 20rpx;
  625. font-size: 28rpx;
  626. color:rgba(241, 57, 57, 0.8);
  627. }
  628. .bottom{
  629. display: flex;
  630. justify-content: space-between;
  631. align-items: center;
  632. padding-top: 20rpx;
  633. .user{
  634. display: flex;
  635. align-items: center;
  636. font-size: 24rpx;
  637. color: rgba(0, 0, 0, 1);
  638. .avatar{
  639. width: 44rpx;
  640. margin-right: 10rpx;
  641. }
  642. }
  643. .hand-time{
  644. font-size: 24rpx;
  645. color: rgba(0, 0, 0, 1);
  646. }
  647. }
  648. }
  649. }
  650. }
  651. }
  652. }
  653. }
  654. }
  655. </style>