This commit is contained in:
cjw
2026-03-15 11:39:28 +08:00
parent 570efb7dea
commit 5ad7fa97b2
+15 -18
View File
@@ -389,7 +389,7 @@ const HomeView = {
const loadStats = async () => { const loadStats = async () => {
try { try {
const [inventoryStats, health] = await Promise.all([ const [inventoryStats, health] = await Promise.all([
apiRequest('/api/inventory/dashboard').catch(() => null), apiRequest('/api/dashboard').catch(() => null),
apiRequest('/health').catch(() => null) apiRequest('/health').catch(() => null)
]); ]);
state.stats = { inventory: inventoryStats, health }; state.stats = { inventory: inventoryStats, health };
@@ -419,8 +419,7 @@ const HomeView = {
<div v-if="state.loading" class="loading-state"> <div v-if="state.loading" class="loading-state">
<div class="spinner"></div> <div class="spinner"></div>
<p>正在加载任务数据...</p> <p>正在加载数据...</p>
<p style="font-size:12px;color:#666;">DEBUG: {{ route.params.taskId }}</p>
</div> </div>
<div v-else class="dashboard-grid"> <div v-else class="dashboard-grid">
@@ -911,6 +910,11 @@ const MoldInsightView = {
loadHistory(); loadHistory();
}); });
const isFoamMaterial = (material) => {
const foamMaterials = ['AlSi10Mg', 'AlSi12', 'Pure Al Foam', 'AlSi7Mg'];
return foamMaterials.includes(material);
};
return { return {
state, state,
handleFileChange, handleFileChange,
@@ -920,7 +924,8 @@ const MoldInsightView = {
formatDateTime, formatDateTime,
formatNumber, formatNumber,
toggleFileHistory, toggleFileHistory,
viewResult viewResult,
isFoamMaterial
}; };
}, },
template: ` template: `
@@ -1181,14 +1186,6 @@ const ResultView = {
<button class="btn-back" @click="$router.back()">← 返回</button> <button class="btn-back" @click="$router.back()">← 返回</button>
<h1>分析结果</h1> <h1>分析结果</h1>
</div> </div>
<!-- DEBUG -->
<div style="background:#f0f;padding:20px;margin:20px;">
<h2>DEBUG: ResultView</h2>
<p>taskId: {{ route.params.taskId }}</p>
<p>loading: {{ state.loading }}</p>
<p>task: {{ state.task ? 'exists' : 'null' }}</p>
<p>error: {{ state.error }}</p>
</div>
<div v-if="state.loading" class="loading-state"> <div v-if="state.loading" class="loading-state">
<div class="spinner"></div> <div class="spinner"></div>
<span>加载中...</span> <span>加载中...</span>
@@ -1488,7 +1485,7 @@ const InventoryView = {
const loadDashboard = async () => { const loadDashboard = async () => {
state.loading = true; state.loading = true;
try { try {
state.dashboard = await apiRequest('/api/inventory/dashboard'); state.dashboard = await apiRequest('/api/dashboard');
} catch (e) { } catch (e) {
handleApiError(e, '加载仪表盘'); handleApiError(e, '加载仪表盘');
} finally { } finally {
@@ -1499,7 +1496,7 @@ const InventoryView = {
const loadProducts = async () => { const loadProducts = async () => {
state.loading = true; state.loading = true;
try { try {
state.products = await apiRequest('/api/inventory/products'); state.products = await apiRequest('/api/products');
} catch (e) { } catch (e) {
handleApiError(e, '加载产品'); handleApiError(e, '加载产品');
} finally { } finally {
@@ -1510,7 +1507,7 @@ const InventoryView = {
const loadSuppliers = async () => { const loadSuppliers = async () => {
state.loading = true; state.loading = true;
try { try {
state.suppliers = await apiRequest('/api/inventory/suppliers'); state.suppliers = await apiRequest('/api/suppliers');
} catch (e) { } catch (e) {
handleApiError(e, '加载供应商'); handleApiError(e, '加载供应商');
} finally { } finally {
@@ -1521,7 +1518,7 @@ const InventoryView = {
const loadCustomers = async () => { const loadCustomers = async () => {
state.loading = true; state.loading = true;
try { try {
state.customers = await apiRequest('/api/inventory/customers'); state.customers = await apiRequest('/api/customers');
} catch (e) { } catch (e) {
handleApiError(e, '加载客户'); handleApiError(e, '加载客户');
} finally { } finally {
@@ -1532,7 +1529,7 @@ const InventoryView = {
const loadInventory = async () => { const loadInventory = async () => {
state.loading = true; state.loading = true;
try { try {
state.inventory = await apiRequest('/api/inventory/inventory'); state.inventory = await apiRequest('/api/inventory');
} catch (e) { } catch (e) {
handleApiError(e, '加载库存'); handleApiError(e, '加载库存');
} finally { } finally {
@@ -1543,7 +1540,7 @@ const InventoryView = {
const loadMovements = async () => { const loadMovements = async () => {
state.loading = true; state.loading = true;
try { try {
state.movements = await apiRequest('/api/inventory/stock-movements'); state.movements = await apiRequest('/api/stock-movements');
} catch (e) { } catch (e) {
handleApiError(e, '加载变动记录'); handleApiError(e, '加载变动记录');
} finally { } finally {