index.vue 14 KB

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