仪表换新列表优化
This commit is contained in:
@@ -62,6 +62,12 @@ export default {
|
|||||||
.flex-1 {
|
.flex-1 {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
.h-full {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.w-full {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
/* 自定义导航栏专用 */
|
/* 自定义导航栏专用 */
|
||||||
.custom-header {
|
.custom-header {
|
||||||
height: calc(var(--status-bar-height) + 88rpx);
|
height: calc(var(--status-bar-height) + 88rpx);
|
||||||
@@ -80,9 +86,11 @@ export default {
|
|||||||
|
|
||||||
.page_container {
|
.page_container {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
max-height: 100vh;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: repeating-linear-gradient(180deg, #e2f0ff, #f6faff);
|
background: repeating-linear-gradient(180deg, #e2f0ff, #f6faff);
|
||||||
|
overflow: hidden;
|
||||||
|
box-sizing: border-box;
|
||||||
padding: 0 40rpx;
|
padding: 0 40rpx;
|
||||||
/* 先写 constant() 兼容 iOS < 11.2,再写 env() */
|
/* 先写 constant() 兼容 iOS < 11.2,再写 env() */
|
||||||
padding-top: calc(constant(safe-area-inset-top) + 20rpx);
|
padding-top: calc(constant(safe-area-inset-top) + 20rpx);
|
||||||
|
|||||||
@@ -5,21 +5,24 @@
|
|||||||
<uni-data-checkbox v-model="formData.type" :localdata="items"></uni-data-checkbox>
|
<uni-data-checkbox v-model="formData.type" :localdata="items"></uni-data-checkbox>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="设备编号">
|
<uni-forms-item label="设备编号">
|
||||||
|
<view class="flex items-center justify-between">
|
||||||
<uni-easyinput
|
<uni-easyinput
|
||||||
|
class="flex-1"
|
||||||
:input-border="false"
|
:input-border="false"
|
||||||
v-model="formData.deviceCode"
|
v-model="formData.deviceCode"
|
||||||
placeholder="请输入设备号"
|
placeholder="请输入设备号"
|
||||||
|
:clearable="true"
|
||||||
>
|
>
|
||||||
<template #right>
|
|
||||||
<uni-icons type="scan" color="#737373"></uni-icons>
|
|
||||||
</template>
|
|
||||||
</uni-easyinput>
|
</uni-easyinput>
|
||||||
|
<uni-icons @tap="handleScan" size="48rpx" type="scan" color="#737373"></uni-icons>
|
||||||
|
</view>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="房屋号">
|
<uni-forms-item label="房屋号">
|
||||||
<uni-easyinput
|
<uni-easyinput
|
||||||
:inputBorder="false"
|
:inputBorder="false"
|
||||||
@tap="handleClick"
|
@tap="handleClick"
|
||||||
disabled
|
disabled
|
||||||
|
v-model="houseName"
|
||||||
placeholderStyle="color: #999999"
|
placeholderStyle="color: #999999"
|
||||||
placeholder="请选择安装房屋"
|
placeholder="请选择安装房屋"
|
||||||
>
|
>
|
||||||
@@ -29,11 +32,16 @@
|
|||||||
</uni-easyinput>
|
</uni-easyinput>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
|
|
||||||
|
<view class="action_btn" @tap="handleSubmit">
|
||||||
|
<text>提 交</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
type: 1,
|
type: 1,
|
||||||
deviceCode: '',
|
deviceCode: '',
|
||||||
@@ -50,8 +58,31 @@ const items = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const houseName = ref('')
|
||||||
|
/** 处理 安装房屋 */
|
||||||
function handleClick() {
|
function handleClick() {
|
||||||
console.log('click')
|
uni.navigateTo({
|
||||||
|
url: '/pageSubPack/instrument/checkouthouse',
|
||||||
|
events: {
|
||||||
|
backData: data => {
|
||||||
|
houseName.value = data.HouseName
|
||||||
|
formData.value.houseId = data.Houseid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/** 处理 扫码 */
|
||||||
|
function handleScan() {
|
||||||
|
// 允许从相机和相册扫码
|
||||||
|
uni.scanCode({
|
||||||
|
success: function (res) {
|
||||||
|
formData.value.deviceCode = res.result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSubmit() {
|
||||||
|
console.log(formData.value)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -70,5 +101,21 @@ function handleClick() {
|
|||||||
&:deep(.uni-easyinput__content) {
|
&:deep(.uni-easyinput__content) {
|
||||||
background: none !important;
|
background: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.action_btn {
|
||||||
|
width: 670rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
background: #4d5dfa;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
margin-top: 300rpx;
|
||||||
|
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
line-height: 80rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="page_container checkouthouse_box">
|
<view class="page_container checkouthouse_box flex flex-col">
|
||||||
<view class="search_box">
|
<view class="search_box">
|
||||||
<view
|
<view
|
||||||
@click="handleClick"
|
@click="handleClick"
|
||||||
@@ -18,13 +18,8 @@
|
|||||||
v-else
|
v-else
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="search_list">
|
<view class="search_list flex-1 flex">
|
||||||
<scroll-view
|
<scroll-view lower-threshold="160" scroll-y="true" @scrolltolower="scrolltolower">
|
||||||
style="height: 100%"
|
|
||||||
lower-threshold="160"
|
|
||||||
scroll-y="true"
|
|
||||||
@scrolltolower="scrolltolower"
|
|
||||||
>
|
|
||||||
<radio-group @change="radioChange">
|
<radio-group @change="radioChange">
|
||||||
<label v-for="(item, index) in searchlist" :key="index">
|
<label v-for="(item, index) in searchlist" :key="index">
|
||||||
<view
|
<view
|
||||||
@@ -46,11 +41,15 @@
|
|||||||
</radio-group>
|
</radio-group>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="action_btn" @tap="handleSelecthouse">
|
||||||
|
<text>确 认</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 滚动 高度如何计算? -->
|
<!-- 滚动 高度如何计算? -->
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref, getCurrentInstance, onMounted } from 'vue'
|
||||||
const Searching = ref(true)
|
const Searching = ref(true)
|
||||||
const queryParmas = ref({
|
const queryParmas = ref({
|
||||||
value: '',
|
value: '',
|
||||||
@@ -82,6 +81,8 @@ const searchlist = ref()
|
|||||||
|
|
||||||
function getlist() {
|
function getlist() {
|
||||||
const allnum = queryParmas.value.pageNum * queryParmas.value.pageSize
|
const allnum = queryParmas.value.pageNum * queryParmas.value.pageSize
|
||||||
|
|
||||||
|
if (allnum < 50) {
|
||||||
searchlist.value = Array.from({ length: allnum }).map((_, index) => {
|
searchlist.value = Array.from({ length: allnum }).map((_, index) => {
|
||||||
return {
|
return {
|
||||||
address: 'A栋3单元301',
|
address: 'A栋3单元301',
|
||||||
@@ -89,6 +90,7 @@ function getlist() {
|
|||||||
id: index + 1
|
id: index + 1
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
getlist()
|
getlist()
|
||||||
|
|
||||||
@@ -96,21 +98,39 @@ function scrolltolower() {
|
|||||||
queryParmas.value.pageNum += 1
|
queryParmas.value.pageNum += 1
|
||||||
getlist()
|
getlist()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let eventChannel = null
|
||||||
|
// 必须在 onMounted 里获取
|
||||||
|
onMounted(() => {
|
||||||
|
const instance = getCurrentInstance().proxy
|
||||||
|
if (instance && instance.getOpenerEventChannel) {
|
||||||
|
eventChannel = instance.getOpenerEventChannel()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function handleSelecthouse() {
|
||||||
|
// 2. 发送数据 (触发 A 页面定义的 'backData' 事件)
|
||||||
|
console.log(eventChannel)
|
||||||
|
eventChannel.emit('backData', {
|
||||||
|
Houseid: checkoutHouseid.value,
|
||||||
|
HouseName: 'A栋3单元301'
|
||||||
|
})
|
||||||
|
// 3. 返回上一页
|
||||||
|
uni.navigateBack()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.checkouthouse_box {
|
.checkouthouse_box {
|
||||||
background: #f9f9f9;
|
background: #f9f9f9;
|
||||||
height: 100%;
|
|
||||||
overflow: hidden;
|
|
||||||
box-sizing: border-box;
|
|
||||||
.search_box {
|
.search_box {
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
.search_view {
|
.search_view {
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
line-height: 80rpx;
|
line-height: 80rpx;
|
||||||
background: #f3f3f3;
|
background: #f3f3f3;
|
||||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
border-radius: 8rpx;
|
||||||
|
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
@@ -121,9 +141,10 @@ function scrolltolower() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.search_list {
|
.search_list {
|
||||||
height: calc(100% - 140rpx);
|
height: 100%;
|
||||||
background-color: #4d5dfa;
|
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: hidden;
|
||||||
.search_item {
|
.search_item {
|
||||||
height: 116rpx;
|
height: 116rpx;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
@@ -157,5 +178,18 @@ function scrolltolower() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.action_btn {
|
||||||
|
width: 670rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
line-height: 80rpx;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
background: #4d5dfa;
|
||||||
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="page_container replacement_record_box">
|
<view class="page_container replacement_record_box flex flex-col">
|
||||||
<view class="nav flex items-center">
|
<view class="nav flex items-center">
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
<text class="title">仪表换新记录</text>
|
<text class="title">仪表换新记录</text>
|
||||||
</view>
|
</view>
|
||||||
<TabsComponents :tabslist="tabslist" @update="handleChangeTabs"></TabsComponents>
|
<TabsComponents :tabslist="tabslist" @update="handleChangeTabs"></TabsComponents>
|
||||||
<view class="instrument_body">
|
<view class="instrument_body flex-1 flex">
|
||||||
|
<scroll-view scroll-y lower-threshold="160" @scrolltolower="scrolltolower">
|
||||||
<view
|
<view
|
||||||
class="instrument_items flex items-center flex-between"
|
class="instrument_items flex items-center flex-between"
|
||||||
v-for="(item, index) in infolist"
|
v-for="(item, index) in infolist"
|
||||||
@@ -27,13 +28,31 @@
|
|||||||
<text v-else>水表</text>
|
<text v-else>水表</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 底部加载状态提示 -->
|
||||||
|
<uni-load-more :status="statusmore"></uni-load-more>
|
||||||
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { computed, nextTick, ref } from 'vue'
|
||||||
import TabsComponents from '@/components/tabs/tabs.vue'
|
import TabsComponents from '@/components/tabs/tabs.vue'
|
||||||
|
/** 加载状态 */
|
||||||
|
const statusmore = computed(() => {
|
||||||
|
if (isLoading.value === true) {
|
||||||
|
return 'loading'
|
||||||
|
} else if (isLoading.value === false) {
|
||||||
|
if (hasMore.value) {
|
||||||
|
return 'more'
|
||||||
|
} else {
|
||||||
|
return 'noMore'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const isLoading = ref(false) // 加载锁
|
||||||
|
const hasMore = ref(true) // 是否还有更多数据
|
||||||
|
|
||||||
const tabslist = [
|
const tabslist = [
|
||||||
{
|
{
|
||||||
name: '全部',
|
name: '全部',
|
||||||
@@ -49,32 +68,54 @@ const tabslist = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
function handleChangeTabs(val: number) {
|
function handleChangeTabs(val: number) {
|
||||||
console.log('选择了:', val)
|
queryParmas.value.pageNum = 1
|
||||||
|
infolist.value = []
|
||||||
|
getlist()
|
||||||
}
|
}
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
const queryParmas = ref({
|
||||||
const infolist = ref([
|
pageNum: 1,
|
||||||
{
|
pageSize: 15
|
||||||
title: 'M2栋3单元1801室(M2-3-1801)',
|
})
|
||||||
time: '2023-08-01 10:05:46',
|
const infolist = ref([])
|
||||||
type: 1 //1水表 2电表
|
function scrolltolower() {
|
||||||
},
|
if (hasMore.value) {
|
||||||
{
|
queryParmas.value.pageNum += 1
|
||||||
title: 'M2栋3单元1801室(M2-3-1801)',
|
getlist()
|
||||||
time: '2023-08-01 10:05:46',
|
|
||||||
type: 2 //1水表 2电表
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'M2栋3单元1801室(M2-3-1801)',
|
|
||||||
time: '2023-08-01 10:05:46',
|
|
||||||
type: 1 //1水表 2电表
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'M2栋3单元1801室(M2-3-1801)',
|
|
||||||
time: '2023-08-01 10:05:46',
|
|
||||||
type: 2 //1水表 2电表
|
|
||||||
}
|
}
|
||||||
])
|
}
|
||||||
|
|
||||||
|
function getlist() {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
// 1. 如果正在加载或没有更多数据,直接返回
|
||||||
|
if (isLoading.value || !hasMore.value) return
|
||||||
|
// 2. 开启锁
|
||||||
|
isLoading.value = true
|
||||||
|
const all = queryParmas.value.pageNum * queryParmas.value.pageSize
|
||||||
|
if (all > 50) {
|
||||||
|
isLoading.value = false
|
||||||
|
uni.hideLoading()
|
||||||
|
hasMore.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const arr = Array.from({ length: all }).map((_, index) => {
|
||||||
|
return {
|
||||||
|
title: 'M2栋3单元18' + index + '室(M2-3-1801)',
|
||||||
|
time: '2023-08-01 10:05:46',
|
||||||
|
type: 1 //1水表 2电表
|
||||||
|
}
|
||||||
|
})
|
||||||
|
hasMore.value = true
|
||||||
|
nextTick(() => {
|
||||||
|
infolist.value = [...infolist.value, ...arr]
|
||||||
|
isLoading.value = false
|
||||||
|
uni.hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getlist()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@@ -95,11 +136,16 @@ const infolist = ref([
|
|||||||
}
|
}
|
||||||
|
|
||||||
.instrument_body {
|
.instrument_body {
|
||||||
|
overflow: hidden;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: #4d5dfa;
|
||||||
.instrument_items {
|
.instrument_items {
|
||||||
|
box-sizing: border-box;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
padding: 40rpx 20rpx;
|
padding: 40rpx 20rpx;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
width: 40rpx;
|
width: 40rpx;
|
||||||
height: 32rpx;
|
height: 32rpx;
|
||||||
|
|||||||
Reference in New Issue
Block a user