提交 dca84472 编写于 作者: zhangpingchuan's avatar zhangpingchuan

feat: 新增支持表单重复器

上级 c1f4fb2c
......@@ -13,6 +13,7 @@ export const EditFormControl = defineComponent({
params: { type: Object as PropType<IParams>, default: () => ({}) },
enableAutoSave: { type: Boolean, required: false },
silentVerify: { type: Boolean, required: false },
simpleDataIndex: { type: Number, required: false },
},
setup(props) {
const { proxy } = getCurrentInstance()!;
......
......@@ -44,21 +44,33 @@ export const FormMDCtrl = defineComponent({
this.c.contentCtrlData.map((data: IData, index: number) => {
let formComponent = null;
const { form } = this.c.model;
if (form && this.c.providers[form.name] && this.c.model.appEntity) {
const tempContext = Object.assign(this.c.form.context.clone(), {
[this.c.model.appEntity.codeName?.toLowerCase()]:
data[this.c.model.appEntity.keyName],
});
if (form && this.c.providers[form.name]) {
const tempContext = this.c.form.context.clone();
if (this.c.model.appEntity) {
Object.assign(tempContext, {
[this.c.model.appEntity.codeName?.toLowerCase()]:
data[this.c.model.appEntity.keyName],
});
}
const formProps: IData = {
modelData: form,
context: tempContext,
params: this.c.form.params,
};
if (this.modelData.mdCtrlType === 'REPEATER') {
formProps.simpleDataIndex = index;
} else {
formProps.enableAutoSave = true;
}
const formEmits: IData = {};
if (this.modelData.mdCtrlType === 'REPEATER') {
formEmits.neuronInit = this.c.onNeuronInit(index.toString());
} else {
formEmits.neuronInit = this.c.onNeuronInit(data.srfkey);
}
formComponent = h(this.c.providers[form.name].component, {
props: {
modelData: form,
context: tempContext,
params: this.c.form.params,
enableAutoSave: true,
},
on: {
neuronInit: this.c.onNeuronInit(data.srfkey),
},
props: formProps,
on: formEmits,
});
}
return (
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册