From 09c5667700fb6da21d29c41e51fa5482a4b40bc9 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 24 十月 2025 11:22:22 +0800
Subject: [PATCH] 新公司部署相关配置修改
---
src/views/production/components/ProductionDialog.vue | 88 ++++++++++++++++++++++++++++----------------
1 files changed, 56 insertions(+), 32 deletions(-)
diff --git a/src/views/production/components/ProductionDialog.vue b/src/views/production/components/ProductionDialog.vue
index 955a1aa..4a21fa4 100644
--- a/src/views/production/components/ProductionDialog.vue
+++ b/src/views/production/components/ProductionDialog.vue
@@ -165,6 +165,7 @@
getCoalInfoList,
deleteProductionInventory,
} from "@/api/production/index.js";
+import { getSupplyList } from "@/api/procureMent/index.js"
import {validateFormData, validateNumber, deepClone, createDefaultProductionRow} from "@/utils/production";
import {useCoalData} from "./useCoalData";
import useUserStore from "@/store/modules/user";
@@ -199,10 +200,10 @@
const currentRow = ref(null);
const copyForm = ref(null);
const coalList = ref([])
-const supplierList = ref({});
+const supplierList = ref([]);
// 琛ㄦ牸鍒楅厤缃�
const columns = [
- {prop: "coalId", label: "鐓ょ", minwidth: 60,slot:false,
+ {prop: "coalId", label: "鐓ょ", minwidth: 60,
formatter: (row) => {
return coalList.value.find(coal => coal.id === row.coalId)?.coal || "--";
}
@@ -218,15 +219,8 @@
];
const formalDatabaseColumns = ref([
- {prop: "supplierName", label: "渚涘簲鍟嗗悕绉�", minwidth: 150
- // ,formatter: (row) => {
- // console.log(row);
- // return supplierList.value[row.supplierId] || "--";
- // }
- },
{prop: "coalId", label: "鐓ょ", minwidth: 60,
formatter: (row) => {
- // return coalList.value[row.coalId].coal || "--";
return coalList.value.find(coal => coal.id === row.coalId)?.coal || "--";
}
},
@@ -248,28 +242,51 @@
currentRow.value = row;
};
+// 鑾峰彇鍩虹鏁版嵁锛堢叅绉嶅拰渚涘簲鍟嗭級
+const loadBasicData = async () => {
+ try {
+ const [coalResponse, supplierResponse] = await Promise.all([
+ getCoalInfoList(),
+ getSupplyList()
+ ]);
+
+ coalList.value = coalResponse.data || [];
+ supplierList.value = supplierResponse.data || [];
+ } catch (error) {
+ ElMessage.error("鑾峰彇鍩虹鏁版嵁澶辫触");
+ }
+};
+
// 鑾峰彇閰嶇疆鏁版嵁
const handlData = async () => {
innerVisible.value = true;
- let getSupplier = await getOfficialAll();
- let getCoalName = await getCoalInfoList();
- coalList.value = getCoalName.data || [];
- supplierList.value = getSupplier.data || [];
- if (getSupplier.code === 200) {
- formalDatabaseData.value = getSupplier.data;
- const existingOfficialIds = tableData.value
- .map((item) => item.officialId)
- .filter((id) => id);
- selectedIds.value = existingOfficialIds;
- debugIdMatching();
- nextTick(() => {
- setTimeout(() => {
- if (etableRef.value && existingOfficialIds.length > 0) {
- etableRef.value.setDefaultSelection();
- }
- }, 100);
- });
- } else {
+
+ // 纭繚鍩虹鏁版嵁宸插姞杞�
+ if (coalList.value.length === 0 || supplierList.value.length === 0) {
+ await loadBasicData();
+ }
+
+ try {
+ const OfficialAll = await getOfficialAll();
+
+ if (OfficialAll.code === 200) {
+ formalDatabaseData.value = OfficialAll.data;
+ const existingOfficialIds = tableData.value
+ .map((item) => item.officialId)
+ .filter((id) => id);
+ selectedIds.value = existingOfficialIds;
+ debugIdMatching();
+ nextTick(() => {
+ setTimeout(() => {
+ if (etableRef.value && existingOfficialIds.length > 0) {
+ etableRef.value.setDefaultSelection();
+ }
+ }, 100);
+ });
+ } else {
+ ElMessage.error("鑾峰彇閰嶇疆鏁版嵁澶辫触");
+ }
+ } catch (error) {
ElMessage.error("鑾峰彇閰嶇疆鏁版嵁澶辫触");
}
};
@@ -296,14 +313,17 @@
};
// 鍒濆鍖栧拰缂栬緫鍒濆鍖�
-const Initialization = () => {
+const Initialization = async () => {
tableData.value = [];
detailsTableData.value = [];
copyForm.value = null;
dialogType.value = "add";
+
+ // 鍔犺浇鍩虹鏁版嵁
+ await loadBasicData();
};
-const editInitialization = (type,data) => {
+const editInitialization = async (type, data) => {
copyForm.value = deepClone(data);
tableData.value = data.productionInventoryList || [];
detailsTableData.value = data.productionList || [];
@@ -312,6 +332,9 @@
.map((item) => item.officialId)
.filter((id) => id);
selectedIds.value = existingOfficialIds;
+
+ // 鍔犺浇鍩虹鏁版嵁
+ await loadBasicData();
};
// 鐩戝惉瀵硅瘽妗嗙姸鎬侊紝鍦ㄦ墦寮�鏃惰缃�変腑鐘舵��
watch(innerVisible, (newVal) => {
@@ -457,12 +480,13 @@
}
};
-// 鑾峰彇鐢ㄦ埛淇℃伅
+// 鑾峰彇鐢ㄦ埛淇℃伅骞跺姞杞藉熀纭�鏁版嵁
onMounted(async () => {
try {
userInfo = await userStore.getInfo();
+ await loadBasicData();
} catch (error) {
- ElMessage.error("鑾峰彇鐢ㄦ埛淇℃伅澶辫触锛岃閲嶈瘯");
+ ElMessage.error("鍒濆鍖栧け璐ワ紝璇烽噸璇�");
}
});
--
Gitblit v1.9.3