فهرست منبع

fix: import watch and fix types in WarehouseSection.vue

unknown 21 ساعت پیش
والد
کامیت
1d5e7bcbe3
1فایلهای تغییر یافته به همراه4 افزوده شده و 3 حذف شده
  1. 4 3
      src/components/admin/WarehouseSection.vue

+ 4 - 3
src/components/admin/WarehouseSection.vue

@@ -164,7 +164,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, reactive, onMounted } from "vue";
+import { ref, reactive, onMounted, watch } from "vue";
 import { useI18n } from "vue-i18n";
 import { Package, Plus, PackageOpen, Check, Edit2, Trash2, Minus } from "lucide-vue-next";
 import { toast } from "vue-sonner";
@@ -197,8 +197,9 @@ const form = reactive({
   notes: ""
 });
 
-watch(() => [form.unit_mass, form.units_count], ([m, c]) => {
-  if (!editingId.value) {
+// Watch unit properties to calculate total quantity
+watch(() => [form.unit_mass, form.units_count], ([m, c]: any[]) => {
+  if (!editingId.value) { // Only auto-calc for new items to avoid overriding manual tweaks
      form.quantity = Number((m * c).toFixed(3));
   }
 });