From 81e1019af1480baa0d98eb3feccac08c44a83542 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 15 一月 2026 10:10:58 +0800
Subject: [PATCH] fix: 添加详情页面头部插件

---
 src/views/productionManagement/productStructure/Detail/index.vue |   42 ++++++++++----------
 src/main.js                                                      |    3 +
 src/components/PageHeader/index.vue                              |   53 ++++++++++++++++++++++++++
 3 files changed, 77 insertions(+), 21 deletions(-)

diff --git a/src/components/PageHeader/index.vue b/src/components/PageHeader/index.vue
new file mode 100644
index 0000000..d8fc6fa
--- /dev/null
+++ b/src/components/PageHeader/index.vue
@@ -0,0 +1,53 @@
+<template>
+  <div class="page-header-wrapper">
+    <el-page-header @back="handleBack" :content="content">
+      <template #icon v-if="$slots.icon">
+        <slot name="icon"></slot>
+      </template>
+      <template #title v-if="$slots.title">
+        <slot name="title"></slot>
+      </template>
+      <template #content v-if="$slots.content">
+        <slot name="content"></slot>
+      </template>
+      <template #extra>
+        <slot name="extra">
+          <slot name="right-button"></slot>
+        </slot>
+      </template>
+    </el-page-header>
+  </div>
+</template>
+
+<script setup>
+import { useRouter } from 'vue-router'
+
+const props = defineProps({
+  content: {
+    type: String,
+    default: ''
+  }
+})
+
+const emit = defineEmits(['back'])
+
+const router = useRouter()
+
+const handleBack = () => {
+  emit('back')
+  // 榛樿杩斿洖鍒颁笂涓�绾�
+  router.back()
+}
+</script>
+
+<style scoped>
+.page-header-wrapper {
+  margin-bottom: 16px;
+}
+
+.page-header-wrapper :deep(.el-page-header__extra) {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+}
+</style>
diff --git a/src/main.js b/src/main.js
index abaac2e..0b3f714 100644
--- a/src/main.js
+++ b/src/main.js
@@ -52,6 +52,8 @@
 import DictTag from "@/components/DictTag";
 // 琛ㄦ牸缁勪欢
 import PIMTable from "@/components/PIMTable/PIMTable.vue";
+// 椤甸潰澶撮儴缁勪欢
+import PageHeader from "@/components/PageHeader/index.vue";
 
 import { getToken } from "@/utils/auth";
 import {
@@ -93,6 +95,7 @@
 app.component("RightToolbar", RightToolbar);
 app.component("Editor", Editor);
 app.component("PIMTable", PIMTable);
+app.component("PageHeader", PageHeader);
 
 app.use(router);
 app.use(store);
diff --git a/src/views/productionManagement/productStructure/Detail/index.vue b/src/views/productionManagement/productStructure/Detail/index.vue
index a131830..e95f906 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -1,26 +1,26 @@
 <template>
   <div class="app-container">
-    <el-button v-if="dataValue.isEdit"
-               type="primary"
-               @click="addItem"
-               style="margin-bottom: 10px">娣诲姞
-    </el-button>
-    <el-button v-if="!dataValue.isEdit"
-               type="primary"
-               @click="dataValue.isEdit = true"
-               style="margin-bottom: 10px">缂栬緫
-    </el-button>
-    <el-button v-if="dataValue.isEdit"
-               type="primary"
-               @click="cancelEdit"
-               style="margin-bottom: 10px">鍙栨秷
-    </el-button>
-    <el-button type="primary"
-               :loading="dataValue.loading"
-               @click="submit"
-               :disabled="!dataValue.isEdit"
-               style="margin-bottom: 10px">纭
-    </el-button>
+    <PageHeader content="浜у搧缁撴瀯璇︽儏">
+      <template #right-button>
+        <el-button v-if="dataValue.isEdit"
+                   type="primary"
+                   @click="addItem">娣诲姞
+        </el-button>
+        <el-button v-if="!dataValue.isEdit"
+                   type="primary"
+                   @click="dataValue.isEdit = true">缂栬緫
+        </el-button>
+        <el-button v-if="dataValue.isEdit"
+                   type="primary"
+                   @click="cancelEdit">鍙栨秷
+        </el-button>
+        <el-button type="primary"
+                   :loading="dataValue.loading"
+                   @click="submit"
+                   :disabled="!dataValue.isEdit">纭
+        </el-button>
+      </template>
+    </PageHeader>
     <el-table
         :data="tableData"
         border

--
Gitblit v1.9.3