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