index.vue 17 KB

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