Commit 0f60ec9b by yancanhua

Merge branch 'release/venus-usedcar-h5/1.0.0' of http://192.168.3.233:8090/monor…

…epo/venus into release/venus-usedcar-h5/1.0.0

# Conflicts:
#	apps/web/venus-usedcar-quality/src/components/CustomizeForm/Index.vue
2 parents b6bc0dd3 5322f7f5
Pipeline #112 for 0f60ec9b failed in 0 seconds
Showing 40 changed files with 563 additions and 305 deletions
...@@ -11,11 +11,11 @@ ...@@ -11,11 +11,11 @@
"type-check": "vue-tsc --noEmit" "type-check": "vue-tsc --noEmit"
}, },
"dependencies": { "dependencies": {
"axios": "^1.12.2",
"@vueuse/core": "catalog:", "@vueuse/core": "catalog:",
"axios": "^1.12.2",
"dayjs": "catalog:", "dayjs": "catalog:",
"glsk-toolkit": "catalog:",
"glsk-oss-jssdk": "catalog:", "glsk-oss-jssdk": "catalog:",
"glsk-toolkit": "catalog:",
"pinia": "catalog:", "pinia": "catalog:",
"pinia-plugin-persistedstate": "catalog:", "pinia-plugin-persistedstate": "catalog:",
"tailwindcss": "catalog:", "tailwindcss": "catalog:",
......
...@@ -54,9 +54,9 @@ export function getRecommendedCars(limit = 10) { ...@@ -54,9 +54,9 @@ export function getRecommendedCars(limit = 10) {
} }
export function collectCar(carId: number) { export function collectCar(carId: number) {
return post<void>(`/api/cars/${carId}/collect`); return post(`/api/cars/${carId}/collect`);
} }
export function uncollectCar(carId: number) { export function uncollectCar(carId: number) {
return post<void>(`/api/cars/${carId}/uncollect`); return post(`/api/cars/${carId}/uncollect`);
} }
export * from "./page"; export * from "./page";
export * from "./template";
export * from "./record"; export * from "./record";
export * from "./template";
...@@ -25,13 +25,13 @@ export interface InspectReportPageData<T> { ...@@ -25,13 +25,13 @@ export interface InspectReportPageData<T> {
} }
export interface InspectReportVehicleCover { export interface InspectReportVehicleCover {
uid?: string | number; uid?: number | string;
name?: string; name?: string;
status?: string; status?: string;
url?: string; url?: string;
filePath?: string; filePath?: string;
thumbPath?: string | null; thumbPath?: null | string;
thumbUrl?: string | null; thumbUrl?: null | string;
size?: number; size?: number;
lastModified?: number; lastModified?: number;
lastModifiedDate?: string; lastModifiedDate?: string;
......
...@@ -21,7 +21,7 @@ export interface InspectionRecordSaveParams { ...@@ -21,7 +21,7 @@ export interface InspectionRecordSaveParams {
/** 大项 nodeId */ /** 大项 nodeId */
locationModule: number | string; locationModule: number | string;
/** 二级项 nodeId;无二级分组时为 null */ /** 二级项 nodeId;无二级分组时为 null */
locationSubModule: number | string | null; locationSubModule: null | number | string;
/** true = 保存并跳下一步,false = 仅保存 */ /** true = 保存并跳下一步,false = 仅保存 */
nextFlag: boolean; nextFlag: boolean;
leafNodes: LeafNodeRecord[]; leafNodes: LeafNodeRecord[];
...@@ -31,7 +31,7 @@ export interface InspectionRecordSaveParams { ...@@ -31,7 +31,7 @@ export interface InspectionRecordSaveParams {
* 保存/下一步 * 保存/下一步
*/ */
export function saveInspectionRecord(params: InspectionRecordSaveParams) { export function saveInspectionRecord(params: InspectionRecordSaveParams) {
return post<void>("/rest/inspectionRecord/save", params); return post("/rest/inspectionRecord/save", params);
} }
/** /**
......
...@@ -43,7 +43,7 @@ export interface InspectionNode { ...@@ -43,7 +43,7 @@ export interface InspectionNode {
options?: string; options?: string;
validationRules?: string; validationRules?: string;
allowNoStructure?: number; allowNoStructure?: number;
existsDefaultValue?: string | number; existsDefaultValue?: number | string;
defaultValue?: string; defaultValue?: string;
defaultType?: number; defaultType?: number;
nodeLevel: number; nodeLevel: number;
...@@ -67,7 +67,7 @@ export interface InspectionNode { ...@@ -67,7 +67,7 @@ export interface InspectionNode {
* 获取检测模板根节点(大项) * 获取检测模板根节点(大项)
* @param taskId 检测工单ID * @param taskId 检测工单ID
*/ */
export function getInspectionRootNodes(taskId: string | number) { export function getInspectionRootNodes(taskId: number | string) {
return get<InspectionNode[]>(`/rest/inspectionTemplate/${taskId}/rootNodes`); return get<InspectionNode[]>(`/rest/inspectionTemplate/${taskId}/rootNodes`);
} }
...@@ -75,14 +75,14 @@ export function getInspectionRootNodes(taskId: string | number) { ...@@ -75,14 +75,14 @@ export function getInspectionRootNodes(taskId: string | number) {
* 检测评分回显(与 `completeInspection` 字段对应,接口可能省略部分字段) * 检测评分回显(与 `completeInspection` 字段对应,接口可能省略部分字段)
*/ */
export interface InspectionScoreVO { export interface InspectionScoreVO {
exteriorScore?: number | string | null; exteriorScore?: null | number | string;
exteriorComment?: string | null; exteriorComment?: null | string;
skeletonLevel?: string | null; skeletonLevel?: null | string;
skeletonComment?: string | null; skeletonComment?: null | string;
interiorLevel?: string | null; interiorLevel?: null | string;
interiorComment?: string | null; interiorComment?: null | string;
overallScore?: number | string | null; overallScore?: null | number | string;
overallComment?: string | null; overallComment?: null | string;
[key: string]: unknown; [key: string]: unknown;
} }
...@@ -94,8 +94,8 @@ export interface InspectionScoreVO { ...@@ -94,8 +94,8 @@ export interface InspectionScoreVO {
export type InspectionChildrenData = export type InspectionChildrenData =
| InspectionNode[] | InspectionNode[]
| { | {
inspectionScoreVO?: InspectionScoreVO | null;
[key: string]: unknown; [key: string]: unknown;
inspectionScoreVO?: InspectionScoreVO | null;
}; };
/** /**
...@@ -103,7 +103,7 @@ export type InspectionChildrenData = ...@@ -103,7 +103,7 @@ export type InspectionChildrenData =
* @param rootNodeId 根节点ID;传 `-1` 时可拉取检测评分回显(`inspectionScoreVO`) * @param rootNodeId 根节点ID;传 `-1` 时可拉取检测评分回显(`inspectionScoreVO`)
* @param taskId 检测工单ID * @param taskId 检测工单ID
*/ */
export function getInspectionChildren(rootNodeId: string | number, taskId: string | number) { export function getInspectionChildren(rootNodeId: number | string, taskId: number | string) {
return get<InspectionChildrenData>(`/rest/inspectionNode/${rootNodeId}/children`, { return get<InspectionChildrenData>(`/rest/inspectionNode/${rootNodeId}/children`, {
taskId, taskId,
}); });
...@@ -137,7 +137,7 @@ export interface InspectionTemplateDefaultData { ...@@ -137,7 +137,7 @@ export interface InspectionTemplateDefaultData {
* 获取检测模板默认值(业务层已解包为 data 对象) * 获取检测模板默认值(业务层已解包为 data 对象)
* @param taskId 检测工单ID * @param taskId 检测工单ID
*/ */
export function getInspectionTemplateDefault(taskId: string | number) { export function getInspectionTemplateDefault(taskId: number | string) {
return post<InspectionTemplateDefaultData>(`/rest/inspectionTemplate/default`, { return post<InspectionTemplateDefaultData>(`/rest/inspectionTemplate/default`, {
taskId, taskId,
}); });
...@@ -149,8 +149,8 @@ function hasDefaultValueFlag(node: InspectionNode): boolean { ...@@ -149,8 +149,8 @@ function hasDefaultValueFlag(node: InspectionNode): boolean {
} }
const KEYED_SELECT_INTERACTION_TYPES = new Set([ const KEYED_SELECT_INTERACTION_TYPES = new Set([
"dropdown",
"button_select", "button_select",
"dropdown",
"radio_button_select", "radio_button_select",
]); ]);
...@@ -257,7 +257,7 @@ export function applyResolvedInitialValuesToLeafNodes( ...@@ -257,7 +257,7 @@ export function applyResolvedInitialValuesToLeafNodes(
): InspectionNode[] { ): InspectionNode[] {
if (!leafNodes?.length) return []; if (!leafNodes?.length) return [];
return leafNodes.map((node) => { return leafNodes.map((node) => {
if (node.inspectionResultVO != null) { if (node.inspectionResultVO !== null && node.inspectionResultVO !== undefined) {
return { ...node }; return { ...node };
} }
const valueTexts = resolveInspectionNodeInitialValueTexts(node, templateDefaultData); const valueTexts = resolveInspectionNodeInitialValueTexts(node, templateDefaultData);
...@@ -275,7 +275,10 @@ export function applyResolvedInitialValuesToLeafNodes( ...@@ -275,7 +275,10 @@ export function applyResolvedInitialValuesToLeafNodes(
if (!isKeyedSelectInteractionType(node.interactionType) || list.length === 0) { if (!isKeyedSelectInteractionType(node.interactionType) || list.length === 0) {
return merged; return merged;
} }
const first = list[0]!; const first = list[0];
if (first === undefined) {
return merged;
}
const it = node.interactionType ?? ""; const it = node.interactionType ?? "";
const valueKey = first.valueKey ?? ""; const valueKey = first.valueKey ?? "";
const valueText = first.valueText ?? ""; const valueText = first.valueText ?? "";
......
...@@ -68,7 +68,7 @@ export function login(params: LoginParams) { ...@@ -68,7 +68,7 @@ export function login(params: LoginParams) {
} }
export function logout() { export function logout() {
return post<void>("/rest/auth/logout", {}); return post("/rest/auth/logout", {});
} }
export function getUserInfo() { export function getUserInfo() {
......
...@@ -28,10 +28,10 @@ body { ...@@ -28,10 +28,10 @@ body {
// rem 根字号上限与 utils/flexible.ts 中 LAYOUT_MAX_WIDTH 保持一致 // rem 根字号上限与 utils/flexible.ts 中 LAYOUT_MAX_WIDTH 保持一致
// #app 已加入 postcss-pxtorem selectorBlackList,px 不会被转 rem // #app 已加入 postcss-pxtorem selectorBlackList,px 不会被转 rem
#app { #app {
position: relative;
max-width: 430px; max-width: 430px;
min-height: 100vh; min-height: 100vh;
margin: 0 auto; margin: 0 auto;
position: relative;
background-color: #f7f8fa; background-color: #f7f8fa;
} }
......
...@@ -7,21 +7,20 @@ export {} ...@@ -7,21 +7,20 @@ export {}
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
ButtonSelect: typeof import('./components/CustomizeForm/buttonSelect.vue')['default'] ButtonSelect: typeof import('./components/customizeForm/buttonSelect.vue')['default']
CustomizeUploadFile: typeof import('./components/CustomizeForm/customizeUploadFile.vue')['default'] CustomizeUploadFile: typeof import('./components/customizeForm/customizeUploadFile.vue')['default']
Index: typeof import('./components/CustomizeForm/Index.vue')['default'] Index: typeof import('./components/customizeForm/Index.vue')['default']
Layouts: typeof import('./layouts/index.vue')['default'] Layouts: typeof import('./layouts/index.vue')['default']
LogoutConfirmModal: typeof import('./components/LogoutConfirmModal.vue')['default'] LogoutConfirmModal: typeof import('./components/LogoutConfirmModal.vue')['default']
PageTitle: typeof import('./components/PageTitle.vue')['default'] PageTitle: typeof import('./components/PageTitle.vue')['default']
PageTop: typeof import('./components/PageTop.vue')['default'] PageTop: typeof import('./components/PageTop.vue')['default']
RadioSelect: typeof import('./components/CustomizeForm/radioSelect.vue')['default'] RadioSelect: typeof import('./components/customizeForm/radioSelect.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
SelectDatePicker: typeof import('./components/CustomizeForm/selectDatePicker.vue')['default'] SelectDatePicker: typeof import('./components/customizeForm/selectDatePicker.vue')['default']
SelectDropdown: typeof import('./components/CustomizeForm/selectDropdown.vue')['default'] SelectDropdown: typeof import('./components/customizeForm/selectDropdown.vue')['default']
VanActionSheet: typeof import('vant/es')['ActionSheet'] VanActionSheet: typeof import('vant/es')['ActionSheet']
VanButton: typeof import('vant/es')['Button'] VanButton: typeof import('vant/es')['Button']
VanCheckbox: typeof import('vant/es')['Checkbox']
VanDatePicker: typeof import('vant/es')['DatePicker'] VanDatePicker: typeof import('vant/es')['DatePicker']
VanEmpty: typeof import('vant/es')['Empty'] VanEmpty: typeof import('vant/es')['Empty']
VanField: typeof import('vant/es')['Field'] VanField: typeof import('vant/es')['Field']
...@@ -38,12 +37,10 @@ declare module 'vue' { ...@@ -38,12 +37,10 @@ declare module 'vue' {
VanRadio: typeof import('vant/es')['Radio'] VanRadio: typeof import('vant/es')['Radio']
VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanRadioGroup: typeof import('vant/es')['RadioGroup']
VanSearch: typeof import('vant/es')['Search'] VanSearch: typeof import('vant/es')['Search']
VanSkeleton: typeof import('vant/es')['Skeleton']
VanSlider: typeof import('vant/es')['Slider'] VanSlider: typeof import('vant/es')['Slider']
VanTabbar: typeof import('vant/es')['Tabbar'] VanTabbar: typeof import('vant/es')['Tabbar']
VanTabbarItem: typeof import('vant/es')['TabbarItem'] VanTabbarItem: typeof import('vant/es')['TabbarItem']
VanTag: typeof import('vant/es')['Tag'] VanTag: typeof import('vant/es')['Tag']
VanUploader: typeof import('vant/es')['Uploader']
WorkOrderStatusTags: typeof import('./components/WorkOrderStatusTags.vue')['default'] WorkOrderStatusTags: typeof import('./components/WorkOrderStatusTags.vue')['default']
} }
} }
...@@ -4,14 +4,14 @@ import { computed, ref } from "vue"; ...@@ -4,14 +4,14 @@ import { computed, ref } from "vue";
const props = defineProps({ const props = defineProps({
item: { item: {
type: Object, type: Object,
default: () => { }, default: () => {},
}, },
}); });
const emit = defineEmits(["update"]); const emit = defineEmits(["update"]);
const pickerValue = ref([]); const pickerValue = ref([]);
//页面加载时初始化数据 // 页面加载时初始化数据
onMounted(() => { onMounted(() => {
initData(); initData();
}); });
...@@ -22,9 +22,9 @@ function initData() { ...@@ -22,9 +22,9 @@ function initData() {
if (props?.item?.inspectionResultVO) { if (props?.item?.inspectionResultVO) {
const inspectionValueList = props?.item?.inspectionResultVO?.inspectionValueList || []; const inspectionValueList = props?.item?.inspectionResultVO?.inspectionValueList || [];
if (inspectionValueList && inspectionValueList.length > 0 && inspectionValueList[0].valueKey) { if (inspectionValueList && inspectionValueList.length > 0 && inspectionValueList[0].valueKey) {
for (let i = 0; i < inspectionValueList.length; i++) { for (const element of inspectionValueList) {
if (inspectionValueList[i].valueKey) { if (element.valueKey) {
pickerValue.value.push(inspectionValueList[i].valueKey); pickerValue.value.push(element.valueKey);
} }
} }
...@@ -35,11 +35,11 @@ function initData() { ...@@ -35,11 +35,11 @@ function initData() {
// 计算属性 // 计算属性
const columnsList = computed(() => { const columnsList = computed(() => {
const optionsList = JSON.parse(props.item.options || '[]').map(item => { const optionsList = JSON.parse(props.item.options || "[]").map(item => {
const valueList = (item || '').split('-'); const valueList = (item || "").split("-");
return { return {
text: valueList[1] || '', text: valueList[1] || "",
value: valueList[0] || '', value: valueList[0] || "",
}; };
}); });
return optionsList; return optionsList;
...@@ -59,16 +59,14 @@ function setupdate() { ...@@ -59,16 +59,14 @@ function setupdate() {
const valueList = (pickerValue.value || []).map(item => { const valueList = (pickerValue.value || []).map(item => {
const object = (columnsList.value || []).find(finditem => finditem.value == item) || {}; const object = (columnsList.value || []).find(finditem => finditem.value == item) || {};
return { return {
valueText: object.text || '', valueText: object.text || "",
valueKey: item || '', valueKey: item || "",
}; };
}); });
if (valueList.length) { if (valueList.length > 0) {
props.item.value = JSON.stringify(valueList || []);
emit("update", JSON.stringify(valueList || [])); emit("update", JSON.stringify(valueList || []));
} else { } else {
props.item.value = ''; emit("update", "");
emit("update", '');
} }
} }
...@@ -81,10 +79,13 @@ function setupdate() { ...@@ -81,10 +79,13 @@ function setupdate() {
<span>{{ item.nodeName }}</span> <span>{{ item.nodeName }}</span>
</div> </div>
<div class="selectList"> <div class="selectList">
<div v-for="(item, index) in columnsList" :key="index" @click="handleBut(item)" class="selectBut" <div v-for="(col, index) in columnsList"
:class="{ 'pitchOn': pickerValue.includes(item.value) }"> :key="index"
{{ item.text }} class="selectBut"
<div v-if="pickerValue.includes(item.value)" class="pitchImg"></div> :class="{ 'pitchOn': pickerValue.includes(col.value) }"
@click="handleBut(col)">
{{ col.text }}
<div v-if="pickerValue.includes(col.value)" class="pitchImg"></div>
</div> </div>
</div> </div>
</div> </div>
...@@ -92,27 +93,27 @@ function setupdate() { ...@@ -92,27 +93,27 @@ function setupdate() {
<style lang="scss" scoped> <style lang="scss" scoped>
.buttonSelect { .buttonSelect {
width: 100%;
background: #ffffff;
float: left; float: left;
width: 100%;
background: #fff;
} }
.title { .title {
float: left;
width: 100%; width: 100%;
height: 24px; height: 24px;
color: #141e34; padding-left: 16px;
font-size: 14px;
line-height: 24px;
float: left;
margin-top: 16px; margin-top: 16px;
margin-bottom: 10px; margin-bottom: 10px;
padding-left: 16px; font-size: 14px;
line-height: 24px;
color: #141e34;
} }
.isRequired { .isRequired {
color: #ee3040;
font-size: 14px;
padding-right: 2px; padding-right: 2px;
font-size: 14px;
color: #ee3040;
} }
.selectList { .selectList {
...@@ -120,29 +121,27 @@ function setupdate() { ...@@ -120,29 +121,27 @@ function setupdate() {
} }
.selectBut { .selectBut {
width: -webkit-calc(33.333% - 12px); position: relative;
width: -moz-calc(33.333% - 12px); float: left;
width: calc(33.333% - 12px); width: calc(33.333% - 12px);
height: 36px; height: 36px;
line-height: 36px; margin-right: 6px;
border-radius: 6px; margin-bottom: 12px;
background: #f9f9f9; margin-left: 6px;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
line-height: 36px;
color: #333;
text-align: center; text-align: center;
color: #333333;
float: left;
cursor: pointer; cursor: pointer;
position: relative; background: #f9f9f9;
margin-bottom: 12px;
margin-left: 6px;
margin-right: 6px;
border: 1px solid #f9f9f9; border: 1px solid #f9f9f9;
border-radius: 6px;
} }
.pitchOn { .pitchOn {
background: #ecf1ff !important;
color: #185EFE !important; color: #185EFE !important;
background: #ecf1ff !important;
border: 1px solid #185efe !important; border: 1px solid #185efe !important;
} }
...@@ -150,9 +149,9 @@ function setupdate() { ...@@ -150,9 +149,9 @@ function setupdate() {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
z-index: 99;
width: 16px; width: 16px;
height: 16px; height: 16px;
z-index: 99;
background-image: url("https://img02.glsx.com.cn/aus/images/preference/pitchOn.png"); background-image: url("https://img02.glsx.com.cn/aus/images/preference/pitchOn.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100%; background-size: 100%;
......
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from "vue"; import { ref } from "vue";
import { uploadFile } from "@/utils/upload.js";
const uploading = ref(false);
import { uploadFile } from "@/utils/upload.js";
import { showToast } from "vant"; import { showToast } from "vant";
const props = defineProps({ const props = defineProps({
item: { item: {
type: Object, type: Object,
default: () => { }, default: () => {},
}, },
}); });
const emit = defineEmits(["update"]); const emit = defineEmits(["update"]);
const uploading = ref(false);
const pickerValue = ref([]); const pickerValue = ref([]);
const fileInputRef = ref<HTMLInputElement | null>(null); const fileInputRef = ref<HTMLInputElement | null>(null);
...@@ -20,7 +22,7 @@ function pickFile() { ...@@ -20,7 +22,7 @@ function pickFile() {
fileInputRef.value?.click(); fileInputRef.value?.click();
} }
//页面加载时初始化数据 // 页面加载时初始化数据
onMounted(() => { onMounted(() => {
initData(); initData();
}); });
...@@ -31,7 +33,7 @@ function initData() { ...@@ -31,7 +33,7 @@ function initData() {
if (props?.item?.inspectionResultVO) { if (props?.item?.inspectionResultVO) {
const inspectionValueList = props?.item?.inspectionResultVO?.inspectionValueList || []; const inspectionValueList = props?.item?.inspectionResultVO?.inspectionValueList || [];
for (const i of inspectionValueList) { for (const i of inspectionValueList) {
if (i.valueText) { pickerValue.value.push(i.valueText) } if (i.valueText) { pickerValue.value.push(i.valueText); }
} }
} }
updateData(); updateData();
...@@ -39,7 +41,7 @@ function initData() { ...@@ -39,7 +41,7 @@ function initData() {
// 计算属性 // 计算属性
const validationRules = computed(() => { const validationRules = computed(() => {
return JSON.parse(props.item.validationRules || '{}'); return JSON.parse(props.item.validationRules || "{}");
}); });
async function onFileChange(ev: Event) { async function onFileChange(ev: Event) {
...@@ -54,11 +56,11 @@ async function onFileChange(ev: Event) { ...@@ -54,11 +56,11 @@ async function onFileChange(ev: Event) {
showToast("上传成功"); showToast("上传成功");
pickerValue.value.push(url); pickerValue.value.push(url);
console.log('pickerValue.value', pickerValue.value); console.log("pickerValue.value", pickerValue.value);
updateData(); updateData();
} catch (e: unknown) { } catch (error: unknown) {
const msg = e instanceof Error ? e.message : String(e); const msg = error instanceof Error ? error.message : String(error);
showToast(`上传失败:${msg}`); showToast(`上传失败:${msg}`);
} finally { } finally {
uploading.value = false; uploading.value = false;
...@@ -71,12 +73,10 @@ function handleDelete(item: string) { ...@@ -71,12 +73,10 @@ function handleDelete(item: string) {
} }
function updateData() { function updateData() {
if (pickerValue.value.length) { if (pickerValue.value.length > 0) {
props.item.value = JSON.stringify(pickerValue.value);
emit("update", JSON.stringify(pickerValue.value)); emit("update", JSON.stringify(pickerValue.value));
} else { } else {
props.item.value = ''; emit("update", "");
emit("update", '');
} }
} }
...@@ -94,18 +94,35 @@ function updateData() { ...@@ -94,18 +94,35 @@ function updateData() {
有损伤请拍摄图片,无损伤请忽略 有损伤请拍摄图片,无损伤请忽略
</div> </div>
</div> </div>
<input ref="fileInputRef" :accept="item.interactionType == 'image_upload' ? 'image/*' : 'video/*'" <input ref="fileInputRef"
class="hidden-input" type="file" @change="onFileChange"> :accept="item.interactionType == 'image_upload' ? 'image/*' : 'video/*'"
class="hidden-input"
type="file"
@change="onFileChange">
<div class="uploadPage"> <div class="uploadPage">
<div v-if="(validationRules.maxCount || 3) > pickerValue.length" class="uploadBox" @click="pickFile"> <div v-if="(validationRules.maxCount || 3) > pickerValue.length"
<van-icon name="plus" size="24" color="#999999" class="plusBox" /> class="uploadBox"
<div class="uploadTxt"> {{ item.interactionType == 'image_upload' ? '添加照片' : '添加视频' }}</div> @click="pickFile">
<van-icon class="plusBox"
color="#999999"
name="plus"
size="24" />
<div class="uploadTxt">
{{ item.interactionType == 'image_upload' ? '添加照片' : '添加视频' }}
</div> </div>
<div v-if="pickerValue.length" v-for="(item, index) in pickerValue" :key="index" class="uploadBox">
<div class="deleteBox" @click="handleDelete(item)">
<van-icon name="clear" size="20" color="#999999" />
</div> </div>
<van-image width="96" height="96" style="border-radius: 8px;" :src="item" /> <div v-for="(url, index) in pickerValue"
:key="index"
class="uploadBox">
<div class="deleteBox" @click="handleDelete(url)">
<van-icon color="#999999"
name="clear"
size="20" />
</div>
<van-image height="96"
:src="url"
style="border-radius: 8px;"
width="96" />
</div> </div>
</div> </div>
</div> </div>
...@@ -113,88 +130,86 @@ function updateData() { ...@@ -113,88 +130,86 @@ function updateData() {
<style lang="scss" scoped> <style lang="scss" scoped>
.buttonSelect { .buttonSelect {
width: 100%;
background: #ffffff;
float: left; float: left;
width: 100%;
background: #fff;
} }
.title { .title {
width: 100%;
float: left; float: left;
width: 100%;
padding-left: 16px;
margin-top: 16px; margin-top: 16px;
margin-bottom: 10px; margin-bottom: 10px;
padding-left: 16px;
} }
.titleContent { .titleContent {
float: left;
width: 100%; width: 100%;
height: 24px; height: 24px;
float: left;
color: #141e34;
font-size: 14px; font-size: 14px;
line-height: 24px; line-height: 24px;
color: #141e34;
} }
.titleTip { .titleTip {
float: left;
width: 100%; width: 100%;
height: 16px; height: 16px;
line-height: 16px;
float: left;
color: #999999;
font-size: 12px; font-size: 12px;
font-weight: 400; font-weight: 400;
line-height: 16px;
color: #999;
} }
.isRequired { .isRequired {
color: #ee3040;
font-size: 14px;
padding-right: 2px; padding-right: 2px;
font-size: 14px;
color: #ee3040;
} }
.hidden-input { .hidden-input {
position: absolute; position: absolute;
width: 0; width: 0;
height: 0; height: 0;
opacity: 0;
pointer-events: none; pointer-events: none;
opacity: 0;
} }
.uploadPage { .uploadPage {
width: -webkit-calc(100% - 24px);
width: -moz-calc(100% - 24px);
width: calc(100% - 24px);
float: left; float: left;
width: calc(100% - 24px);
margin-left: 12px; margin-left: 12px;
} }
.uploadBox { .uploadBox {
position: relative;
float: left;
width: 96px; width: 96px;
height: 96px; height: 96px;
border-radius: 8px;
border: 1px solid #dddddd;
background: #f9f9f9;
float: left;
margin-bottom: 16px;
margin-right: 12px; margin-right: 12px;
position: relative; margin-bottom: 16px;
background: #f9f9f9;
border: 1px solid #ddd;
border-radius: 8px;
} }
.plusBox { .plusBox {
float: left; float: left;
margin-top: 22px; margin-top: 22px;
margin-left: 36px;
margin-right: 36px; margin-right: 36px;
margin-left: 36px;
} }
.uploadTxt { .uploadTxt {
float: left;
width: 100%; width: 100%;
height: 20px; height: 20px;
float: left;
margin-top: 8px; margin-top: 8px;
line-height: 20px;
color: #999999;
font-size: 12px; font-size: 12px;
font-weight: 400; font-weight: 400;
line-height: 20px;
color: #999;
text-align: center; text-align: center;
} }
...@@ -202,9 +217,9 @@ function updateData() { ...@@ -202,9 +217,9 @@ function updateData() {
position: absolute; position: absolute;
top: 2px; top: 2px;
right: 2px; right: 2px;
z-index: 99;
width: 20px; width: 20px;
height: 20px; height: 20px;
z-index: 99;
cursor: pointer; cursor: pointer;
} }
</style> </style>
...@@ -4,58 +4,69 @@ import { computed, ref } from "vue"; ...@@ -4,58 +4,69 @@ import { computed, ref } from "vue";
const props = defineProps({ const props = defineProps({
item: { item: {
type: Object, type: Object,
default: () => { }, default: () => {},
}, },
}); });
const emit = defineEmits(["update"]); const emit = defineEmits(["update"]);
const pickerValue = ref(''); const pickerValue = ref("");
//页面加载时初始化数据 // 页面加载时初始化数据
onMounted(() => { onMounted(() => {
initData(); initData();
}); });
// 初始化数据 // 初始化数据
function initData() { function initData() {
pickerValue.value = ''; pickerValue.value = "";
if (props?.item?.inspectionResultVO) { if (props?.item?.inspectionResultVO) {
const inspectionValueList = props?.item?.inspectionResultVO?.inspectionValueList || []; const inspectionValueList = props?.item?.inspectionResultVO?.inspectionValueList || [];
if (inspectionValueList && inspectionValueList.length > 0) { if (inspectionValueList && inspectionValueList.length > 0) {
pickerValue.value = inspectionValueList[0].valueKey || ''; pickerValue.value = inspectionValueList[0].valueKey || "";
} }
} }
} }
// 计算属性 // 计算属性
const columnsList = computed(() => { const columnsList = computed(() => {
const optionsList = JSON.parse(props.item.options || '[]').map(item => { const optionsList = JSON.parse(props.item.options || "[]").map(item => {
const valueList = (item || '').split('-'); const valueList = (item || "").split("-");
return { return {
text: valueList[1] || '', text: valueList[1] || "",
value: valueList[0] || '', value: valueList[0] || "",
}; };
}); });
return optionsList; return optionsList;
}); });
function handleBut() { function handleBut() {
const ObjectItem = columnsList.value.find(item => item.value == pickerValue.value); const selected = columnsList.value.find((col) => col.value === pickerValue.value);
props.item.valueText = ObjectItem.text || ''; const value = pickerValue.value || "";
props.item.valueKey = ObjectItem.value || ''; emit("update", {
props.item.value = pickerValue.value || ''; value,
emit("update", pickerValue.value); valueText: selected?.text ?? "",
valueKey: selected?.value ?? "",
});
} }
</script> </script>
<template> <template>
<van-field name="radio" v-model="pickerValue" :required="item.required === 1" :label="item.nodeName"> <van-field v-model="pickerValue"
:label="item.nodeName"
name="radio"
:required="item.required === 1">
<template #input> <template #input>
<div class="templateBox"> <div class="templateBox">
<van-radio-group style="float: right;" v-model="pickerValue" @change="handleBut" direction="horizontal"> <van-radio-group v-model="pickerValue"
<van-radio v-for="item in columnsList" :key="item.value" :name="item.value" icon-size="14px"> direction="horizontal"
{{ item.text }} style="float: right;"
@change="handleBut">
<van-radio v-for="col in columnsList"
:key="col.value"
icon-size="14px"
:name="col.value">
{{ col.text }}
</van-radio> </van-radio>
</van-radio-group> </van-radio-group>
</div> </div>
......
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { computed, ref } from "vue";
const props = defineProps({ const props = defineProps({
item: { item: {
type: Object, type: Object,
default: () => { }, default: () => {},
}, },
}); });
const columnsType = ref(['year', 'month', 'day']);
const emit = defineEmits(["update"]); const emit = defineEmits(["update"]);
const displayValue = computed({
get: () => String(props.item.value ?? ""),
set: (v: string) => emit("update", v),
});
const columnsType = ref(["year", "month", "day"]);
const showPicker = ref(false); const showPicker = ref(false);
const pickerValue = ref([]); const pickerValue = ref([]);
//页面加载时初始化数据 // 页面加载时初始化数据
onMounted(() => { onMounted(() => {
initData(); initData();
}); });
// 初始化数据 // 初始化数据
function initData() { function initData() {
const validationRules = JSON.parse(props.item.validationRules || '{}'); const validationRules = JSON.parse(props.item.validationRules || "{}");
if (validationRules.datePattern && validationRules.datePattern == 'YYYY-MM') { if (validationRules.datePattern && validationRules.datePattern === "YYYY-MM") {
columnsType.value = ['year', 'month']; columnsType.value = ["year", "month"];
} else { } else {
columnsType.value = ['year', 'month', 'day']; columnsType.value = ["year", "month", "day"];
} }
} }
...@@ -46,7 +51,6 @@ function onConfirm() { ...@@ -46,7 +51,6 @@ function onConfirm() {
picker = pickerValue.value.join("-"); picker = pickerValue.value.join("-");
} }
showPicker.value = false; showPicker.value = false;
props.item.value = picker;
emit("update", picker); emit("update", picker);
} }
...@@ -54,11 +58,23 @@ function onConfirm() { ...@@ -54,11 +58,23 @@ function onConfirm() {
<template> <template>
<div> <div>
<van-field v-model="item.value" clearable is-link :label="item.nodeName" name="datePicker" <van-field v-model="displayValue"
:placeholder="item.placeholder" readonly :required="item.required === 1" @click="handleShowPicker" /> clearable
<van-popup v-model:show="showPicker" destroy-on-close position="bottom"> is-link
<van-date-picker v-model="pickerValue" :title="item.nodeName" :columns-type="columnsType" :label="item.nodeName"
@cancel="showPicker = false" @confirm="onConfirm" /> name="datePicker"
:placeholder="item.placeholder"
readonly
:required="item.required === 1"
@click="handleShowPicker" />
<van-popup v-model:show="showPicker"
destroy-on-close
position="bottom">
<van-date-picker v-model="pickerValue"
:columns-type="columnsType"
:title="item.nodeName"
@cancel="showPicker = false"
@confirm="onConfirm" />
</van-popup> </van-popup>
</div> </div>
</template> </template>
......
...@@ -4,7 +4,7 @@ import { computed, ref } from "vue"; ...@@ -4,7 +4,7 @@ import { computed, ref } from "vue";
const props = defineProps({ const props = defineProps({
item: { item: {
type: Object, type: Object,
default: () => { }, default: () => {},
}, },
}); });
...@@ -12,8 +12,23 @@ const emit = defineEmits(["update"]); ...@@ -12,8 +12,23 @@ const emit = defineEmits(["update"]);
const showPicker = ref(false); const showPicker = ref(false);
const pickerValue = ref([]); const pickerValue = ref([]);
const displayValueText = computed({
get: () => String(props.item.valueText ?? ""),
set: (v: string) => {
if (!v) {
emit("update", { value: "", valueText: "", valueKey: "" });
return;
}
emit("update", {
value: String(props.item.value ?? ""),
valueText: v,
valueKey: String(props.item.valueKey ?? ""),
});
},
});
//页面加载时初始化数据 // 页面加载时初始化数据
onMounted(() => { onMounted(() => {
initData(); initData();
}); });
...@@ -32,11 +47,11 @@ function initData() { ...@@ -32,11 +47,11 @@ function initData() {
// 计算属性 // 计算属性
const columnsList = computed(() => { const columnsList = computed(() => {
const optionsList = JSON.parse(props.item.options || '[]').map(item => { const optionsList = JSON.parse(props.item.options || "[]").map(item => {
const valueList = (item || '').split('-'); const valueList = (item || "").split("-");
return { return {
text: valueList[1] || '', text: valueList[1] || "",
value: valueList[0] || '', value: valueList[0] || "",
}; };
}); });
return optionsList; return optionsList;
...@@ -45,21 +60,34 @@ const columnsList = computed(() => { ...@@ -45,21 +60,34 @@ const columnsList = computed(() => {
function onConfirm() { function onConfirm() {
const picker = pickerValue.value && pickerValue.value.length > 0 ? pickerValue.value[0] : ""; const picker = pickerValue.value && pickerValue.value.length > 0 ? pickerValue.value[0] : "";
showPicker.value = false; showPicker.value = false;
const ObjectItem = columnsList.value.find(item => item.value == picker) || {}; const selected = columnsList.value.find((col) => col.value === picker) || {};
props.item.valueText = ObjectItem.text || ''; emit("update", {
props.item.valueKey = ObjectItem.value || ''; value: picker || "",
props.item.value = picker || ''; valueText: selected.text || "",
emit("update", picker); valueKey: selected.value || "",
});
} }
</script> </script>
<template> <template>
<div> <div>
<van-field v-model="item.valueText" clearable is-link :label="item.nodeName" name="datePicker" <van-field v-model="displayValueText"
:placeholder="item.placeholder" readonly :required="item.required === 1" @click="showPicker = true" /> clearable
<van-popup v-model:show="showPicker" destroy-on-close position="bottom"> is-link
<van-picker v-model="pickerValue" :columns="columnsList" :title="item.nodeName" @cancel="showPicker = false" :label="item.nodeName"
name="datePicker"
:placeholder="item.placeholder"
readonly
:required="item.required === 1"
@click="showPicker = true" />
<van-popup v-model:show="showPicker"
destroy-on-close
position="bottom">
<van-picker v-model="pickerValue"
:columns="columnsList"
:title="item.nodeName"
@cancel="showPicker = false"
@confirm="onConfirm" /> @confirm="onConfirm" />
</van-popup> </van-popup>
</div> </div>
......
...@@ -50,8 +50,8 @@ defineProps<{ ...@@ -50,8 +50,8 @@ defineProps<{
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
"update:show": [value: boolean];
confirm: []; confirm: [];
"update:show": [value: boolean];
}>(); }>();
function close() { function close() {
...@@ -109,9 +109,9 @@ function onConfirm() { ...@@ -109,9 +109,9 @@ function onConfirm() {
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
pointer-events: none;
object-fit: cover; object-fit: cover;
object-position: top center; object-position: top center;
pointer-events: none;
} }
.logout-confirm__hero { .logout-confirm__hero {
......
...@@ -20,7 +20,6 @@ const checkTag = computed(() => { ...@@ -20,7 +20,6 @@ const checkTag = computed(() => {
case 3: { case 3: {
return { text: "检测完成", bg: "#e9f9f1", color: "#2cca74" }; return { text: "检测完成", bg: "#e9f9f1", color: "#2cca74" };
} }
case 4:
default: { default: {
return { text: "已取消", bg: "#f2f3f5", color: "#969799" }; return { text: "已取消", bg: "#f2f3f5", color: "#969799" };
} }
...@@ -56,7 +55,9 @@ const auditTag = computed(() => { ...@@ -56,7 +55,9 @@ const auditTag = computed(() => {
<van-tag v-if="auditTag" <van-tag v-if="auditTag"
class="wo-tag" class="wo-tag"
:style="{ background: auditTag.bg, color: auditTag.color }"> :style="{ background: auditTag.bg, color: auditTag.color }">
<van-icon class="wo-tag__icon" :color="auditTag.color" :name="auditTag.icon" /> <van-icon class="wo-tag__icon"
:color="auditTag.color"
:name="auditTag.icon" />
{{ auditTag.text }} {{ auditTag.text }}
</van-tag> </van-tag>
</div> </div>
......
...@@ -6,6 +6,7 @@ import { Defaults, Request } from "glsk-toolkit"; ...@@ -6,6 +6,7 @@ import { Defaults, Request } from "glsk-toolkit";
import { showToast } from "vant"; import { showToast } from "vant";
import { CONFIG_CACHE_KEY, CONFIG_CENTER_URL, TOKEN_KEY } from "./constants"; import { CONFIG_CACHE_KEY, CONFIG_CENTER_URL, TOKEN_KEY } from "./constants";
const defaultBaseURL = import.meta.env.VITE_API_BASE_URL ?? ""; const defaultBaseURL = import.meta.env.VITE_API_BASE_URL ?? "";
let config: Record<string, unknown> = {}; let config: Record<string, unknown> = {};
...@@ -45,11 +46,11 @@ export function getRequestApi(): null | Request { ...@@ -45,11 +46,11 @@ export function getRequestApi(): null | Request {
*/ */
function initRequestInstance(cfg: Record<string, unknown>): void { function initRequestInstance(cfg: Record<string, unknown>): void {
const apiBaseUrl = (( const apiBaseUrl = ((
(cfg.apiEnv as { baseURL?: string; baseUrl?: string } | undefined)?.baseURL ?? (cfg.apiEnv as undefined | { baseURL?: string; baseUrl?: string })?.baseURL ??
(cfg.apiEnv as { baseURL?: string; baseUrl?: string } | undefined)?.baseUrl ?? (cfg.apiEnv as undefined | { baseURL?: string; baseUrl?: string })?.baseUrl ??
cfg.apiBaseUrl ?? cfg.apiBaseUrl ??
(cfg.gsc as { baseUrl?: string; baseURL?: string } | undefined)?.baseUrl ?? (cfg.gsc as undefined | { baseUrl?: string; baseURL?: string })?.baseUrl ??
(cfg.gsc as { baseUrl?: string; baseURL?: string } | undefined)?.baseURL (cfg.gsc as undefined | { baseUrl?: string; baseURL?: string })?.baseURL
) as string | undefined); ) as string | undefined);
const baseUrl = apiBaseUrl || defaultBaseURL; const baseUrl = apiBaseUrl || defaultBaseURL;
......
import { createRouter, createWebHistory } from "vue-router"; import { createRouter, createWebHistory } from "vue-router";
import { closeToast, showLoadingToast } from "vant";
import { LOGIN_REDIRECT_KEY } from "@/config/constants"; import { LOGIN_REDIRECT_KEY } from "@/config/constants";
import { useUserStore } from "@stores/modules/user.ts";
import { closeToast, showLoadingToast } from "vant";
import routes from "./routes.ts"; import routes from "./routes.ts";
import { useUserStore } from "@stores/modules/user.ts";
const ROUTE_LOADING_DELAY_MS = 200; const ROUTE_LOADING_DELAY_MS = 200;
let routeLoadingTimer: ReturnType<typeof setTimeout> | undefined; let routeLoadingTimer: ReturnType<typeof setTimeout> | undefined;
...@@ -22,7 +21,7 @@ const router = createRouter({ ...@@ -22,7 +21,7 @@ const router = createRouter({
}); });
// 不需要登录的白名单路由 // 不需要登录的白名单路由
const WHITE_LIST: string[] = ["/login"]; const WHITE_LIST = new Set(["/inspect-detail", "/inspect-report", "/login"]);
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
const userStore = useUserStore(); const userStore = useUserStore();
...@@ -63,7 +62,7 @@ router.beforeEach((to, from, next) => { ...@@ -63,7 +62,7 @@ router.beforeEach((to, from, next) => {
} }
// 2. 没有 token 的情况 // 2. 没有 token 的情况
if (WHITE_LIST.includes(to.path)) { if (WHITE_LIST.has(to.path)) {
next(); next();
return; return;
} }
......
...@@ -88,6 +88,33 @@ const routes: RouteRecordRaw[] = [ ...@@ -88,6 +88,33 @@ const routes: RouteRecordRaw[] = [
], ],
}, },
{ {
path: "/car-detail/:id",
name: "CarDetail",
component: () => import("@views/car-detail/index.vue"),
meta: {
title: "车辆详情",
showTabBar: false,
},
},
{
path: "/inspect-report",
name: "InspectReport",
component: () => import("@views/inspect-report/index.vue"),
meta: {
title: "检测报告",
showTabBar: false,
},
},
{
path: "/inspect-detail",
name: "InspectDetail",
component: () => import("@views/inspect-detail/index.vue"),
meta: {
title: "检测详情",
showTabBar: false,
},
},
{
path: "/:pathMatch(.*)*", path: "/:pathMatch(.*)*",
name: "NotFound", name: "NotFound",
component: () => import("@views/404/index.vue"), component: () => import("@views/404/index.vue"),
......
import { defineStore } from "pinia"; import { computed, ref } from "vue";
import { ref, computed } from "vue";
import { logout as requestAuthLogout } from "@/api/modules/user"; import { logout as requestAuthLogout } from "@/api/modules/user";
import { LOGIN_REDIRECT_KEY, TOKEN_KEY } from "@/config/constants"; import { LOGIN_REDIRECT_KEY, TOKEN_KEY } from "@/config/constants";
import { notifyHostLogout } from "@/utils/webviewBridge"; import { notifyHostLogout } from "@/utils/webviewBridge";
import { defineStore } from "pinia";
export interface UserInfo { export interface UserInfo {
id: number; id: number;
...@@ -16,7 +16,7 @@ export const useUserStore = defineStore( ...@@ -16,7 +16,7 @@ export const useUserStore = defineStore(
"user", "user",
() => { () => {
const token = ref<string>(""); const token = ref<string>("");
const userInfo = ref<UserInfo | null>(null); const userInfo = ref<null | UserInfo>(null);
const isLoggedIn = computed(() => !!token.value); const isLoggedIn = computed(() => !!token.value);
const username = computed(() => userInfo.value?.nickname ?? ""); const username = computed(() => userInfo.value?.nickname ?? "");
......
import type { RouteMeta } from "vue-router";
declare module "vue-router" { declare module "vue-router" {
interface RouteMeta { interface RouteMeta {
...@@ -14,8 +13,8 @@ declare module "vue-router" { ...@@ -14,8 +13,8 @@ declare module "vue-router" {
declare global { declare global {
interface Window { interface Window {
__APP_INFO__: { __APP_INFO__: {
version: string;
buildTime: string; buildTime: string;
version: string;
}; };
} }
} }
......
import type { InspectionNode, LeafNodeRecord } from "@/api"; import type { InspectionNode, InspectionResultVO, LeafNodeRecord } from "@/api";
/** 检测评分:骨架/内饰等级选项(与 ScoreForm 共用) */ /** 检测评分:骨架/内饰等级选项(与 ScoreForm 共用) */
export const SCORE_RATING_OPTIONS = ["A", "B", "C", "D"] as const; export const SCORE_RATING_OPTIONS = ["A", "B", "C", "D"] as const;
...@@ -10,6 +10,8 @@ export interface SubTab { ...@@ -10,6 +10,8 @@ export interface SubTab {
nodeId?: number; nodeId?: number;
/** 该二级项下的叶子节点列表(nodeType=3) */ /** 该二级项下的叶子节点列表(nodeType=3) */
leafNodes?: InspectionNode[]; leafNodes?: InspectionNode[];
/** 二级项节点上的检测结果(与接口一致,进度/勾选优先据此判断) */
inspectionResultVO?: InspectionResultVO;
/** 二级项自身的完成标志:0 未完成,1 已完成 */ /** 二级项自身的完成标志:0 未完成,1 已完成 */
completedFlag?: 0 | 1; completedFlag?: 0 | 1;
} }
...@@ -21,6 +23,11 @@ export interface BigModule { ...@@ -21,6 +23,11 @@ export interface BigModule {
/** 是否存在二级分组 Tab;false 表示子节点直接为叶子(nodeType=3),不展示二级 Tab */ /** 是否存在二级分组 Tab;false 表示子节点直接为叶子(nodeType=3),不展示二级 Tab */
hasSecondaryTabs?: boolean; hasSecondaryTabs?: boolean;
subTabs: SubTab[]; subTabs: SubTab[];
/**
* 当前大项下二级接口列表维度:total = 列表长度,done = 各节点 inspectionResultVO.completedFlag 统计
* (无二级 Tab、叶子直挂大项时按同一接口返回的叶子条数统计)
*/
secondaryProgress?: { done: number; total: number; };
} }
/** /**
......
import { TOKEN_KEY } from "@/config/constants";
import axios, { AxiosInstance, AxiosResponse } from "axios"; import axios, { AxiosInstance, AxiosResponse } from "axios";
import { showToast } from "vant"; import { showToast } from "vant";
import { TOKEN_KEY } from "@/config/constants";
import { getConfig } from "../config/center"; import { getConfig } from "../config/center";
/** /**
...@@ -58,7 +58,7 @@ const BIZ_CODES_NO_GLOBAL_TOAST = new Set([1000, 1002, 1003, 1010]); ...@@ -58,7 +58,7 @@ const BIZ_CODES_NO_GLOBAL_TOAST = new Set([1000, 1002, 1003, 1010]);
/** 未登录或登录过期 */ /** 未登录或登录过期 */
const BIZ_CODE_UNAUTHORIZED = 1006; const BIZ_CODE_UNAUTHORIZED = 1006;
function normalizeBizCode(code: unknown): number | null { function normalizeBizCode(code: unknown): null | number {
if (code === null || code === undefined || code === "") { if (code === null || code === undefined || code === "") {
return null; return null;
} }
...@@ -82,11 +82,11 @@ function getToken(): string { ...@@ -82,11 +82,11 @@ function getToken(): string {
function resolveBaseURL(): string { function resolveBaseURL(): string {
const cfg = getConfig() as Record<string, unknown>; const cfg = getConfig() as Record<string, unknown>;
const apiBaseUrl = const apiBaseUrl =
((cfg.apiEnv as { baseURL?: string; baseUrl?: string } | undefined)?.baseURL ?? ((cfg.apiEnv as undefined | { baseURL?: string; baseUrl?: string })?.baseURL ??
(cfg.apiEnv as { baseURL?: string; baseUrl?: string } | undefined)?.baseUrl ?? (cfg.apiEnv as undefined | { baseURL?: string; baseUrl?: string })?.baseUrl ??
(cfg.apiBaseUrl as string | undefined) ?? (cfg.apiBaseUrl as string | undefined) ??
(cfg.gsc as { baseUrl?: string; baseURL?: string } | undefined)?.baseUrl ?? (cfg.gsc as undefined | { baseUrl?: string; baseURL?: string })?.baseUrl ??
(cfg.gsc as { baseUrl?: string; baseURL?: string } | undefined)?.baseURL) as (cfg.gsc as undefined | { baseUrl?: string; baseURL?: string })?.baseURL) as
| string | string
| undefined; | undefined;
...@@ -112,7 +112,7 @@ function getInstance(): AxiosInstance { ...@@ -112,7 +112,7 @@ function getInstance(): AxiosInstance {
const token = getToken(); const token = getToken();
if (token) { if (token) {
config.headers = { config.headers = {
...(config.headers || {}), ...config.headers,
Authorization: token, Authorization: token,
} as typeof config.headers; } as typeof config.headers;
} }
......
import { useUserStore } from "@stores/modules/user"; import { useUserStore } from "@stores/modules/user";
type HostMessage = type HostMessage =
| { type: "INIT_TOKEN"; token?: string } | Record<string, unknown>
| { type: "AUTH_TOKEN"; token?: string } | { token?: string; type: "AUTH_TOKEN"; }
| { type: "LOGOUT" } | { token?: string; type: "INIT_TOKEN"; }
| Record<string, unknown>; | { type: "LOGOUT" };
function safeJsonParse(input: unknown): unknown { function safeJsonParse(input: unknown): unknown {
if (typeof input !== "string") return input; if (typeof input !== "string") return input;
...@@ -35,10 +35,10 @@ function stripTokenFromUrl() { ...@@ -35,10 +35,10 @@ function stripTokenFromUrl() {
} }
function postToUniApp(payload: Record<string, unknown>) { function postToUniApp(payload: Record<string, unknown>) {
console.log('pad端postToUniApp', payload); console.log("pad端postToUniApp", payload);
const w = window as unknown as { const w = window as unknown as {
uni?: { postMessage?: (args: { data: unknown }) => void };
parent?: Window; parent?: Window;
uni?: { postMessage?: (args: { data: unknown }) => void };
}; };
const doPost = () => { const doPost = () => {
...@@ -61,7 +61,7 @@ function postToUniApp(payload: Record<string, unknown>) { ...@@ -61,7 +61,7 @@ function postToUniApp(payload: Record<string, unknown>) {
doPost(); doPost();
} else { } else {
// 等待 UniAppJSBridgeReady 事件后再发送 // 等待 UniAppJSBridgeReady 事件后再发送
document.addEventListener('UniAppJSBridgeReady', doPost, { once: true }); document.addEventListener("UniAppJSBridgeReady", doPost, { once: true });
} }
} }
......
...@@ -396,7 +396,7 @@ defineExpose({ validate, getCompleteInspectionPayload }); ...@@ -396,7 +396,7 @@ defineExpose({ validate, getCompleteInspectionPayload });
.score-section { .score-section {
box-sizing: border-box; box-sizing: border-box;
padding: 14px 16px; padding: 14px 16px;
background: #ffffff; background: #fff;
border-radius: 8px; border-radius: 8px;
opacity: 1; opacity: 1;
} }
...@@ -433,7 +433,7 @@ defineExpose({ validate, getCompleteInspectionPayload }); ...@@ -433,7 +433,7 @@ defineExpose({ validate, getCompleteInspectionPayload });
padding: 0 6px; padding: 0 6px;
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
color: #333333; color: #333;
text-align: center; text-align: center;
appearance: none; appearance: none;
background: #fff; background: #fff;
...@@ -462,8 +462,8 @@ defineExpose({ validate, getCompleteInspectionPayload }); ...@@ -462,8 +462,8 @@ defineExpose({ validate, getCompleteInspectionPayload });
.score-ref-icon { .score-ref-icon {
display: block; display: block;
height: 16px;
width: auto; width: auto;
height: 16px;
} }
.score-slider-wrap { .score-slider-wrap {
...@@ -504,8 +504,8 @@ defineExpose({ validate, getCompleteInspectionPayload }); ...@@ -504,8 +504,8 @@ defineExpose({ validate, getCompleteInspectionPayload });
height: 40px; height: 40px;
font-size: 16px; font-size: 16px;
font-weight: 600; font-weight: 600;
cursor: pointer;
color: #999; color: #999;
cursor: pointer;
background: #f7f8fa; background: #f7f8fa;
border: 1px solid #e8e8e8; border: 1px solid #e8e8e8;
border-radius: 8px; border-radius: 8px;
...@@ -520,11 +520,11 @@ defineExpose({ validate, getCompleteInspectionPayload }); ...@@ -520,11 +520,11 @@ defineExpose({ validate, getCompleteInspectionPayload });
.rating-btn-check { .rating-btn-check {
position: absolute; position: absolute;
top: -3px; top: -3px;
right: 0px; right: 0;
width: 14px; width: 14px;
height: 14px; height: 14px;
object-fit: contain;
pointer-events: none; pointer-events: none;
object-fit: contain;
} }
} }
......
import type { BigModule, SubTab } from "@/types/views/car-detail";
import type {
CompleteInspectionResultData,
InspectionNode,
InspectionResultVO,
InspectionTemplateDefaultData,
} from "@api";
import type { RouteLocationNormalizedLoaded } from "vue-router"; import type { RouteLocationNormalizedLoaded } from "vue-router";
import type { BigModule } from "@/types/views/car-detail"; import { computed, ref } from "vue";
import type { CompleteInspectionResultData, InspectionResultVO, InspectionTemplateDefaultData } from "@api";
import { import {
applyResolvedInitialValuesToLeafNodes, applyResolvedInitialValuesToLeafNodes,
...@@ -9,7 +16,6 @@ import { ...@@ -9,7 +16,6 @@ import {
getInspectionRootNodes, getInspectionRootNodes,
getInspectionTemplateDefault, getInspectionTemplateDefault,
} from "@api"; } from "@api";
import { computed, ref } from "vue";
import { showToast } from "vant"; import { showToast } from "vant";
/** 检测评分大项的固定 key(非接口返回,手动追加至大项末尾) */ /** 检测评分大项的固定 key(非接口返回,手动追加至大项末尾) */
...@@ -25,6 +31,33 @@ export function isCompletedFlagFieldDone(flag: unknown): boolean { ...@@ -25,6 +31,33 @@ export function isCompletedFlagFieldDone(flag: unknown): boolean {
return flag === 1 || String(flag ?? "") === "1"; return flag === 1 || String(flag ?? "") === "1";
} }
/** 二级 Tab 是否完成:优先用接口节点上的 inspectionResultVO,无则回退 completedFlag(如整页叶子合成 Tab) */
export function isSubTabMarkCompleted(sub: SubTab): boolean {
if (sub.inspectionResultVO !== null && sub.inspectionResultVO !== undefined) {
return isInspectionVoCompleted(sub.inspectionResultVO);
}
return isCompletedFlagFieldDone(sub.completedFlag);
}
/** 二级子节点列表:总进度 = 列表长度,已完成 = 各节点 inspectionResultVO.completedFlag */
function computeSecondaryProgressFromList(list: InspectionNode[]): { done: number; total: number; } {
const nodes = Array.isArray(list) ? list : [];
return {
total: nodes.length,
done: nodes.filter((n) => isInspectionVoCompleted(n.inspectionResultVO)).length,
};
}
function secondaryProgressOrFallback(module: BigModule): { done: number; total: number; } {
if (module.secondaryProgress) return module.secondaryProgress;
const subs = module.subTabs;
if (subs.length === 0) return { total: 0, done: 0 };
return {
total: subs.length,
done: subs.filter((s) => isSubTabMarkCompleted(s)).length,
};
}
/** 提交评分返回里是否仍有未完成项(`firstUncompletedNodeId` 有有效值) */ /** 提交评分返回里是否仍有未完成项(`firstUncompletedNodeId` 有有效值) */
export function hasCompleteInspectionUncompletedHint(data: CompleteInspectionResultData | undefined): boolean { export function hasCompleteInspectionUncompletedHint(data: CompleteInspectionResultData | undefined): boolean {
if (!data) return false; if (!data) return false;
...@@ -60,17 +93,18 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) { ...@@ -60,17 +93,18 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) {
bigModules.value.filter((module) => module.key !== SCORE_BIG_KEY) bigModules.value.filter((module) => module.key !== SCORE_BIG_KEY)
); );
const flattenedMainSubTabs = computed(() => /** 检测进度:仅当前大项 — 分母为二级接口列表长度,分子为各二级节点 inspectionResultVO.completedFlag */
mainInspectionBigModules.value.flatMap((module) => module.subTabs) const progressTotal = computed(() => {
); const m = activeBigModule.value;
if (!m || m.key === SCORE_BIG_KEY) return 0;
const progressTotal = computed(() => flattenedMainSubTabs.value.length); return secondaryProgressOrFallback(m).total;
});
const progressDone = computed(() =>
flattenedMainSubTabs.value.filter((subTab) => isCompletedFlagFieldDone(subTab.completedFlag)).length
);
const remainingSubTabCount = computed(() => progressTotal.value - progressDone.value); const progressDone = computed(() => {
const m = activeBigModule.value;
if (!m || m.key === SCORE_BIG_KEY) return 0;
return secondaryProgressOrFallback(m).done;
});
const activeSubTab = computed( const activeSubTab = computed(
() => () =>
...@@ -78,6 +112,16 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) { ...@@ -78,6 +112,16 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) {
activeBigModule.value?.subTabs[0] activeBigModule.value?.subTabs[0]
); );
/** 有真实二级 Tab 时,当前是否为该大项的最后一个二级项(用于底部主按钮「提交检测内容」) */
const isLastSubTabOfActiveBigModule = computed(() => {
const m = activeBigModule.value;
if (!m || m.hasSecondaryTabs !== true) return false;
const subs = m.subTabs;
if (subs.length === 0) return true;
const idx = subs.findIndex((s) => s.key === activeSubKey.value);
return idx !== -1 && idx === subs.length - 1;
});
const currentLeafNodes = computed(() => activeSubTab.value?.leafNodes ?? []); const currentLeafNodes = computed(() => activeSubTab.value?.leafNodes ?? []);
async function initializeInspection() { async function initializeInspection() {
...@@ -136,13 +180,17 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) { ...@@ -136,13 +180,17 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) {
if (!force && targetBigModule.subTabs.length > 0) { if (!force && targetBigModule.subTabs.length > 0) {
if (syncSelection) { if (syncSelection) {
activeSubKey.value = targetBigModule.subTabs[0]!.key; const firstSub = targetBigModule.subTabs[0];
if (firstSub) {
activeSubKey.value = firstSub.key;
}
} }
return; return;
} }
const childLevelNodes = await getInspectionChildren(bigModuleKey, taskId.value); const childLevelNodes = await getInspectionChildren(bigModuleKey, taskId.value);
const list = Array.isArray(childLevelNodes) ? childLevelNodes : []; const list = Array.isArray(childLevelNodes) ? childLevelNodes : [];
targetBigModule.secondaryProgress = computeSecondaryProgressFromList(list);
const firstChild = list[0]; const firstChild = list[0];
const isDirectLeafChildren = firstChild !== undefined && firstChild.nodeType === 3; const isDirectLeafChildren = firstChild !== undefined && firstChild.nodeType === 3;
...@@ -173,12 +221,16 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) { ...@@ -173,12 +221,16 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) {
label: node.nodeName, label: node.nodeName,
nodeId: node.id, nodeId: node.id,
leafNodes: applyResolvedInitialValuesToLeafNodes(node.childrenNodes, templateDefaultData), leafNodes: applyResolvedInitialValuesToLeafNodes(node.childrenNodes, templateDefaultData),
inspectionResultVO: node.inspectionResultVO,
completedFlag: isInspectionVoCompleted(node.inspectionResultVO) ? 1 : 0, completedFlag: isInspectionVoCompleted(node.inspectionResultVO) ? 1 : 0,
})); }));
} }
if (targetBigModule.subTabs.length > 0 && syncSelection) { if (targetBigModule.subTabs.length > 0 && syncSelection) {
activeSubKey.value = targetBigModule.subTabs[0]!.key; const firstSub = targetBigModule.subTabs[0];
if (firstSub) {
activeSubKey.value = firstSub.key;
}
} }
} catch (error) { } catch (error) {
console.error("加载二级项失败:", error); console.error("加载二级项失败:", error);
...@@ -214,30 +266,45 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) { ...@@ -214,30 +266,45 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) {
return false; return false;
} }
function advanceInspectionStep() { async function advanceToNextMainInspectionModule() {
const activeModule = activeBigModule.value;
if (!activeModule) return;
const subTabsOfActive = activeModule.subTabs;
const activeSubIndex = subTabsOfActive.findIndex((subTab) => subTab.key === activeSubKey.value);
if (activeSubIndex < subTabsOfActive.length - 1) {
activeSubKey.value = subTabsOfActive[activeSubIndex + 1]!.key;
return;
}
const mains = mainInspectionBigModules.value; const mains = mainInspectionBigModules.value;
const activeMainIndex = mains.findIndex((module) => module.key === activeBigKey.value); const activeMainIndex = mains.findIndex((module) => module.key === activeBigKey.value);
if (activeMainIndex < mains.length - 1) { if (activeMainIndex < mains.length - 1) {
const nextMain = mains[activeMainIndex + 1]!; const nextMain = mains[activeMainIndex + 1];
if (!nextMain) {
return;
}
activeBigKey.value = nextMain.key; activeBigKey.value = nextMain.key;
loadSubTabsForBigModule(nextMain.key, true, true).then(() => { await loadSubTabsForBigModule(nextMain.key, true, true);
activeSubKey.value = nextMain.subTabs[0]?.key ?? ""; activeSubKey.value = nextMain.subTabs[0]?.key ?? "";
}); return;
} else { }
activeBigKey.value = SCORE_BIG_KEY; activeBigKey.value = SCORE_BIG_KEY;
activeSubKey.value = ""; activeSubKey.value = "";
} }
/**
* 保存(nextFlag)成功后的跳转:
* - 有二级且非最后一个二级 → 仅切到同一大项下一二级;
* - 有二级且最后一个二级,或无二级(整大项一屏)→ 进入下一个检测大项(或检测评分)
*/
async function advanceInspectionStep() {
const activeModule = activeBigModule.value;
if (!activeModule) return;
if (activeModule.hasSecondaryTabs === true) {
const subTabs = activeModule.subTabs;
const activeSubIndex = subTabs.findIndex((subTab) => subTab.key === activeSubKey.value);
if (activeSubIndex !== -1 && activeSubIndex < subTabs.length - 1) {
const nextSub = subTabs[activeSubIndex + 1];
if (nextSub) {
activeSubKey.value = nextSub.key;
}
return;
}
}
await advanceToNextMainInspectionModule();
} }
function onOpenModulePicker() { function onOpenModulePicker() {
...@@ -258,7 +325,7 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) { ...@@ -258,7 +325,7 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) {
mainInspectionBigModules, mainInspectionBigModules,
progressTotal, progressTotal,
progressDone, progressDone,
remainingSubTabCount, isLastSubTabOfActiveBigModule,
activeSubTab, activeSubTab,
currentLeafNodes, currentLeafNodes,
initializeInspection, initializeInspection,
......
import type { BigModule, CustomizeFormValidateNode, CustomizeFormValidateResult } from "@/types/views/car-detail"; import type { BigModule, CustomizeFormValidateNode, CustomizeFormValidateResult } from "@/types/views/car-detail";
import type { LeafNodeRecord } from "@api"; import type { LeafNodeRecord } from "@api";
import type { Ref } from "vue";
import type { InspectModulesReturn } from "./useInspectModules";
import { ref } from "vue";
import { useRouter } from "vue-router";
import customizeForm from "@/components/CustomizeForm/Index.vue"; import customizeForm from "@/components/CustomizeForm/Index.vue";
import { import {
completeInspection, completeInspection,
saveInspectionRecord, saveInspectionRecord,
} from "@api"; } from "@api";
import { isRequestFailureAlreadyHandled } from "@utils/request"; import { isRequestFailureAlreadyHandled } from "@utils/request";
import { ref, type Ref } from "vue";
import { useRouter } from "vue-router";
import { showToast } from "vant"; import { showToast } from "vant";
import ScoreForm from "../components/ScoreForm.vue"; import ScoreForm from "../components/ScoreForm.vue";
import { import {
hasCompleteInspectionUncompletedHint, hasCompleteInspectionUncompletedHint,
SCORE_BIG_KEY,
type InspectModulesReturn, SCORE_BIG_KEY
} from "./useInspectModules"; } from "./useInspectModules";
function buildInspectionSavePayload( function buildInspectionSavePayload(
...@@ -114,7 +119,7 @@ export function useInspectSubmit( ...@@ -114,7 +119,7 @@ export function useInspectSubmit(
if (modules.activeBigKey.value !== SCORE_BIG_KEY) { if (modules.activeBigKey.value !== SCORE_BIG_KEY) {
await modules.loadSubTabsForBigModule(modules.activeBigKey.value, false, true); await modules.loadSubTabsForBigModule(modules.activeBigKey.value, false, true);
} }
modules.advanceInspectionStep(); await modules.advanceInspectionStep();
} catch (error) { } catch (error) {
if (!isRequestFailureAlreadyHandled(error)) { if (!isRequestFailureAlreadyHandled(error)) {
showToast("保存失败,请重试"); showToast("保存失败,请重试");
...@@ -152,14 +157,18 @@ export function useInspectSubmit( ...@@ -152,14 +157,18 @@ export function useInspectSubmit(
); );
if (activeSubIndex > 0) { if (activeSubIndex > 0) {
const prevSubKey = subTabsOfActive[activeSubIndex - 1]!.key; const prevSub = subTabsOfActive[activeSubIndex - 1];
const prevSubKey = prevSub?.key ?? "";
await modules.loadSubTabsForBigModule(modules.activeBigKey.value, false, true); await modules.loadSubTabsForBigModule(modules.activeBigKey.value, false, true);
modules.activeSubKey.value = prevSubKey; modules.activeSubKey.value = prevSubKey;
} else { } else {
const mains = modules.mainInspectionBigModules.value; const mains = modules.mainInspectionBigModules.value;
const activeMainIndex = mains.findIndex((m) => m.key === modules.activeBigKey.value); const activeMainIndex = mains.findIndex((m) => m.key === modules.activeBigKey.value);
if (activeMainIndex > 0) { if (activeMainIndex > 0) {
const previousMain = mains[activeMainIndex - 1]!; const previousMain = mains[activeMainIndex - 1];
if (!previousMain) {
return;
}
modules.activeBigKey.value = previousMain.key; modules.activeBigKey.value = previousMain.key;
await modules.loadSubTabsForBigModule(previousMain.key, true, true); await modules.loadSubTabsForBigModule(previousMain.key, true, true);
modules.activeSubKey.value = modules.activeSubKey.value =
......
...@@ -72,13 +72,13 @@ ...@@ -72,13 +72,13 @@
<div v-for="subTab in activeBigModule?.subTabs" <div v-for="subTab in activeBigModule?.subTabs"
:key="subTab.key" :key="subTab.key"
class="subtab-item" class="subtab-item"
:class="{ active: subTab.key === activeSubKey, completed: isCompletedFlagFieldDone(subTab.completedFlag) }" :class="{ active: subTab.key === activeSubKey, completed: isSubTabMarkCompleted(subTab) }"
@click="onSelectSubTab(subTab.key)"> @click="onSelectSubTab(subTab.key)">
{{ subTab.label }} <van-icon v-if="isSubTabMarkCompleted(subTab)"
<van-icon v-if="isCompletedFlagFieldDone(subTab.completedFlag)"
class="subtab-done-icon" class="subtab-done-icon"
color="#27CD5A" color="#27CD5A"
name="checked" /> name="checked" />
{{ subTab.label }}
</div> </div>
</div> </div>
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
{{ {{
activeBigModule?.hasSecondaryTabs === false activeBigModule?.hasSecondaryTabs === false
? "完成检测" ? "完成检测"
: remainingSubTabCount === 1 : isLastSubTabOfActiveBigModule
? "提交检测内容" ? "提交检测内容"
: "下一步" : "下一步"
}} }}
...@@ -135,34 +135,55 @@ ...@@ -135,34 +135,55 @@
</template> </template>
</div> </div>
<!-- 大项选择弹窗 --> <!-- 大项选择弹窗:列表仅高亮待定项,点确定后才切换模块 -->
<van-action-sheet v-model:show="showModulePicker" <van-action-sheet v-model:show="showModulePicker"
title="选择检测模块"> title="选择检测模块">
<div class="module-picker-sheet">
<div class="module-picker-list"> <div class="module-picker-list">
<div v-for="bigModule in bigModules" <div v-for="bigModule in bigModules"
:key="bigModule.key" :key="bigModule.key"
class="module-picker-item" class="module-picker-item"
:class="{ selected: bigModule.key === activeBigKey }" :class="{ selected: bigModule.key === pendingModuleKey }"
@click="onSelectBigModule(bigModule)"> @click="setPendingModuleKey(bigModule.key)">
<span class="picker-label">{{ bigModule.label }}</span> <span class="picker-label">{{ bigModule.label }}</span>
<van-icon v-if="bigModule.key === activeBigKey" <van-icon v-if="bigModule.key === pendingModuleKey"
color="#477ffe" color="#477ffe"
name="success" name="success"
size="16" /> size="16" />
</div> </div>
</div> </div>
<div class="module-picker-footer">
<van-button class="module-picker-btn-cancel"
plain
round
type="primary"
@click="onCancelModulePicker">
取消
</van-button>
<van-button block
class="module-picker-btn-confirm"
color="#477ffe"
round
type="primary"
@click="onConfirmModulePicker">
确定
</van-button>
</div>
</div>
</van-action-sheet> </van-action-sheet>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue"; import type { BigModule } from "@/types/views/car-detail";
import { onMounted, ref, watch } from "vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import customizeForm from "@/components/CustomizeForm/Index.vue"; import customizeForm from "@/components/CustomizeForm/Index.vue";
import ScoreForm from "./components/ScoreForm.vue"; import ScoreForm from "./components/ScoreForm.vue";
import { isCompletedFlagFieldDone, SCORE_BIG_KEY, useInspectModules } from "./composables/useInspectModules"; import { isSubTabMarkCompleted, SCORE_BIG_KEY, useInspectModules } from "./composables/useInspectModules";
import { useInspectSubmit } from "./composables/useInspectSubmit"; import { useInspectSubmit } from "./composables/useInspectSubmit";
const route = useRoute(); const route = useRoute();
...@@ -192,13 +213,35 @@ const { ...@@ -192,13 +213,35 @@ const {
showInspectionProgressBar, showInspectionProgressBar,
progressTotal, progressTotal,
progressDone, progressDone,
remainingSubTabCount, isLastSubTabOfActiveBigModule,
activeSubTab, activeSubTab,
currentLeafNodes, currentLeafNodes,
initializeInspection, initializeInspection,
onOpenModulePicker, onOpenModulePicker,
} = modules; } = modules;
/** 弹窗内待确认的模块 key,打开时与当前 active 同步 */
const pendingModuleKey = ref<number | string>("");
function setPendingModuleKey(key: number | string) {
pendingModuleKey.value = key;
}
watch(showModulePicker, (open: boolean) => {
if (open) pendingModuleKey.value = activeBigKey.value;
});
function onCancelModulePicker() {
showModulePicker.value = false;
}
async function onConfirmModulePicker() {
const list: BigModule[] = bigModules.value;
const picked = list.find((m) => m.key === pendingModuleKey.value);
if (picked) await onSelectBigModule(picked);
else showModulePicker.value = false;
}
onMounted(() => { onMounted(() => {
initializeInspection(); initializeInspection();
}); });
...@@ -221,7 +264,7 @@ onMounted(() => { ...@@ -221,7 +264,7 @@ onMounted(() => {
// ===== 顶部区(透明,跟随页面背景) ===== // ===== 顶部区(透明,跟随页面背景) =====
.inspect-top { .inspect-top {
flex-shrink: 0; flex-shrink: 0;
padding: calc(env(safe-area-inset-top) + 12px) $spacing-base 12px; padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
} }
.inspect-nav { .inspect-nav {
...@@ -251,8 +294,8 @@ onMounted(() => { ...@@ -251,8 +294,8 @@ onMounted(() => {
} }
.nav-module-arrow { .nav-module-arrow {
color: #333333;
font-weight: 600; font-weight: 600;
color: #333;
transition: $transition-fast; transition: $transition-fast;
} }
} }
...@@ -344,7 +387,7 @@ onMounted(() => { ...@@ -344,7 +387,7 @@ onMounted(() => {
display: flex; display: flex;
flex-shrink: 0; flex-shrink: 0;
gap: 10px; gap: 10px;
padding: 10px $spacing-base; padding: 10px 16px;
overflow-x: auto; overflow-x: auto;
background: #fff linear-gradient(180deg, #e8efff 0%, #fff 100%); background: #fff linear-gradient(180deg, #e8efff 0%, #fff 100%);
border-radius: 12px 12px 0 0; border-radius: 12px 12px 0 0;
...@@ -387,14 +430,13 @@ onMounted(() => { ...@@ -387,14 +430,13 @@ onMounted(() => {
.inspect-subtab-scroll { .inspect-subtab-scroll {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
overflow-x: hidden; overflow: hidden auto;
overflow-y: auto;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
} }
// ===== 中间内容区(高度自适应,不独立滚动) ===== // ===== 中间内容区(高度自适应,不独立滚动) =====
.inspect-content { .inspect-content {
padding: 0 $spacing-base $spacing-base; padding: 0 16px 16px;
} }
// ===== 加载状态 ===== // ===== 加载状态 =====
...@@ -434,7 +476,7 @@ onMounted(() => { ...@@ -434,7 +476,7 @@ onMounted(() => {
flex-shrink: 0; flex-shrink: 0;
gap: $spacing-md; gap: $spacing-md;
align-items: center; align-items: center;
padding: 10px $spacing-base calc(10px + env(safe-area-inset-bottom)); padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
background-color: $color-bg-card; background-color: $color-bg-card;
box-shadow: 0 -2px 10px rgb(0 0 0 / 8%); box-shadow: 0 -2px 10px rgb(0 0 0 / 8%);
...@@ -450,15 +492,44 @@ onMounted(() => { ...@@ -450,15 +492,44 @@ onMounted(() => {
// ===== 大项选择弹窗 ===== // ===== 大项选择弹窗 =====
.module-picker-sheet {
display: flex;
flex-direction: column;
max-height: min(70vh, 520px);
}
.module-picker-list { .module-picker-list {
padding: $spacing-sm 0 calc($spacing-sm + env(safe-area-inset-bottom)); flex: 1;
min-height: 0;
padding: $spacing-sm 0;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.module-picker-footer {
display: flex;
flex-shrink: 0;
gap: $spacing-md;
align-items: center;
padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
background-color: $color-bg-card;
box-shadow: 0 -2px 10px rgb(0 0 0 / 8%);
.module-picker-btn-cancel {
flex-shrink: 0;
width: 88px;
}
.module-picker-btn-confirm {
flex: 1;
}
} }
.module-picker-item { .module-picker-item {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 14px $spacing-base; padding: 14px 16px;
cursor: pointer; cursor: pointer;
transition: $transition-fast; transition: $transition-fast;
......
...@@ -216,7 +216,7 @@ void onRefresh(); ...@@ -216,7 +216,7 @@ void onRefresh();
.list-wrap { .list-wrap {
flex: 1; flex: 1;
padding: 12px 12px calc(12px + env(safe-area-inset-bottom)) 12px; padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
overflow: auto; overflow: auto;
overscroll-behavior: contain; overscroll-behavior: contain;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
......
...@@ -143,6 +143,7 @@ async function onRefresh() { ...@@ -143,6 +143,7 @@ async function onRefresh() {
function onStatusChange(status: WorkOrderStatus) { function onStatusChange(status: WorkOrderStatus) {
activeStatus.value = status; activeStatus.value = status;
keyword.value = "";
} }
function startCheck(item: WorkOrderItem) { function startCheck(item: WorkOrderItem) {
...@@ -163,8 +164,11 @@ function viewWorkOrder(item: WorkOrderItem) :void{ ...@@ -163,8 +164,11 @@ function viewWorkOrder(item: WorkOrderItem) :void{
router.push({ name: "WorkOrderDetail", params: { id: item.id } }); router.push({ name: "WorkOrderDetail", params: { id: item.id } });
} }
function viewReport(_item: WorkOrderItem) { function viewReport(item: WorkOrderItem) {
void router.push({ name: "CarList" }); void router.push({
name: "InspectReport",
query: { recordId: item.id },
});
} }
function showRejectReason(_item: WorkOrderItem) { function showRejectReason(_item: WorkOrderItem) {
...@@ -505,13 +509,14 @@ void onRefresh(); ...@@ -505,13 +509,14 @@ void onRefresh();
.card-bottom { .card-bottom {
min-width: 0; min-width: 0;
font-size: 12px; font-size: 12px;
.k { .k {
margin-right: 6px; margin-right: 6px;
color: #999ea8; color: #999ea8;
} }
.v { .v {
color: #666666; color: #666;
} }
} }
......
...@@ -123,13 +123,13 @@ const { ...@@ -123,13 +123,13 @@ const {
min-height: 0 !important; min-height: 0 !important;
padding: 0 !important; padding: 0 !important;
line-height: 1.25 !important; line-height: 1.25 !important;
border: none !important;
background: transparent !important; background: transparent !important;
border: none !important;
} }
&:deep(.login-send-code-btn.van-button--disabled) { &:deep(.login-send-code-btn.van-button--disabled) {
opacity: 1;
background: transparent !important; background: transparent !important;
opacity: 1;
} }
} }
</style> </style>
......
import { ref, watch } from "vue"; import { ref, watch } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { showFailToast, showSuccessToast } from "vant";
import { login, sendSmsCode } from "@/api/modules/user.ts"; import { login, sendSmsCode } from "@/api/modules/user.ts";
import { LOGIN_REDIRECT_KEY } from "@/config/constants";
import { useUserStore } from "@/stores/modules/user.ts"; import { useUserStore } from "@/stores/modules/user.ts";
import { notifyHostToken } from "@/utils/webviewBridge"; import { notifyHostToken } from "@/utils/webviewBridge";
import { showFailToast, showSuccessToast } from "vant";
import { LOGIN_REDIRECT_KEY } from "@/config/constants";
export function useLogin() { export function useLogin() {
const router = useRouter(); const router = useRouter();
...@@ -19,18 +17,18 @@ export function useLogin() { ...@@ -19,18 +17,18 @@ export function useLogin() {
/** 仅数字 + 长度上限;配合 Field type=digit,并兜底粘贴等非数字字符 */ /** 仅数字 + 长度上限;配合 Field type=digit,并兜底粘贴等非数字字符 */
watch(phone, (v) => { watch(phone, (v) => {
const n = v.replace(/\D/g, "").slice(0, 11); const n = v.replaceAll(/\D/g, "").slice(0, 11);
if (n !== v) phone.value = n; if (n !== v) phone.value = n;
}); });
watch(code, (v) => { watch(code, (v) => {
const n = v.replace(/\D/g, "").slice(0, 6); const n = v.replaceAll(/\D/g, "").slice(0, 6);
if (n !== v) code.value = n; if (n !== v) code.value = n;
}); });
const sending = ref(false); const sending = ref(false);
const countdown = ref(0); const countdown = ref(0);
const hasSent = ref(false); const hasSent = ref(false);
let timer: number | null = null; let timer: null | number = null;
const validPhone = (value: string) => /^1\d{10}$/.test(value); const validPhone = (value: string) => /^1\d{10}$/.test(value);
...@@ -51,7 +49,9 @@ export function useLogin() { ...@@ -51,7 +49,9 @@ export function useLogin() {
timer && window.clearInterval(timer); timer && window.clearInterval(timer);
timer = window.setInterval(() => { timer = window.setInterval(() => {
if (countdown.value <= 1) { if (countdown.value <= 1) {
window.clearInterval(timer!); if (timer !== null) {
window.clearInterval(timer);
}
timer = null; timer = null;
countdown.value = 0; countdown.value = 0;
} else { } else {
......
...@@ -7,6 +7,7 @@ import { getInspectDetail } from "@/api/modules/user"; ...@@ -7,6 +7,7 @@ import { getInspectDetail } from "@/api/modules/user";
import LogoutConfirmModal from "@/components/LogoutConfirmModal.vue"; import LogoutConfirmModal from "@/components/LogoutConfirmModal.vue";
import PageTop from "@/components/PageTop.vue"; import PageTop from "@/components/PageTop.vue";
import { useUserStore } from "@/stores"; import { useUserStore } from "@/stores";
import avatarDefault from "@assets/image/avatar.png";
import { showToast } from "vant"; import { showToast } from "vant";
...@@ -39,8 +40,8 @@ const displayPhone = computed(() => ...@@ -39,8 +40,8 @@ const displayPhone = computed(() =>
const displayAvatar = computed(() => const displayAvatar = computed(() =>
userStore.isLoggedIn userStore.isLoggedIn
? inspectAccount.value?.avatar || userStore.userInfo?.avatar || "" ? inspectAccount.value?.avatar || userStore.userInfo?.avatar || avatarDefault
: "" : avatarDefault
); );
async function fetchInspectDetail() { async function fetchInspectDetail() {
...@@ -93,7 +94,7 @@ watch( ...@@ -93,7 +94,7 @@ watch(
<template> <template>
<div class="mine-page"> <div class="mine-page">
<PageTop title="我的"> <PageTop title="我的">
<div class="mine-header"> <div class="mine-header !pb-[24px]">
<div class="user-row"> <div class="user-row">
<van-image class="avatar" <van-image class="avatar"
fit="cover" fit="cover"
...@@ -158,10 +159,10 @@ watch( ...@@ -158,10 +159,10 @@ watch(
@use "@assets/styles/variables" as *; @use "@assets/styles/variables" as *;
.mine-page { .mine-page {
height: calc(100vh - var(--tabbar-height) - env(safe-area-inset-bottom));
overflow: hidden;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: calc(100vh - var(--tabbar-height) - env(safe-area-inset-bottom));
overflow: hidden;
background: #f2f6fb; background: #f2f6fb;
:deep(.page-top) { :deep(.page-top) {
...@@ -170,12 +171,13 @@ watch( ...@@ -170,12 +171,13 @@ watch(
} }
.mine-content { .mine-content {
display: flex;
flex: 1; flex: 1;
flex-direction: column;
overflow: auto; overflow: auto;
overscroll-behavior: contain; overscroll-behavior: contain;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
display: flex;
flex-direction: column;
} }
.mine-header { .mine-header {
...@@ -192,8 +194,6 @@ watch( ...@@ -192,8 +194,6 @@ watch(
flex-shrink: 0; flex-shrink: 0;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background-color: rgb(25 137 250 / 15%);
border: 2px solid rgb(25 137 250 / 25%);
border-radius: 50%; border-radius: 50%;
} }
...@@ -216,8 +216,10 @@ watch( ...@@ -216,8 +216,10 @@ watch(
.avg-card { .avg-card {
padding: 16px; padding: 16px;
margin: 6px 12px 0; margin: 0 12px;
border-radius: 10px; background: linear-gradient(180deg, #1874fe1a 0%, #1883fe00 50%);
border: 1px solid #fff;
border-radius: 12px;
.avg-label { .avg-label {
margin-bottom: 8px; margin-bottom: 8px;
...@@ -242,11 +244,11 @@ watch( ...@@ -242,11 +244,11 @@ watch(
height: 44px; height: 44px;
font-size: 16px; font-size: 16px;
font-weight: 400; font-weight: 400;
color: #222222; color: #222;
background: #ffffff; background: #fff;
border-radius: 8px; border-radius: 8px;
opacity: 1;
box-shadow: none; box-shadow: none;
opacity: 1;
&:active::before { &:active::before {
opacity: 0; opacity: 0;
......
<script setup lang="ts"> <script setup lang="ts">
import type { WorkOrderStatus } from "@/types/views/work-order-common";
import type { import type {
InspectionWORespVO, InspectionWORespVO,
NodeVO, NodeVO,
...@@ -7,7 +8,6 @@ import type { ...@@ -7,7 +8,6 @@ import type {
WorkOrderDetailRemote, WorkOrderDetailRemote,
WorkOrderVehicle, WorkOrderVehicle,
} from "@/types/views/work-order-detail"; } from "@/types/views/work-order-detail";
import type { WorkOrderStatus } from "@/types/views/work-order-common";
import { computed, onMounted, ref } from "vue"; import { computed, onMounted, ref } from "vue";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"@composables/*": ["src/composables/*"] "@composables/*": ["src/composables/*"]
}, },
"resolveJsonModule": true, "resolveJsonModule": true,
"types": ["vite/client"],
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
"allowJs": true, "allowJs": true,
"strict": true, "strict": true,
...@@ -28,8 +29,7 @@ ...@@ -28,8 +29,7 @@
"noUnusedParameters": true, "noUnusedParameters": true,
"noEmit": true, "noEmit": true,
"isolatedModules": true, "isolatedModules": true,
"skipLibCheck": true, "skipLibCheck": true
"types": ["vite/client"]
}, },
"references": [{ "path": "./tsconfig.node.json"}], "references": [{ "path": "./tsconfig.node.json"}],
"include": [ "include": [
......
import { dirname, resolve } from "node:path"; import { dirname, resolve } from "node:path";
import process from "node:process";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
import vue from "@vitejs/plugin-vue"; import vue from "@vitejs/plugin-vue";
import AutoImport from "unplugin-auto-import/vite"; import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { VantResolver } from "unplugin-vue-components/resolvers"; import { VantResolver } from "unplugin-vue-components/resolvers";
import Components from "unplugin-vue-components/vite";
import { defineConfig, loadEnv } from "vite"; import { defineConfig, loadEnv } from "vite";
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
...@@ -72,7 +73,7 @@ export default defineConfig(({ mode }) => { ...@@ -72,7 +73,7 @@ export default defineConfig(({ mode }) => {
chunkFileNames: "assets/js/[name]-[hash].js", chunkFileNames: "assets/js/[name]-[hash].js",
entryFileNames: "assets/js/[name]-[hash].js", entryFileNames: "assets/js/[name]-[hash].js",
assetFileNames: ({ name = "" }) => { assetFileNames: ({ name = "" }) => {
if (/\.(png|jpe?g|gif|svg|webp|ico)$/.test(name)) { if (/\.(?:png|jpe?g|gif|svg|webp|ico)$/.test(name)) {
return "assets/images/[name]-[hash].[ext]"; return "assets/images/[name]-[hash].[ext]";
} }
if (/\.css$/.test(name)) { if (/\.css$/.test(name)) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!