WIP: corrections multiples formulaires et sérialisation

- Fix constructeurUtils: réordonner delete/add pour sauvegarder les fournisseurs
- Fix prix/supplierPrice: envoyer en string pour DECIMAL Doctrine
- Fix useMachineTypesApi: normaliser les requirements et forceRefresh
- Fix SearchSelect: watch deep sur baseOptions
- Debug logs temporaires pour pieceRequirements

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-23 12:28:40 +01:00
parent 2f3d4c5260
commit 9cc7ac10f0
14 changed files with 276 additions and 89 deletions

View File

@@ -594,6 +594,15 @@ const selectedTypeStructure = computed<ComponentModelStructure | null>(() => {
return structure ? normalizeStructureForEditor(structure) : null
})
const refreshCustomFieldInputs = (
structureOverride?: ComponentModelStructure | null,
valuesOverride?: any[] | null,
) => {
const structure = structureOverride ?? selectedTypeStructure.value ?? null
const values = valuesOverride ?? component.value?.customFieldValues ?? null
customFieldInputs.value = buildCustomFieldInputs(structure, values)
}
const requiredCustomFieldsFilled = computed(() =>
customFieldInputs.value.every((field) => {
if (!field.required) {
@@ -641,6 +650,7 @@ const fetchComponent = async () => {
const customValues = await getCustomFieldValuesByEntity('composant', result.data.id)
if (customValues.success && Array.isArray(customValues.data)) {
component.value.customFieldValues = customValues.data
refreshCustomFieldInputs(undefined, customValues.data)
}
} else {
component.value = null
@@ -677,10 +687,7 @@ watch(
void ensureConstructeurs(editionForm.constructeurIds)
}
customFieldInputs.value = buildCustomFieldInputs(
currentStructure,
currentComponent.customFieldValues,
)
refreshCustomFieldInputs(currentStructure, currentComponent.customFieldValues)
initialized = true
},
@@ -691,10 +698,7 @@ watch(selectedTypeStructure, (currentStructure) => {
if (!component.value) {
return
}
customFieldInputs.value = buildCustomFieldInputs(
currentStructure,
component.value.customFieldValues,
)
refreshCustomFieldInputs(currentStructure, component.value.customFieldValues)
})
const submitEdition = async () => {
@@ -719,7 +723,7 @@ const submitEdition = async () => {
if (rawPrice) {
const parsed = Number(rawPrice)
if (!Number.isNaN(parsed)) {
payload.prix = parsed
payload.prix = String(parsed)
}
} else {
payload.prix = null

View File

@@ -870,7 +870,7 @@ const submitCreation = async () => {
if (rawPrice) {
const parsed = Number(rawPrice)
if (!Number.isNaN(parsed)) {
payload.prix = parsed
payload.prix = String(parsed)
}
}