123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <template>
- <!-- <list-test :bindData="siteListData" :bindUrl="linkUrl" :bindIcon="linkIcon" :bindNum="num" :bindType="type"
- :bindSiteName="siteName" :bindDetailUrl="detailUrl" :bindSiteListRes="siteListRes">
- </list-test> -->
- <view class="site-wrapper" ref="contentWrapper">
- <view style="height: 100rpx"></view>
- <!-- 筛选框start -->
- <view class="ding">
- <view class="cu-bar search bg-gray filter-section">
- <view class="search-form round bg-white">
- <text class="cuIcon-search"></text>
- <input class="" @focus="InputFocus" @blur="InputBlur" :adjust-position="false" type="text" placeholder="请输入站点名称" v-model="siteName" />
- </view>
- <view class="action">
- <button class="cu-btn bg-blue round" @click="searchData">查询</button>
- </view>
- </view>
- </view>
- <!-- 筛选框end -->
- <!-- 站点列表start -->
- <view class="site-items" style="margin-top: 0">
- <view class="cu-list menu-avatar">
- <view class="cu-item" :class="modalName == 'move-box-' + index ? 'move-cur' : ''" v-for="(item, index) in siteListData" :key="index" :data-target="'move-box-' + index">
- <view class="cu-avatar round lg" v-bind:style="{ 'background-image': 'url(' + linkIcon + ')' }"></view>
- <view class="content" v-if="type == 1" @tap="goNowUrl(item)">
- <view class="text-grey site-tit">
- <text style="width: 93%" class="inTwoLine">{{ item.siteName }}( 共{{ item.siteAlarmCount }}个未处理告警 )</text>
- </view>
- </view>
- <view class="content" v-else @tap="goNowUrl" @longpress="showDetail(item)">
- <view class="text-grey site-tit">
- {{ item.siteName }}
- <text>(共3个设备)</text>
- </view>
- <view class="showDetail" v-if="item.isShow" @tap.stop="goNowDetailUrl">查看详情</view>
- </view>
- <view class="nav-right num">
- <view class="text-grey">
- <text class="icon iconfont margin-right-xs margin-left-lg"></text>
- </view>
- </view>
- </view>
- </view>
- <view v-if="!siteListData.length && siteListRes == 1" class="text-center margin-top"> 暂无数据</view>
- <view v-show="isLoadMore && this.currentPage > 1">
- <uni-load-more :status="loadStatus"></uni-load-more>
- </view>
- </view>
- <!-- 站点列表end -->
- </view>
- </template>
- <script>
- import json from "../../data/json.js";
- export default {
- data() {
- return {
- modalName: null,
- siteListRes: 0,
- type: 1,
- linkUrl: "/pages/alarmingList/alarmingList",
- linkIcon: "../../static/site-icon-alarm.png",
- siteListData: [],
- num: " 共3个未处理告警",
- detailUrl: "/pages/siteDetail/siteDetail",
- siteName: "",
- currentPage: 1,
- size: 12,
- loadStatus: "loading", //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
- isLoadMore: false, //是否加载中
- };
- },
- onPullDownRefresh() {
- console.log("refresh");
- setTimeout(function () {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- computed: {},
- mounted() {},
- onReachBottom() {
- //上拉触底函数
- if (!this.isLoadMore) {
- //此处判断,上锁,防止重复请求
- this.isLoadMore = true;
- this.currentPage += 1;
- this.loadData();
- }
- },
- onLoad() {
- this.loadData();
- },
- methods: {
- searchData() {
- (this.currentPage = 1), (this.siteListData = []);
- this.siteListRes = 0;
- this.loadData();
- },
- loadData() {
- this.getDataList({
- siteName: this.siteName,
- currentPage: this.currentPage,
- size: this.size,
- });
- },
- // 页面跳转
- goNowUrl(item) {
- uni.navigateTo({
- url: this.linkUrl + "?companyCode=" + item.companyCode,
- success: (res) => {},
- fail: () => {},
- complete: () => {},
- });
- // if(item.siteAlarmCount){
- // }
- },
- InputFocus(e) {
- this.InputBottom = e.detail.height;
- },
- InputBlur(e) {
- this.InputBottom = 0;
- },
- async getDataList(params = {}) {
- const res = await this.$myRequest({
- url: "IntegratedAlarm/getSiteList",
- showLoading: true,
- data: params,
- });
- // console.log(res.data.data)
- // this.siteListData = res.data.data
- this.siteListRes = 1;
- if (res.data.total) {
- this.siteListData = this.siteListData.concat(res.data.data);
- if (res.data.data.length < this.size) {
- //判断接口返回数据量小于请求数据量,则表示此为最后一页
- this.isLoadMore = true;
- this.loadStatus = "nomore";
- } else {
- this.isLoadMore = false;
- }
- } else {
- this.isLoadMore = true;
- this.loadStatus = "nomore";
- }
- },
- },
- };
- </script>
- <style></style>
|