From 187041ecb09b7b1e911e12423e4db90b5d1d2d28 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 19 一月 2026 14:53:38 +0800
Subject: [PATCH] 生产管控迁移遗漏

---
 src/views/productionManagement/productStructure/Detail/index.vue |  264 ++++++++++++++++++++++---------------------
 src/main.js                                                      |    3 
 src/components/PageHeader/index.vue                              |   53 ++++++++
 3 files changed, 191 insertions(+), 129 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 20a472b..b773b89 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -22,13 +22,11 @@
         </el-button>
       </template>
     </PageHeader>
-    <el-table
-        :data="tableData"
-        border
-        :preserve-expanded-content="false"
-        :default-expand-all="true"
-        style="width: 100%"
-    >
+    <el-table :data="tableData"
+              border
+              :preserve-expanded-content="false"
+              :default-expand-all="true"
+              style="width: 100%">
       <el-table-column type="expand">
         <template #default="props">
           <el-form ref="form"
@@ -36,7 +34,7 @@
             <el-table :data="dataValue.dataList"
                       style="width: 100%">
               <el-table-column prop="productName"
-                               label="浜у搧"/>
+                               label="浜у搧" />
               <el-table-column prop="model"
                                label="瑙勬牸">
                 <template #default="{ row, $index }">
@@ -123,7 +121,9 @@
                   </el-form-item>
                 </template>
               </el-table-column>
-              <el-table-column label="鎿嶄綔" fixed="right" width="100">
+              <el-table-column label="鎿嶄綔"
+                               fixed="right"
+                               width="100">
                 <template #default="{ row, $index }">
                   <el-button v-if="dataValue.isEdit"
                              type="danger"
@@ -136,11 +136,13 @@
           </el-form>
         </template>
       </el-table-column>
-      <el-table-column label="BOM缂栧彿" prop="bomNo" />
-      <el-table-column label="浜у搧鍚嶇О" prop="productName" />
-      <el-table-column label="瑙勬牸鍨嬪彿" prop="model" />
+      <el-table-column label="BOM缂栧彿"
+                       prop="bomNo" />
+      <el-table-column label="浜у搧鍚嶇О"
+                       prop="productName" />
+      <el-table-column label="瑙勬牸鍨嬪彿"
+                       prop="model" />
     </el-table>
-
     <product-select-dialog v-if="dataValue.showProductDialog"
                            v-model:model-value="dataValue.showProductDialog"
                            @confirm="handleProduct" />
@@ -148,103 +150,107 @@
 </template>
 
 <script setup lang="ts">
-import {
-  computed,
-  defineAsyncComponent,
-  defineComponent,
-  onMounted,
-  reactive,
-  ref,
-} from "vue";
-import { queryList, add } from "@/api/productionManagement/productStructure.js";
-import { listProcessBom } from "@/api/productionManagement/productionOrder.js";
-import { list } from "@/api/productionManagement/productionProcess";
-import { ElMessage } from "element-plus";
-import {useRoute, useRouter} from "vue-router";
+  import {
+    computed,
+    defineAsyncComponent,
+    defineComponent,
+    onMounted,
+    reactive,
+    ref,
+  } from "vue";
+  import { queryList, add } from "@/api/productionManagement/productStructure.js";
+  import { listProcessBom } from "@/api/productionManagement/productionOrder.js";
+  import { list } from "@/api/productionManagement/productionProcess";
+  import { ElMessage } from "element-plus";
+  import { useRoute, useRouter } from "vue-router";
 
-defineComponent({
-  name: "StructureEdit",
-});
+  defineComponent({
+    name: "StructureEdit",
+  });
 
-const ProductSelectDialog = defineAsyncComponent(
+  const ProductSelectDialog = defineAsyncComponent(
     () => import("@/views/basicData/product/ProductSelectDialog.vue")
-);
-const form = ref();
+  );
+  const form = ref();
 
-const route = useRoute()
-const router = useRouter()
-const routeId = computed({
-  get() {
-    return route.query.id;
-  },
+  const route = useRoute();
+  const router = useRouter();
+  const routeId = computed({
+    get() {
+      return route.query.id;
+    },
 
-  set(val) {
-    emit('update:router', val)
-  }
-});
+    set(val) {
+      emit("update:router", val);
+    },
+  });
 
-// 浠庤矾鐢卞弬鏁拌幏鍙栦骇鍝佷俊鎭�
-const routeBomNo = computed(() => route.query.bomNo || '');
-const routeProductName = computed(() => route.query.productName || '');
-const routeProductModelName = computed(() => route.query.productModelName || '');
-const routeOrderId = computed(() => route.query.orderId);
-const pageType = computed(() => route.query.type);
-const isOrderPage = computed(() => pageType.value === 'order' && routeOrderId.value);
+  // 浠庤矾鐢卞弬鏁拌幏鍙栦骇鍝佷俊鎭�
+  const routeBomNo = computed(() => route.query.bomNo || "");
+  const routeProductName = computed(() => route.query.productName || "");
+  const routeProductModelName = computed(
+    () => route.query.productModelName || ""
+  );
+  const routeOrderId = computed(() => route.query.orderId);
+  const pageType = computed(() => route.query.type);
+  const isOrderPage = computed(
+    () => pageType.value === "order" && routeOrderId.value
+  );
 
-const dataValue = reactive({
-  dataList: [],
-  productOptions: [],
-  processOptions: [],
-  showProductDialog: false,
-  currentRowIndex: null,
-  loading: false,
-  isEdit: false,
-});
+  const dataValue = reactive({
+    dataList: [],
+    productOptions: [],
+    processOptions: [],
+    showProductDialog: false,
+    currentRowIndex: null,
+    loading: false,
+    isEdit: false,
+  });
 
