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 +++++++++++++++++++++++++++-------------------------
1 files changed, 135 insertions(+), 129 deletions(-)
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