From f1659a1ecde53251bf9c52bc125b2fb07e36da3b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 20 五月 2026 14:00:16 +0800
Subject: [PATCH] 进销存pro 1.首页及登录页样式微调 2.添加系统架构图页面 3.优化头部搜索菜单栏功能 4.首页快捷功能跳转路由修改
---
src/views/productionManagement/productStructure/Detail/index.vue | 134 +++++++++++++++++++++++++++++++++++++++++---
1 files changed, 124 insertions(+), 10 deletions(-)
diff --git a/src/views/productionManagement/productStructure/Detail/index.vue b/src/views/productionManagement/productStructure/Detail/index.vue
index 6fbe21b..76c67dc 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -86,6 +86,7 @@
:step="1"
controls-position="right"
style="width: 100%"
+ @change="handleUnitQuantityChange"
:disabled="!dataValue.isEdit || dataValue.dataList.some(item => (item as any).tempId === row.tempId)" />
</el-form-item>
</template>
@@ -103,7 +104,7 @@
:step="1"
controls-position="right"
style="width: 100%"
- :disabled="!dataValue.isEdit || dataValue.dataList.some(item => (item as any).tempId === row.tempId)" />
+ :disabled="true" />
</el-form-item>
</template>
</el-table-column>
@@ -163,7 +164,10 @@
reactive,
ref,
} from "vue";
- import { queryList, addBomDetail } from "@/api/productionManagement/productStructure.js";
+ import {
+ queryList,
+ addBomDetail,
+ } from "@/api/productionManagement/productStructure.js";
import { listProcessBom } from "@/api/productionManagement/productionOrder.js";
import { list } from "@/api/productionManagement/productionProcess";
import { ElMessage } from "element-plus";
@@ -228,9 +232,11 @@
if (id === undefined || id === null || id === "") {
return null;
}
- return normalizeListData(dataValue.processOptions).find(
- option => String(option.id) === String(id)
- ) || null;
+ return (
+ normalizeListData(dataValue.processOptions).find(
+ option => String(option.id) === String(id)
+ ) || null
+ );
};
const syncProcessOperationFields = (item: any) => {
@@ -263,6 +269,42 @@
});
};
+ const toQuantityNumber = (value: any) => {
+ const numberValue = Number(value);
+ if (!Number.isFinite(numberValue)) {
+ return 0;
+ }
+ return Number(numberValue.toFixed(2));
+ };
+
+ const syncDemandedQuantityTree = (
+ items: any[],
+ parentDemandedQuantity: number | null = null
+ ) => {
+ items.forEach((item: any) => {
+ if (parentDemandedQuantity !== null) {
+ item.demandedQuantity = toQuantityNumber(
+ parentDemandedQuantity * toQuantityNumber(item.unitQuantity)
+ );
+ }
+
+ if (Array.isArray(item.children) && item.children.length > 0) {
+ syncDemandedQuantityTree(
+ item.children,
+ toQuantityNumber(item.demandedQuantity)
+ );
+ }
+ });
+ };
+
+ const recalculateDemandedQuantities = () => {
+ if (!isOrderPage.value) {
+ return;
+ }
+
+ syncDemandedQuantityTree(dataValue.dataList);
+ };
+
const buildSubmitTree = (items: any[]) => {
return items.map((item: any) => {
const current = { ...item };
@@ -274,9 +316,40 @@
});
};
+ const findSiblings = (items: any[], tempId: string): any[] | null => {
+ if (!items || items.length === 0) return null;
+ // 妫�鏌ュ綋鍓嶅眰绾�
+ if (items.some(item => item.tempId === tempId)) {
+ return items;
+ }
+ // 閫掑綊鏌ユ壘瀛愮骇
+ for (const item of items) {
+ if (item.children && item.children.length > 0) {
+ const result = findSiblings(item.children, tempId);
+ if (result) return result;
+ }
+ }
+ return null;
+ };
+
const handleProcessChange = (row: any, value: any) => {
row.processId = value || "";
syncProcessOperationFields(row);
+
+ // 鍚屼竴灞傜骇鍙兘閫変竴鏍风殑宸ュ簭
+ const siblings = findSiblings(dataValue.dataList, row.tempId);
+ if (siblings && value) {
+ siblings.forEach(sibling => {
+ if (sibling.tempId !== row.tempId) {
+ sibling.processId = value;
+ syncProcessOperationFields(sibling);
+ }
+ });
+ }
+ };
+
+ const handleUnitQuantityChange = () => {
+ recalculateDemandedQuantities();
};
const tableData = reactive([
@@ -299,6 +372,7 @@
const { data } = await listProcessBom({ orderId: routeOrderId.value });
dataValue.dataList = (data as any) || [];
normalizeTreeData(dataValue.dataList);
+ recalculateDemandedQuantities();
} else {
// 闈炶鍗曟儏鍐碉細浣跨敤鍘熸潵鐨勬帴鍙�
const { data } = await queryList(routeId.value);
@@ -384,8 +458,41 @@
const validateAll = () => {
let isValid = true;
+ // 鏍¢獙涓�缁勫厔寮熻妭鐐圭殑宸ュ簭鏄惁閮界浉鍚�
+ const checkProcessUniqueness = (items: any[]) => {
+ if (!items || items.length === 0 || !isValid) return;
+
+ // 鑾峰彇绗竴涓潪绌虹殑宸ュ簭ID浣滀负鍙傝��
+ const firstProcessId = items.find(item => item.processId)?.processId;
+
+ // 濡傛灉鏈夊伐搴廔D锛屾鏌ユ墍鏈夐」鏄惁閮戒娇鐢ㄧ浉鍚岀殑宸ュ簭
+ if (firstProcessId) {
+ for (const item of items) {
+ if (item.processId && item.processId !== firstProcessId) {
+ const option1 = getProcessOptionById(firstProcessId);
+ const option2 = getProcessOptionById(item.processId);
+ const processName1 = option1?.name || "鏈煡宸ュ簭";
+ const processName2 = option2?.name || "鏈煡宸ュ簭";
+ ElMessage.error(
+ `褰撳墠灞傜骇涓嬪伐搴忎笉涓�鑷达紝璇蜂娇鐢ㄧ浉鍚岀殑宸ュ簭銆傚瓨鍦ㄣ��${processName1}銆嶅拰銆�${processName2}銆峘
+ );
+ isValid = false;
+ return;
+ }
+ }
+ }
+
+ // 閫掑綊鏍¢獙瀛愮骇鐨勫厔寮熻妭鐐�
+ for (const item of items) {
+ if (item.children && item.children.length > 0) {
+ checkProcessUniqueness(item.children);
+ }
+ }
+ };
+
// 鏍¢獙鍑芥暟
const validateItem = (item: any, isTopLevel = false) => {
+ if (!isValid) return;
// 鏍¢獙褰撳墠椤圭殑蹇呭~瀛楁
if (!item.model) {
ElMessage.error("璇烽�夋嫨瑙勬牸");
@@ -413,7 +520,7 @@
// return;
// }
- // 閫掑綊鏍¢獙瀛愰」
+ // 閫掑綊鏍¢獙瀛愰」瀛楁
if (item.children && item.children.length > 0) {
item.children.forEach(child => {
validateItem(child, false);
@@ -421,7 +528,11 @@
}
};
- // 閬嶅巻鎵�鏈夐《灞傞」
+ // 1. 棣栧厛鏍¢獙鍚屼竴鐖剁骇涓嬬殑鍚屽眰娑堣�楀伐搴忔槸鍚﹀敮涓�
+ checkProcessUniqueness(dataValue.dataList);
+ if (!isValid) return false;
+
+ // 2. 鐒跺悗閬嶅巻鏍¢獙鎵�鏈夐《灞傞」鐨勫瓧娈靛繀濉儏鍐�
dataValue.dataList.forEach(item => {
validateItem(item, true);
});
@@ -432,6 +543,7 @@
const submit = () => {
dataValue.loading = true;
normalizeTreeData(dataValue.dataList);
+ recalculateDemandedQuantities();
// 鍏堣繘琛岃〃鍗曟牎楠�
const valid = validateAll();
@@ -502,13 +614,14 @@
processName: "",
operationId: "",
operationName: "",
- unitQuantity: 0,
+ unitQuantity: 1,
demandedQuantity: 0,
unit: "",
children: [],
tempId: new Date().getTime(),
});
+ recalculateDemandedQuantities();
return;
}
addchildItem(item, tempId);
@@ -531,12 +644,13 @@
processName: "",
operationId: "",
operationName: "",
- unitQuantity: 0,
+ unitQuantity: 1,
demandedQuantity: 0,
children: [],
unit: "",
tempId: new Date().getTime(),
});
+ recalculateDemandedQuantities();
return true;
}
if (item.children && item.children.length > 0) {
@@ -582,4 +696,4 @@
await fetchProcessOptions();
await fetchData();
});
-</script>
+</script>
\ No newline at end of file
--
Gitblit v1.9.3