Commit 6d6bb1bf by 张立顺

feat(venus-usedcar-h5): 检测报告详情功能开发

1 parent 36f81cbd
......@@ -11,11 +11,11 @@
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"axios": "^1.12.2",
"@vueuse/core": "catalog:",
"axios": "^1.12.2",
"dayjs": "catalog:",
"glsk-toolkit": "catalog:",
"glsk-oss-jssdk": "catalog:",
"glsk-toolkit": "catalog:",
"pinia": "catalog:",
"pinia-plugin-persistedstate": "catalog:",
"tailwindcss": "catalog:",
......
......@@ -25,13 +25,13 @@ export interface InspectReportPageData<T> {
}
export interface InspectReportVehicleCover {
uid?: string | number;
uid?: number | string;
name?: string;
status?: string;
url?: string;
filePath?: string;
thumbPath?: string | null;
thumbUrl?: string | null;
thumbPath?: null | string;
thumbUrl?: null | string;
size?: number;
lastModified?: number;
lastModifiedDate?: string;
......@@ -127,7 +127,7 @@ export interface InspectionNode {
options?: string;
validationRules?: string;
allowNoStructure?: number;
existsDefaultValue?: string | number;
existsDefaultValue?: number | string;
defaultValue?: string;
defaultType?: number;
nodeLevel: number;
......@@ -158,7 +158,7 @@ export interface InspectionNodeResponse {
* 获取检测模板根节点(大项)
* @param taskId 检测工单ID
*/
export function getInspectionRootNodes(taskId: string | number) {
export function getInspectionRootNodes(taskId: number | string) {
return get<InspectionNode[]>(`/rest/inspectionTemplate/${taskId}/rootNodes`);
}
......@@ -167,7 +167,7 @@ export function getInspectionRootNodes(taskId: string | number) {
* @param rootNodeId 根节点ID
* @param taskId 检测工单ID
*/
export function getInspectionChildren(rootNodeId: string | number, taskId: string | number) {
export function getInspectionChildren(rootNodeId: number | string, taskId: number | string) {
return get<InspectionNode[]>(`/rest/inspectionNode/${rootNodeId}/children`, {
taskId,
});
......@@ -201,7 +201,7 @@ export interface InspectionTemplateDefaultData {
* 获取检测模板默认值(业务层已解包为 data 对象)
* @param taskId 检测工单ID
*/
export function getInspectionTemplateDefault(taskId: string | number) {
export function getInspectionTemplateDefault(taskId: number | string) {
return post<InspectionTemplateDefaultData>(`/rest/inspectionTemplate/default`, {
taskId,
});
......@@ -289,7 +289,168 @@ export interface InspectionRecordSaveParams {
* 保存/下一步
*/
export function saveInspectionRecord(params: InspectionRecordSaveParams) {
return post<void>("/rest/inspectionRecord/save", params);
return post("/rest/inspectionRecord/save", params);
}
// ===== 检测记录详情 =====
export interface InspectionValueItem {
id: number;
resultId: number;
nodeId: number;
/** 交互类型,与叶子节点 interactionType 一致 */
interactionType: string;
/** 值内容:图片时为 URL,文字时为文本,按钮选择时为选项 key */
valueText: null | string;
valueKey: null | string;
valueSeq: number;
remark: null | string;
}
export interface InspectionDetailResultVO {
id: number;
recordId: number;
nodeId: number;
nodeName: string;
/** 完成标志:"0"-未完成,"1"-已完成 */
completedFlag: string;
/** 结果状态:1-正常,2-故障,3-无此结构 */
resultStatus: 1 | 2 | 3;
remark: null | string;
inspectionValueList: InspectionValueItem[];
}
export interface InspectionNodeDetail {
id: number;
templateId: number;
/** 父节点 ID,0 表示根节点 */
parentId: number;
nodeName: string;
/** 节点类型:1-模块,2-分组,3-叶子节点 */
nodeType: 1 | 2 | 3;
/** 展示节点名称:1-展示 0-不展示 */
showNodeName: string;
/** 编辑权限,0 不可编辑,1 可编辑 */
editPermission: string;
/** 展现模式:1-列表表单,2-网格检测,3-区域分组,4-图片上传,5-基础信息,6-视频录制 */
displayMode: number;
/** 检测项类型:1-基础字段,2-故障检测 */
itemType: number;
interactionType: string;
dataFormat: string;
datePattern: string;
reserved: string;
placeholder: string;
suffix: string;
/** 是否必填:0-选填,1-必填 */
required: number;
optionsJson: string;
optionsSourceType: number;
validationRules: string;
options: string;
/** 是否支持"无此结构":0-否,1-是 */
allowNoStructure: number;
/** 是否存在默认值:1-存在 0-不存在 */
existsDefaultValue: string;
defaultValue: string;
defaultField: string;
defaultExpr: string;
/** 默认值类型:1-固定值,2-接口获取,3-表达式 */
defaultType: number;
defaultConfig: string;
maxCount: number;
captureRequirement: string;
maxKb: number;
nodePath: string;
/** 节点层级,根节点为 0 */
nodeLevel: number;
sortOrder: number;
/** 状态:0-禁用,1-启用 */
status: number;
remark: string;
createTime: string;
updateTime: string;
/** 失败数(异常) */
failNum: number;
/** 成功数(正常) */
successNum: number;
/** 无此结构数 */
noStructureNum: number;
/** 嵌套子节点(nodeType=1→2→3 层级) */
childrenNodes: InspectionNodeDetail[];
/** 叶子节点(nodeType=3)的检测结果,其他层级为 null */
inspectionResultVO: InspectionDetailResultVO | null;
}
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 InspectionScoreVO {
/** 外观评分 */
exteriorScore?: number;
/** 外观评分依据 */
exteriorComment?: string;
/** 骨架评级(A/B/C/D) */
skeletonLevel?: string;
/** 骨架评级依据 */
skeletonComment?: string;
/** 内饰评级(A/B/C/D) */
interiorLevel?: string;
/** 内饰评级依据 */
interiorComment?: string;
/** 综合评分 */
overallScore?: number;
/** 综合评价 */
overallComment?: string;
}
export interface DetailRes {
id?: number;
taskId?: number;
cover?: FileInfo;
albums?: FileInfo[];
carSeriesId?: number;
carSeriesName?: string;
carTypeId?: number;
carTypeName?: string;
licensePlate?: string;
registrationDate?: string;
/** 表显里程,单位万公里 */
mileage?: string;
emissionStandard?: string;
displacement?: string;
inspectionScoreVO?: InspectionScoreVO;
inspectionNodeList: InspectionNodeDetail[];
/** 整车外观视频 */
wholeCarAppearanceVideo?: string;
/** 发动机工况视频 */
engineConditionVideo?: string;
/** 尾气工况视频 */
tailGasConditionVideo?: string;
/** 检测完成时间 */
inspectionCompletedTime?: string;
}
/**
* 详情
* @param {number} recordId 检测记录id
* @returns {Promise<DetailRes>} 检测记录详情
*/
export function detail(recordId: number): Promise<DetailRes> {
return get<DetailRes>(`/rest/inspectionRecord/${recordId}/detail`);
}
// ===== 完成检测(检测评分提交)=====
......@@ -310,6 +471,6 @@ export interface CompleteInspectionParams {
* 完成检测(提交检测评分)
*/
export function completeInspection(params: CompleteInspectionParams) {
return post<void>("/rest/inspectionRecord/completeInspection", params);
return post("/rest/inspectionRecord/completeInspection", params);
}
import { createRouter, createWebHistory } from "vue-router";
import { useUserStore } from "@stores/modules/user.ts";
import { closeToast, showLoadingToast } from "vant";
import routes from "./routes.ts";
import { useUserStore } from "@stores/modules/user.ts";
const LOGIN_REDIRECT_KEY = "venus_usedcar_login_redirect";
......@@ -19,7 +19,7 @@ const router = createRouter({
});
// 不需要登录的白名单路由
const WHITE_LIST: string[] = ["/login"];
const WHITE_LIST = new Set(["/inspect-detail", "/inspect-report", "/login"]);
router.beforeEach((to, from, next) => {
const userStore = useUserStore();
......@@ -50,7 +50,7 @@ router.beforeEach((to, from, next) => {
}
// 2. 没有 token 的情况
if (WHITE_LIST.includes(to.path)) {
if (WHITE_LIST.has(to.path)) {
next();
return;
}
......
......@@ -60,6 +60,24 @@ const routes: RouteRecordRaw[] = [
},
},
{
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(.*)*",
name: "NotFound",
component: () => import("@views/404/index.vue"),
......
......@@ -178,9 +178,11 @@ function viewWorkOrder(item: WorkOrderItem) {
void router.push({ name: "CarDetail", params: { id: item.id } });
}
function viewReport(_item: WorkOrderItem) {
showToast("查看报告");
void router.push({ name: "CarList" });
function viewReport(item: WorkOrderItem) {
void router.push({
name: "InspectReport",
query: { recordId: item.id },
});
}
function showRejectReason(_item: WorkOrderItem) {
......
import { dirname, resolve } from "node:path";
import process from "node:process";
import { fileURLToPath } from "node:url";
import vue from "@vitejs/plugin-vue";
// @ts-expect-error - no types provided
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { VantResolver } from "unplugin-vue-components/resolvers";
import Components from "unplugin-vue-components/vite";
import { defineConfig, loadEnv } from "vite";
// @ts-expect-error - no types provided
import pxToViewport from "postcss-px-to-viewport-8-plugin";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const PORT = 8082;
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "VITE_");
const env = loadEnv(mode, process.cwd(), "VITE_");
return {
plugins: [
vue(),
AutoImport({
imports: ["vue", "vue-router", "pinia", "@vueuse/core"],
dts: "src/auto-imports.d.ts",
eslintrc: { enabled: false },
}),
Components({
dts: "src/components.d.ts",
resolvers: [VantResolver()],
dirs: ["src/components", "src/layouts"],
}),
],
return {
plugins: [
vue(),
AutoImport({
imports: ["vue", "vue-router", "pinia", "@vueuse/core"],
dts: "src/auto-imports.d.ts",
eslintrc: { enabled: false },
}),
Components({
dts: "src/components.d.ts",
resolvers: [VantResolver()],
dirs: ["src/components", "src/layouts"],
}),
],
resolve: {
alias: {
"@": resolve(__dirname, "src"),
"@assets": resolve(__dirname, "src/assets"),
"@views": resolve(__dirname, "src/views"),
"@components": resolve(__dirname, "src/components"),
"@stores": resolve(__dirname, "src/stores"),
"@utils": resolve(__dirname, "src/utils"),
"@api": resolve(__dirname, "src/api"),
"@composables": resolve(__dirname, "src/composables"),
},
},
resolve: {
alias: {
"@": resolve(__dirname, "src"),
"@assets": resolve(__dirname, "src/assets"),
"@views": resolve(__dirname, "src/views"),
"@components": resolve(__dirname, "src/components"),
"@stores": resolve(__dirname, "src/stores"),
"@utils": resolve(__dirname, "src/utils"),
"@api": resolve(__dirname, "src/api"),
"@composables": resolve(__dirname, "src/composables"),
},
},
css: {
preprocessorOptions: {
scss: {
api: "modern-compiler",
},
},
},
css: {
preprocessorOptions: {
scss: {
api: "modern-compiler",
},
},
},
server: {
port: PORT,
host: true,
proxy: {
"/api": {
target: env.VITE_API_BASE_URL || "http://localhost:3000",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
server: {
port: PORT,
host: true,
proxy: {
"/api": {
target: env.VITE_API_BASE_URL || "http://localhost:3000",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
build: {
target: "es2015",
outDir: "dist",
cssCodeSplit: true,
rollupOptions: {
output: {
chunkFileNames: "assets/js/[name]-[hash].js",
entryFileNames: "assets/js/[name]-[hash].js",
assetFileNames: ({ name = "" }) => {
if (/\.(png|jpe?g|gif|svg|webp|ico)$/.test(name)) {
return "assets/images/[name]-[hash].[ext]";
}
if (/\.css$/.test(name)) {
return "assets/css/[name]-[hash].[ext]";
}
return "assets/[ext]/[name]-[hash].[ext]";
},
manualChunks: {
"vue-core": ["vue", "vue-router", "pinia"],
vant: ["vant"],
},
},
},
},
build: {
target: "es2015",
outDir: "dist",
cssCodeSplit: true,
rollupOptions: {
output: {
chunkFileNames: "assets/js/[name]-[hash].js",
entryFileNames: "assets/js/[name]-[hash].js",
assetFileNames: ({ name = "" }) => {
if (/\.(?:png|jpe?g|gif|svg|webp|ico)$/.test(name)) {
return "assets/images/[name]-[hash].[ext]";
}
if (/\.css$/.test(name)) {
return "assets/css/[name]-[hash].[ext]";
}
return "assets/[ext]/[name]-[hash].[ext]";
},
manualChunks: {
"vue-core": ["vue", "vue-router", "pinia"],
vant: ["vant"],
},
},
},
},
optimizeDeps: {
include: ["vue", "vue-router", "pinia", "@vueuse/core", "axios", "dayjs"],
},
};
optimizeDeps: {
include: ["vue", "vue-router", "pinia", "@vueuse/core", "axios", "dayjs"],
},
};
});
......@@ -5,12 +5,8 @@
"path": "apps/uniappX/uniapp-x-shop",
},
{
"name": "cool-unix",
"path": "apps/uniappX/uniapp-x-shop/uni_modules/cool-unix",
},
{
"name": "cool-unix-demo",
"path": "apps/uniappX/uniapp-x-shop/uni_modules/cool-unix/配置文件",
"name": "uniapp-x-tape",
"path": "apps/uniappX/uniapp-x-tape",
},
{
"name": "@venus/venus-agentic-assisant",
......@@ -21,8 +17,8 @@
"path": "apps/web/venus-agentic/venus-agentic-base",
},
{
"name": "@venus/car-life-system",
"path": "apps/web/vue2/dj-car-life-system",
"name": "venus-usedcar-h5",
"path": "apps/web/venus-usedcar-quality",
},
{
"name": "@venus/docs",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!