index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  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">
  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">
  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">
  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. },
  206. methods: {
  207. taskStatus,taskPriority,taskType,
  208. alertLevel,alertStatus,
  209. dangerStatus,dangerLevel,
  210. scanQrcode(){
  211. uni.scanCode({
  212. onlyFromCamera: true,
  213. success: function (res) {
  214. let qrcode=uni.setStorageSync('qrcode',res.result)
  215. uni.navigateTo({
  216. url:`/pages/webview/webview?type=scan&name=扫码处理`
  217. })
  218. },
  219. fail(res) {
  220. uni.showToast({
  221. icon:'none',
  222. title:"扫码失败"
  223. })
  224. }
  225. });
  226. },
  227. linkToMessage(){
  228. uni.navigateTo({
  229. url:"/pages/message/message"
  230. })
  231. },
  232. getData(){
  233. let user=uni.getStorageSync('accountInfo');
  234. if(user){this.user=user}
  235. let notice=""
  236. getNotices({
  237. page: 1,
  238. limit: 10,
  239. artCatId: 2,
  240. artCatTitle: "最新动态"
  241. }).then((res)=>{
  242. for(let i=0;i<res.data.length;i++){
  243. notice+=`${res.data[i].artTitle} 发布时间:${res.data[i].issuedAt};`
  244. }
  245. this.notice=notice
  246. })
  247. let params={
  248. page: 1,
  249. limit: 5,
  250. status: 0,
  251. handleAccountId: user.userId
  252. }
  253. getAlertByPage(params).then((res)=>{
  254. this.alertList=res.data
  255. this.alertTotal=res.total
  256. })
  257. getDangerByPage({
  258. page: 1,
  259. limit: 5,
  260. curAccountId: user.userId
  261. }).then((res)=>{
  262. this.dangerList=res.data
  263. this.dangerTotal=res.total
  264. })
  265. getTaskByPage(params).then((res)=>{
  266. this.taskList=res.data
  267. this.taskTotal=res.total
  268. })
  269. },
  270. linkTo(type,name){
  271. uni.navigateTo({
  272. url:`/pages/index/detail/detail?type=${type}&name=${name}`
  273. })
  274. }
  275. }
  276. }
  277. </script>
  278. <style lang="scss" scoped>
  279. .index-page {
  280. min-height: 100vh;
  281. background-color: rgba(245, 246, 248, 1);
  282. .header{
  283. height: 400rpx;
  284. background-image: url('/static/index/bg.png');
  285. background-repeat: no-repeat;
  286. background-size: 100% 100%;
  287. /* #ifdef MP-WEIXIN */
  288. padding-top: 28px;
  289. /* #endif */
  290. .status_bar{
  291. padding: 0 32rpx;
  292. height: 88rpx;
  293. display: flex;
  294. justify-content: space-between;
  295. align-items: center;
  296. .name{
  297. font-size: 40rpx;
  298. font-weight: 600;
  299. color: #000;
  300. }
  301. .actions{
  302. display: flex;
  303. align-items: center;
  304. .message{
  305. .icon{
  306. display: inline-block;
  307. width: 32rpx;
  308. }
  309. }
  310. .scan{
  311. width: 144rpx;
  312. height: 48rpx;
  313. border-radius: 20rpx;
  314. background-color: #fff;
  315. display: flex;
  316. justify-content: center;
  317. align-items: center;
  318. margin-left: 32rpx;
  319. .icon{
  320. display: inline-block;
  321. width: 28rpx;
  322. }
  323. .icon-name{
  324. font-size: 24rpx;
  325. color: #000;
  326. padding-left: 10rpx;
  327. }
  328. }
  329. }
  330. }
  331. .user-info{
  332. width: 686rpx;
  333. height: 228rpx;
  334. background: linear-gradient(180deg, #7AB2FF 0%, #808EFF 100%);
  335. margin: 0 auto;
  336. border-radius: 16px;
  337. margin-top: 24rpx;
  338. padding: 24px 22rpx 0 30rpx;
  339. box-sizing: border-box;
  340. .company{
  341. display: flex;
  342. justify-content: flex-end;
  343. align-items: center;
  344. .company-name{
  345. padding-right: 10rpx;
  346. font-size: 28rpx;
  347. color: #fff;
  348. }
  349. .icon{
  350. display: block;
  351. width: 40rpx;
  352. height: 40rpx;
  353. }
  354. }
  355. .user{
  356. display: flex;
  357. align-items: center;
  358. .avatar-box{
  359. width: 72rpx;
  360. height: 72rpx;
  361. border-radius: 50%;
  362. .avatar{
  363. display: block;
  364. width: 72rpx;
  365. height: 72rpx;
  366. border-radius: 50%;
  367. }
  368. }
  369. .info{
  370. padding-left: 24rpx;
  371. .user-name{
  372. font-size: 32rpx;
  373. color: #fff;
  374. }
  375. .user-position{
  376. font-size: 24rpx;
  377. color: #fff;
  378. opacity: 0.6;
  379. padding-top: 8rpx;
  380. }
  381. }
  382. }
  383. }
  384. }
  385. .container{
  386. position: relative;
  387. width: 750rpx;
  388. .cont{
  389. width: 750rpx;
  390. min-height: 1200px;
  391. position: absolute;
  392. overflow: auto;
  393. background-image: url('/static/index/bg-bottom.png');
  394. background-repeat: no-repeat;
  395. background-size: 100% 1200px;
  396. background-position: 0 0;
  397. box-sizing: border-box;
  398. top: -45px;
  399. margin-top: var(--status-bar-height);
  400. left: 0;
  401. .container-wrap{
  402. padding: 0 32rpx;
  403. background-color: rgba(245, 246, 248, 1);
  404. padding-bottom: 180rpx;
  405. }
  406. .notice{
  407. height: 84rpx;
  408. background-color:rgba(245, 246, 248, 1);
  409. margin-top: 48rpx;
  410. border-radius: 8rpx;
  411. display: flex;
  412. justify-content: space-between;
  413. align-items: center;
  414. box-shadow: 0px 10px 10px -4px rgba(45, 54, 67, 0.2);
  415. padding: 0 32rpx;
  416. .notice-name{
  417. font-weight: 600;
  418. font-size: 24rpx;
  419. color: rgba(0, 0, 0, 0.9);
  420. .icon{
  421. width: 22rpx;
  422. margin-right: 8rpx;
  423. }
  424. }
  425. .notice-cont{
  426. width: 500rpx;
  427. height: 80rpx;
  428. flex: 1;
  429. font-size: 28rpx;
  430. color: rgba(0, 0, 0, 0.9);
  431. // background-color: #fff;
  432. }
  433. }
  434. .tab{
  435. display: flex;
  436. justify-content: center;
  437. align-items: center;
  438. padding: 40rpx 0 20rpx 0;
  439. .tab-item{
  440. width: 33.33%;
  441. height: 150rpx;
  442. display: flex;
  443. justify-content: center;
  444. align-items: center;
  445. flex-direction: column;
  446. .icon{
  447. width: 96rpx;
  448. }
  449. .tab-name{
  450. font-size: 28rpx;
  451. color: rgba(0, 0, 0, 0.9);
  452. padding-top: 12rpx;
  453. }
  454. }
  455. }
  456. .tab-cont{
  457. .part{
  458. .head{
  459. padding-top: 20rpx;
  460. display: flex;
  461. justify-content: space-between;
  462. align-items: center;
  463. .head-name{
  464. font-size: 32rpx;
  465. font-weight: 600;
  466. color: rgba(0, 0, 0, 0.9);
  467. }
  468. .more{
  469. font-size: 24rpx;
  470. color: rgba(110, 116, 128, 1);
  471. }
  472. }
  473. .part-cont{
  474. .item{
  475. background-color: #fff;
  476. border-radius: 12rpx;
  477. margin-top: 16rpx;
  478. padding: 24rpx 20rpx;
  479. .title{
  480. display: flex;
  481. justify-content: space-between;
  482. align-items: center;
  483. .name{
  484. font-size: 36rpx;
  485. color: rgba(0, 0, 0, 0.8);
  486. }
  487. .state{
  488. font-size: 32rpx;
  489. color: rgba(250, 139, 55, 1);
  490. }
  491. }
  492. .tags{
  493. padding-top: 24rpx;
  494. .tag{
  495. background: rgba(245, 246, 248, 1);
  496. font-size: 20rpx;
  497. margin-left: 10rpx;
  498. padding: 10rpx 20rpx;
  499. &:nth-child(1){
  500. color: rgba(234, 130, 89, 1);
  501. background: rgba(251, 241, 237, 1);
  502. }
  503. }
  504. }
  505. .time{
  506. padding-top: 20rpx;
  507. font-size: 28rpx;
  508. color:rgba(241, 57, 57, 0.8);
  509. }
  510. .bottom{
  511. display: flex;
  512. justify-content: space-between;
  513. align-items: center;
  514. padding-top: 20rpx;
  515. .user{
  516. display: flex;
  517. align-items: center;
  518. font-size: 24rpx;
  519. color: rgba(0, 0, 0, 1);
  520. .avatar{
  521. width: 44rpx;
  522. margin-right: 10rpx;
  523. }
  524. }
  525. .hand-time{
  526. font-size: 24rpx;
  527. color: rgba(0, 0, 0, 1);
  528. }
  529. }
  530. }
  531. }
  532. }
  533. }
  534. }
  535. }
  536. }
  537. </style>