巡检接口

This commit is contained in:
Zy
2026-05-19 17:31:17 +08:00
parent 82200a3617
commit abc8086ad0
15 changed files with 433 additions and 253 deletions

View File

@@ -13,13 +13,19 @@
<view class="location-area">
<!-- 定位图标 -->
<view class="location-icon">
<image src="https://wuyeadmin.bugtc.com/images/imgs/adress.png" style="height: 100%; width: 100%"></image>
<image
src="https://wuyeadmin.bugtc.com/images/imgs/adress.png"
style="height: 100%; width: 100%"
></image>
</view>
<!-- 小区名称和下拉箭头 -->
<view class="community-selector">
<text class="community-name">{{ currentCommunity }}</text>
<view class="community-icon">
<image src="https://wuyeadmin.bugtc.com/images/imgs/三角形.png" style="height: 100%; width: 100%"></image>
<image
src="https://wuyeadmin.bugtc.com/images/imgs/三角形.png"
style="height: 100%; width: 100%"
></image>
</view>
</view>
</view>
@@ -52,8 +58,11 @@
<view class="noticeClass">
<!-- 左侧消息通知文字 -->
<view class="notice-left">
<image src="https://wuyeadmin.bugtc.com/images/imgs/notice.png" class="notice-icon"></image>
<view class="notice-line"></view>
<image
src="https://wuyeadmin.bugtc.com/images/imgs/notice.png"
class="notice-icon"
></image>
<view class="notice-line"></view>
</view>
<!-- 右侧滚动公告 -->
<view class="notice-right" @click="getNoticeMore">
@@ -75,15 +84,15 @@
<!-- 巡检数据统计区 -->
<view class="statistics-wrap">
<view class="statistics-item" @click="goToInspectionRecord">
<text class="num">{{allCount}}</text>
<text class="num">{{ totalTasks }}</text>
<text class="label">全部巡检</text>
</view>
<view class="statistics-item" @click="goToDaysInspection">
<text class="num">{{pendingCount}}</text>
<text class="num">{{ pendingCount }}</text>
<text class="label">待巡检</text>
</view>
<view class="statistics-item">
<text class="num">{{InspectedCount}}</text>
<text class="num">{{ InspectedCount }}</text>
<text class="label">已巡检</text>
</view>
</view>
@@ -94,26 +103,46 @@
<!-- 第一行功能:故障上报、一键开门、工单大厅、我的工单 -->
<view class="function-row">
<view class="function-item" @click="goToReport">
<image class="item-icon" src="https://wuyeadmin.bugtc.com/images/imgs/fault-report.png" mode="aspectFit"></image>
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/fault-report.png"
mode="aspectFit"
></image>
<text class="item-text">故障上报</text>
</view>
<view class="function-item" @click="goToOneOpenDoor">
<image class="item-icon" src="https://wuyeadmin.bugtc.com/images/imgs/open.png" mode="aspectFit"></image>
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/open.png"
mode="aspectFit"
></image>
<text class="item-text">一键开门</text>
</view>
<view class="function-item" @tap="goToTicketHall">
<image class="item-icon" src="https://wuyeadmin.bugtc.com/images/imgs/work-order.png" mode="aspectFit"></image>
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/work-order.png"
mode="aspectFit"
></image>
<text class="item-text">工单大厅</text>
</view>
<view class="function-item" @tap="goToMyTicket">
<image class="item-icon" src="https://wuyeadmin.bugtc.com/images/imgs/my-work.png" mode="aspectFit"></image>
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/my-work.png"
mode="aspectFit"
></image>
<text class="item-text">我的工单</text>
</view>
</view>
<!-- 第二行 -->
<view class="function-row" style="margin-top: 2px">
<view class="function-item" @tap="goToComplaint">
<image class="item-icon" src="https://wuyeadmin.bugtc.com/images/imgs/complaint.png" mode="aspectFit"></image>
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/complaint.png"
mode="aspectFit"
></image>
<text class="item-text">投诉处理</text>
</view>
</view>
@@ -124,28 +153,27 @@
<script setup>
import { ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { getCurrentVillage,getTodayInspection,getNewNoticeData } from '../../api/api.js'
import { getCurrentVillage, getTodayInspection, getNewNoticeData } from '../../api/api.js'
// 列表数据状态
const current = ref(0)
const currentCommunity = ref('请选择小区')
const bannerList = ref([{ img: 'https://wuyeadmin.bugtc.com/images/imgs/banner1.png' }])
const noticeText = ref('暂无公告')
const allCount = ref(0) // 全部巡检
const totalTasks = ref(0) // 全部巡检
const pendingCount = ref(0) //待巡检
const InspectedCount = ref(0) //已巡检
// =======方法=======
// 跳转小区
const navigateToPage = () => {
const curVillageId = uni.getStorageSync('currentVillage')
let villageId = ''
if(curVillageId){
try{
villageId = JSON.parse(curVillageId).villageId || JSON.parse(curVillageId).id || ''
}catch(e){}
}
const curVillageId = uni.getStorageSync('currentVillage')
let villageId = ''
if (curVillageId) {
try {
villageId = JSON.parse(curVillageId).villageId || JSON.parse(curVillageId).id || ''
} catch (e) {}
}
uni.navigateTo({
url: `/pageSubPack/notice-list/select-community?villageId=${villageId}`
})
@@ -200,42 +228,48 @@ const goToReport = () => {
}
// 获取当前小区
const currentVillageData = () => {
getCurrentVillage().then(res => {
const data = res.data
if (data) {
currentCommunity.value = data.villageName
uni.setStorageSync('currentVillage', JSON.stringify(data))
getNoticeData()
}
}).catch(() => {})
getCurrentVillage()
.then(res => {
const data = res.data
if (data) {
currentCommunity.value = data.villageName
uni.setStorageSync('currentVillage', JSON.stringify(data))
getNoticeData()
}
})
.catch(() => {})
}
// 获取今日巡检数据
const getInspectionData = () =>{
getTodayInspection().then(res =>{
if(res.code === 200){
if(res.data){
allCount.value = res.data.unfinishedPoints
pendingCount.value = res.data.unfinishedTasks
InspectedCount.value = res.data.completedTasks
}else{
allCount.value = 0
pendingCount.value = 0
InspectedCount.value = 0
const getInspectionData = () => {
getTodayInspection()
.then(res => {
if (res.code === 200) {
if (res.data) {
totalTasks.value = res.data.totalTasks
pendingCount.value = res.data.unfinishedTasks
InspectedCount.value = res.data.completedTasks
} else {
totalTasks.value = 0
pendingCount.value = 0
InspectedCount.value = 0
}
}
}
}).catch(err =>{
uni.showToast({title:err.msg || '获取失败',icon:'none'})
})
})
.catch(err => {
uni.showToast({ title: err.msg || '获取失败', icon: 'none' })
})
}
// 获取消息通知
const getNoticeData = () => {
getNewNoticeData().then(res => {
if (res.code === 200 && res.data) {
noticeText.value = res.data.notice || ''
}else{
noticeText.value = '暂无公告'
}
}).catch(() => {})
getNewNoticeData()
.then(res => {
if (res.code === 200 && res.data) {
noticeText.value = res.data.notice || ''
} else {
noticeText.value = '暂无公告'
}
})
.catch(() => {})
}
// 接收选择小区返回的参数
@@ -396,17 +430,16 @@ const clickItem = index => {
align-items: center;
margin-right: 16rpx;
.notice-icon {
width: 48rpx;
height: 48rpx;
margin-right: 15rpx;
}
.notice-icon {
width: 48rpx;
height: 48rpx;
margin-right: 15rpx;
}
.notice-line {
width: 1rpx;
height: 40rpx;
background-color: rgba(255, 255, 255, 0.4);
}
}