平安校园
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.
 
 
 
 
 
 

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