From 52b3b54470ecc3c80d816a9891b651ce7f5a0eaa Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期六, 11 十月 2025 13:39:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_NEW' into dev_NEW
---
src/views/production/components/ProductionDialog.vue | 86 +++++++++++++++++++++++++++---------------
1 files changed, 55 insertions(+), 31 deletions(-)
diff --git a/src/views/production/components/ProductionDialog.vue b/src/views/production/components/ProductionDialog.vue
index c14ca96..4a21fa4 100644
--- a/src/views/production/components/ProductionDialog.vue
+++ b/src/views/production/components/ProductionDialog.vue
@@ -200,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 || "--";
}
@@ -219,11 +219,6 @@
];
const formalDatabaseColumns = ref([
- {prop: "supplierId", label: "渚涘簲鍟嗗悕绉�", minwidth: 150
- ,formatter: (row) => {
- return supplierList.value.find(supplier => supplier.id === row.supplierId)?.supplierName || "--";
- }
- },
{prop: "coalId", label: "鐓ょ", minwidth: 60,
formatter: (row) => {
return coalList.value.find(coal => coal.id === row.coalId)?.coal || "--";
@@ -247,29 +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 OfficialAll = await getOfficialAll();
- let getSupplierList = await getSupplyList();
- let getCoalName = await getCoalInfoList();
- coalList.value = getCoalName.data || [];
- supplierList.value = getSupplierList.data || [];
- 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 {
+
+ // 纭繚鍩虹鏁版嵁宸插姞杞�
+ 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