Commit 2eb0c33d by 张立顺

Merge branch 'release/venus-usedcar-h5/1.0.0' of 192.168.3.233:monorepo/venus in…

…to release/venus-usedcar-h5/1.0.0
2 parents d5df7abd fba1d26a
Pipeline #150 for 2eb0c33d failed in 0 seconds
......@@ -16,7 +16,6 @@ import selectDropdown from "@/components/CustomizeForm/selectDropdown.vue";
// 获取父组件传递数据
const props = withDefaults(
defineProps<{
bigModuleLabel?: string;
leafNodes?: InspectionNode[];
subTabLabel?: string;
......@@ -56,6 +55,7 @@ watch(() => props.leafNodes, (nodes) => {
if (columnsList.value && columnsList.value.length) {
allowNoStructure.value = columnsList?.value?.[0]?.allowNoStructure == 1;
}
resultStatus.value = false
setTimeout(() => {
pageLoading.value = false;
}, 1200);
......
......@@ -2,7 +2,6 @@
import { onMounted, computed, ref } from "vue";
import { uploadFile } from "@/utils/upload.js";
import { showToast } from "vant";
import { showImagePreview } from 'vant';
const props = defineProps({
item: {
......@@ -81,10 +80,14 @@ function updateData() {
}
// 图片预览
const imagePreview = ref(false);
const previewImagesList = ref([]);
function previewImage(url: string) {
showImagePreview([url]);
previewImagesList.value = [url];
imagePreview.value = true;
}
</script>
<template>
......@@ -97,6 +100,8 @@ function previewImage(url: string) {
</div>
</van-overlay>
<van-image-preview v-model:show="imagePreview" :images="previewImagesList"></van-image-preview>
<div class="buttonSelect">
<div class="title">
<div class="titleContent">
......
......@@ -2,7 +2,6 @@
import { onMounted, computed, ref } from "vue";
import { uploadFile } from "@/utils/upload.js";
import { showToast } from "vant";
import { showImagePreview } from 'vant';
const props = defineProps({
item: {
......@@ -89,8 +88,11 @@ function updateData() {
}
// 图片预览
const imagePreview = ref(false);
const previewImagesList = ref([]);
function previewImage(url: string) {
showImagePreview([url]);
previewImagesList.value = [url];
imagePreview.value = true;
}
</script>
......@@ -104,6 +106,9 @@ function previewImage(url: string) {
<van-loading color="#1989fa" size="24px" vertical>上传中...</van-loading>
</div>
</van-overlay>
<van-image-preview v-model:show="imagePreview" :images="previewImagesList"></van-image-preview>
<div class="buttonSelect">
<div class="title">
<div class="titleContent">
......@@ -129,7 +134,7 @@ function previewImage(url: string) {
<van-icon color="#999999" name="clear" size="20" />
</div>
<!-- 图片 -->
<van-image v-if="item.interactionType == 'image_upload'" :src="url" @click="previewImage(url)" class="uploadBoxImg" width="96" height="96" radius="8px" />
<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 标签。
......
......@@ -10,14 +10,19 @@
<script setup lang="ts">
import PageTitle from "@/components/PageTitle.vue";
defineProps<{
title: string;
}>();
withDefaults(
defineProps<{
title: string;
/** 宿主小程序带 openType=miniApp 跳转时隐藏标题栏 */
hideTitle?: boolean;
}>(),
{ hideTitle: false },
);
</script>
<template>
<div class="page-top">
<PageTitle :title="title" />
<PageTitle v-if="!hideTitle" :title="title" />
<slot />
</div>
</template>
......
<!--
* @Author: cen
* @Date: 2026-03-26 10:52:58
* @Description:
* @FilePath: /venus-usedcar-h5/apps/web/venus-usedcar-quality/src/components/WorkOrderStatusTags.vue
* @LastEditTime: 2026-03-27 16:04:23
* @LastEditors: cenchengwei@foreverht.com
* 可以输入预定的版权声明、个性签名、空行等
-->
<script setup lang="ts">
import { computed } from "vue";
......@@ -79,7 +88,7 @@ const auditTag = computed(() => {
}
.wo-tag__icon {
margin-right: 4px;
font-size: 12px;
vertical-align: -1px;
}
......
......@@ -2,8 +2,12 @@ export interface ReportItem {
address: string;
carTitle: string;
coverImage: string;
/** 列表接口返回的报告 H5 链接 */
h5Url?: string;
id: number;
plateNo: string;
/** 检测记录 id,无 h5Url 时用于站内 InspectReport */
recordId?: number;
reportNo: string;
updateTime: string;
vin: string;
......
......@@ -541,10 +541,10 @@ defineExpose({ validate, getCompleteInspectionPayload });
.rating-btn-check {
position: absolute;
top: -3px;
top: -4px;
right: 0;
width: 14px;
height: 14px;
width: 20px;
height: 20px;
pointer-events: none;
object-fit: contain;
}
......
......@@ -19,10 +19,12 @@ import { showToast } from "vant";
import ScoreForm from "../components/ScoreForm.vue";
import {
hasCompleteInspectionUncompletedHint,
SCORE_BIG_KEY
SCORE_BIG_KEY,
} from "./useInspectModules";
/** 底部操作区:仅当前点击的按钮显示 loading */
type FooterLoadingKey = "idle" | "prev" | "next" | "score";
function buildInspectionSavePayload(
modules: InspectModulesReturn,
leafNodes: LeafNodeRecord[],
......@@ -61,7 +63,11 @@ export function useInspectSubmit(
inspectionScoreFormRef: Ref<InstanceType<typeof ScoreForm> | null>
) {
const router = useRouter();
const submitting = ref(false);
const footerLoading = ref<FooterLoadingKey>("idle");
function isFooterBusy() {
return footerLoading.value !== "idle";
}
async function saveCurrentLeafInspectionRecord(nextFlag: boolean): Promise<boolean> {
const saved = (await customizeFormRef.value?.saveData?.()) as CustomizeFormValidateResult | undefined;
......@@ -103,9 +109,9 @@ export function useInspectSubmit(
}
async function onNext() {
if (submitting.value) return;
if (isFooterBusy()) return;
try {
submitting.value = true;
footerLoading.value = "next";
const res = (await customizeFormRef.value?.validate?.()) as CustomizeFormValidateResult | undefined;
if (!res?.success) {
showToast(res?.message ?? "校验失败");
......@@ -125,12 +131,12 @@ export function useInspectSubmit(
showToast("保存失败,请重试");
}
} finally {
submitting.value = false;
footerLoading.value = "idle";
}
}
async function onBack() {
if (submitting.value) return;
if (isFooterBusy()) return;
if (modules.activeBigKey.value !== SCORE_BIG_KEY) {
try {
const persisted = await saveCurrentLeafInspectionRecord(false);
......@@ -148,9 +154,9 @@ export function useInspectSubmit(
}
async function onPrev() {
if (submitting.value) return;
if (isFooterBusy()) return;
try {
submitting.value = true;
footerLoading.value = "prev";
if (modules.activeBigKey.value === SCORE_BIG_KEY) {
const mains = modules.mainInspectionBigModules.value;
......@@ -194,15 +200,15 @@ export function useInspectSubmit(
showToast("保存失败,请重试");
}
} finally {
submitting.value = false;
footerLoading.value = "idle";
}
}
async function onSubmitScore() {
if (!inspectionScoreFormRef.value?.validate()) return;
if (submitting.value) return;
if (isFooterBusy()) return;
try {
submitting.value = true;
footerLoading.value = "score";
const result = await completeInspection(
inspectionScoreFormRef.value.getCompleteInspectionPayload(modules.taskId.value)
);
......@@ -230,12 +236,12 @@ export function useInspectSubmit(
showToast("提交失败,请重试");
}
} finally {
submitting.value = false;
footerLoading.value = "idle";
}
}
return {
submitting,
footerLoading,
onSelectBigModule,
onSelectSubTab,
onNext,
......
......@@ -100,7 +100,7 @@
<van-button block
class="btn-next"
color="#477ffe"
:loading="submitting"
:loading="footerLoading === 'score'"
round
type="primary"
@click="onSubmitScore">
......@@ -111,7 +111,7 @@
<template v-else>
<van-button v-if="showInspectionPrevButton"
class="btn-save"
:loading="submitting"
:loading="footerLoading === 'prev'"
plain
round
type="primary"
......@@ -121,7 +121,7 @@
<van-button block
class="btn-next"
color="#477ffe"
:loading="submitting"
:loading="footerLoading === 'next'"
round
type="primary"
@click="onNext">
......@@ -189,7 +189,7 @@ const inspectionScoreFormRef = ref<InstanceType<typeof ScoreForm> | null>(null);
const modules = useInspectModules(route);
const templateDefaultData = modules.templateDefaultData;
const {
submitting,
footerLoading,
onSelectBigModule,
onSelectSubTab,
onNext,
......@@ -388,7 +388,6 @@ onMounted(() => {
overflow-x: auto;
background: #fff linear-gradient(180deg, #e8efff 0%, #fff 100%);
border-radius: 12px 12px 0 0;
box-shadow: 0 1px 0 rgb(0 0 0 / 6%);
&::-webkit-scrollbar {
display: none;
......
......@@ -4,7 +4,6 @@ import type { ReportItem } from "@/types/views/car-list";
import { computed, onActivated, ref, watch } from "vue";
import { useRouter } from "vue-router";
import { getWorkOrderH5Url } from "@/api/modules/work-order";
import { getInspectReportPage } from "@/api/modules/inspect-report";
import PageTop from "@/components/PageTop.vue";
......@@ -31,6 +30,8 @@ function resetList() {
currentPage.value = 1;
finished.value = false;
displayList.value = [];
// 避免与 van-list 并发时 loading 仍为 true,导致 fillMore 直接 return
loading.value = false;
}
function mapReportItem(item: Record<string, unknown>): ReportItem {
......@@ -45,9 +46,20 @@ function mapReportItem(item: Record<string, unknown>): ReportItem {
(venue.address as string | undefined) ??
`${(ownership.carProvinceName as string | undefined) ?? ""}${(ownership.carCityName as string | undefined) ?? ""}`;
const inspectionRecord = (item.inspectionRecord as Record<string, unknown> | undefined) ?? {};
const recordIdRaw = inspectionRecord.id;
const recordId =
typeof recordIdRaw === "number"
? recordIdRaw
: (typeof recordIdRaw === "string" && recordIdRaw !== ""
? Number(recordIdRaw)
: undefined);
return {
id: Number(item.id ?? 0),
reportNo: String(item.reportNo ?? ""),
h5Url: typeof item.h5Url === "string" ? item.h5Url : undefined,
recordId: Number.isFinite(recordId) ? recordId : undefined,
carTitle: [
(baseInfo.carBrand as string | undefined) ?? "",
(baseInfo.carSeriesName as string | undefined) ?? "",
......@@ -90,7 +102,7 @@ function onLoad() {
}
async function onRefresh() {
if (refreshing.value) return;
// 勿在开头判断 refreshing:PullRefresh 触发 @refresh 时 v-model 已为 true,会误 return 且无法执行 finally,下拉一直转圈
refreshing.value = true;
try {
resetList();
......@@ -100,17 +112,16 @@ async function onRefresh() {
}
}
async function openReportByWorkOrderId(id: string) {
const h5Url = (await getWorkOrderH5Url(id)).trim();
if (h5Url) {
window.location.href = h5Url;
/** 检测报告列表:查看报告优先使用行内 h5Url,否则进站内报告页 */
function onViewReport(item: ReportItem) {
const url = item.h5Url?.trim();
if (url) {
window.location.href = url;
return;
}
void router.push({ name: "InspectReport", query: { recordId: id } });
}
function onViewReport(item: ReportItem) {
void openReportByWorkOrderId(String(item.id));
if (item.recordId != null) {
void router.push({ name: "InspectReport", query: { recordId: String(item.recordId) } });
}
}
watch([keyword], () => {
......@@ -144,7 +155,7 @@ void onRefresh();
<van-list v-else
v-model:loading="loading"
:finished="finished"
finished-text="到底了"
finished-text="到底了~"
:scroller="scroller"
@load="onLoad">
<div v-for="item in displayList"
......
......@@ -3,11 +3,12 @@ import type { CardAction, WorkOrderItem } from "@/types/views/home";
import type { AuditStatus, WorkOrderStatus } from "@/types/views/work-order-common";
import { computed, ref, watch } from "vue";
import { useRouter } from "vue-router";
import { useRoute, useRouter } from "vue-router";
import { getWorkOrderCountByStatus, getWorkOrderH5Url, getWorkOrderPage } from "@/api/modules/work-order";
import PageTop from "@/components/PageTop.vue";
import WorkOrderStatusTags from "@/components/WorkOrderStatusTags.vue";
import searchIcon from "@assets/image/searchIcon.png";
const keyword = ref("");
const activeStatus = ref<WorkOrderStatus>(1);
......@@ -18,7 +19,14 @@ const pageSize = 20;
const displayList = ref<WorkOrderItem[]>([]);
const currentPage = ref(1);
const scroller = ref<Element | undefined>(undefined);
const route = useRoute();
const router = useRouter();
/** 宿主小程序跳转带 openType=miniApp 时隐藏顶部标题 */
const hidePageTitle = computed(() => {
const v = route.query.openType;
return (Array.isArray(v) ? v[0] : v) === "miniApp";
});
const rejectReasonDialogVisible = ref(false);
const rejectReasonContent = ref("");
const tabCounts = ref({
......@@ -29,9 +37,9 @@ const tabCounts = ref({
});
const statusTabs = computed(() => [
{ status: 1 as const, label: "待检测 ·", count: tabCounts.value.dispatchedCount },
{ status: 2 as const, label: "检测中 ·", count: tabCounts.value.inProgressCount },
{ status: 3 as const, label: "检测完成 ·", count: tabCounts.value.completedCount },
{ status: 1 as const, label: "待检测", count: tabCounts.value.dispatchedCount },
{ status: 2 as const, label: "检测中", count: tabCounts.value.inProgressCount },
{ status: 3 as const, label: "检测完成", count: tabCounts.value.completedCount },
]);
/** 首屏/刷新结束后仍无数据 */
......@@ -268,21 +276,22 @@ void onRefresh();
<template>
<div class="work-order-page">
<PageTop title="检测工单">
<PageTop title="检测工单" :hide-title="hidePageTitle">
<!-- 顶部状态 Tab -->
<div class="status-tabs">
<div v-for="t in statusTabs"
:key="t.status"
class="status-tab flex-1 text-center"
class="status-tab flex-1"
:class="{ active: activeStatus === t.status }"
@click="onStatusChange(t.status)">
<span class="label">{{ t.label }}</span>
<span class="count">{{ t.count }}</span>
<span class="count">·{{ t.count }}</span>
</div>
</div>
<!-- 搜索框(同顶部背景容器) -->
<div class="search-wrap">
<van-search v-model="keyword"
:left-icon="searchIcon"
placeholder="搜索车牌号、VIN码、车型名称"
shape="round" />
</div>
......@@ -390,6 +399,9 @@ void onRefresh();
}
.status-tab {
display: flex;
align-items: flex-start;
justify-content: center;
position: relative;
padding: 2px 0 10px;
font-size: $font-size-base;
......@@ -404,7 +416,7 @@ void onRefresh();
.count {
margin-left: 4px;
color: $color-text-secondary;
color: 12px;
}
&.active {
......@@ -416,6 +428,7 @@ void onRefresh();
.count {
color: #333;
font-size: 14px;
}
&::after {
......@@ -554,7 +567,7 @@ void onRefresh();
:deep(.wo-tag) {
display: inline-flex;
gap: 4px;
gap: 2px;
align-items: center;
font-size: 11px;
line-height: 1;
......
......@@ -106,6 +106,7 @@ const {
font-size: 14px;
font-weight: 500;
color: #333;
width: auto;
}
&:deep(.login-send-code-btn.van-button) {
......
......@@ -230,7 +230,7 @@ watch(
.avg-value {
font-size: 24px;
font-weight: 800;
color: var(--color-primary);
color: #185efe;
letter-spacing: 0.5px;
}
}
......@@ -249,6 +249,7 @@ watch(
border-radius: 8px;
box-shadow: none;
opacity: 1;
border:none;
&:active::before {
opacity: 0;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!