uniapp【修复】:万能表单提交,商品模式和复选模式修复值的问题

This commit is contained in:
花城
2025-05-26 16:17:16 +08:00
parent f64e3e452e
commit 5088036bb5

View File

@@ -344,9 +344,11 @@
/** 多选 */ /** 多选 */
const handleChangeChecbox = (e : any, index : number) => { const handleChangeChecbox = (e : any, index : number) => {
state.formInfo?.items[1]?.checkboxValue.forEach((item : any) => { state.formInfo?.items[index]?.checkboxValue.forEach((item : any) => {
item.checked = e.includes(item.value); item.checked = e.includes(item.value);
}); });
let arr :any = state.formInfo?.items[index]?.checkboxValue.filter((item:any) => item.checked);
state.formInfo.items[index].defaultValue = (arr?.map((item:any) => item.value)).join(',') || '';
} }
/** 打开日期选择 */ /** 打开日期选择 */
@@ -407,7 +409,12 @@
key: item.id, key: item.id,
value: item.defaultValue.join(',') value: item.defaultValue.join(',')
} }
} else { } else if(item.type === FormTypeEnum.goods){
return {
key: item.id,
value: JSON.stringify(item.defaultValue)
}
} else {
return { return {
key: item.id, key: item.id,
value: item.defaultValue value: item.defaultValue