diff --git a/static/vue-app.js b/static/vue-app.js index 1daa8c7..797fcf7 100644 --- a/static/vue-app.js +++ b/static/vue-app.js @@ -1472,6 +1472,7 @@ const InventoryView = { const route = useRoute(); const state = reactive({ activeTab: 'dashboard', + productCategory: 'finished', dashboard: null, financeSummary: null, financePeriod: { @@ -1746,6 +1747,24 @@ const InventoryView = { } }; + const switchProductCategory = (category) => { + state.productCategory = category; + }; + + const openCreateProduct = (itemType) => { + state.modalType = 'product'; + state.editingItem = null; + state.form = { + item_type: itemType, + unit: itemType === 'material' ? 'kg' : '件', + min_stock: 0, + max_stock: 1000, + cost_price: 0, + sale_price: 0 + }; + state.showModal = true; + }; + const loadOrderProductionPlan = async (orderId) => { try { state.productionPlan = await apiRequest(`/api/sales-orders/${orderId}/production-plan`); @@ -2243,6 +2262,8 @@ const InventoryView = { formatCurrency, formatDateTime, openModal, + switchProductCategory, + openCreateProduct, closeModal, saveProduct, deleteProduct, @@ -2345,8 +2366,15 @@ const InventoryView = {
| {{ product.item_type === 'material' ? '物料' : '成品' }} | {{ product.sku }} | {{ product.name }} |