Kundenanlage mit aktiven Standardwerten vorbelegen #120
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 27s
Build and Push Docker Images / build-frontend (push) Successful in 1m10s
Build and Push Docker Images / build-docs (push) Successful in 16s

This commit is contained in:
2026-05-11 18:20:59 +02:00
parent 64df33f0fa
commit 34f537238e
2 changed files with 26 additions and 0 deletions

View File

@@ -123,11 +123,33 @@ const saveAllowed = computed(() => {
const setupCreate = () => {
const setDefaultValue = (datapoint) => {
if (props.mode !== "create" || !("defaultValue" in datapoint)) return
const defaultValue = typeof datapoint.defaultValue === "function"
? datapoint.defaultValue()
: datapoint.defaultValue
if(datapoint.key.includes(".")){
const [parentKey, childKey] = datapoint.key.split(".")
if (item.value[parentKey][childKey] === undefined) {
item.value[parentKey][childKey] = defaultValue
}
return
}
if (item.value[datapoint.key] === undefined) {
item.value[datapoint.key] = defaultValue
}
}
dataType.templateColumns.forEach(datapoint => {
if(datapoint.key.includes(".")){
!item.value[datapoint.key.split(".")[0]] ? item.value[datapoint.key.split(".")[0]] = {} : null
}
setDefaultValue(datapoint)
if(datapoint.inputType === "editor") {
if(datapoint.key.includes(".")){
item.value[datapoint.key.split(".")[0]][datapoint.key.split(".")[1]] = {}