|
@@ -53,16 +53,26 @@
|
|
v-autoTrim="{ obj: form, key: 'gitPassword' }"
|
|
v-autoTrim="{ obj: form, key: 'gitPassword' }"
|
|
v-model="form.gitPassword"
|
|
v-model="form.gitPassword"
|
|
>
|
|
>
|
|
|
|
+ <el-button slot="suffix" type="primary" @click="testConnection">测试链接</el-button>
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <div class="testLinkPanel">
|
|
|
|
- <el-button type="primary" @click="testConnection">测试链接</el-button>
|
|
|
|
- </div>
|
|
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
<div class="btns">
|
|
<div class="btns">
|
|
- <el-button type="primary" @click="save">保存</el-button>
|
|
|
|
- <el-button type="primary" @click="cancel">取消</el-button>
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ @click="save"
|
|
|
|
+ >保存</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button
|
|
|
|
+ v-if="form.share === '0' || form.share === '1'"
|
|
|
|
+ type="primary"
|
|
|
|
+ @click="saveOther"
|
|
|
|
+ >另存为</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button type="primary" plain @click="cancel"
|
|
|
|
+ >取消</el-button
|
|
|
|
+ >
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -96,24 +106,53 @@ export default {
|
|
},
|
|
},
|
|
};
|
|
};
|
|
},
|
|
},
|
|
-
|
|
|
|
- methods: {
|
|
|
|
- testConnection(){
|
|
|
|
|
|
+ mounted(){
|
|
|
|
+ let id = this.$route.query.id;
|
|
|
|
+ if (id) {
|
|
|
|
+ this.form.share = this.$route.query.share;
|
|
this.$axios({
|
|
this.$axios({
|
|
- method: "POST",
|
|
|
|
- url: this.$api.algorithmsLibrary.testConnection,
|
|
|
|
- data:{
|
|
|
|
- gitUrl: this.form.gitUrl,
|
|
|
|
- gitUserName: this.form.gitUserName,
|
|
|
|
- gitPassword: this.form.gitPassword,
|
|
|
|
- }
|
|
|
|
- }).then(res=>{
|
|
|
|
- if (res.code == 200) {
|
|
|
|
- this.$message.success("测试成功");
|
|
|
|
|
|
+ method: "post",
|
|
|
|
+ url: this.$api.algorithmsLibrary.selectDetailsById,
|
|
|
|
+ data: {
|
|
|
|
+ id,
|
|
|
|
+ },
|
|
|
|
+ }).then((res) => {
|
|
|
|
+ if (res.code == 200 && res.info) {
|
|
|
|
+ this.form = res.info;
|
|
} else {
|
|
} else {
|
|
- this.$message.error(res.message || "测试失败");
|
|
|
|
|
|
+ this.$message.error(res.message || "获取信息失败");
|
|
}
|
|
}
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ testConnection(){
|
|
|
|
+ let validateFieldList = []
|
|
|
|
+ this.$refs.form.validateField(['gitUserName','gitPassword','gitUrl'],async errorMsg=>{
|
|
|
|
+ if(!errorMsg){
|
|
|
|
+ validateFieldList.push(errorMsg)
|
|
|
|
+ if(validateFieldList.length == 3 && validateFieldList.every(item=>item ==='')){
|
|
|
|
+ this.$axios({
|
|
|
|
+ method: "POST",
|
|
|
|
+ url: this.$api.algorithmsLibrary.testConnection,
|
|
|
|
+ data:{
|
|
|
|
+ gitUrl: this.form.gitUrl,
|
|
|
|
+ gitUserName: this.form.gitUserName,
|
|
|
|
+ gitPassword: this.form.gitPassword,
|
|
|
|
+ }
|
|
|
|
+ }).then(res=>{
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
+ this.$message.success("测试成功");
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(res.message || "测试失败");
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
})
|
|
})
|
|
|
|
+ return
|
|
},
|
|
},
|
|
save(){
|
|
save(){
|
|
this.$refs.form.validate((valid) => {
|
|
this.$refs.form.validate((valid) => {
|
|
@@ -135,6 +174,26 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ saveOther(){
|
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ let data = {...this.form}
|
|
|
|
+ data.id = ''
|
|
|
|
+ this.$axios({
|
|
|
|
+ method: "post",
|
|
|
|
+ url: this.$api.algorithmsLibrary.addOrUpdate,
|
|
|
|
+ data: data,
|
|
|
|
+ }).then((res) => {
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
+ this.$message.success("保存成功");
|
|
|
|
+ this.cancel();
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(res.message || "保存失败");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
cancel(){
|
|
cancel(){
|
|
this.$router.replace({ path: "/algorithmsLibraryList" });
|
|
this.$router.replace({ path: "/algorithmsLibraryList" });
|
|
}
|
|
}
|
|
@@ -188,8 +247,6 @@ export default {
|
|
this.type = val;
|
|
this.type = val;
|
|
}, */
|
|
}, */
|
|
},
|
|
},
|
|
-
|
|
|
|
- // mounted: {},
|
|
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -203,6 +260,9 @@ export default {
|
|
.el-select {
|
|
.el-select {
|
|
width: 100%;
|
|
width: 100%;
|
|
}
|
|
}
|
|
|
|
+ /deep/ .el-input__suffix{
|
|
|
|
+ right: 0;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
.testLinkPanel {
|
|
.testLinkPanel {
|