195 lines
5.3 KiB
Vue
195 lines
5.3 KiB
Vue
|
<template>
|
||
|
<view class="inde-scada">
|
||
|
<u-sticky zIndex="98" bgColor="#F1F3F9">
|
||
|
<view class="nav-bar">
|
||
|
<view v-if="!isSearch" style="margin-right: 20rpx;">
|
||
|
<u-icon name="search" size="27" @click="isSearch = true"></u-icon>
|
||
|
</view>
|
||
|
<view v-else style="width: 100%;">
|
||
|
<!-- #ifndef APP-NVUE -->
|
||
|
<u-input :customStyle="{ padding: '17rpx 36rpx', background: '#FFFFFF' }"
|
||
|
v-model="queryParams.pageName" :placeholder="$tt('indeScada.inputScada')" shape="circle"
|
||
|
@clear="handleClearSearch" clearable>
|
||
|
<!-- #endif -->
|
||
|
<!-- #ifdef APP-NVUE -->
|
||
|
<u--input :customStyle="{ padding: '17rpx 36rpx', background: '#FFFFFF' }"
|
||
|
v-model="queryParams.pageName" :placeholder="$tt('indeScada.inputScada')" shape="circle"
|
||
|
@clear="handleClearSearch" clearable>
|
||
|
<!-- #endif -->
|
||
|
<template slot="prefix">
|
||
|
<u-icon name="search" color="rgb(192, 196, 204)" size="26"
|
||
|
@click="isSearch = false"></u-icon>
|
||
|
</template>
|
||
|
<template slot="suffix">
|
||
|
<view style="display: flex; flex-direction: row; align-items: center;">
|
||
|
<span
|
||
|
style="width: 0px; height: 14px; border: 1px solid #000000; opacity: 0.1;"></span>
|
||
|
<span style="font-size: 14px; font-weight: 400; color: #3378FE; margin-left: 24rpx;"
|
||
|
@click="handleSearch">{{$tt('indeScada.search')}}</span>
|
||
|
</view>
|
||
|
</template>
|
||
|
<!-- #ifndef APP-NVUE -->
|
||
|
</u-input>
|
||
|
<!-- #endif -->
|
||
|
<!-- #ifdef APP-NVUE -->
|
||
|
</u--input>
|
||
|
<!-- #endif -->
|
||
|
</view>
|
||
|
</view>
|
||
|
</u-sticky>
|
||
|
<view class="content-wrap">
|
||
|
<view class="item-wrap" v-for="(item, index) in scadaList" :key="index">
|
||
|
<view class="card"
|
||
|
:style="{margin:(index % 2 === 0 ?'14rpx 14rpx 14rpx 30rpx':'14rpx 30rpx 14rpx 14rpx')}"
|
||
|
@tap="handleScadaDetail(item.guid,item.pageName)">
|
||
|
<view class="img-wrap">
|
||
|
<u--image :src="baseUrl + item.pageImage" radius="16rpx 16rpx 0 0" mode="aspectFill"
|
||
|
width="100%" height="80">
|
||
|
</u--image>
|
||
|
</view>
|
||
|
<view class="title">{{item.pageName}}</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
<u-loadmore :status="loadStatus" v-if="total > queryParams.pageSize"
|
||
|
:loading-text="$tt('indeScada.tryingToLoad')" :loadmoreText="$tt('indeScada.gentlyPullUp')"
|
||
|
:nomoreText="$tt('indeScada.emptyData')" marginTop="20" />
|
||
|
<u-empty mode="data" :show="total === 0" marginTop="60" :text="$tt('indeScada.emptyData')"></u-empty>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import projectConfig from '@/env.config.js';
|
||
|
import {
|
||
|
getIndeScadaList
|
||
|
} from '@/apis/modules/scada';
|
||
|
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
isSearch: true,
|
||
|
baseUrl: projectConfig.baseUrl,
|
||
|
loadStatus: 'loadmore', // 加载更多
|
||
|
queryParams: {
|
||
|
pageNum: 1,
|
||
|
pageSize: 12,
|
||
|
pageName: '',
|
||
|
type: 3,
|
||
|
},
|
||
|
scadaList: [],
|
||
|
total: 0,
|
||
|
};
|
||
|
},
|
||
|
mounted() {
|
||
|
this.getList();
|
||
|
},
|
||
|
methods: {
|
||
|
getList() {
|
||
|
getIndeScadaList(this.queryParams).then(res => {
|
||
|
if (this.queryParams.pageNum == 1) {
|
||
|
this.scadaList = res.rows;
|
||
|
} else {
|
||
|
this.scadaList = this.scadaList.concat(res.rows);
|
||
|
}
|
||
|
this.total = res.total;
|
||
|
const {
|
||
|
pageNum,
|
||
|
pageSize
|
||
|
} = this.queryParams;
|
||
|
this.loadStatus = this.total > pageNum * pageSize ? 'loadmore' : 'nomore';
|
||
|
uni.stopPullDownRefresh();
|
||
|
}).catch(errors => {
|
||
|
console.log(res.msg);
|
||
|
})
|
||
|
},
|
||
|
// 搜索
|
||
|
handleSearch() {
|
||
|
this.queryParams.pageNum = 1;
|
||
|
this.getList();
|
||
|
},
|
||
|
handleClearSearch() {
|
||
|
this.handleSearch();
|
||
|
},
|
||
|
//组态详情
|
||
|
handleScadaDetail(guid, pageName) {
|
||
|
const title = pageName;
|
||
|
if (projectConfig.baseUrl.includes('prod-api')) {
|
||
|
// 去掉 '/prod-api/' 部分
|
||
|
projectConfig.baseUrl = projectConfig.baseUrl.replace('/prod-api/', '/');
|
||
|
}
|
||
|
if (projectConfig.baseUrl.includes('8080')) {
|
||
|
projectConfig.baseUrl = projectConfig.baseUrl.replace('8080', '80/');
|
||
|
}
|
||
|
const token = uni.getStorageSync('token');
|
||
|
const url = projectConfig.baseUrl + `${'scada/topo/fullscreen'}?guid=${guid}&type=3&share=${token}`;
|
||
|
uni.navigateTo({
|
||
|
url: `/pages/common/webview/index?title=${title}&url=${encodeURIComponent(url)}`
|
||
|
})
|
||
|
},
|
||
|
// 下拉刷新
|
||
|
onPullDownRefresh() {
|
||
|
this.dataList = [];
|
||
|
this.queryParams.pageNum = 1;
|
||
|
this.getList();
|
||
|
},
|
||
|
// 上拉加载
|
||
|
onReachBottom() {
|
||
|
this.loadStatus = 'loading';
|
||
|
this.queryParams.pageNum = this.queryParams.pageNum + 1;
|
||
|
if ((this.queryParams.pageNum - 1) * this.queryParams.pageSize > this.total) {
|
||
|
this.loadStatus = 'nomore';
|
||
|
} else {
|
||
|
this.loadStatus = 'loading';
|
||
|
this.getList();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
page {
|
||
|
height: 100%;
|
||
|
background: #F1F3F9;
|
||
|
}
|
||
|
</style>
|
||
|
<style lang="scss" scoped>
|
||
|
.inde-scada {
|
||
|
padding-bottom: 40rpx;
|
||
|
|
||
|
.nav-bar {
|
||
|
display: flex;
|
||
|
flex-direction: row;
|
||
|
justify-content: space-between;
|
||
|
align-items: center;
|
||
|
padding: 24rpx 30rpx 28rpx;
|
||
|
height: 84rpx;
|
||
|
}
|
||
|
|
||
|
.content-wrap {
|
||
|
display: flex;
|
||
|
flex-direction: row;
|
||
|
flex-wrap: wrap;
|
||
|
align-content: flex-start;
|
||
|
width: 100%;
|
||
|
|
||
|
.item-wrap {
|
||
|
width: 50%;
|
||
|
|
||
|
.card {
|
||
|
background-color: #fff;
|
||
|
border-radius: 14rpx;
|
||
|
border: 1px solid #dcdfe6;
|
||
|
|
||
|
.title {
|
||
|
font-size: 14px;
|
||
|
white-space: nowrap;
|
||
|
overflow: hidden;
|
||
|
text-overflow: ellipsis;
|
||
|
padding: 16rpx;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</style>
|