巡检记录接口对接

This commit is contained in:
Zy
2026-05-19 09:23:23 +08:00
parent 9d06785fd2
commit 82200a3617
17 changed files with 880 additions and 467 deletions

View File

@@ -4,23 +4,25 @@
<view
@click="handleClick"
class="search_view flex-center"
v-if="!queryParmas.keyword.trim() && Searching"
v-if="!queryParmas.searchValue.trim() && Searching"
>
<uni-icons type="search" size="34rpx" color="rgba(0,0,0,0.26)"></uni-icons>
<text>请输入关键字进行搜索</text>
</view>
<uni-easyinput
@blur="handleInput"
@change="handleSearch"
@clear="handleInput"
@confirm="handleSearch"
@input="handleInputString"
:focus="true"
ref="inputRef"
v-model="queryParmas.keyword"
v-model="queryParmas.searchValue"
v-else
/>
</view>
<view class="search_list flex-1 flex">
<scroll-view lower-threshold="160" scroll-y="true" @scrolltolower="scrolltolower">
<radio-group @change="radioChange">
<radio-group @change="radioChange" v-if="searchlist.length > 0">
<label v-for="(item, index) in searchlist" :key="index">
<view
class="search_item flex flex-between"
@@ -39,6 +41,9 @@
</view>
</label>
</radio-group>
<view class="noData" v-else>
<text>暂无数据</text>
</view>
</scroll-view>
</view>
@@ -54,18 +59,31 @@ import { getVillageHouseList_keyword } from '@/api/common.js'
const Searching = ref(true)
const queryParmas = ref({
keyword: '',
searchValue: '',
pageNum: 1,
pageSize: 10
})
/** 点击时切换到input,并聚焦 */
function handleClick() {
Searching.value = false
queryParmas.value.searchValue = ''
}
/** 判断 失去焦点时 切换回 view */
function handleInput() {
if (queryParmas.value.keyword.trim()) {
const value = queryParmas.value.searchValue.trim()
if (value) {
handleSearch()
} else if (value === '') {
queryParmas.value.searchValue = ''
Searching.value = true
handleSearch()
}
}
function handleInputString() {
if (queryParmas.value.searchValue.trim() === '') {
queryParmas.value.searchValue = ''
Searching.value = true
handleSearch()
}
}
@@ -102,13 +120,20 @@ function getlist() {
title: '加载中',
mask: true
})
getVillageHouseList_keyword(queryParmas.value, queryParmas.value.keyword)
getVillageHouseList_keyword(queryParmas.value, queryParmas.value.searchValue)
.then(res => {
// 追加数据(正确方式)
searchlist.value = [...searchlist.value, ...res.rows]
total.value = res.total
// 判断是否还有更多
hasMore.value = searchlist.value.length < total.value
})
.catch(() => {
uni.showToast({
icon: 'error',
title: '网络异常'
})
})
.finally(() => {
isLoading.value = false
uni.hideLoading()
@@ -126,6 +151,7 @@ function resetList() {
// Search
function handleSearch() {
hasMore.value = true
queryParmas.value.pageNum = 1
queryParmas.value.pageSize = 10
searchlist.value = []
@@ -211,6 +237,13 @@ function handleSelecthouse() {
}
}
}
.noData {
text-align: center;
color: rgba(0, 0, 0, 0.26);
font-size: larger;
padding-top: 50rpx;
letter-spacing: 10rpx;
}
.action_btn {
width: 670rpx;