index.vue 14 KB

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