-const tableData = reactive([
-  {
-    productName: "",
-    model: "",
-    bomNo: "",
-  }
-])
+  const tableData = reactive([
+    {
+      productName: "",
+      model: "",
+      bomNo: "",
+    },
+  ]);
 
-const openDialog = index => {
-  dataValue.currentRowIndex = index;
-  dataValue.showProductDialog = true;
-};
+  const openDialog = index => {
+    dataValue.currentRowIndex = index;
+    dataValue.showProductDialog = true;
+  };
 
-const fetchData = async () => {
-  if (isOrderPage.value) {
-    // 璁㈠崟鎯呭喌锛氫娇鐢ㄨ鍗曠殑浜у搧缁撴瀯鎺ュ彛
-    const { data } = await listProcessBom({ orderId: routeOrderId.value });
-    dataValue.dataList = data || [];
-  } else {
-    // 闈炶鍗曟儏鍐碉細浣跨敤鍘熸潵鐨勬帴鍙�
-    const { data } = await queryList(routeId.value);
-    dataValue.dataList = data || [];
-  }
-};
+  const fetchData = async () => {
+    if (isOrderPage.value) {
+      // 璁㈠崟鎯呭喌锛氫娇鐢ㄨ鍗曠殑浜у搧缁撴瀯鎺ュ彛
+      const { data } = await listProcessBom({ orderId: routeOrderId.value });
+      dataValue.dataList = data || [];
+    } else {
+      // 闈炶鍗曟儏鍐碉細浣跨敤鍘熸潵鐨勬帴鍙�
+      const { data } = await queryList(routeId.value);
+      dataValue.dataList = data || [];
+    }
+  };
 
-const fetchProcessOptions = async () => {
-  const { data } = await list(routeId.value);
-  dataValue.processOptions = data;
-};
+  const fetchProcessOptions = async () => {
+    const { data } = await list(routeId.value);
+    dataValue.processOptions = data;
+  };
 
-const handleProduct = row => {
-  if (row?.length > 1) {
-    ElMessage.error("鍙兘閫夋嫨涓�涓骇鍝�");
-  }
-  dataValue.dataList[dataValue.currentRowIndex].productName =
+  const handleProduct = row => {
+    if (row?.length > 1) {
+      ElMessage.error("鍙兘閫夋嫨涓�涓骇鍝�");
+    }
+    dataValue.dataList[dataValue.currentRowIndex].productName =
       row[0].productName;
-  dataValue.dataList[dataValue.currentRowIndex].model = row[0].model;
-  dataValue.dataList[dataValue.currentRowIndex].productModelId = row[0].id;
-  dataValue.dataList[dataValue.currentRowIndex].unit = row[0].unit || "";
-  dataValue.showProductDialog = false;
-};
+    dataValue.dataList[dataValue.currentRowIndex].model = row[0].model;
+    dataValue.dataList[dataValue.currentRowIndex].productModelId = row[0].id;
+    dataValue.dataList[dataValue.currentRowIndex].unit = row[0].unit || "";
+    dataValue.showProductDialog = false;
+  };
 
-const submit = () => {
-  form.value
+  const submit = () => {
+    form.value
       .validate(valid => {
         dataValue.loading = true;
         if (valid) {
@@ -253,8 +259,8 @@
             productStructureList: dataValue.dataList || [],
           }).then(res => {
             router.push({
-              path: '/productionManagement/productionManagement/productStructure/index',
-            })
+              path: "/productionManagement/productionManagement/productStructure/index",
+            });
             ElMessage.success("淇濆瓨鎴愬姛");
             dataValue.loading = false;
           });
@@ -263,38 +269,38 @@
       .finally(() => {
         dataValue.loading = false;
       });
-};
+  };
 
-const addItem = () => {
-  dataValue.dataList.push({
-    productName: "",
-    productId: "",
-    model: undefined,
-    productModelId: undefined,
-    processId: "",
-    unitQuantity: 0,
-    demandedQuantity: 0,
-    unit: "",
-  });
-};
+  const addItem = () => {
+    dataValue.dataList.push({
+      productName: "",
+      productId: "",
+      model: undefined,
+      productModelId: undefined,
+      processId: "",
+      unitQuantity: 0,
+      demandedQuantity: 0,
+      unit: "",
+    });
+  };
 
-const cancelEdit = () => {
-  dataValue.isEdit = false;
-  dataValue.dataList = dataValue.dataList.filter(item => item.id !== undefined);
-};
-
-onMounted(() => {
-  // 浠庤矾鐢卞弬鏁板洖鏄炬暟鎹�
-  tableData[0].productName = routeProductName.value;
-  tableData[0].model = routeProductModelName.value;
-  tableData[0].bomNo = routeBomNo.value;
-  
-  // 璁㈠崟鎯呭喌涓嬬鐢ㄧ紪杈�
-  if (isOrderPage.value) {
+  const cancelEdit = () => {
     dataValue.isEdit = false;
-  }
-  
-  fetchData();
-  fetchProcessOptions();
-});
+    dataValue.dataList = dataValue.dataList.filter(item => item.id !== undefined);
+  };
+
+  onMounted(() => {
+    // 浠庤矾鐢卞弬鏁板洖鏄炬暟鎹�
+    tableData[0].productName = routeProductName.value;
+    tableData[0].model = routeProductModelName.value;
+    tableData[0].bomNo = routeBomNo.value;
+
+    // 璁㈠崟鎯呭喌涓嬬鐢ㄧ紪杈�
+    if (isOrderPage.value) {
+      dataValue.isEdit = false;
+    }
+
+    fetchData();
+    fetchProcessOptions();
+  });
 </script>
\ No newline at end of file

--
Gitblit v1.9.3