(null)
@@ -72,6 +78,16 @@ export const useItemMasterStore = defineStore('itemMaster', () => {
}
}
+ async function loadItemStats() {
+ try {
+ stats.value = await itemMasterService.getItemStats()
+ return stats.value
+ } catch (err) {
+ error.value = err instanceof Error ? err.message : '품목 통계를 불러오지 못했습니다.'
+ throw err
+ }
+ }
+
async function loadItemReferences(id: number) {
itemReferences.value = await itemMasterService.getItemReferences(id)
return itemReferences.value
@@ -177,6 +193,7 @@ export const useItemMasterStore = defineStore('itemMaster', () => {
itemUsages,
duplicateCheck,
suggestions,
+ stats,
isLoading,
isSaving,
error,
@@ -188,6 +205,7 @@ export const useItemMasterStore = defineStore('itemMaster', () => {
lastSearchParams,
loadItems,
loadItem,
+ loadItemStats,
loadItemReferences,
loadItemUsages,
checkDuplicates,
diff --git a/frontend/src/views/HomeView.vue b/frontend/src/views/HomeView.vue
index ea5ccd3..485a5b0 100644
--- a/frontend/src/views/HomeView.vue
+++ b/frontend/src/views/HomeView.vue
@@ -72,6 +72,15 @@ function severityLabel(severity: DashboardSeverity) {
}[severity]
}
+function insightSourceLabel(source: string) {
+ return {
+ production_execution: '품질 지표',
+ current_inventory: '재고 지표',
+ outbound_shipping: '출하 지표',
+ dashboard: '대시보드'
+ }[source] ?? source
+}
+
function selectPeriod(period: DashboardPeriod) {
dashboardStore.loadDashboard(period)
}
@@ -259,7 +268,7 @@ function getDashboardAnalysisQuestion(metricId: DashboardMetricCategory) {
- {{ insight.source }}
+ {{ insightSourceLabel(insight.source) }}
diff --git a/frontend/src/views/ItemMasterView.vue b/frontend/src/views/ItemMasterView.vue
index 3e5b016..bc10c80 100644
--- a/frontend/src/views/ItemMasterView.vue
+++ b/frontend/src/views/ItemMasterView.vue
@@ -50,11 +50,10 @@ const form = reactive({
})
const stats = computed(() => {
- const items = itemMasterStore.items
return {
- total: itemMasterStore.totalElements,
- active: items.filter((item) => item.itemStatus === 'ACTIVE').length,
- inactive: items.filter((item) => item.itemStatus === 'INACTIVE').length
+ total: itemMasterStore.stats.totalCount,
+ active: itemMasterStore.stats.activeCount,
+ inactive: itemMasterStore.stats.inactiveCount
}
})
const canWrite = computed(() => authStore.canManageMasterData)
@@ -79,10 +78,21 @@ const keywordSuggestions = computed(() => {
return [...unique.values()].slice(0, 8)
})
-onMounted(() => {
- fetchItems(0)
+onMounted(async () => {
+ await Promise.all([
+ fetchItems(0),
+ loadStats()
+ ])
})
+async function loadStats() {
+ try {
+ await itemMasterStore.loadItemStats()
+ } catch (err) {
+ pageError.value = err instanceof Error ? err.message : '품목 통계를 불러오지 못했습니다.'
+ }
+}
+
async function fetchItems(page = itemMasterStore.page) {
try {
pageError.value = null
@@ -206,6 +216,7 @@ async function submitCreate(skipDuplicateCheck = false) {
closeCreate()
isDuplicateOpen.value = false
pendingPayload.value = null
+ await loadStats()
await router.push({ name: 'item-master-detail', params: { id: created.itemId } })
} catch (err) {
formError.value = err instanceof Error ? err.message : '품목 등록에 실패했습니다.'
@@ -220,6 +231,7 @@ async function submitDuplicateConfirmed() {
closeCreate()
isDuplicateOpen.value = false
pendingPayload.value = null
+ await loadStats()
await router.push({ name: 'item-master-detail', params: { id: created.itemId } })
} catch (err) {
formError.value = err instanceof Error ? err.message : '품목 등록에 실패했습니다.'