This commit is contained in:
2026-06-09 11:14:03 +08:00
parent c6a8bc39da
commit 7d0fa506b6
19 changed files with 25 additions and 31 deletions
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { reactive, ref } from 'vue'
import { reactive, ref, onMounted } from 'vue'
import { useInventory } from '@/modules/inventory/composables/useInventory'
import { apiRequest } from '@/shared/api'
import { addNotification, handleApiError } from '@/shared/notification'
@@ -75,6 +75,7 @@ async function deleteCustomer(id: number) {
handleApiError(e, '删除客户')
}
}
onMounted(() => { loadCustomers() })
</script>
<template>
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { reactive, ref } from 'vue'
import { reactive, ref, onMounted } from 'vue'
import { useInventory } from '@/modules/inventory/composables/useInventory'
import { apiRequest } from '@/shared/api'
import { addNotification, handleApiError } from '@/shared/notification'
@@ -81,6 +81,7 @@ async function deleteItem(id: number) {
handleApiError(e, '删除物料库存')
}
}
onMounted(() => { loadInventory() })
</script>
<template>
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, computed } from 'vue'
import { ref, computed, onMounted } from 'vue'
import { useInventory } from '../composables/useInventory'
import { apiRequest } from '@/shared/api'
import { addNotification, handleApiError } from '@/shared/notification'
@@ -169,6 +169,7 @@ function closeRestockModal() {
showRestockModal.value = false
restockItems.value = []
}
onMounted(() => { loadMaterials() })
</script>
<template>
@@ -1,7 +1,8 @@
<script setup lang="ts">
import { onMounted } from 'vue'
import { useInventory } from '@/modules/inventory/composables/useInventory'
const { state, getMovementTypeLabel, getMovementBadgeClass, formatDateTime } = useInventory()
const { state, loadMovements, getMovementTypeLabel, getMovementBadgeClass, formatDateTime } = useInventory()
const getMovementTagType = (movementType: string): 'success' | 'danger' | 'warning' | 'info' | '' => {
const badgeClass = getMovementBadgeClass(movementType)
@@ -10,6 +11,7 @@ const getMovementTagType = (movementType: string): 'success' | 'danger' | 'warni
if (badgeClass === 'badge-warning') return 'warning'
return 'info'
}
onMounted(() => { loadMovements() })
</script>
<template>
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { reactive, ref } from 'vue'
import { reactive, ref, onMounted } from 'vue'
import { useInventory } from '../composables/useInventory'
import { apiRequest } from '@/shared/api'
import { addNotification, handleApiError } from '@/shared/notification'
@@ -118,6 +118,7 @@ function closeModal() {
form.value = {}
bomItems.value = []
}
onMounted(() => { loadFinishedProducts() })
</script>
<template>
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { reactive, ref } from 'vue'
import { reactive, ref, onMounted } from 'vue'
import { useInventory } from '@/modules/inventory/composables/useInventory'
import { apiRequest } from '@/shared/api'
import { addNotification, handleApiError } from '@/shared/notification'
@@ -75,6 +75,7 @@ async function deleteSupplier(id: number) {
handleApiError(e, '删除供应商')
}
}
onMounted(() => { loadSuppliers() })
</script>
<template>
@@ -391,19 +391,6 @@ export function useInventory() {
const switchTab = (tab: string) => {
state.activeTab = tab
if (!state.backendDbReady) return
switch (tab) {
case 'dashboard': loadDashboard(); break
case 'sales_orders': loadProductionOrders(); break
case 'products': loadFinishedProducts(); break
case 'materials': loadMaterials(); break
case 'purchases': loadPurchaseOrders(); break
case 'inventory': loadInventory(); break
case 'customers': loadCustomers(); break
case 'suppliers': loadSuppliers(); break
case 'finance': loadFinance(); break
case 'movements': loadMovements(); break
}
}
const closeModal = () => {