修改用户数据添加表单

master
夜笙歌 2 years ago
parent 969ee3979b
commit 21ff3b2ea5

@ -156,6 +156,7 @@ export default {
name: "Userdatasource",
data() {
return {
operationType:null,
//
loading: true,
//
@ -184,7 +185,8 @@ export default {
//
form: {
datasourceId: null,
userId: null},
userId: null
},
//
rules: {
datasourceId: [
@ -226,6 +228,7 @@ export default {
},
//
reset() {
this.operationType = null
this.form = {
datasourceId: null,
userId: null
@ -250,12 +253,14 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
this.operationType = 1
this.reset();
this.open = true;
this.title = "添加用户数据";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.operationType = 2
this.reset();
const datasourceId = row.datasourceId || this.ids
getUserdatasource(datasourceId).then(response => {
@ -268,17 +273,20 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.datasourceId != null) {
if (this.operationType === 2) {
updateUserdatasource(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
this.operationType = null
});
} else {
}
if(this.operationType === 1){
addUserdatasource(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
this.operationType = null
});
}
}

Loading…
Cancel
Save