* [story #79425] fix widget type not set in ai form config.

This commit is contained in:
sunhao
2025-12-02 16:32:21 +08:00
parent 918b25dbdb
commit ec78562fc1
+9 -2
View File
@@ -46,10 +46,17 @@ window.openPageForm = function(url, data, callback)
function getPromptFormConfig(fields, extraConfig)
{
if(!Array.isArray(fields) || !fields.length) return;
const typeMap = {text: 'string', radio: 'picker', checkbox: 'multiPicker'};
const typeMap = {radio: 'picker', checkbox: 'multiPicker'};
const required = [];
const properties = fields.reduce((properties, field, index) => {
properties[field.name] = {type: typeMap[field.type] || field.type || 'string', title: field.name, description: field.placeholder, order: index, required: field.required && field.required !== '0'};
properties[field.name] = {
type: 'string',
widget: typeMap[field.type] || field.type,
title: field.name,
order: index,
required: field.required && field.required !== '0',
props: zui.isNotEmptyString(field.options) ? {items: field.options.split(',').map(x => ({text: x, value: x}))} : undefined
};
if(field.required) required.push(field.name);
return properties;
}, {});