Commit afdaa675 by wangzhihui

Merge branches 'release/venus-usedcar-h5/1.0.0' and 'release/venus-usedcar-h5/1.…

…0.0' of http://192.168.3.233:8090/monorepo/venus into release/venus-usedcar-h5/1.0.0
2 parents 6e668bed 3dce3c3d
Pipeline #163 for afdaa675 failed in 0 seconds
...@@ -57,6 +57,26 @@ body { ...@@ -57,6 +57,26 @@ body {
pointer-events: auto; pointer-events: auto;
} }
// Vant ImagePreview 桌面端:预览项只监听 touch,全屏 popup 又叠在 overlay 之上,导致鼠标点「遮罩」关不掉;
// 关闭按钮 z-index 偏低时还会被 swipe 层盖住。允许点击穿透 popup,仅图片/关闭/页码接收事件,让底层 overlay 处理关闭。
@media (hover: hover) and (pointer: fine) {
#vant-portal-host .van-popup.van-image-preview {
pointer-events: none;
}
#vant-portal-host .van-popup.van-image-preview .van-image-preview__close-icon,
#vant-portal-host .van-popup.van-image-preview .van-image-preview__image,
#vant-portal-host .van-popup.van-image-preview .van-image-preview__image-wrap,
#vant-portal-host .van-popup.van-image-preview .van-image-preview__index,
#vant-portal-host .van-popup.van-image-preview .van-image-preview__cover {
pointer-events: auto;
}
#vant-portal-host .van-popup.van-image-preview .van-image-preview__close-icon {
z-index: 10;
}
}
a { a {
color: inherit; color: inherit;
text-decoration: none; text-decoration: none;
......
...@@ -36,13 +36,10 @@ type InspectionColumnRow = InspectionNode & { ...@@ -36,13 +36,10 @@ type InspectionColumnRow = InspectionNode & {
/** 叶子列(含展示用 value 等扩展字段) */ /** 叶子列(含展示用 value 等扩展字段) */
const columnsList = ref<InspectionColumnRow[]>([]); const columnsList = ref<InspectionColumnRow[]>([]);
const resultStatus = ref(false);
const form = ref({}); const form = ref({});
const rules = ref({}); const rules = ref({});
//是否支持"无此结构":0-否,1-是
const allowNoStructure = ref(false);
// 加载中 // 加载中
const pageLoading = ref(false); const pageLoading = ref(false);
...@@ -50,12 +47,9 @@ watch(() => props.leafNodes, (nodes) => { ...@@ -50,12 +47,9 @@ watch(() => props.leafNodes, (nodes) => {
pageLoading.value = true; pageLoading.value = true;
columnsList.value = (nodes || []).map((item) => ({ columnsList.value = (nodes || []).map((item) => ({
...item, ...item,
resultStatus: item?.inspectionResultVO?.resultStatus == 3 ? true : false,
value: getValueText(item), value: getValueText(item),
})) as InspectionColumnRow[]; })) as InspectionColumnRow[];
if (columnsList.value && columnsList.value.length) {
allowNoStructure.value = columnsList?.value?.[0]?.allowNoStructure == 1;
}
resultStatus.value = false
setTimeout(() => { setTimeout(() => {
pageLoading.value = false; pageLoading.value = false;
}, 1200); }, 1200);
...@@ -171,7 +165,7 @@ function setSubmitData() { ...@@ -171,7 +165,7 @@ function setSubmitData() {
if (item.itemType == 2 && dataList.length) { if (item.itemType == 2 && dataList.length) {
allowNoStatus = 2; allowNoStatus = 2;
} }
if (resultStatus.value) { if (item.allowNoStructure == 1 && item.resultStatus) {
allowNoStatus = 3; allowNoStatus = 3;
} }
// 每项都入列,便于大项/二级切换时静默保存仍能带上当前 Tab 全部叶子(未填则为空 data,仍会走保存接口) // 每项都入列,便于大项/二级切换时静默保存仍能带上当前 Tab 全部叶子(未填则为空 data,仍会走保存接口)
...@@ -260,6 +254,14 @@ async function getCarTypeListData() { ...@@ -260,6 +254,14 @@ async function getCarTypeListData() {
} }
} }
function getLeft(nodeName: string) {
let leftPx = 86;
if (nodeName.length > 4) {
leftPx = leftPx + ((nodeName.length - 4) * 12);
}
return leftPx;
}
defineExpose({ defineExpose({
validate, validate,
saveData, saveData,
...@@ -277,25 +279,28 @@ defineExpose({ ...@@ -277,25 +279,28 @@ defineExpose({
<div v-if="!pageLoading"> <div v-if="!pageLoading">
<van-form ref="customizeFormRef" :model="form" :rules="rules"> <van-form ref="customizeFormRef" :model="form" :rules="rules">
<div v-if="allowNoStructure" class="formTitle">
<div @click="resultStatus = !resultStatus">
<van-icon v-if="!resultStatus" color="#666666" name="circle" size="14" />
<van-icon v-if="resultStatus" color="#185EFE" name="checked" size="14" />
<span class="radioText">无此结构</span>
</div>
</div>
<div v-for="(item, index) in columnsList" :key="index" class="customizeList" :class="{ <div v-for="(item, index) in columnsList" :key="index" class="customizeList" :class="{
'border-bottom': index < columnsList.length - 1 && item.interactionType != 'image_upload', 'border-bottom': (index < columnsList.length - 1 && item.interactionType != 'image_upload') || item.interactionType == 'textarea_input',
'customizeList50': setImgWidth(item) 'customizeList50': setImgWidth(item)
}"> }">
<!-- 是否支持"无此结构":0-否,1-是 -->
<div v-if="item.allowNoStructure" class="formTitle"
:style="{ left: getLeft(item.nodeName) + 'px' }">
<div @click="item.resultStatus = !item.resultStatus">
<van-icon v-if="!item.resultStatus" color="#666666" name="circle" size="14" />
<van-icon v-if="item.resultStatus" color="#185EFE" name="checked" size="14" />
<span class="radioText">无此结构</span>
</div>
</div>
<!-- 文本输入框 --> <!-- 文本输入框 -->
<div v-if="item.interactionType == 'text_input'"> <div v-if="item.interactionType == 'text_input'">
<van-field v-model="item.value" clearable :label="item.nodeName" <van-field type="textarea" rows="1" v-model="item.value" clearable :label="item.nodeName"
:maxlength="getValidationRules(item).maxLength || 120" :placeholder="item.placeholder" :maxlength="getValidationRules(item).maxLength || 120" :placeholder="item.placeholder"
:required="item.required === 1" :disabled="item.editPermission == '0'" input-align="right" :required="item.required === 1" :disabled="item.editPermission == '0'" input-align="right"
label-width="120px" /> label-width="120px" autosize />
</div> </div>
<!-- 长文本输入框 --> <!-- 长文本输入框 -->
...@@ -314,7 +319,7 @@ defineExpose({ ...@@ -314,7 +319,7 @@ defineExpose({
:min="getValidationRules(item).min || 0" :placeholder="item.placeholder" :min="getValidationRules(item).min || 0" :placeholder="item.placeholder"
:required="item.required === 1" step="0.01" type="number" :required="item.required === 1" step="0.01" type="number"
@input="(e) => { item.value = parseFloat(item.value)?.toFixed(getValidationRules(item).decimalDigits || 2) || '' }" @input="(e) => { item.value = parseFloat(item.value)?.toFixed(getValidationRules(item).decimalDigits || 2) || '' }"
input-align="right" label-width="120px"> input-align="right" label-width="120px" autosize>
<template v-if="item.suffix" #right-icon> <template v-if="item.suffix" #right-icon>
<span>{{ item.suffix }}</span> <span>{{ item.suffix }}</span>
</template> </template>
...@@ -362,11 +367,11 @@ defineExpose({ ...@@ -362,11 +367,11 @@ defineExpose({
<style lang="scss" scoped> <style lang="scss" scoped>
.formTitle { .formTitle {
float: left;
display: flex; display: flex;
width: 100%;
padding: 0 12px;
background: #fff; background: #fff;
position: absolute;
top: 18px;
left: 86px;
} }
.radioText { .radioText {
...@@ -378,6 +383,7 @@ defineExpose({ ...@@ -378,6 +383,7 @@ defineExpose({
.customizeList { .customizeList {
float: left; float: left;
width: 100%; width: 100%;
position: relative;
} }
.customizeList50 { .customizeList50 {
......
...@@ -47,9 +47,10 @@ async function onFileChange(ev: Event) { ...@@ -47,9 +47,10 @@ async function onFileChange(ev: Event) {
const file = input.files?.[0]; const file = input.files?.[0];
input.value = ""; input.value = "";
if (!file) return; if (!file) return;
const fileSize = file.size / 1024 / 1024; const maxSize10MB = 10 * 1024 * 1024;
if (fileSize && fileSize > 5) { if (file.size > maxSize10MB) {
return showToast(`文件大小不能超过5MB`); showToast("文件大小不能超过10MB");
return;
} }
uploading.value = true; uploading.value = true;
try { try {
...@@ -193,7 +194,6 @@ function previewImage(url: string) { ...@@ -193,7 +194,6 @@ function previewImage(url: string) {
margin-right: 12px; margin-right: 12px;
margin-bottom: 16px; margin-bottom: 16px;
background: #f9f9f9; background: #f9f9f9;
border: 1px solid #ddd;
border-radius: 8px; border-radius: 8px;
} }
......
...@@ -48,16 +48,16 @@ async function onFileChange(ev: Event) { ...@@ -48,16 +48,16 @@ async function onFileChange(ev: Event) {
const file = input.files?.[0]; const file = input.files?.[0];
input.value = ""; input.value = "";
if (!file) return; if (!file) return;
const fileSize = file.size / 1024 / 1024; const maxSize10MB = 10 * 1024 * 1024;
// 检查文件大小是否超过限制 10MB const maxSize100MB = 100 * 1024 * 1024;
if (props.item.interactionType == 'image_upload' && fileSize && fileSize > 5) { if (props.item.interactionType == 'image_upload' && file.size > maxSize10MB) {
return showToast(`文件大小不能超过5MB`);; showToast("文件大小不能超过10MB");
return;
} }
// 检查文件大小是否超过限制 10MB if (props.item.interactionType == 'video_upload' && file.size > maxSize100MB) {
if (props.item.interactionType == 'video_upload' && fileSize && fileSize > 100) { showToast("文件大小不能超过100MB");
return showToast(`文件大小不能超过100MB`); return;
} }
uploading.value = true; uploading.value = true;
try { try {
const res = await uploadFile(file); const res = await uploadFile(file);
...@@ -95,20 +95,39 @@ function previewImage(url: string) { ...@@ -95,20 +95,39 @@ function previewImage(url: string) {
imagePreview.value = true; imagePreview.value = true;
} }
// 视频预览
const videoShow = ref(false);
const sourceUrl = ref([]);
function previewVideo(url: string) {
sourceUrl.value = [url];
console.log("sourceUrl.value", sourceUrl.value);
videoShow.value = true;
}
</script> </script>
<template> <template>
<div> <div>
<van-overlay :show="uploading" <van-overlay :show="uploading" teleport="#vant-portal-host" z-index="2000">
teleport="#vant-portal-host"
z-index="2000">
<div class="loadingBox"> <div class="loadingBox">
<van-loading color="#1989fa" size="24px" vertical>上传中...</van-loading> <van-loading color="#1989fa" size="24px" vertical>上传中...</van-loading>
</div> </div>
</van-overlay> </van-overlay>
<!-- 图片预览 -->
<van-image-preview v-model:show="imagePreview" :images="previewImagesList"></van-image-preview> <van-image-preview v-model:show="imagePreview" :images="previewImagesList"></van-image-preview>
<!-- 视频预览 -->
<van-image-preview v-model:show="videoShow" :images="sourceUrl" :close-on-click-image="false">
<template #image="{ src }">
<video style="width: 100%;" controls>
<source :src="src" />
</video>
</template>
</van-image-preview>
<div class="buttonSelect"> <div class="buttonSelect">
<div class="title"> <div class="title">
<div class="titleContent"> <div class="titleContent">
...@@ -130,19 +149,24 @@ function previewImage(url: string) { ...@@ -130,19 +149,24 @@ function previewImage(url: string) {
</div> </div>
</div> </div>
<div v-for="(url, index) in pickerValue" :key="index" class="uploadBox"> <div v-for="(url, index) in pickerValue" :key="index" class="uploadBox">
<!-- 删除按钮 -->
<div class="deleteBox" @click="handleDelete(url)"> <div class="deleteBox" @click="handleDelete(url)">
<van-icon color="#999999" name="clear" size="20" /> <van-icon color="#999999" name="clear" size="20" />
</div> </div>
<!-- 图片 --> <!-- 图片 -->
<van-image v-if="item.interactionType == 'image_upload'" :src="url" class="uploadBoxImg" width="96" height="96" radius="8px" @click="previewImage(url)" /> <van-image v-if="item.interactionType == 'image_upload'" :src="url" class="uploadBoxImg" width="96"
height="96" radius="8px" @click="previewImage(url)" />
<!-- 视频 --> <!-- 视频 -->
<video v-if="item.interactionType == 'video_upload'" :src="url" class="uploadBoxImg" controls> <video v-if="item.interactionType == 'video_upload'" :src="url" class="uploadBoxImg" controls>
您的浏览器不支持 video 标签。 您的浏览器不支持 video 标签。
</video> </video>
<!-- 点击视频预览 -->
<div v-if="item.interactionType == 'video_upload'" class="videoPreviewBox"
@click="previewVideo(url)"></div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -207,7 +231,6 @@ function previewImage(url: string) { ...@@ -207,7 +231,6 @@ function previewImage(url: string) {
margin-right: 12px; margin-right: 12px;
margin-bottom: 16px; margin-bottom: 16px;
background: #f9f9f9; background: #f9f9f9;
border: 1px solid #ddd;
border-radius: 8px; border-radius: 8px;
} }
...@@ -240,7 +263,7 @@ function previewImage(url: string) { ...@@ -240,7 +263,7 @@ function previewImage(url: string) {
position: absolute; position: absolute;
top: 2px; top: 2px;
right: 2px; right: 2px;
z-index: 99; z-index: 999;
width: 20px; width: 20px;
height: 20px; height: 20px;
cursor: pointer; cursor: pointer;
...@@ -255,4 +278,14 @@ function previewImage(url: string) { ...@@ -255,4 +278,14 @@ function previewImage(url: string) {
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
.videoPreviewBox {
position: absolute;
top: 0px;
left: 0;
width: 96px;
height: 96px;
background: rgba(0, 0, 0, 0.5);
opacity: 0.1;
z-index: 9;
}
</style> </style>
...@@ -15,6 +15,7 @@ type AuditStatus = 1 | 2 | 3 | 4; ...@@ -15,6 +15,7 @@ type AuditStatus = 1 | 2 | 3 | 4;
const props = defineProps<{ const props = defineProps<{
auditStatus?: AuditStatus; auditStatus?: AuditStatus;
onlyAudit?: boolean;
status: WorkOrderStatus; status: WorkOrderStatus;
}>(); }>();
...@@ -56,7 +57,8 @@ const auditTag = computed(() => { ...@@ -56,7 +57,8 @@ const auditTag = computed(() => {
<template> <template>
<div class="wo-tags"> <div class="wo-tags">
<van-tag class="wo-tag" <van-tag v-if="!props.onlyAudit"
class="wo-tag"
:style="{ background: checkTag.bg, color: checkTag.color }"> :style="{ background: checkTag.bg, color: checkTag.color }">
{{ checkTag.text }} {{ checkTag.text }}
</van-tag> </van-tag>
......
...@@ -405,6 +405,7 @@ onUnmounted(() => { ...@@ -405,6 +405,7 @@ onUnmounted(() => {
</div> </div>
<van-image-preview v-model:show="previewVisible" <van-image-preview v-model:show="previewVisible"
closeable
:images="previewImages" :images="previewImages"
:start-position="previewIndex" :start-position="previewIndex"
teleport="#vant-portal-host" /> teleport="#vant-portal-host" />
......
...@@ -288,7 +288,12 @@ const videoSwipeAutoplayMs = computed(() => ...@@ -288,7 +288,12 @@ const videoSwipeAutoplayMs = computed(() =>
inspectVideos.value.length > 1 ? 4000 : 0, inspectVideos.value.length > 1 ? 4000 : 0,
); );
const videoPosterUrl = computed(() => reportData.value.coverUrl); /** 阿里云 OSS 视频截帧作为封面 */
function videoOssSnapshotPosterUrl(url: string) {
if (!url) return "";
const sep = url.includes("?") ? "&" : "?";
return `${url}${sep}x-oss-process=video/snapshot,t_1000,f_jpg,w_375,h_200,m_fast`;
}
const videoPlayerShow = ref(false); const videoPlayerShow = ref(false);
const videoPlayerSrc = ref(""); const videoPlayerSrc = ref("");
...@@ -617,7 +622,7 @@ onMounted(() => { ...@@ -617,7 +622,7 @@ onMounted(() => {
<van-image fit="cover" <van-image fit="cover"
height="200" height="200"
radius="8" radius="8"
:src="videoPosterUrl" :src="videoOssSnapshotPosterUrl(v.url)"
width="100%"> width="100%">
<template #error> <template #error>
<div class="video-cover__placeholder"> <div class="video-cover__placeholder">
......
...@@ -14,6 +14,7 @@ import { useRoute, useRouter } from "vue-router"; ...@@ -14,6 +14,7 @@ import { useRoute, useRouter } from "vue-router";
import { getWorkOrderDetail } from "@/api/modules/work-order"; import { getWorkOrderDetail } from "@/api/modules/work-order";
import PageTitle from "@/components/PageTitle.vue"; import PageTitle from "@/components/PageTitle.vue";
import WorkOrderStatusTags from "@/components/WorkOrderStatusTags.vue";
const title = ref("工单详情"); const title = ref("工单详情");
const route = useRoute(); const route = useRoute();
...@@ -24,6 +25,10 @@ const nodes = ref<NodeVO[]>([]); ...@@ -24,6 +25,10 @@ const nodes = ref<NodeVO[]>([]);
const orderNo = computed(() => detail.value?.woId ?? ""); const orderNo = computed(() => detail.value?.woId ?? "");
const status = computed<WorkOrderStatus>(() => (detail.value?.status ?? 1) as WorkOrderStatus); const status = computed<WorkOrderStatus>(() => (detail.value?.status ?? 1) as WorkOrderStatus);
const auditStatus = computed<1 | 2 | 3 | 4 | undefined>(() => {
const v = (detail.value as null | Record<string, unknown>)?.auditStatus;
return typeof v === "number" ? (v as 1 | 2 | 3 | 4) : undefined;
});
const vehicle = computed<WorkOrderVehicle>(() => (detail.value?.vehicle ?? {}) as WorkOrderVehicle); const vehicle = computed<WorkOrderVehicle>(() => (detail.value?.vehicle ?? {}) as WorkOrderVehicle);
...@@ -116,9 +121,12 @@ onMounted(() => { ...@@ -116,9 +121,12 @@ onMounted(() => {
<van-tag class="head-tag" :style="{ background: pageStatusTag.bg, color: pageStatusTag.color }"> <van-tag class="head-tag" :style="{ background: pageStatusTag.bg, color: pageStatusTag.color }">
{{ pageStatusTag.text }} {{ pageStatusTag.text }}
</van-tag> </van-tag>
工单号 <span class="head-order">{{ orderNo }}</span>
</div> </div>
<div class="head-right"> <div class="head-right">
工单号 <span class="head-order">{{ orderNo }}</span> <WorkOrderStatusTags :audit-status="auditStatus"
only-audit
:status="status" />
</div> </div>
</div> </div>
...@@ -294,7 +302,9 @@ onMounted(() => { ...@@ -294,7 +302,9 @@ onMounted(() => {
.page-head { .page-head {
display: flex; display: flex;
justify-content: space-between;
align-items: center; align-items: center;
gap: 8px;
margin-left: 12px; margin-left: 12px;
background: #f0f2f5; background: #f0f2f5;
} }
...@@ -317,8 +327,13 @@ onMounted(() => { ...@@ -317,8 +327,13 @@ onMounted(() => {
} }
.head-right { .head-right {
display: flex;
gap: 6px;
align-items: center;
flex-wrap: wrap;
font-size: 12px; font-size: 12px;
color: #999; color: #999;
margin-right:12px;
} }
.head-order { .head-order {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!