平安校园
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

736 rader
17 KiB

  1. <template>
  2. <view class="warningBox">
  3. <!-- 头部背景 -->
  4. <view class="headerBox">
  5. <!-- <view class="">
  6. <image src="@/static/image/earlyWarning/back.png" mode="aspectFill"></image>
  7. </view> -->
  8. <view class="logo">
  9. <image src="@/static/image/earlyWarning/logo.png" mode="heightFix"></image>
  10. </view>
  11. </view>
  12. <view class="contentBox">
  13. <view class="warningInfo">
  14. <view class="searchBox">
  15. <view class="searchLine" @click="openSearch">
  16. <view class="searchLabels">
  17. <image v-show="isShowSearch==false" src="@/static/image/earlyWarning/screen.png" mode="">
  18. </image>
  19. <image v-show="isShowSearch" src="@/static/image/earlyWarning/screenActive.png" mode="">
  20. </image>
  21. <text class="labels">筛选</text>
  22. <view class="values">{{searchValue}}</view>
  23. </view>
  24. <view class="arrow">
  25. <image v-show="isShowSearch==false" src="@/static/image/earlyWarning/arrow1.png" mode="">
  26. </image>
  27. <image v-show="isShowSearch" src="@/static/image/earlyWarning/arrow2.png" mode=""></image>
  28. </view>
  29. </view>
  30. <view @click="isShowSearch=false" class="searchDialog" v-if="isShowSearch">
  31. <view class="content" @click.stop="isSelect">
  32. <u-row justify="space-between" gutter="10">
  33. <u-col span="7">
  34. <view class="demo-layout" @click="toOpen">
  35. <view class="left-layout">
  36. <text>{{searchForm.$alarmType || '预警类型'}}</text>
  37. </view>
  38. <view class="right-layout">
  39. <image style="width: 30rpx;height:30rpx;"
  40. src="@/static/image/earlyWarning/arrowRight.png" mode=""></image>
  41. </view>
  42. </view>
  43. </u-col>
  44. <u-col span="5">
  45. <view class="demo-layout" @click="toOpenSelect">
  46. <view class="left-layout">
  47. <text>{{searchForm.$warnHand || '处理状态'}}</text>
  48. </view>
  49. <view class="right-layout">
  50. <image style="width: 30rpx;height:30rpx;"
  51. src="@/static/image/earlyWarning/arrowRight.png" mode=""></image>
  52. </view>
  53. </view>
  54. </u-col>
  55. </u-row>
  56. <u-row style="margin-top:10px;" justify="space-between" gutter="10">
  57. <u-col span="12">
  58. <uni-datetime-picker v-model="searchForm.tick" type="datetimerange">
  59. <view class="demo-layout">
  60. <view class="startBox">
  61. {{searchForm.StartTick || '开始时间'}}
  62. </view>
  63. <text>至</text>
  64. <view class="endBox">
  65. {{searchForm.EndTick || '结束时间'}}
  66. </view>
  67. <view class="timeIcon">
  68. <image style="width: 30rpx;height:30rpx;"
  69. src="@/static/image/earlyWarning/calendar.png" mode=""></image>
  70. </view>
  71. </view>
  72. </uni-datetime-picker>
  73. </u-col>
  74. </u-row>
  75. <view class="btnBox">
  76. <view class="leftBtn" @click="clearform">
  77. 重置
  78. </view>
  79. <view class="rightBtn" @click="onsubmit">
  80. 确认
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <view class="tableBox">
  87. <u-empty marginTop="100rpx" :show="false" mode="list" text="暂无数据"></u-empty>
  88. <!-- <u-pull-refresh :refreshing="refreshing" @refresh="onRefresh"> -->
  89. <!-- <scroll-view class="scroll-view" scroll-y="true" refresher-enabled="true"
  90. @refresher-pull="onRefresh" @refresher-refresh="doRefresh" @refresher-restore="restore"
  91. @refresher-abort="abort"> -->
  92. <u-list :loading="isLoading" refresher-enabled :refresher-triggered="isTriggered"
  93. @refresher-pull="onRefresh" @scrolltolower="scrolltolower" style="height: calc(100% - 0rpx);">
  94. <u-list-item v-for="(item, index) in warnList" :key="index">
  95. <view class="liBox">
  96. <view class="headerCard">
  97. <view class="schoolName">
  98. 演示学校
  99. </view>
  100. <view class="statusBox" :class="[item.warnHand == 1?'handle':'nohandle']">
  101. {{item.warnHand == 1 ? '已处理' : '未处理'}}
  102. </view>
  103. </view>
  104. <view class="topCard">
  105. <view class="pic">
  106. <image :src="item.snapshotUrl" mode="aspectFill"
  107. @click="previewImage(item.snapshotUrl,index)"></image>
  108. </view>
  109. <view class="rightCard">
  110. <u-row>
  111. <u-col span="6">
  112. <view class="midContent">
  113. 姓名:--
  114. </view>
  115. </u-col>
  116. <u-col span="6">
  117. <view class="midContent">
  118. 系部:--
  119. </view>
  120. </u-col>
  121. </u-row>
  122. <u-row style="margin-top: 20rpx;">
  123. <u-col span="6">
  124. <view class="midContent">
  125. 专业:--
  126. </view>
  127. </u-col>
  128. <u-col span="6">
  129. <view class="midContent">
  130. 班级:{{item.personSetName || '--'}}
  131. </view>
  132. </u-col>
  133. </u-row>
  134. </view>
  135. </view>
  136. <view class="midCard">
  137. <view class="secondCard">
  138. <image style="width: 30rpx;height: 30rpx;"
  139. src="@/static/image/earlyWarning/warnType.png" mode=""></image>
  140. <view class="txt">
  141. 预警类型:{{item.alarmTypeDesc || '--'}}
  142. </view>
  143. </view>
  144. <view class="thirdCard">
  145. <image style="width: 30rpx;height: 30rpx;"
  146. src="@/static/image/earlyWarning/warnVideo.png" mode=""></image>
  147. <view class="txt">
  148. 预警摄像头:{{item.cameraName || '--'}}
  149. </view>
  150. </view>
  151. </view>
  152. <view class="btoCard">
  153. <view class="btoContent">
  154. 时间:{{item.tick}}
  155. </view>
  156. <view class="rightBox btoBox" @click="toDetail(item)">
  157. <view class="txt">
  158. 查看
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. </u-list-item>
  164. <u-loadmore :status="status" />
  165. </u-list>
  166. <!-- </scroll-view> -->
  167. <!-- </u-pull-refresh> -->
  168. </view>
  169. <selectSearch ref="selectSearchBox" :cellVisible="false"
  170. v-model="searchForm.alarmType" :options="warnOption" :title.sync="searchForm.$alarmType"
  171. placeholder="预警类型" search-placeholder="预警类型" />
  172. <selectRadio ref="selectRadioBox" :cellVisible="false" v-model="searchForm.warnHand"
  173. :options="handOption" :title.sync="searchForm.$warnHand" placeholder="处理状态" />
  174. </view>
  175. </view>
  176. </view>
  177. </template>
  178. <script>
  179. import selectRadio from "@/components/selectRadio.vue"
  180. import selectSearch from "@/components/selectSearch.vue"
  181. import {
  182. page, //获取列表
  183. warnType, //获取预警类型
  184. } from '@/api/warn/index.js'
  185. export default {
  186. components: {
  187. selectRadio,
  188. selectSearch
  189. },
  190. data() {
  191. return {
  192. searchValue: '全部',
  193. isShowSearch: false,
  194. isTriggered: true,
  195. searchForm: {
  196. alarmType: '',
  197. $alarmType: '全部',
  198. warnHand: '',
  199. $warnHand: '',
  200. tick: [],
  201. StartTick: '',
  202. EndTick: '',
  203. pageNum: 1,
  204. pageSize: 10
  205. },
  206. warnOption: [
  207. {
  208. label: '全部',
  209. value: ''
  210. }
  211. ],
  212. handOption: [{
  213. label: '已处理',
  214. value: 1
  215. },
  216. {
  217. label: '未处理',
  218. value: 0
  219. },
  220. ],
  221. warnList: [],
  222. isLoading: false,
  223. finished: false,
  224. refreshing: false,
  225. status: 'loadmore', //loading正在加载 loadmore加载更多 nomore没有更多了
  226. }
  227. },
  228. watch: {
  229. "searchForm.tick"() {
  230. console.log('日期时间:', this.searchForm.tick);
  231. if (this.searchForm.tick && this.searchForm.tick.length > 0) {
  232. this.searchForm.StartTick = this.searchForm.tick[0]
  233. this.searchForm.EndTick = this.searchForm.tick[1]
  234. }
  235. },
  236. },
  237. onLoad() {
  238. console.log(this.searchForm.$alarmType)
  239. // 获取预警类型
  240. this.getWarnTypeList()
  241. // 隐藏导航栏
  242. this.loadmore()
  243. },
  244. onPullDownRefresh() {
  245. uni.stopPullDownRefresh()
  246. this.status = 'loadmore'
  247. this.searchForm.pageNum = 1;
  248. this.warnList = []
  249. this.loadmore()
  250. },
  251. methods: {
  252. selectChange(e) {
  253. console.log(e, 2323)
  254. },
  255. // 预览图片
  256. previewImage(url, index) {
  257. // 使用uni.previewImage API 进行图片预览
  258. uni.previewImage({
  259. current: index, // 当前显示图片索引
  260. urls: [url] // 需要预览的图片链接列表
  261. });
  262. },
  263. clearform() {
  264. this.searchForm = {
  265. alarmType: '',
  266. $alarmType: '全部',
  267. warnHand: '',
  268. $warnHand: '',
  269. tick: [],
  270. StartTick: '',
  271. EndTick: '',
  272. pageNum: 1,
  273. pageSize: 10
  274. }
  275. // this.isShowSearch = false;
  276. },
  277. onsubmit() {
  278. let arr = []
  279. for (let key in this.searchForm) {
  280. if (['$alarmType', '$warnHand', 'StartTick', 'EndTick'].includes(key)) {
  281. if (Object.hasOwnProperty.call(this.searchForm, key) && this.searchForm[key]) {
  282. arr.push(this.searchForm[key])
  283. }
  284. }
  285. }
  286. this.searchValue = arr.join(',');
  287. this.isShowSearch = false;
  288. this.status = 'loadmore'
  289. this.searchForm.pageNum = 1;
  290. this.warnList = []
  291. this.loadmore()
  292. },
  293. // 获取预警类型
  294. getWarnTypeList() {
  295. warnType({}).then(res => {
  296. let {
  297. code,
  298. data
  299. } = res;
  300. if (code == 200) {
  301. let arr = data.map(item => {
  302. return {
  303. label: item.name,
  304. value: item.code
  305. };
  306. })
  307. this.warnOption = [...this.warnOption,...arr]
  308. // this.warnOption.unshift({
  309. // label: '全部',
  310. // value: ''
  311. // })
  312. }
  313. });
  314. },
  315. // 跳转详情页面
  316. toDetail(row) {
  317. uni.navigateTo({
  318. url: '/pages/earlyWarning/detail?id=' + row.id
  319. });
  320. },
  321. // 预警类型弹框筛选
  322. toOpen() {
  323. this.$refs.selectSearchBox.show = true;
  324. },
  325. // 处理情况筛选
  326. toOpenSelect() {
  327. this.$refs.selectRadioBox.show = true;
  328. },
  329. // 打开筛选框
  330. openSearch() {
  331. this.isShowSearch = !this.isShowSearch;
  332. },
  333. isSelect() {
  334. },
  335. scrolltolower() {
  336. if (this.status == 'loading' || this.status == 'nomore') {
  337. return;
  338. }
  339. this.searchForm.pageNum += 1;
  340. this.loadmore()
  341. },
  342. loadmore() {
  343. if (this.status != 'loadmore') return
  344. this.status = 'loading'
  345. this.isLoading = true;
  346. delete this.searchForm.tick
  347. page(this.searchForm).then(res => {
  348. if (res?.code === 200) {
  349. this.warnList = [...this.warnList, ...res?.data?.list];
  350. this.isLoading = false;
  351. // 获取到的总条数>=接口总条数
  352. if (this.warnList.length >= res.data.total) {
  353. this.status = 'nomore'
  354. } else {
  355. this.status = 'loadmore'
  356. }
  357. }
  358. })
  359. }
  360. }
  361. }
  362. </script>
  363. <style lang="scss" scoped>
  364. .warningBox {
  365. height: 100%;
  366. .headerBox {
  367. /*#ifdef H5*/
  368. height: 272rpx;
  369. background: url("@/static/image/earlyWarning/back2.png") no-repeat center center / cover;
  370. /*#endif*/
  371. /*#ifdef APP-PLUS || MP-ALIPAY || MP-WEIXIN*/
  372. height: 340rpx;
  373. background: url("@/static/image/earlyWarning/back.png") no-repeat center center / cover;
  374. /*#endif*/
  375. position: relative;
  376. image {
  377. width: 100%;
  378. height: 100%;
  379. }
  380. .logo {
  381. image {
  382. height: 46rpx;
  383. }
  384. image {
  385. height: 46rpx;
  386. }
  387. position: absolute;
  388. left: 36rpx;
  389. /*#ifdef H5*/
  390. top: 50rpx;
  391. /*#endif*/
  392. /*#ifdef APP-PLUS || MP-ALIPAY || MP-WEIXIN*/
  393. top: 110rpx;
  394. /*#endif*/
  395. }
  396. }
  397. .contentBox {
  398. /*#ifdef H5*/
  399. height: calc(100% - 303rpx);
  400. /*#endif*/
  401. /*#ifdef APP-PLUS || MP-ALIPAY || MP-WEIXIN*/
  402. height: calc(100% - 375rpx);
  403. /*#endif*/
  404. .warningInfo {
  405. width: 100%;
  406. height: 100%;
  407. background: #F6F8FA;
  408. .u-modal__title {
  409. color: #000000;
  410. }
  411. }
  412. .searchBox {
  413. // height: calc(100% - 360rpx);
  414. position: relative;
  415. .searchLine {
  416. height: 88rpx;
  417. display: flex;
  418. align-items: center;
  419. justify-content: space-between;
  420. padding: 0 15px;
  421. box-sizing: border-box;
  422. background: #fff;
  423. font-size: 28rpx;
  424. .searchLabels {
  425. display: flex;
  426. align-items: center;
  427. width: calc(100% - 34rpx);
  428. image {
  429. width: 40rpx;
  430. height: 40rpx;
  431. flex-shrink: 1;
  432. }
  433. .labels {
  434. width: 70rpx;
  435. display: block;
  436. color: #333333;
  437. margin-left: 10rpx;
  438. flex-shrink: 1;
  439. }
  440. .values {
  441. width: calc(100% - 40rpx - 50rpx);
  442. color: #2388FF;
  443. font-weight: 700;
  444. margin-left: 18rpx;
  445. overflow: hidden;
  446. word-wrap: break-word;
  447. white-space: pre-wrap;
  448. display: -webkit-box;
  449. -webkit-box-orient: vertical;
  450. -webkit-line-clamp: 1;
  451. }
  452. }
  453. .arrow {
  454. // text-align: right;
  455. // flex-shrink: 1;
  456. image {
  457. width: 34rpx;
  458. height: 34rpx;
  459. }
  460. }
  461. .leftSearchBox {
  462. display: flex;
  463. align-items: center;
  464. width: calc(100% - 40px);
  465. .searchLabel {
  466. flex-shrink: 1;
  467. color: #333333;
  468. width: 80px;
  469. }
  470. .searchValue {
  471. width: calc(100% - 60px);
  472. margin-left: 10px;
  473. color: #2388FF;
  474. overflow: hidden;
  475. word-wrap: break-word;
  476. white-space: pre-wrap;
  477. display: -webkit-box;
  478. -webkit-box-orient: vertical;
  479. -webkit-line-clamp: 1;
  480. }
  481. }
  482. }
  483. .searchDialog {
  484. position: absolute;
  485. z-index: 990;
  486. top: 89rpx;
  487. width: 100%;
  488. height: calc(100vh - 375rpx - 60rpx);
  489. font-size: 26rpx;
  490. background: rgba(0, 0, 0, 0.2);
  491. .content {
  492. background: #FFFFFF;
  493. padding: 15px;
  494. box-sizing: border-box;
  495. border-top: 1px solid rgba(0, 0, 0, 0.1);
  496. .demo-layout {
  497. height: 80rpx;
  498. border-radius: 8rpx;
  499. background: #F5F5F5;
  500. display: flex;
  501. justify-content: space-between;
  502. align-items: center;
  503. padding: 0 10px;
  504. box-sizing: border-box;
  505. .left-layout {
  506. color: #777777;
  507. }
  508. .right-layout {}
  509. .startBox {
  510. color: #777777;
  511. }
  512. text {
  513. color: #777777;
  514. }
  515. .endBox {
  516. color: #777777;
  517. }
  518. .timeIcon {}
  519. }
  520. }
  521. .btnBox {
  522. display: flex;
  523. align-items: center;
  524. margin-top: 15px;
  525. .leftBtn {
  526. width: 50%;
  527. height: 74rpx;
  528. line-height: 74rpx;
  529. border: 1px solid #ccc;
  530. border-radius: 12rpx;
  531. color: #333333;
  532. text-align: center;
  533. }
  534. .rightBtn {
  535. width: 50%;
  536. height: 74rpx;
  537. line-height: 74rpx;
  538. border: 1px solid #2388FF;
  539. border-radius: 12rpx;
  540. color: #fff;
  541. text-align: center;
  542. background: #2388FF;
  543. margin-left: 15rpx;
  544. }
  545. }
  546. }
  547. }
  548. .tableBox {
  549. height: 100%;
  550. padding: 30rpx;
  551. box-sizing: border-box;
  552. // height: 600px;
  553. padding-bottom: 30px;
  554. .liBox {
  555. background: #fff;
  556. padding: 0 30rpx;
  557. box-sizing: border-box;
  558. border-radius: 20rpx;
  559. margin-bottom: 30rpx;
  560. font-family: 'PingFang SC';
  561. .headerCard {
  562. display: flex;
  563. justify-content: space-between;
  564. align-items: center;
  565. padding: 24rpx 0;
  566. .schoolName {
  567. font-size: 32rpx;
  568. font-weight: 700;
  569. font-family: 'PingFang SC';
  570. color: #333333;
  571. overflow: hidden;
  572. word-wrap: break-word;
  573. white-space: pre-wrap;
  574. // font-size: 14px;
  575. display: -webkit-box;
  576. -webkit-box-orient: vertical;
  577. -webkit-line-clamp: 1;
  578. }
  579. .statusBox {
  580. width: 100rpx;
  581. flex-shrink: 1;
  582. text-align: center;
  583. font-size: 24rpx;
  584. border-radius: 8rpx;
  585. color: #fff;
  586. padding: 8rpx 12rpx;
  587. font-family: 'PingFang SC';
  588. }
  589. .handle {
  590. background: rgba(15, 175, 118, 0.1);
  591. color: #0FAF76;
  592. }
  593. .nohandle {
  594. background: rgba(239, 45, 45, 0.1);
  595. color: rgba(239, 45, 45, 1);
  596. }
  597. }
  598. .topCard {
  599. display: flex;
  600. border-top: 1px solid rgba(0, 0, 0, 0.1);
  601. align-items: center;
  602. padding: 20rpx 0;
  603. .pic {
  604. width: 120rpx;
  605. height: 120rpx;
  606. image {
  607. width: 120rpx;
  608. height: 120rpx;
  609. border-radius: 4px;
  610. }
  611. }
  612. .rightCard {
  613. margin-left: 20rpx;
  614. font-size: 26rpx;
  615. font-family: 'PingFang SC';
  616. width: calc(100% - 140rpx);
  617. }
  618. }
  619. .midCard {
  620. font-size: 26rpx;
  621. .secondCard,
  622. .thirdCard {
  623. display: flex;
  624. align-items: center;
  625. .txt {
  626. font-size: 26rpx;
  627. font-family: 'PingFang SC';
  628. margin-left: 10rpx;
  629. color: #333333;
  630. }
  631. }
  632. .thirdCard {
  633. margin-top: 18rpx;
  634. }
  635. }
  636. .btoCard {
  637. border-top: 1px solid rgba(0, 0, 0, 0.1);
  638. margin-top: 20rpx;
  639. padding: 20rpx 0;
  640. display: flex;
  641. justify-content: space-between;
  642. align-items: center;
  643. font-size: 26rpx;
  644. font-family: 'PingFang SC';
  645. .rightBox {
  646. .txt {
  647. width: 120rpx;
  648. height: 60rpx;
  649. line-height: 60rpx;
  650. font-family: 'PingFang SC';
  651. text-align: center;
  652. background: #2388FF;
  653. color: #fff;
  654. border-radius: 80rpx;
  655. }
  656. }
  657. }
  658. }
  659. }
  660. }
  661. }
  662. </style>