refactor(接口测试): 数据库配置添加清空按钮

This commit is contained in:
chenjianxing 2020-11-27 16:02:35 +08:00
parent 8333c3f77d
commit c0329ce42a
3 changed files with 15 additions and 3 deletions

View File

@ -58,7 +58,11 @@
this.currentConfig = new DatabaseConfig(); this.currentConfig = new DatabaseConfig();
}, },
rowSelect(config) { rowSelect(config) {
//
this.currentConfig = {};
this.$nextTick(() => {
this.currentConfig = config; this.currentConfig = config;
});
} }
} }
} }

View File

@ -80,4 +80,8 @@
float: right; float: right;
} }
.el-table {
cursor: pointer;
}
</style> </style>

View File

@ -39,9 +39,10 @@
<el-form-item> <el-form-item>
<div class="buttons"> <div class="buttons">
<el-button type="primary" v-show="currentConfig.id" size="small" @click="validate()">{{$t('commons.validate')}}</el-button> <el-button type="primary" v-show="currentConfig.id" size="small" @click="validate">{{$t('commons.validate')}}</el-button>
<el-button type="primary" v-show="currentConfig.id" size="small" @click="save('update')">{{$t('commons.update')}}</el-button> <el-button type="primary" v-show="currentConfig.id" size="small" @click="save('update')">{{$t('commons.update')}}</el-button>
<el-button type="primary" size="small" @click="save('add')">{{$t('commons.add')}}</el-button> <el-button type="primary" v-show="currentConfig.id" size="small" @click="clear">{{$t('commons.clear')}}</el-button>
<el-button type="primary" v-show="!currentConfig.id" size="small" @click="save('add')">{{$t('commons.add')}}</el-button>
</div> </div>
</el-form-item> </el-form-item>
@ -127,6 +128,9 @@
} }
}); });
}, },
clear() {
this.currentConfig = new DatabaseConfig();
},
validate() { validate() {
this.result = this.$post('/api/database/validate', this.currentConfig, () => { this.result = this.$post('/api/database/validate', this.currentConfig, () => {
this.$success(this.$t('commons.connection_successful')); this.$success(this.$t('commons.connection_successful'));