平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

744 lines
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" @touchmove.stop @touch.stop>
  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" v-model="searchForm.alarmType"
  170. :options="warnOption" :title.sync="searchForm.$alarmType" placeholder="预警类型"
  171. 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. handOption: [{
  208. label: '已处理',
  209. value: 1
  210. },
  211. {
  212. label: '未处理',
  213. value: 0
  214. },
  215. ],
  216. warnList: [],
  217. isLoading: false,
  218. finished: false,
  219. refreshing: false,
  220. status: 'loadmore', //loading正在加载 loadmore加载更多 nomore没有更多了
  221. }
  222. },
  223. watch: {
  224. "searchForm.tick"() {
  225. console.log('日期时间:', this.searchForm.tick);
  226. if (this.searchForm.tick && this.searchForm.tick.length > 0) {
  227. this.searchForm.StartTick = this.searchForm.tick[0]
  228. this.searchForm.EndTick = this.searchForm.tick[1]
  229. }
  230. },
  231. },
  232. onLoad() {
  233. // 获取预警类型
  234. this.getWarnTypeList()
  235. // 隐藏导航栏
  236. this.loadmore()
  237. },
  238. methods: {
  239. onRefresh() {
  240. // this.refreshing = true;
  241. console.log('下拉刷新')
  242. },
  243. // 执行刷新操作
  244. doRefresh() {
  245. console.log('正在刷新...');
  246. // 这里执行刷新数据的逻辑
  247. this.searchForm.pageNum = 1;
  248. this.warnList = [];
  249. this.loadmore()
  250. setTimeout(() => {
  251. // 刷新数据完成后,调用restore或abort方法结束刷新状态
  252. this.restore();
  253. }, 2000);
  254. },
  255. // 刷新结束,恢复scroll-view
  256. restore() {
  257. console.log('刷新结束');
  258. },
  259. // 刷新结束,取消scroll-view的刷新状态
  260. abort() {
  261. console.log('取消刷新');
  262. },
  263. // 预览图片
  264. previewImage(url, index) {
  265. // 使用uni.previewImage API 进行图片预览
  266. uni.previewImage({
  267. current: index, // 当前显示图片索引
  268. urls: [url] // 需要预览的图片链接列表
  269. });
  270. },
  271. clearform() {
  272. this.searchForm = {
  273. alarmType: '',
  274. $alarmType: '全部',
  275. warnHand: '',
  276. $warnHand: '',
  277. tick: [],
  278. StartTick: '',
  279. EndTick: '',
  280. pageNum: 1,
  281. pageSize: 10
  282. }
  283. // this.isShowSearch = false;
  284. },
  285. onsubmit() {
  286. let arr = []
  287. for (let key in this.searchForm) {
  288. if (['$alarmType', '$warnHand', 'StartTick', 'EndTick'].includes(key)) {
  289. if (Object.hasOwnProperty.call(this.searchForm, key) && this.searchForm[key]) {
  290. arr.push(this.searchForm[key])
  291. }
  292. }
  293. }
  294. this.searchValue = arr.join(',');
  295. this.isShowSearch = false;
  296. this.status = 'loadmore'
  297. this.searchForm.pageNum = 1;
  298. this.warnList = []
  299. this.loadmore()
  300. },
  301. // 获取预警类型
  302. getWarnTypeList() {
  303. warnType({}).then(res => {
  304. let {
  305. code,
  306. data
  307. } = res;
  308. if (code == 200) {
  309. this.warnOption = data.map(item => {
  310. return {
  311. label: item.name,
  312. value: item.code
  313. };
  314. })
  315. this.warnOption.unshift({
  316. label: '全部',
  317. value: ''
  318. })
  319. }
  320. });
  321. },
  322. // 跳转详情页面
  323. toDetail(row) {
  324. uni.navigateTo({
  325. url: '/pages/earlyWarning/detail?id=' + row.id
  326. });
  327. },
  328. // 预警类型弹框筛选
  329. toOpen() {
  330. this.$refs.selectSearchBox.show = true;
  331. },
  332. // 处理情况筛选
  333. toOpenSelect() {
  334. this.$refs.selectRadioBox.show = true;
  335. },
  336. // 打开筛选框
  337. openSearch() {
  338. this.isShowSearch = !this.isShowSearch;
  339. },
  340. isSelect() {
  341. },
  342. scrolltolower() {
  343. if (this.status == 'loading' || this.status == 'nomore') {
  344. return;
  345. }
  346. this.searchForm.pageNum += 1;
  347. this.loadmore()
  348. },
  349. loadmore() {
  350. if (this.status != 'loadmore') return
  351. this.status = 'loading'
  352. this.isLoading = true;
  353. delete this.searchForm.tick
  354. page(this.searchForm).then(res => {
  355. if (res?.code === 200) {
  356. this.warnList = [...this.warnList, ...res?.data?.list];
  357. this.isLoading = false;
  358. // 获取到的总条数>=接口总条数
  359. if (this.warnList.length >= res.data.total) {
  360. this.status = 'nomore'
  361. } else {
  362. this.status = 'loadmore'
  363. }
  364. }
  365. })
  366. }
  367. }
  368. }
  369. </script>
  370. <style lang="scss" scoped>
  371. .warningBox {
  372. height: 100%;
  373. .headerBox {
  374. /*#ifdef H5*/
  375. height: 272rpx;
  376. background: url("@/static/image/earlyWarning/back2.png") no-repeat center center / cover;
  377. /*#endif*/
  378. /*#ifdef APP-PLUS || MP-ALIPAY || MP-WEIXIN*/
  379. height: 340rpx;
  380. background: url("@/static/image/earlyWarning/back.png") no-repeat center center / cover;
  381. /*#endif*/
  382. position: relative;
  383. image {
  384. width: 100%;
  385. height: 100%;
  386. }
  387. .logo {
  388. image {
  389. height: 46rpx;
  390. }
  391. image {
  392. height: 46rpx;
  393. }
  394. position: absolute;
  395. left: 36rpx;
  396. /*#ifdef H5*/
  397. top: 50rpx;
  398. /*#endif*/
  399. /*#ifdef APP-PLUS || MP-ALIPAY || MP-WEIXIN*/
  400. top: 110rpx;
  401. /*#endif*/
  402. }
  403. }
  404. .contentBox {
  405. /*#ifdef H5*/
  406. height: calc(100% - 303rpx);
  407. /*#endif*/
  408. /*#ifdef APP-PLUS || MP-ALIPAY || MP-WEIXIN*/
  409. height: calc(100% - 375rpx);
  410. /*#endif*/
  411. .warningInfo {
  412. width: 100%;
  413. height: 100%;
  414. background: #F6F8FA;
  415. .u-modal__title {
  416. color: #000000;
  417. }
  418. }
  419. .searchBox {
  420. // height: calc(100% - 360rpx);
  421. position: relative;
  422. .searchLine {
  423. height: 88rpx;
  424. display: flex;
  425. align-items: center;
  426. justify-content: space-between;
  427. padding: 0 15px;
  428. box-sizing: border-box;
  429. background: #fff;
  430. font-size: 28rpx;
  431. .searchLabels {
  432. display: flex;
  433. align-items: center;
  434. width: calc(100% - 34rpx);
  435. image {
  436. width: 40rpx;
  437. height: 40rpx;
  438. flex-shrink: 1;
  439. }
  440. .labels {
  441. width: 70rpx;
  442. display: block;
  443. color: #333333;
  444. margin-left: 10rpx;
  445. flex-shrink: 1;
  446. }
  447. .values {
  448. width: calc(100% - 40rpx - 50rpx);
  449. color: #2388FF;
  450. font-weight: 700;
  451. margin-left: 18rpx;
  452. overflow: hidden;
  453. word-wrap: break-word;
  454. white-space: pre-wrap;
  455. display: -webkit-box;
  456. -webkit-box-orient: vertical;
  457. -webkit-line-clamp: 1;
  458. }
  459. }
  460. .arrow {
  461. // text-align: right;
  462. // flex-shrink: 1;
  463. image {
  464. width: 34rpx;
  465. height: 34rpx;
  466. }
  467. }
  468. .leftSearchBox {
  469. display: flex;
  470. align-items: center;
  471. width: calc(100% - 40px);
  472. .searchLabel {
  473. flex-shrink: 1;
  474. color: #333333;
  475. width: 80px;
  476. }
  477. .searchValue {
  478. width: calc(100% - 60px);
  479. margin-left: 10px;
  480. color: #2388FF;
  481. overflow: hidden;
  482. word-wrap: break-word;
  483. white-space: pre-wrap;
  484. display: -webkit-box;
  485. -webkit-box-orient: vertical;
  486. -webkit-line-clamp: 1;
  487. }
  488. }
  489. }
  490. .searchDialog {
  491. position: absolute;
  492. z-index: 990;
  493. top: 89rpx;
  494. width: 100%;
  495. height: calc(100vh - 375rpx - 60rpx);
  496. font-size: 26rpx;
  497. background: rgba(0, 0, 0, 0.2);
  498. .content {
  499. background: #FFFFFF;
  500. padding: 15px;
  501. box-sizing: border-box;
  502. border-top: 1px solid rgba(0, 0, 0, 0.1);
  503. .demo-layout {
  504. height: 80rpx;
  505. border-radius: 8rpx;
  506. background: #F5F5F5;
  507. display: flex;
  508. justify-content: space-between;
  509. align-items: center;
  510. padding: 0 10px;
  511. box-sizing: border-box;
  512. .left-layout {
  513. color: #777777;
  514. }
  515. .right-layout {}
  516. .startBox {
  517. color: #777777;
  518. }
  519. text {
  520. color: #777777;
  521. }
  522. .endBox {
  523. color: #777777;
  524. }
  525. .timeIcon {}
  526. }
  527. }
  528. .btnBox {
  529. display: flex;
  530. align-items: center;
  531. margin-top: 15px;
  532. .leftBtn {
  533. width: 50%;
  534. height: 74rpx;
  535. line-height: 74rpx;
  536. border: 1px solid #ccc;
  537. border-radius: 12rpx;
  538. color: #333333;
  539. text-align: center;
  540. }
  541. .rightBtn {
  542. width: 50%;
  543. height: 74rpx;
  544. line-height: 74rpx;
  545. border: 1px solid #2388FF;
  546. border-radius: 12rpx;
  547. color: #fff;
  548. text-align: center;
  549. background: #2388FF;
  550. margin-left: 15rpx;
  551. }
  552. }
  553. }
  554. }
  555. .tableBox {
  556. height: 100%;
  557. padding: 30rpx;
  558. box-sizing: border-box;
  559. // height: 600px;
  560. padding-bottom: 30px;
  561. .liBox {
  562. background: #fff;
  563. padding: 0 30rpx;
  564. box-sizing: border-box;
  565. border-radius: 20rpx;
  566. margin-bottom: 30rpx;
  567. font-family: 'PingFang SC';
  568. .headerCard {
  569. display: flex;
  570. justify-content: space-between;
  571. align-items: center;
  572. padding: 24rpx 0;
  573. .schoolName {
  574. font-size: 32rpx;
  575. font-weight: 700;
  576. font-family: 'PingFang SC';
  577. color: #333333;
  578. overflow: hidden;
  579. word-wrap: break-word;
  580. white-space: pre-wrap;
  581. // font-size: 14px;
  582. display: -webkit-box;
  583. -webkit-box-orient: vertical;
  584. -webkit-line-clamp: 1;
  585. }
  586. .statusBox {
  587. width: 100rpx;
  588. flex-shrink: 1;
  589. text-align: center;
  590. font-size: 24rpx;
  591. border-radius: 8rpx;
  592. color: #fff;
  593. padding: 8rpx 12rpx;
  594. font-family: 'PingFang SC';
  595. }
  596. .handle {
  597. background: rgba(15, 175, 118, 0.1);
  598. color: #0FAF76;
  599. }
  600. .nohandle {
  601. background: rgba(239, 45, 45, 0.1);
  602. color: rgba(239, 45, 45, 1);
  603. }
  604. }
  605. .topCard {
  606. display: flex;
  607. border-top: 1px solid rgba(0, 0, 0, 0.1);
  608. align-items: center;
  609. padding: 20rpx 0;
  610. .pic {
  611. width: 120rpx;
  612. height: 120rpx;
  613. image {
  614. width: 120rpx;
  615. height: 120rpx;
  616. border-radius: 4px;
  617. }
  618. }
  619. .rightCard {
  620. margin-left: 20rpx;
  621. font-size: 26rpx;
  622. font-family: 'PingFang SC';
  623. width: calc(100% - 140rpx);
  624. }
  625. }
  626. .midCard {
  627. font-size: 26rpx;
  628. .secondCard,
  629. .thirdCard {
  630. display: flex;
  631. align-items: center;
  632. .txt {
  633. font-size: 26rpx;
  634. font-family: 'PingFang SC';
  635. margin-left: 10rpx;
  636. color: #333333;
  637. }
  638. }
  639. .thirdCard {
  640. margin-top: 18rpx;
  641. }
  642. }
  643. .btoCard {
  644. border-top: 1px solid rgba(0, 0, 0, 0.1);
  645. margin-top: 20rpx;
  646. padding: 20rpx 0;
  647. display: flex;
  648. justify-content: space-between;
  649. align-items: center;
  650. font-size: 26rpx;
  651. font-family: 'PingFang SC';
  652. .rightBox {
  653. .txt {
  654. width: 120rpx;
  655. height: 60rpx;
  656. line-height: 60rpx;
  657. font-family: 'PingFang SC';
  658. text-align: center;
  659. background: #2388FF;
  660. color: #fff;
  661. border-radius: 80rpx;
  662. }
  663. }
  664. }
  665. }
  666. }
  667. }
  668. }
  669. </style>