Files
property-manager-side/wuye-manager-uniapp/pageSubPack/inspection/inspection_main.vue
2026-08-10 14:37:13 +08:00

292 lines
7.8 KiB
Vue
Raw 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="page_padding">
<view class="flex-1 flex-col flex inspection_main_box">
<view class="info_box">
<view class="title_box flex flex-between">
<view class="title flex">
<text class="line"></text>
<text>{{ info.villageName }} - {{ info.taskName }}</text>
</view>
<view class="inspection_status" style="flex: 100rpx"> <text>已巡检</text> </view>
</view>
<view class="info">
<view class="item">
<text>巡检项目:</text>
<text>{{ info.planName }}</text>
</view>
<view class="item">
<text>巡检时间:</text>
<text>{{ info.taskTime }}</text>
</view>
<view class="item">
<text>巡检小区:</text>
<text>{{ info.villageName }}</text>
</view>
<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>
<view class="result_box" v-if="baseFormData.length > 0">
<view class="inspecton_result_title">
<text>巡检结果</text>
</view>
<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>{{ info.inspectorName }}</text>
</view>
<view class="inspection_items">
<text class="label">手机号码:</text>
<text>{{ info.phoneNumber }}</text>
</view>
<view class="inspection_items">
<text class="label">巡检时间:</text>
<text>{{ ite.createTime }}</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">
<textarea class="my_textarea" disabled auto-height :value="ite.desition" />
</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"
@tap="handlePrivew(ite.files, ind)"
mode="scaleToFill"
></image>
</view>
<view class="linedash" v-show="ind + 1 !== item.points.length"> </view>
</view>
</view>
</view>
<view class="nodata" v-else>
<text>暂无数据</text>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { getInspectionMain } from '@/api/insepction.js'
import { onLoad } from '@dcloudio/uni-app'
const taskid = ref('')
let date = ''
const info = ref({
planName: '',
remindTime: '',
routes: [],
taskId: '',
taskName: '',
taskTime: '',
inspectorName: '',
phoneNumber: '',
villageName: ''
})
const baseFormData = ref([])
function init() {
if (!taskid.value) return
getInspectionMain(taskid.value, date)
.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,
createTime: ite.createTime,
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
})
.catch(() => {
uni.showToast({
icon: 'error',
title: '网络异常'
})
})
}
onLoad(options => {
taskid.value = options.id
date = options.date
console.log(date)
init()
})
/**预览图片*/
function handlePrivew(lists, index) {
if (lists.length <= 0) return
uni.previewImage({
urls: lists,
current: index
})
}
</script>
<style lang="scss" scoped>
.page_padding {
background: #f9f9f9;
}
.inspection_main_box {
padding: 20rpx 40rpx;
background: #f9f9f9;
flex: 1;
overflow: hidden;
box-sizing: border-box;
.info_box {
padding: 40rpx 30rpx;
border-radius: 16rpx;
background-color: #fff;
.title_box {
.title {
font-weight: 550;
font-size: 32rpx;
color: #333333;
min-height: 40rpx;
line-height: 40rpx;
.line {
display: block;
width: 6rpx;
background: #4d5dfa;
margin-right: 10rpx;
}
}
.inspection_status {
font-weight: 400;
font-size: 28rpx;
color: #666666;
line-height: 36rpx;
text-align: center;
&.todo {
color: #4d5dfa;
}
}
}
.info {
margin-top: 20rpx;
.item {
font-weight: 400;
font-size: 28rpx;
margin-bottom: 20rpx;
color: #333333;
line-height: 36rpx;
}
}
}
// 巡检结果
.result_box {
padding: 28rpx 40rpx;
background-color: #fff;
border-radius: 16rpx;
margin-top: 20rpx;
flex: 1;
box-sizing: border-box;
overflow: hidden;
overflow-y: auto;
.inspecton_result_title {
font-size: 32rpx;
color: #222222;
line-height: 40rpx;
font-weight: 550;
}
.inspection_body {
margin-top: 20rpx;
padding-left: 15rpx;
margin-bottom: 20rpx;
.inspection_items {
margin-bottom: 20rpx;
font-weight: 400;
font-size: 28rpx;
color: #333333;
line-height: 36rpx;
.inspection_photo {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
margin-top: 20rpx;
}
.label {
font-weight: 450;
font-size: 28rpx;
color: #333333;
}
.desction_value {
margin-bottom: 20rpx;
font-weight: 400;
font-size: 28rpx;
color: #666666;
line-height: 36rpx;
max-height: 250rpx; /* 最大高度,超出滚动 */
overflow-y: auto; /* 超出滚动 */
.my_textarea {
min-height: 80rpx;
font-weight: 400;
font-size: 28rpx;
color: #666666;
line-height: 36rpx;
}
}
}
.linedash {
width: 100%;
height: 0;
border: 1rpx dashed #ccc;
margin: 40rpx 0;
}
}
}
}
</style>