Просмотр исходного кода

feat(web-admin): fill load/delivery notes from address when empty

Apply library notes only if the stop notes field is currently blank.

Co-authored-by: Cursor <cursoragent@cursor.com>
zlwu 2 месяцев назад
Родитель
Сommit
6021287c97

+ 6 - 0
web-admin/src/components/business/pl-plan-delivery-section/index.vue

@@ -230,6 +230,7 @@
   } from '@/components/business/pl-address-with-library/index.vue'
   import PlPlanContractMultiSelect from '@/components/business/pl-plan-contract-multi-select/index.vue'
   import PlPlanStopProductTable from '@/components/business/pl-plan-stop-product-table/index.vue'
+  import { resolveAddressNotesFill } from '@/utils/pl-address-notes-fill'
   import {
     createEmptyDeliveryForm,
     resolveStopDibangDefaults,
@@ -336,6 +337,7 @@
   }
 
   function patchDeliveryAddress(index: number, fields: PlAddressApplyPayload) {
+    const delivery = props.modelValue[index]
     const partial: Partial<PlanDeliveryForm> = {
       address: fields.address,
       lng: fields.lng,
@@ -344,6 +346,10 @@
     if (fields.contact !== undefined) {
       partial.contact = fields.contact
     }
+    const nextNotes = resolveAddressNotesFill(delivery?.notes, fields.notes)
+    if (nextNotes !== undefined) {
+      partial.notes = nextNotes
+    }
     patchDelivery(index, partial)
   }
 

+ 5 - 0
web-admin/src/components/business/pl-plan-load-section/index.vue

@@ -161,6 +161,7 @@
   } from '@/components/business/pl-address-with-library/index.vue'
   import PlPlanContractMultiSelect from '@/components/business/pl-plan-contract-multi-select/index.vue'
   import PlPlanStopProductTable from '@/components/business/pl-plan-stop-product-table/index.vue'
+  import { resolveAddressNotesFill } from '@/utils/pl-address-notes-fill'
   import { resolveStopDibangDefaults, type PlanLoadForm } from '@/utils/pl-plan-stop-form'
   import { isPlInternalCustomerName } from '@/utils/pl-internal-customer'
   import { pickBxData } from '@/utils/http/bx'
@@ -241,6 +242,10 @@
     if (fields.contact !== undefined) {
       partial.contact = fields.contact
     }
+    const nextNotes = resolveAddressNotesFill(props.modelValue.notes, fields.notes)
+    if (nextNotes !== undefined) {
+      partial.notes = nextNotes
+    }
     patch(partial)
   }