更新xUpdate

This commit is contained in:
小陌 2023-09-11 21:37:28 +08:00
parent 1a5e3926db
commit f636670bf6

View File

@ -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;
},
}