巡检记录接口对接

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

@@ -5,33 +5,32 @@
<view class="title_box flex items-center justify-between">
<view class="title flex items-center">
<view class="line"> </view>
<text>{{ info.taskName }}</text>
</view>
<view class="inspection_status" v-if="info.status === 0"> <text>已巡检</text> </view>
<view class="inspection_status todo" v-else>
<text>未巡检</text>
<text>{{ info.villageName }} - {{ info.taskName }}</text>
</view>
<view class="inspection_status"> <text>已巡检</text> </view>
</view>
<view class="info">
<view class="item">
<text>巡检项目:</text>
<text>{{ info.items.join('; ') }}</text>
<text>{{ info.planName }}</text>
</view>
<view class="item">
<text>巡检时间:</text>
<text>{{ info.time }}</text>
<text>07:00:00 - 09:00:00</text>
</view>
<view class="item">
<text>巡检小区:</text>
<text>{{ info.villageName }}</text>
</view>
<view class="item">
<text>巡检路线:</text>
<text>{{ info.planName }}</text>
</view>
<view class="item">
<text>巡检点:</text>
<text>{{ info.point.join('; ') }}</text>
<view class="" v-for="(item, index) in baseFormData" :key="index">
<view class="item">
<text>巡检路线:</text>
<text>{{ item.routeName }}</text>
</view>
<view class="item">
<text>巡检点:</text>
<text v-for="(ite, ind) in item.points" :key="ind">{{ ite.pointName }};</text>
</view>
</view>
</view>
</view>
@@ -39,39 +38,49 @@
<view class="inspecton_result_title">
<text>巡检结果</text>
</view>
<view class="inspection_body" v-for="(item, index) in result" :key="index">
<view class="inspection_items">
<text class="label">巡检点:</text>
<text>{{ item.pointName }}</text>
<view class="inspection_body" v-for="(item, index) in baseFormData" :key="index">
<view v-for="(ite, ind) in item.points" :key="ind">
<view class="inspection_items">
<text class="label">巡检路线:</text>
<text style="font-weight: 550">{{ item.routeName }}</text>
</view>
<view class="inspection_items">
<text class="label">巡检点:</text>
<text>{{ ite.pointName }}</text>
</view>
<view class="inspection_items">
<text class="label">巡检人:</text>
<text>{{ ite.resientName }}</text>
</view>
<view class="inspection_items">
<text class="label">手机号码:</text>
<text>{{ ite.phone }}</text>
</view>
<view class="inspection_items">
<text class="label">巡检时间:</text>
<text>{{ ite.time }}</text>
</view>
<view class="inspection_items">
<text class="label">巡检状态:</text>
<text>{{ ite.status === 0 ? '正常' : '异常' }}</text>
</view>
<view class="inspection_items">
<view class="label">巡检结果:</view>
<view class="desction_value">{{ ite.descrtion }}</view>
</view>
<view class="inspection_items">
<view class="label">巡检照片:</view>
<image
lazy-load
class="inspection_photo"
v-for="(it, ind) in ite.files"
:key="ind"
:src="it"
mode="scaleToFill"
></image>
</view>
<view class="linedash" v-show="ind + 1 !== item.points.length"> </view>
</view>
<view class="inspection_items">
<text class="label">巡检人:</text>
<text>{{ item.user }}</text>
</view>
<view class="inspection_items">
<text class="label">手机号码:</text>
<text>{{ item.phone }}</text>
</view>
<view class="inspection_items">
<text class="label">巡检时间:</text>
<text>{{ item.time }}</text>
</view>
<view class="inspection_items">
<view class="label">巡检结果:</view>
<view class="desction_value">{{ item.descrtion }}</view>
</view>
<view class="inspection_items">
<view class="label">巡检照片:</view>
<image
lazy-load
class="inspection_photo"
v-for="(ite, ind) in item.photos"
:key="ind"
:src="ite"
mode="scaleToFill"
></image>
</view>
<view class="linedash" v-show="index + 1 !== result.length"> </view>
</view>
</view>
</view>
@@ -80,57 +89,65 @@
<script setup lang="ts">
import { ref } from 'vue'
import { getInspectionMain } from '@/api/insepction.js'
import { onLoad } from '@dcloudio/uni-app'
const taskid = ref('')
const info = ref({
items: ['设备巡检', '电力检查'],
time: '07:00:00-12:00:00',
villageName: '幸福苑小区',
taskName: '幸福苑小区-B1层地下车区',
status: 0, // 0 已巡检 1未巡检
planName: '常规巡检路线1',
point: ['安全出口1号', '巡检点2号', '巡检点3号']
planName: '',
remindTime: '',
routes: [],
taskId: '',
taskName: '',
taskTime: '',
villageName: ''
})
const baseFormData = ref([])
function init() {
if (!taskid.value) return
getInspectionMain(taskid.value)
.then(res => {
info.value = res.data
if (!res.data.routes) return
let result = res.data.routes
.map(item => {
if (!item.points || item.points.length <= 0) return false
const points = item.points.map(ite => {
return {
pointId: ite.pointId,
pointName: ite.pointName,
status: ite.status ?? 0,
desition: ite.remark,
files: ite.imgUrl ? ite.imgUrl.split(',') : [],
phone: '',
time: '',
resientName: ''
}
})
return {
routeName: item.routeName,
routeId: item.routeId,
description: item.description,
points: points
}
})
.filter(item => item !== false)
baseFormData.value = result
console.log(result)
})
.catch(err => {
uni.showToast({
icon: 'error',
title: '网络异常'
})
})
}
onLoad(options => {
taskid.value = options.id
init()
})
const result = ref([
{
pointName: '安全出口1号',
user: '李相龙',
phone: '1502360831',
time: '2026-10-25 08:10:01',
descrtion: '设备正常运转,电力系统正常,设备使用正常',
photos: [
'https://picsum.photos/80',
'https://picsum.photos/80',
'https://picsum.photos/80',
'https://picsum.photos/80'
]
},
{
pointName: '巡检点2号',
user: '李相龙',
phone: '1502360831',
time: '2026-10-25 10:10:01',
descrtion: '部分墙体漏水',
photos: [
'https://picsum.photos/80',
'https://picsum.photos/80',
'https://picsum.photos/80',
'https://picsum.photos/80'
]
},
{
pointName: '巡检点3号',
user: '李相龙',
phone: '1502360831',
time: '2026-10-25 12:10:01',
descrtion: '正常',
photos: [
'https://picsum.photos/80',
'https://picsum.photos/80',
'https://picsum.photos/80',
'https://picsum.photos/80'
]
}
])
</script>
<style lang="scss" scoped>
@@ -237,7 +254,9 @@ const result = ref([
}
.linedash {
width: 100%;
border: 2rpx dashed #ccc;
height: 0;
border: 1rpx dashed #ccc;
margin: 40rpx 0;
}
}
}