Commit abd63871 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 f0e8b089 11ccf170
Pipeline #123 for abd63871 failed in 0 seconds
/** 检测记录详情里的单项值(与详情接口结构对齐;与模板侧的 `InspectionValueItem` 区分) */
import { get } from "@utils/request";
export interface FileInfo {
......@@ -16,7 +18,7 @@ export interface FileInfo {
linkProps?: Record<string, unknown>;
}
/** 检测记录详情里的单项值(与详情接口结构对齐;与模板侧的 `InspectionValueItem` 区分) */
/** 检测记录详情中单条值(与详情接口字段对齐) */
export interface InspectionDetailValueItem {
id: number;
resultId: number;
......@@ -125,6 +127,21 @@ export interface InspectionDetailScoreVO {
overallComment?: string;
}
export interface FileInfo {
uid?: string;
name?: string;
status?: string;
response?: string;
filePath?: string;
url?: string;
thumbPath?: string;
thumbUrl?: string;
percent?: number;
size?: number;
lastModified?: string;
lastModifiedDate?: string;
linkProps?: Record<string, unknown>;
}
export interface DetailRes {
id?: number;
taskId?: number;
......@@ -159,3 +176,7 @@ export interface DetailRes {
export function detail(recordId: number) {
return get<DetailRes>(`/rest/inspectionRecord/${recordId}/detail`);
}
export function getCarTypeList(csId: number) {
return get<DetailRes>(`/rest/ropApi/getCarTypeList?csId=${csId}`);
}
<script setup lang="ts">
import type { CustomizeFormValidateResult } from "@/types/views/car-detail";
import type { InspectionNode } from "@api";
import type { InspectionNode, InspectionTemplateDefaultData } from "@api";
import { ref, watch } from "vue";
import { getCarTypeList } from "@/api/modules/inspect-report";
import buttonSelect from "@/components/CustomizeForm/buttonSelect.vue";
import buttonSelectAndImageUpload from "@/components/CustomizeForm/buttonSelectAndImageUpload.vue";
import customizeUploadFile from "@/components/CustomizeForm/customizeUploadFile.vue";
......@@ -16,14 +17,14 @@ import selectDropdown from "@/components/CustomizeForm/selectDropdown.vue";
const props = withDefaults(
defineProps<{
allowNoStructure?: boolean;
bigModuleLabel?: string;
leafNodes?: InspectionNode[];
subTabLabel?: string;
/** `getInspectionTemplateDefault` 解包后的 data(与 nodeCode 等字段对应) */
templateDefaultData?: InspectionTemplateDefaultData | null;
}>(), {
leafNodes: () => [],
bigModuleLabel: "",
subTabLabel: "",
allowNoStructure: false,
templateDefaultData: null,
});
type InspectionColumnRow = InspectionNode & {
......@@ -48,11 +49,18 @@ watch(() => props.leafNodes, (nodes) => {
value: getValueText(item),
})) as InspectionColumnRow[];
console.log("watchLeafNodes", columnsList.value);
setTimeout(() => {
pageLoading.value = false;
}, 1200);
}, { immediate: true, deep: true });
// 页面加载时初始化数据
onMounted(() => {
setTimeout(() => {
getCarTypeListData();
}, 1200);
});
function getValueText(item: any) {
let valueText = "";
......@@ -196,27 +204,31 @@ async function validate(): Promise<CustomizeFormValidateResult> {
message = message || title + item.nodeName;
}
if (item.interactionType == "image_upload_and_button_select" && !item.uploadValue) {
if (item.interactionType == "image_upload_and_button_select" && item.value && !item.uploadValue) {
success = false;
message = message || "请上传图片";
}
});
return {
const returnData = {
data: nodesData,
message: message || "操作成功",
success,
};
console.log("validate", returnData);
return returnData;
}
/** 与 `validate` 相同返回结构,不校验必填,用于静默保存 / 上一步等场景 */
async function saveData(): Promise<CustomizeFormValidateResult> {
const nodesData = setSubmitData();
return {
const returnData = {
data: nodesData,
message: "操作成功",
success: true,
};
console.log("saveData", returnData);
return returnData;
}
function getValidationRules(item: any) {
......@@ -234,6 +246,18 @@ function setImgWidth(item: any) {
return resultStatus;
}
const carTypeList = ref([]);
async function getCarTypeListData() {
const templateDefaultData = props?.templateDefaultData || {};
if (templateDefaultData.carSeriesId) {
const res = await getCarTypeList(templateDefaultData.carSeriesId);
carTypeList.value = (res?.data?.carinfos || []).map(item => ({
text: item.name || "",
value: String(item.id) || "",
}));
}
}
defineExpose({
validate,
saveData,
......@@ -333,9 +357,10 @@ defineExpose({
<!-- 下拉选择器 -->
<div v-if="item.interactionType == 'dropdown'">
<selectDropdown :item="item"
<selectDropdown :car-type-list="carTypeList"
:item="item"
:value="item.value"
@update="onDropdownUpdate(item, $event)" />
@update="item.value = $event" />
</div>
<!-- 按钮选择器 -->
......
......@@ -6,6 +6,10 @@ const props = defineProps({
type: Object,
default: () => {},
},
carTypeList: {
type: Array,
default: () => {},
},
});
const emit = defineEmits(["update"]);
......@@ -43,7 +47,6 @@ function initData() {
}
}
onConfirm();
console.log("pickerValue.value2222222222222222222", pickerValue.value);
}
// 计算属性
......@@ -55,9 +58,11 @@ const columnsList = computed(() => {
value: valueList[0] || "",
};
});
return optionsList;
return props.item.nodeName === "车型" ? props.carTypeList : optionsList;
});
function onConfirm() {
const picker = pickerValue.value && pickerValue.value.length > 0 ? pickerValue.value[0] : "";
showPicker.value = false;
......
<!--
* @Author: cen
* @Date: 2026-03-18 18:09:39
* @Description:
* @FilePath: /venus-usedcar-h5/apps/web/venus-usedcar-quality/src/components/PageTop.vue
* @LastEditTime: 2026-03-26 15:33:11
* @LastEditors: cenchengwei@foreverht.com
* 可以输入预定的版权声明、个性签名、空行等
-->
<script setup lang="ts">
import PageTitle from "@/components/PageTitle.vue";
......@@ -15,8 +24,8 @@ defineProps<{
<style lang="scss" scoped>
.page-top {
background: url("@assets/image/top_bg.png") no-repeat top center;
background-size: 100% auto;
// background: url("@assets/image/top_bg.png") no-repeat top center;
// background-size: 100% auto;
}
</style>
......@@ -188,7 +188,8 @@ async function handleResponse<T>(
}
showToast(errMsg);
throw new ApiHandledError(errMsg);
// 后端调整后修改放开注释
// throw new ApiHandledError(errMsg);
}
// 非标准结构,直接返回 data
......
......@@ -74,6 +74,8 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) {
const showModulePicker = ref(false);
const loading = ref(false);
const activeSubKey = ref<number | string>("");
/** `getInspectionTemplateDefault` 解包后的 data,供表单区等消费 */
const templateDefaultData = ref<InspectionTemplateDefaultData | null>(null);
const activeBigModule = computed(
() =>
......@@ -112,7 +114,7 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) {
activeBigModule.value?.subTabs[0]
);
/** 有真实二级 Tab 时,当前是否为该大项的最后一个二级项(用于底部主按钮「提交检测内容」) */
/** 有真实二级 Tab 时,当前是否为该大项的最后一个二级项 */
const isLastSubTabOfActiveBigModule = computed(() => {
const m = activeBigModule.value;
if (!m || m.hasSecondaryTabs !== true) return false;
......@@ -194,16 +196,17 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) {
const firstChild = list[0];
const isDirectLeafChildren = firstChild !== undefined && firstChild.nodeType === 3;
let templateDefaultData: InspectionTemplateDefaultData | null = null;
let fetchedDefaultData: InspectionTemplateDefaultData | null = null;
try {
templateDefaultData = await getInspectionTemplateDefault(taskId.value);
fetchedDefaultData = await getInspectionTemplateDefault(taskId.value);
} catch (error) {
console.error("获取模板默认值失败:", error);
}
templateDefaultData.value = fetchedDefaultData;
if (isDirectLeafChildren) {
targetBigModule.hasSecondaryTabs = false;
const leafNodes = applyResolvedInitialValuesToLeafNodes(list, templateDefaultData);
const leafNodes = applyResolvedInitialValuesToLeafNodes(list, fetchedDefaultData);
const allDone = list.every((n) => isInspectionVoCompleted(n.inspectionResultVO));
targetBigModule.subTabs = [
{
......@@ -220,7 +223,7 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) {
key: node.id,
label: node.nodeName,
nodeId: node.id,
leafNodes: applyResolvedInitialValuesToLeafNodes(node.childrenNodes, templateDefaultData),
leafNodes: applyResolvedInitialValuesToLeafNodes(node.childrenNodes, fetchedDefaultData),
inspectionResultVO: node.inspectionResultVO,
completedFlag: isInspectionVoCompleted(node.inspectionResultVO) ? 1 : 0,
}));
......@@ -328,6 +331,7 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) {
isLastSubTabOfActiveBigModule,
activeSubTab,
currentLeafNodes,
templateDefaultData,
initializeInspection,
loadSubTabsForBigModule,
switchToUncompletedInspectionNode,
......
......@@ -129,7 +129,21 @@ export function useInspectSubmit(
}
}
function onBack() {
async function onBack() {
if (submitting.value) return;
if (modules.activeBigKey.value !== SCORE_BIG_KEY) {
try {
const persisted = await saveCurrentLeafInspectionRecord(false);
if (persisted) {
showToast("已自动保存草稿");
}
} catch (error) {
if (!isRequestFailureAlreadyHandled(error)) {
showToast("草稿保存失败,请稍后重试");
}
return;
}
}
router.back();
}
......
......@@ -87,7 +87,8 @@
:active-sub-tab="activeBigModule"
:big-module-label="activeBigModule?.label"
:leaf-nodes="currentLeafNodes"
:sub-tab-label="activeSubTab?.label" />
:sub-tab-label="activeSubTab?.label"
:template-default-data="templateDefaultData" />
</div>
</div>
</div>
......@@ -106,7 +107,7 @@
提交评分
</van-button>
</template>
<!-- 普通检测页:有二级时上一步 + 下一步;无二级时仅完成检测(全宽) -->
<!-- 普通检测页:有二级时上一步 + 下一步;无二级时仅下一步(全宽) -->
<template v-else>
<van-button v-if="activeBigModule?.hasSecondaryTabs !== false"
class="btn-save"
......@@ -124,13 +125,7 @@
round
type="primary"
@click="onNext">
{{
activeBigModule?.hasSecondaryTabs === false
? "完成检测"
: isLastSubTabOfActiveBigModule
? "提交检测内容"
: "下一步"
}}
下一步
</van-button>
</template>
</div>
......@@ -191,6 +186,7 @@ const customizeFormRef = ref<InstanceType<typeof customizeForm> | null>(null);
const inspectionScoreFormRef = ref<InstanceType<typeof ScoreForm> | null>(null);
const modules = useInspectModules(route);
const templateDefaultData = modules.templateDefaultData;
const {
submitting,
onSelectBigModule,
......@@ -213,7 +209,6 @@ const {
showInspectionProgressBar,
progressTotal,
progressDone,
isLastSubTabOfActiveBigModule,
activeSubTab,
currentLeafNodes,
initializeInspection,
......
......@@ -283,7 +283,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"
......@@ -539,8 +539,8 @@ void onRefresh();
:deep(.wo-btn) {
height: auto;
padding: 10px 12px;
font-size: 13px;
padding: 6px 8px;
font-size: 12px;
font-weight: 400;
line-height: 1;
border: 0;
......
......@@ -4,7 +4,6 @@ import { useLogin } from "./useLogin.ts";
const {
phone,
code,
agreed,
sending,
countdown,
hasSent,
......@@ -70,18 +69,6 @@ const {
</div>
<div aria-hidden="true" class="min-h-6 flex-1" />
<div class="flex shrink-0 justify-center pt-10 text-center text-[12px] text-[#999]">
<van-checkbox v-model="agreed"
checked-color="#4f8cff"
icon-size="14px">
<span class="whitespace-nowrap">
我已阅读并同意
<a class="mx-0.5 text-[#4f8cff] no-underline" href="javascript:;">《用户协议》</a>
<a class="mx-0.5 text-[#4f8cff] no-underline" href="javascript:;">《隐私协议》</a>
</span>
</van-checkbox>
</div>
</div>
</div>
</template>
......
......@@ -4,7 +4,6 @@ import { useLogin } from "./useLogin.ts";
const {
phone,
code,
agreed,
sending,
countdown,
hasSent,
......@@ -63,18 +62,6 @@ const {
@click="handleLogin">
登录
</van-button>
<div class="mt-4 flex items-center justify-center text-[12px] text-[#999]">
<van-checkbox v-model="agreed"
checked-color="#4f8cff"
icon-size="14px">
<span class="whitespace-nowrap">
我已阅读并同意
<a class="mx-0.5 text-[#4f8cff] no-underline" href="javascript:;">《用户协议》</a>
<a class="mx-0.5 text-[#4f8cff] no-underline" href="javascript:;">《隐私协议》</a>
</span>
</van-checkbox>
</div>
</div>
</div>
</div>
......
......@@ -13,7 +13,6 @@ export function useLogin() {
const phone = ref("");
const code = ref("");
const agreed = ref(false);
/** 仅数字 + 长度上限;配合 Field type=digit,并兜底粘贴等非数字字符 */
watch(phone, (v) => {
......@@ -76,10 +75,6 @@ export function useLogin() {
showFailToast("请输入验证码");
return;
}
if (!agreed.value) {
showFailToast("请先阅读并同意相关协议");
return;
}
try {
const res = await login({
......@@ -112,7 +107,6 @@ export function useLogin() {
return {
phone,
code,
agreed,
sending,
countdown,
hasSent,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!