巡检接口

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

@@ -16,7 +16,7 @@
</view>
<view class="item">
<text>巡检时间:</text>
<text>07:00:00 - 09:00:00</text>
<text>{{ info.taskTime }}</text>
</view>
<view class="item">
<text>巡检小区:</text>
@@ -34,7 +34,7 @@
</view>
</view>
</view>
<view class="result_box">
<view class="result_box" v-if="baseFormData.length > 0">
<view class="inspecton_result_title">
<text>巡检结果</text>
</view>
@@ -50,15 +50,15 @@
</view>
<view class="inspection_items">
<text class="label">巡检人:</text>
<text>{{ ite.resientName }}</text>
<text>{{ info.inspectorName }}</text>
</view>
<view class="inspection_items">
<text class="label">手机号码:</text>
<text>{{ ite.phone }}</text>
<text>{{ info.phoneNumber }}</text>
</view>
<view class="inspection_items">
<text class="label">巡检时间:</text>
<text>{{ ite.time }}</text>
<text>{{ ite.createTime }}</text>
</view>
<view class="inspection_items">
<text class="label">巡检状态:</text>
@@ -66,7 +66,11 @@
</view>
<view class="inspection_items">
<view class="label">巡检结果:</view>
<view class="desction_value">{{ ite.descrtion }}</view>
<!-- <view class="desction_value"> {{ ite.desition }}</view> -->
<view class="desction_value">
<!-- <rich-text :nodes="ite.desition"></rich-text> -->
<textarea class="my_textarea" disabled auto-height :value="ite.desition" />
</view>
</view>
<view class="inspection_items">
<view class="label">巡检照片:</view>
@@ -83,6 +87,9 @@
</view>
</view>
</view>
<view class="nodata" v-else>
<text>暂无数据</text>
</view>
</view>
</view>
</template>
@@ -100,6 +107,8 @@ const info = ref({
taskId: '',
taskName: '',
taskTime: '',
inspectorName: '',
phoneNumber: '',
villageName: ''
})
const baseFormData = ref([])
@@ -118,6 +127,7 @@ function init() {
pointId: ite.pointId,
pointName: ite.pointName,
status: ite.status ?? 0,
createTime: ite.createTime,
desition: ite.remark,
files: ite.imgUrl ? ite.imgUrl.split(',') : [],
phone: '',
@@ -134,7 +144,6 @@ function init() {
})
.filter(item => item !== false)
baseFormData.value = result
console.log(result)
})
.catch(err => {
uni.showToast({
@@ -233,7 +242,6 @@ onLoad(options => {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
margin-bottom: 20rpx;
margin-top: 20rpx;
}
@@ -241,7 +249,6 @@ onLoad(options => {
font-weight: 450;
font-size: 28rpx;
color: #333333;
margin-bottom: 20rpx;
}
.desction_value {
@@ -250,6 +257,16 @@ onLoad(options => {
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 {

View File

@@ -25,6 +25,7 @@
scroll-y
lower-threshold="160"
@scrolltolower="scrolltolower"
v-if="list.length > 0"
>
<view
class="record_list_item"
@@ -52,6 +53,9 @@
</view>
</view>
</scroll-view>
<view class="nodata" v-else>
<text>暂无数据</text>
</view>
</view>
</view>
</template>
@@ -110,11 +114,12 @@ function getlist() {
title: '加载中',
mask: true
})
const { pageNum, pageSize, date } = queryParmas.value
const { pageNum, pageSize, date, status } = queryParmas.value
getInspectionList({
pageSize,
pageNum,
date
date,
status
})
.then(res => {
list.value = res.rows
@@ -125,7 +130,6 @@ function getlist() {
ite.itemNames.forEach(it => items.add(it))
})
item.itemslist = Array.from(items)
console.log(item.itemslist)
})
hasMore.value = list.value.length < res.total
total.value = res.total
@@ -163,6 +167,7 @@ function scrolltolower() {
}
function handleChangeTabs(val: number) {
hasMore.value = true
queryParmas.value.status = val
queryParmas.value.pageNum = 1
queryParmas.value.pageSize = 10
@@ -177,7 +182,6 @@ function init() {
onShow(() => {
hasMore.value = true
console.log('show')
init()
})
// 返回上一页

View File

@@ -67,7 +67,10 @@
</view>
</view>
<view class="items_picker_box">
<view class="label"> 巡检照片 </view>
<view class="label">
<text v-if="info.inspectSetting === 1" class="is-required">*</text>
<text>巡检照片</text>
</view>
<view class="filePickerbox" v-if="!ite.complated">
<filePicker
v-model="ite.files"
@@ -138,6 +141,14 @@ const rules = {
errorMessage: '巡检状态不能为空'
}
]
},
files: {
rules: [
{
required: true,
errorMessage: '巡检照片不能为空'
}
]
}
}
@@ -169,8 +180,6 @@ function init() {
})
.filter(item => item !== false)
baseFormData.value = result
console.log(result)
console.log(isComputed.value)
})
.catch(err => {
uni.showToast({
@@ -194,7 +203,16 @@ function onUploadFail(e) {
/** 提交巡检点 检查情况 */
function handleSubmit(item) {
console.log(item, baseFormData.value)
if (info.value.inspectSetting === 1) {
if (item.files.length <= 0) {
uni.showToast({
icon: 'error',
mask: true,
title: '必须拍照'
})
return
}
}
let obj = {
pointId: item.pointId,
imgUrl: item.files.length > 0 ? item.files.join(',') : '',
@@ -202,15 +220,15 @@ function handleSubmit(item) {
status: item.status,
taskId: taskid.value
}
console.log(obj)
putInsepctionPoint(obj)
.then(res => {
item.complated = true
console.log(isComputed.value)
console.log(res)
})
.catch(err => {
console.log(err)
uni.showToast({
icon: 'error',
title: '网络错误'
})
})
}
@@ -240,6 +258,10 @@ function previewImages(images, currentIndex) {
</script>
<style scoped lang="scss">
.is-required {
color: #dd524d;
font-weight: bold;
}
.inspection_upload_box {
background: #f9f9f9;
padding: 20rpx 40rpx;

View File

@@ -3,41 +3,45 @@
<view class="today_inspection_page flex flex-col">
<!-- 状态筛选标签 -->
<TabsComponents :tabslist="tabslist" @update="handleTabs"></TabsComponents>
<!-- body -->
<view class="inspection_body flex-1">
<view class="inspection_body flex-1" v-if="list.length > 0">
<view
class="inspection_items"
v-for="(item, index) in list"
:key="index"
@tap="gotoInspection(item)"
@tap="handleTap(item)"
>
<view class="title">
<text class="subtitle">
<i></i>
{{ item.address }}
{{ item.taskName }}
</text>
<text class="noactions" v-if="item.status === 0">未巡检</text>
<text class="noactions" v-if="!isComputed(item.taskStatus)">未巡检</text>
<text class="noactions alaway_actions" v-else>已巡检</text>
</view>
<view class="inspection_item_box flex">
<text class="inspection_item" v-for="(ite, index) in item.item" :key="index">
<text class="inspection_item" v-for="(ite, index) in item.itemslist" :key="index">
{{ ite }}
</text>
</view>
<view class="inspection_time">
<text>巡检时间:</text>
<text>{{ item.time }}</text>
<text>{{ item.taskTime }}</text>
</view>
<view class="inspection_time">
<text>巡检人:</text>
<text>{{ item.user }}</text>
<view class="actions" v-if="item.status === 0">
<view class="inspection_time flex items-center justify-between">
<view class="">
<text>巡检人:</text>
<text>{{ item.inspectorName }}</text>
</view>
<view class="actions" v-if="!isComputed(item.taskStatus)">
<text>去巡检</text>
</view>
</view>
</view>
</view>
<view class="nodata" v-else>
<text>暂无数据</text>
</view>
</view>
<!-- body -->
</view>
@@ -47,91 +51,103 @@
import { ref, computed } from 'vue'
import TabsComponents from '@/components/tabs/tabs.vue'
import { onShow } from '@dcloudio/uni-app'
import { getInspectionList } from '@/api/insepction.js'
import { parseTime } from '@/utils/time.js'
// tabs =========================================================
const activeValue = ref(0)
const tabslist = ref([
{
name: '全部',
value: 0
value: 2
},
{
name: '未巡检',
value: 1
value: 0
},
{
name: '已巡检',
value: 2
value: 1
}
])
// 点击事件
const handleTabs = (val: number) => {
activeValue.value = val
queryParmas.value.status = val
init()
}
// tabs =========================================================
// body =========================================================
const isComputed = (status: string) => {
const awaitlist = ['未完成', '待执行', '执行中']
return !awaitlist.includes(status)
}
const list = ref([])
const queryParmas = ref({
date: '',
status: 2,
pageNum: 1,
pageSize: 10
})
const isLoading = ref(false) // 加载锁
const hasMore = ref(true) // 是否还有更多数据
const total = ref(0)
function getlist() {
if (isLoading.value || !hasMore.value) return
isLoading.value = true
uni.showLoading({
title: '加载中',
mask: true
})
const { pageNum, pageSize, date, status } = queryParmas.value
getInspectionList({
pageSize,
pageNum,
status,
date
})
.then(res => {
let items: Set<string> = new Set()
res.rows.forEach(item => {
if (!item.points || item.points.length <= 0) return
item.points.forEach(ite => {
ite.itemNames.forEach(it => items.add(it))
})
item.itemslist = Array.from(items)
})
list.value = res.rows
hasMore.value = list.value.length < res.total
total.value = res.total
})
.finally(() => {
isLoading.value = false
uni.hideLoading()
})
}
/** 跳转到巡检上传页面 */
// 0未巡检 1已巡检
const gotoInspection = row => {
if (row.status === 0) {
function handleTap(ite) {
if (isComputed(ite.taskStatus)) {
uni.navigateTo({
url: '/pageSubPack/inspection/inspection_upload'
url: '/pageSubPack/inspection/inspection_main?id=' + ite.id
})
} else {
uni.navigateTo({
url: '/pageSubPack/inspection/inspection_main'
url: '/pageSubPack/inspection/inspection_upload?id=' + ite.id
})
}
}
// body =========================================================
const list = ref([
{
address: '幸福苑小区- B1层地下车库',
time: '07:00:00 -09:00:00',
item: [
'防火设施安全巡检',
'防火设施安全巡检',
'防火设施安全巡检',
'防火设施安全巡检',
'防火设施安全巡检'
],
user: '李相龙',
status: 0 // 0未巡检 1已巡检
},
{
address: '幸福苑小区- B2层地下车库',
time: '13:00:00 -15:00:00',
item: ['设备巡检'],
user: '李相龙',
status: 1 // 0未巡检 1已巡检
},
{
address: '幸福苑小区- B2层地下车库',
time: '13:00:00 -15:00:00',
item: ['设备巡检'],
user: '李相龙',
status: 1 // 0未巡检 1已巡检
},
{
address: '幸福苑小区- B2层地下车库',
time: '13:00:00 -15:00:00',
item: ['设备巡检'],
user: '李相龙',
status: 1 // 0未巡检 1已巡检
},
{
address: '幸福苑小区- B2层地下车库',
time: '13:00:00 -15:00:00',
item: ['设备巡检'],
user: '李相龙',
status: 1 // 0未巡检 1已巡检
}
])
function getInspectionList() {
getInspectionList()
function init() {
hasMore.value = true
queryParmas.value.date = parseTime(new Date(), '{y}-{m}-{d}')
getlist()
}
onShow(() => getInspectionList())
onShow(() => {
init()
})
</script>
<style scoped lang="scss">
@@ -259,13 +275,11 @@ onShow(() => getInspectionList())
color: #333333;
line-height: 36rpx;
position: relative;
overflow: hidden;
text-overflow: ellipsis;
}
.actions {
position: absolute;
right: 0;
bottom: 0;
width: 140rpx;
height: 50rpx;
background: #4d5dfa;
@@ -279,5 +293,12 @@ onShow(() => getInspectionList())
}
}
}
.nodata {
color: #ccc;
text-align: center;
margin-top: 200rpx;
letter-spacing: 1rpx;
}
}
</style>