123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 |
- <template>
- <view class="uni-container uni-container-bg">
- <view class="top">
- <view>
- <view class="search-time">
- <text class="time-item">事件时间:</text>
- <uni-datetime-picker class="time-item-check" type="date" v-model="startSingle"
- @maskClick="startMaskClick" />
- </view>
- <view class="search-time">
- <text class="time-item">结束时间:</text>
- <uni-datetime-picker class="time-item-check" type="date" v-model="endSingle"
- @maskClick="endMaskClick" />
- </view>
- </view>
- <view class="search-icon">
- <u-icon name="search" color="#4CB2B6" size="40" @click="handleQuery"></u-icon>
- </view>
- </view>
- <view class="main">
- <view v-for="(item, index) in list" :key="index">
- <uni-card v-if="list.length>0">
- <view class="main-item">
- <rich-text :nodes="`事件内容: ${item.eventContent}`" class="font-16 uni-ellipsis-set"></rich-text>
- </view>
- <view class="main-item">
- <text style="width: 140rpx;">事件日期:</text>
- <text class="conts">{{ item.eventTime}}</text>
- </view>
- <view class="">
- <view class="an-niu" @click.native="delClick(item.id)" link style="margin-left:3px">
- <text class="deletes">删除事件</text>
- </view>
- <view class="an-niu" @click.native="detailClick(item.id)" link style="margin-left:3px;">
- <text class="bianji details">查看详情</text>
- </view>
- <view class="an-niu" @click.native="editClick(item.id)" link style="margin-left:3px;">
- <text class="bianji">编辑事件</text>
- </view>
- </view>
- </uni-card>
- <view v-else style="text-align:center">
- 暂无数据
- </view>
- </view>
- </view>
-
- <view>
- <image :src="Group" @click="addClick" class="tiantupian"></image>
- </view>
- </view>
- </template>
- <script>
- import config from '@/config'
- import {
- getStationEvent,
- delMicrostation
- } from '@/api/fire_station/index';
- const baseUrlImg = config.baseUrlImg
- export default {
- data() {
- return {
- Group: `${baseUrlImg}/checkActive/Group.png`,
- endSingle: '', //结束时间
- startSingle: '', //开始时间
- list: [],
- queryParams: {
- pageNo: 1,
- pageSize: 5,
- eventTime: [],
- eventContent: null,
- microstationid:''
- },
- eventTimeString: '',
- // 总条数
- total: 0,
- runId:""
- }
- },
- onShow() {
- this.list = []
- this.getData()
- },
- onLoad: function(option) {
- this.runId=option.runId
- this.queryParams.microstationid=option.runId
- },
- methods: {
- getData() {
- if (this.queryParams.pageNo != 1) {
- this.queryParams.eventTime.push(this.startSingle, this.endSingle)
- }
- getStationEvent(this.queryParams).then(response => {
- this.list = [...this.list, ...response.data.list]
- this.total = response.data.total;
- this.queryParams.eventTime = []
- })
- },
- delClick(val) {
- let that = this
- uni.showModal({
- title: '确认删除',
- content: `是否确认删除?`,
- success: function(res) {
- if (res.confirm) {
- delMicrostation({
- id: val
- }).then(delres => {
- that.$modal.msg('删除成功')
- that.queryParams.pageNo = 1;
- that.list=[]
- that.getData()
- that.$forceUpdate()
- })
- // delRole(ids);
- } else if (res.cancel) {
- }
- }
- });
- },
- /** 搜索按钮操作 */
- handleQuery() {
- const end = new Date(this.endSingle).getTime()
- const start = new Date(this.startSingle).getTime()
- if (!this.endSingle && !this.startSingle) {
- this.queryParams.pageNo = 1;
- this.list = []
- this.getData();
- } else if (this.endSingle && this.startSingle && start <= end) {
- // } else{
- this.queryParams.pageNo = 1;
- this.queryParams.eventTime.push(this.startSingle, this.endSingle)
- this.list = []
- this.getData();
- } else if (start > end) {
- this.$modal.msgError('结束时间不能小于事件时间')
- } else {
- this.$modal.msgError('请选择事件时间和结束时间')
- }
- },
- startMaskClick(e) {
- },
- endMaskClick(e) {
- },
- addClick() {
- uni.navigateTo({
- url: `/pagesA/fire/add_fireRun/add_fireEvent/add_fireEvent?runId=${this.runId}`
- });
- },
- detailClick(val){
- uni.navigateTo({
- url: `/pagesA/fire/add_fireRun/add_fireEvent/add_fireEvent?id=${val}&runId=${this.runId}&isview=isview`
- });
- },
- editClick(val) {
- uni.navigateTo({
- url: `/pagesA/fire/add_fireRun/add_fireEvent/add_fireEvent?id=${val}&runId=${this.runId}`
- });
- }
- },
- // 触底的事件
- onReachBottom() {
- // 判断是否还有下一页数据
- if (this.queryParams.pageNo * this.queryParams.pageSize >= this.total)
- return uni.showToast({
- title: `数据加载完毕`
- });
- // 判断是否正在请求其它数据,如果是,则不发起额外的请求
- if (this.loading) return;
- this.queryParams.pageNo += 1;
- this.getData();
- },
- }
- </script>
- <style lang="scss" scoped>
- body {
- background-color: #f5f7f9;
- }
- page {
- background-color: #f5f7f9 !important;
- }
- .uni-container {
- height: 100vh;
- }
- .top {
- display: flex;
- align-items: center;
- width: 90%;
- margin-left: 5%;
- justify-content: space-between;
- .search-time {
- display: flex;
- align-items: center;
- margin-top: 40rpx;
- margin-bottom: 20rpx;
- .time-item {
- margin-right: 20rpx;
- }
- .time-item-check {}
- }
- .search-icon {}
- }
- .tiantupian {
- width: 110rpx;
- height: 110rpx;
- position: fixed;
- right: 15px;
- bottom: 40rpx;
- }
- /deep/.uni-card {
- box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
- border-radius: 30rpx;
- }
- .main {
- margin-left: 5%;
- margin-top: 30rpx;
- width: 90%;
- .main-item {
- display: flex;
- // justify-content: start;
- // justify-content: space-between;
- margin-bottom: 15rpx;
- color: #728f90;
- }
- }
- .an-niu {
- float: right;
- font-size: 10px;
- text-align: center;
- display: flex;
- color: #fff;
- .deletes,
- .bianji {
- width: 72px;
- height: 60rpx;
- border-radius: 30px;
- background-color: red;
- margin-right: 20rpx;
- margin-bottom: 20rpx;
- text-align: center;
- line-height: 60rpx;
- }
- .bianji {
- background-color: #4CB2B6
- }
- .details{
- background-color: #F7C41E
- }
- }
- /deep/.u-button--primary {
- border: 1px solid #fff;
- background-color: #fff !important;
- }
- </style>
|