格式化一下xkXc

This commit is contained in:
ywyonui 2025-08-01 10:13:31 +08:00
parent 3ee00aa59b
commit 16f7aaefdd

View File

@ -71,16 +71,20 @@
> >
<view class="item-info flex-1"> <view class="item-info flex-1">
<!-- 项目名称单独一行 --> <!-- 项目名称单独一行 -->
<text class="item-text">{{ index + 1 }}{{ item.xcMc }}</text> <text class="item-text"
>{{ index + 1 }}{{ item.xcMc }}</text
>
<!-- 分值和结果同一行 --> <!-- 分值和结果同一行 -->
<view class="item-score-result"> <view class="item-score-result">
<text class="item-deduction mr-20">分值{{ item.xmFz }}</text> <text class="item-deduction mr-20">
分值{{ item.xmFz }}
</text>
<view class="item-result"> <view class="item-result">
<radio-group <radio-group
:name="'result_' + item.id" :name="'result_' + item.id"
@change="e => { item.checked = e.detail.value === 'A'; }"
class="item-radio-group" class="item-radio-group"
> @change="onCheckItemChange($event, item)"
>
<label class="item-radio-label mr-10"> <label class="item-radio-label mr-10">
<radio <radio
:value="'A'" :value="'A'"
@ -107,7 +111,10 @@
</view> </view>
</template> </template>
<template v-else> <template v-else>
<view class="no-check-items" style="text-align:center;color:#999;padding:20px 0;"> <view
class="no-check-items"
style="text-align: center; color: #999; padding: 20px 0"
>
暂无巡查项目 暂无巡查项目
</view> </view>
</template> </template>
@ -158,7 +165,10 @@
<view v-else class="completed-inspection"> <view v-else class="completed-inspection">
<!-- 巡查记录列表 --> <!-- 巡查记录列表 -->
<view class="inspection-list"> <view class="inspection-list">
<BasicListLayout @register="registerInspection" style="position: absolute;"> <BasicListLayout
@register="registerInspection"
style="position: absolute"
>
<template v-slot="{ data, index }"> <template v-slot="{ data, index }">
<view class="inspection-record bg-white r-md p-15 mb-15"> <view class="inspection-record bg-white r-md p-15 mb-15">
<view class="record-header"> <view class="record-header">
@ -176,22 +186,38 @@
<text class="item-value">{{ data.jsxm }}</text> <text class="item-value">{{ data.jsxm }}</text>
</view> </view>
<view class="content-item flex-col"> <view class="content-item flex-col">
<text class="item-label" style="flex: 0 0 25px;">巡查项目</text> <text class="item-label" style="flex: 0 0 25px"
<view class="item-value" style="width:100%"> >巡查项目</text
<template v-if="data.xkXcXmList && data.xkXcXmList.length > 0"> >
<view v-for="(xm, idx) in data.xkXcXmList" :key="xm.xcXmId" style="margin-bottom: 4px;"> <view class="item-value" style="width: 100%">
<template
v-if="data.xkXcXmList && data.xkXcXmList.length > 0"
>
<view
v-for="(xm, idx) in data.xkXcXmList"
:key="xm.xcXmId"
style="margin-bottom: 4px"
>
<view> <view>
<text>{{ idx + 1 }}{{ xm.xcMc }}</text> <text>{{ idx + 1 }}{{ xm.xcMc }}</text>
<view style="display: flex; justify-content: space-between; margin: 4px 0;"> <view
style="
display: flex;
justify-content: space-between;
margin: 4px 0;
"
>
<text>分值{{ xm.xmFz }}</text> <text>分值{{ xm.xmFz }}</text>
<text>巡查结果{{ xm.xcJg === 'A' ? '有' : '无' }}</text> <text
>巡查结果{{
xm.xcJg === "A" ? "有" : "无"
}}</text
>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<template v-else> <template v-else> 无巡查项目 </template>
无巡查项目
</template>
</view> </view>
</view> </view>
<view <view
@ -199,14 +225,23 @@
v-if="data.images && data.images.length > 0" v-if="data.images && data.images.length > 0"
> >
<text class="item-label">巡查图片</text> <text class="item-label">巡查图片</text>
<view class="item-value" style="display: flex; flex-wrap: wrap; gap: 8px;"> <view
class="item-value"
style="display: flex; flex-wrap: wrap; gap: 8px"
>
<image <image
v-for="(img, imgIdx) in data.images" v-for="(img, imgIdx) in data.images"
:key="imgIdx" :key="imgIdx"
:src="img" :src="img"
mode="aspectFill" mode="aspectFill"
style="width: 60px; height: 60px; border-radius: 4px; border: 1px solid #eee; cursor: pointer;" style="
@click="uni.previewImage({ current: img, urls: data.images })" width: 60px;
height: 60px;
border-radius: 4px;
border: 1px solid #eee;
cursor: pointer;
"
@click="handlePreviewImage(img, data.images)"
/> />
</view> </view>
</view> </view>
@ -215,16 +250,31 @@
v-if="data.videos && data.videos.length > 0" v-if="data.videos && data.videos.length > 0"
> >
<text class="item-label">巡查视频</text> <text class="item-label">巡查视频</text>
<view class="item-value" style="display: flex; flex-wrap: wrap; gap: 8px;"> <view
class="item-value"
style="display: flex; flex-wrap: wrap; gap: 8px"
>
<view <view
v-for="(video, vIdx) in data.videos" v-for="(video, vIdx) in data.videos"
:key="vIdx" :key="vIdx"
style="width: 80px; height: 60px; position: relative; border-radius: 4px; overflow: hidden; border: 1px solid #eee; cursor: pointer; display: flex; align-items: center; justify-content: center; background: #000;" style="
@click="uni.previewMedia ? uni.previewMedia({ sources: data.videos.map(v => ({ url: v, type: 'video' })), current: vIdx }) : uni.showToast({ title: '当前平台不支持视频预览', icon: 'none' })" width: 80px;
height: 60px;
position: relative;
border-radius: 4px;
overflow: hidden;
border: 1px solid #eee;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
background: #000;
"
@click="handlePreviewVideo(data.videos, vIdx)"
> >
<video <video
:src="video" :src="video"
style="width: 100%; height: 100%; object-fit: cover;" style="width: 100%; height: 100%; object-fit: cover"
:controls="false" :controls="false"
:show-center-play-btn="false" :show-center-play-btn="false"
:show-play-btn="false" :show-play-btn="false"
@ -237,8 +287,23 @@
:muted="true" :muted="true"
:poster="''" :poster="''"
></video> ></video>
<view style="position: absolute;left: 0;top: 0;width: 100%;height: 100%;display: flex;align-items: center;justify-content: center;"> <view
<u-icon name="play-right-fill" color="#fff" size="28"></u-icon> style="
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
"
>
<u-icon
name="play-right-fill"
color="#fff"
size="28"
></u-icon>
</view> </view>
</view> </view>
</view> </view>
@ -338,14 +403,14 @@ const xcBeforeMinute = ref<number>(0);
let inspectionParams = ref({ let inspectionParams = ref({
rows: 10, rows: 10,
xkkcId: xkkc.value.id, xkkcId: xkkc.value.id,
jsId: js.value.id jsId: js.value.id,
}); });
// //
const [registerInspection, { reload }] = useLayout({ const [registerInspection, { reload }] = useLayout({
api: xkXcFindPageApi, api: xkXcFindPageApi,
componentProps: {}, componentProps: {},
param: inspectionParams.value param: inspectionParams.value,
}); });
// //
@ -356,8 +421,8 @@ const loadCheckItems = async () => {
checkItems.value = res.result.map((item: any) => { checkItems.value = res.result.map((item: any) => {
return { return {
...item, ...item,
checked: false checked: false,
} };
}); });
} else { } else {
// API使 // API使
@ -450,6 +515,10 @@ const confirmStatus = (e: any) => {
statusPickerVisible.value = false; statusPickerVisible.value = false;
}; };
const onCheckItemChange = (e: any, item: any) => {
item.checked = e.detail.value === "A";
};
// //
const handleImageUploadSuccess = (res: any) => { const handleImageUploadSuccess = (res: any) => {
console.log("图片上传成功:", res); console.log("图片上传成功:", res);
@ -460,6 +529,28 @@ const handleVideoUploadSuccess = (res: any) => {
console.log("视频上传成功:", res); console.log("视频上传成功:", res);
}; };
//
const handlePreviewImage = (img: string, images: string[]) => {
// uni-appAPI
uni.previewImage({
current: img,
urls: images,
});
};
//
const handlePreviewVideo = (videos: string[], index: number) => {
// uni-appAPI
// uni.previewMedia H5//APP
uni.previewMedia({
current: index,
sources: videos.map((url) => ({
url,
type: "video",
})),
});
};
// tab // tab
const onTabClick = (e: any) => { const onTabClick = (e: any) => {
currentTab.value = e.currentIndex; currentTab.value = e.currentIndex;
@ -801,7 +892,7 @@ onMounted(async () => {
.item-score-result { .item-score-result {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between;; justify-content: space-between;
} }
&:first-child { &:first-child {