提交 acd4b984 编写于 作者: Shine-zwj's avatar Shine-zwj

update:更新

上级 6c8a509b
...@@ -55,11 +55,15 @@ export class FormControl extends MainControl { ...@@ -55,11 +55,15 @@ export class FormControl extends MainControl {
* @memberof FormControl * @memberof FormControl
*/ */
public formDataChange(name: string, value: any) { public formDataChange(name: string, value: any) {
this.controlState.data[name] = value; const { enableAutoSave } = this.controlState;
const { data } = toRefs(this.controlState);
data.value[name] = value;
this.resetFormData(name); this.resetFormData(name);
this.formItemUpdate(name); this.formItemUpdate(name);
this.formDynamicLogic(name); this.formDynamicLogic(name);
// TODO 自动保存(可以单独做一个逻辑块,监听data的变化) if (enableAutoSave) {
this.useSave().save();
}
} }
/** /**
...@@ -230,6 +234,7 @@ export class FormControl extends MainControl { ...@@ -230,6 +234,7 @@ export class FormControl extends MainControl {
} }
}); });
} }
/** /**
* @description 设置默认值 * @description 设置默认值
* @param {string} action 表单行为 * @param {string} action 表单行为
...@@ -459,7 +464,7 @@ export class FormControl extends MainControl { ...@@ -459,7 +464,7 @@ export class FormControl extends MainControl {
* @return {*} * @return {*}
* @memberof FormControl * @memberof FormControl
*/ */
public useSave(props: FormControlProps) { public useSave(props?: FormControlProps) {
const { viewSubject, controlName } = this.controlState; const { viewSubject, controlName } = this.controlState;
/** /**
......
...@@ -38,12 +38,11 @@ export class GridControl extends MainControl { ...@@ -38,12 +38,11 @@ export class GridControl extends MainControl {
* @memberof GridControl * @memberof GridControl
*/ */
public gridDataChange(rowIndex: number, name: string, value: any){ public gridDataChange(rowIndex: number, name: string, value: any){
if (this.controlState.data[rowIndex][name] !== value) { const { data } = toRefs(this.controlState);
this.controlState.data[rowIndex][name] = value; if (data.value[rowIndex][name] !== value) {
if (!this.controlState.data[rowIndex]["rowDataState"]) { data.value[rowIndex][name] = value;
this.controlState.data[rowIndex]["rowDataState"] = "update"; data.value[rowIndex]["rowDataState"] = "update";
} }
}
} }
/** /**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册