Commit 95d26196 by wangzhihui

feat: 添加页面标题和返回功能

- 重构导入语句,将PageTitle组件引入到正确位置
- 添加页面标题组件和返回按钮功能
- 实现路由返回方法,支持页面导航回退
- 添加顶部标题栏样式,包含返回图标和页面标题
- 优化页面头部布局结构
1 parent 9b0a1b0f
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import { getWorkOrderDetail } from "@/api/modules/work-order";
import type { import type {
InspectionWORespVO, InspectionWORespVO,
NodeVO, NodeVO,
...@@ -13,6 +9,13 @@ import type { ...@@ -13,6 +9,13 @@ import type {
} from "@/types/views/word-order-detail"; } from "@/types/views/word-order-detail";
import type { WorkOrderStatus } from "@/types/views/work-order-common"; import type { WorkOrderStatus } from "@/types/views/work-order-common";
import { computed, onMounted, ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import { getWorkOrderDetail } from "@/api/modules/work-order";
import PageTitle from "@/components/PageTitle.vue";
const title = ref("工单详情");
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const loading = ref(true); const loading = ref(true);
...@@ -62,7 +65,9 @@ function continueCheck():void { ...@@ -62,7 +65,9 @@ function continueCheck():void {
const id = route.params.id as string; const id = route.params.id as string;
router.push({ name: "CarDetail", params: { taskId: id } }); router.push({ name: "CarDetail", params: { taskId: id } });
} }
const onBack=()=>{
router.back();
};
async function fetchDetail() { async function fetchDetail() {
loading.value = true; loading.value = true;
try { try {
...@@ -92,6 +97,14 @@ onMounted(() => { ...@@ -92,6 +97,14 @@ onMounted(() => {
<template> <template>
<div class="wo-detail-page"> <div class="wo-detail-page">
<div class="header-top">
<van-icon class="nav-back"
name="arrow-left"
size="20"
@click="onBack" />
<PageTitle class="title" :title="title" />
</div>
<div class="page-head"> <div class="page-head">
<div class="head-left"> <div class="head-left">
<van-tag class="head-tag" :style="{ background: pageStatusTag.bg, color: pageStatusTag.color }"> <van-tag class="head-tag" :style="{ background: pageStatusTag.bg, color: pageStatusTag.color }">
...@@ -255,6 +268,15 @@ onMounted(() => { ...@@ -255,6 +268,15 @@ onMounted(() => {
min-height: 100vh; min-height: 100vh;
padding:6px 12px; padding:6px 12px;
background: #f2f3f7; background: #f2f3f7;
.header-top{
.nav-back{
position:absolute;
top:15px;
}
}
} }
.page-head { .page-head {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!