更新xUpdate
This commit is contained in:
parent
1a5e3926db
commit
f636670bf6
@ -47,6 +47,7 @@
|
||||
labelPosition : "right",
|
||||
labelWidth : "120px",
|
||||
size : "medium",
|
||||
submitinfokey : "info",
|
||||
url:'',
|
||||
merge:false, // 远程数据时, 是否合并data
|
||||
submitname:'保存'
|
||||
@ -83,6 +84,8 @@
|
||||
},
|
||||
// 表单提交方法
|
||||
submit(){
|
||||
|
||||
|
||||
this.$refs.formref.validate(async (valid) => {
|
||||
if (valid) {
|
||||
if (!this.config.url) {
|
||||
@ -90,8 +93,22 @@
|
||||
this.$alert('没有'+ ((this.config.name || this.titleMap[this.mode]) || '编辑') +'数据相关配置', "提示", {type: 'error'});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const data = {
|
||||
[this.config.submitinfokey || 'info']: this.data,
|
||||
};
|
||||
|
||||
if (this.key && typeof this.data[this.key] !== 'undefined') {
|
||||
Object.assign(data,{[this.key]: this.data[this.key]});
|
||||
}
|
||||
|
||||
if (this.token) {
|
||||
Object.assign(data,{token: this.token});
|
||||
}
|
||||
|
||||
this.isSaveing = true;
|
||||
this.$http.post(this.config.url, {token:this.token, info:this.data}).then((res) => {
|
||||
this.$http.post(this.config.url, data).then((res) => {
|
||||
this.isSaveing = false;
|
||||
if (res.code == 200 ) {
|
||||
this.visible = false;
|
||||
@ -150,11 +167,6 @@
|
||||
// 表单注入数据
|
||||
setData(data){
|
||||
this.data = data;
|
||||
|
||||
if (this.key == 'token' && typeof this.data[this.key] !== 'undefined') {
|
||||
this.token = this.data[this.key];
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user