格式化一下xkXc

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

View File

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