Merge branch 'lhq_20250606' into 'dev'
1.组件change添加参数,添加支持function格式2.多选框bug修复 See merge request itc-framework/ma/2024/front!83
This commit is contained in:
@ -192,7 +192,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function displayText() {
|
function displayText() {
|
||||||
const _checked = checked.value;;
|
const _checked = checked.value || [];
|
||||||
const labelArr = [];
|
const labelArr = [];
|
||||||
(getOptions.value || []).forEach((opt) => {
|
(getOptions.value || []).forEach((opt) => {
|
||||||
if (_checked.includes(opt.value)) {
|
if (_checked.includes(opt.value)) {
|
||||||
|
|||||||
@ -438,9 +438,14 @@
|
|||||||
if (schema.componentProps?.['events']) {
|
if (schema.componentProps?.['events']) {
|
||||||
for (const eventKey in schema.componentProps['events']) {
|
for (const eventKey in schema.componentProps['events']) {
|
||||||
if (eventKey !== 'change') return;
|
if (eventKey !== 'change') return;
|
||||||
|
const handler = schema.componentProps['events'][eventKey];
|
||||||
try {
|
try {
|
||||||
const event = new Function('schema', 'formModel', 'formActionType', 'extParams', `${schema.componentProps['events'][eventKey]}`);
|
if (typeof handler === 'string') {
|
||||||
event(schema, formModel, formApi, { formData });
|
const event = new Function('schema', 'formModel', 'formActionType', 'extParams', handler);
|
||||||
|
event(schema, formModel, formApi, { formData, allSchemas });
|
||||||
|
} else if (typeof handler === 'function') {
|
||||||
|
handler(schema, formModel, formApi, { formData, allSchemas });
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('error', error);
|
console.log('error', error);
|
||||||
notification.error({
|
notification.error({
|
||||||
|
|||||||
@ -438,9 +438,14 @@
|
|||||||
if (schema.componentProps?.['events']) {
|
if (schema.componentProps?.['events']) {
|
||||||
for (const eventKey in schema.componentProps['events']) {
|
for (const eventKey in schema.componentProps['events']) {
|
||||||
if (eventKey !== 'change') return;
|
if (eventKey !== 'change') return;
|
||||||
|
const handler = schema.componentProps['events'][eventKey];
|
||||||
try {
|
try {
|
||||||
const event = new Function('schema', 'formModel', 'formActionType', 'extParams', `${schema.componentProps['events'][eventKey]}`);
|
if (typeof handler === 'string') {
|
||||||
event(schema, formModel, formApi, { formData });
|
const event = new Function('schema', 'formModel', 'formActionType', 'extParams', handler);
|
||||||
|
event(schema, formModel, formApi, { formData, allSchemas });
|
||||||
|
} else if (typeof handler === 'function') {
|
||||||
|
handler(schema, formModel, formApi, { formData, allSchemas });
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('error', error);
|
console.log('error', error);
|
||||||
notification.error({
|
notification.error({
|
||||||
|
|||||||
@ -275,6 +275,7 @@
|
|||||||
}) ?? {};
|
}) ?? {};
|
||||||
} else {
|
} else {
|
||||||
if (componentProps['events']) {
|
if (componentProps['events']) {
|
||||||
|
const allSchemas = formProps.value.schemas;
|
||||||
for (const eventKey in componentProps['events']) {
|
for (const eventKey in componentProps['events']) {
|
||||||
try {
|
try {
|
||||||
const fun = componentProps['events'][eventKey];
|
const fun = componentProps['events'][eventKey];
|
||||||
@ -290,7 +291,7 @@
|
|||||||
let field = camelCaseString(item);
|
let field = camelCaseString(item);
|
||||||
if (field) cloneFormModel[field] = cloneFormModel[item];
|
if (field) cloneFormModel[field] = cloneFormModel[item];
|
||||||
}
|
}
|
||||||
event(props.schema, isCamelCase ? cloneFormModel : formModel, props.formApi, { value, selectedOptions });
|
event(props.schema, isCamelCase ? cloneFormModel : formModel, props.formApi, {formData, value, selectedOptions, allSchemas: allSchemas});
|
||||||
|
|
||||||
if (isCamelCase) {
|
if (isCamelCase) {
|
||||||
for (let item in formModel) {
|
for (let item in formModel) {
|
||||||
|
|||||||
Reference in New Issue
Block a user