Files
hnxdcount-uniapp/pages/mine/piles.vue
PC-202306242200\Administrator dac42e3b0c first commit
2026-03-28 23:09:02 +08:00

177 lines
3.8 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="p30 piles">
<z-paging ref="paging" v-model="dataList" use-page-scroll @query="queryList">
<!-- <view class="piles_card">
<view class="piles_card_title">充电桩汇总</view>
<view class="piles_card_view">
<view>
<text>{{ count.installCount || 0 }}</text>
<text>已安装</text>
</view>
<view>
<text>{{ count.installNotCount || 0 }}</text>
<text>未安装数量</text>
</view>
</view>
</view>
<up-subsection :list="list" keyName="name" :current="current" @change="upChange"></up-subsection> -->
<view class="order_view" v-for="i in dataList" :key="i">
<view class="piles_list">
<view class="piles_list_title">电站名称{{ i.stationName || '-' }}</view>
<view class="piles_list_view">
<view>设备号</view>
<view>{{ i.deviceNo }}</view>
</view>
<view class="piles_list_view">
<view>设备功率</view>
<view>{{ i.deviceType }}KW</view>
</view>
<view class="piles_list_view">
<view>设备类型</view>
<view>{{ i.deviceTypeName }}</view>
</view>
<view class="piles_list_view">
<view>创建时间</view>
<view>{{ timeFormat(new Date(i.createTime).getTime(), 'yyyy-mm-dd hh:MM') }}</view>
</view>
</view>
</view>
</z-paging>
</view>
</template>
<script setup>
import { getDeviceInfo, getDeviceCount } from '@/api/api.js';
import { reactive, ref } from 'vue';
import { onPullDownRefresh, onPageScroll, onReachBottom, onLoad } from '@dcloudio/uni-app';
import { timeFormat } from '@/uni_modules/uview-plus';
const paging = ref(null);
let dataList = ref([]);
let dataFrom = reactive({
deviceStatus: 1
});
let count = ref({});
// onLoad(async () => {
// count.value = await getDeviceCount();
// });
let isPagingRefNotFound = () => {
return !paging.value;
};
onPullDownRefresh(() => {
if (isPagingRefNotFound()) return;
paging.value.reload().catch(() => {});
});
onPageScroll((e) => {
if (isPagingRefNotFound()) return;
paging.value.updatePageScrollTop(e.scrollTop);
e.scrollTop < 10 && paging.value.doChatRecordLoadMore();
});
onReachBottom(() => {
if (isPagingRefNotFound()) return;
paging.value.pageReachBottom();
});
const queryList = (pageNo, pageSize) => {
const params = {
current: pageNo,
pageSize: pageSize,
...dataFrom
};
getDeviceInfo(params)
.then((res) => {
paging.value.complete(res);
})
.catch((res) => {
paging.value.complete(false);
});
};
const list = ref([
{
name: '已安装',
id: 1
},
{
name: '待安装',
id: 0
}
]);
const current = ref(0);
const upChange = (e) => {
current.value = e;
dataFrom.deviceStatus = list.value[e].id;
paging.value.reload();
};
</script>
<style scoped lang="scss">
.piles {
&_card {
width: 690rpx;
height: 192rpx;
background: linear-gradient(179deg, #4874e5 0%, #3864d6 100%);
border-radius: 8rpx 8rpx 0rpx 0rpx;
padding: 30rpx;
&_title {
font-weight: bold;
font-size: 28rpx;
color: #ffffff;
margin-bottom: 20rpx;
}
&_view {
padding: 0 150rpx;
flex-direction: column;
@include flex($space: space-between);
view {
@include flex($direction: column, $space: space-between);
text:nth-child(1) {
font-weight: bold;
font-size: 32rpx;
color: #ffffff;
margin-bottom: 15rpx;
}
text:nth-child(2) {
font-size: 26rpx;
color: #ffffff;
}
}
}
}
&_list {
padding: 25rpx;
width: 690rpx;
background: #ffffff;
border-radius: 16rpx 16rpx 16rpx 16rpx;
margin-top: 30rpx;
&_title {
font-weight: bold;
font-size: 28rpx;
color: #232323;
}
&_view {
@include flex;
color: #555555;
font-size: 28rpx;
margin-top: 15rpx;
view:nth-child(2) {
font-weight: bold;
font-size: 28rpx;
color: #232323;
}
text {
color: #ff2727;
}
}
}
}
</style>