提供测试连接按钮,测试配置信息是否正确
This commit is contained in:
@@ -23,4 +23,12 @@ export function edit(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function testConnect(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/serverDeploy/testConnect',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export default { add, edit, del }
|
export default { add, edit, del }
|
||||||
|
|||||||
@@ -24,7 +24,8 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
@click="showAddFormDialog"
|
@click="showAddFormDialog"
|
||||||
>新增</el-button>
|
>新增
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<!--表单组件-->
|
<!--表单组件-->
|
||||||
<el-dialog :append-to-body="true" :close-on-click-modal="false" :visible.sync="dialog" :title="getFormTitle()" width="470px">
|
<el-dialog :append-to-body="true" :close-on-click-modal="false" :visible.sync="dialog" :title="getFormTitle()" width="470px">
|
||||||
@@ -42,7 +43,8 @@
|
|||||||
<el-input v-model="form.account" style="width: 370px" />
|
<el-input v-model="form.account" style="width: 370px" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="密码" prop="password">
|
<el-form-item label="密码" prop="password">
|
||||||
<el-input v-model="form.password" type="password" style="width: 370px" />
|
<el-input v-model="form.password" type="password" style="width: 200px" />
|
||||||
|
<el-button :loading="loading" type="success" style="align: right;" @click="testConnectServer">测试连接</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
@@ -94,7 +96,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import crud from '@/mixins/crud'
|
import crud from '@/mixins/crud'
|
||||||
import crudServer from '@/api/mnt/serverDeploy'
|
import { crudServer, testConnect } from '@/api/mnt/serverDeploy'
|
||||||
import { validateIP } from '@/utils/validate'
|
import { validateIP } from '@/utils/validate'
|
||||||
export default {
|
export default {
|
||||||
mixins: [crud],
|
mixins: [crud],
|
||||||
@@ -134,6 +136,23 @@ export default {
|
|||||||
async beforeInit() {
|
async beforeInit() {
|
||||||
this.url = 'api/serverDeploy'
|
this.url = 'api/serverDeploy'
|
||||||
return true
|
return true
|
||||||
|
},
|
||||||
|
testConnectServer() {
|
||||||
|
this.$refs['form'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.loading = true
|
||||||
|
testConnect(this.form).then((res) => {
|
||||||
|
this.loading = false
|
||||||
|
this.$notify({
|
||||||
|
title: res ? '连接成功' : '连接失败',
|
||||||
|
type: res ? 'success' : 'error',
|
||||||
|
duration: 2500
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user