Commit a0a903f0 authored by 王晓旭's avatar 王晓旭

增加页面setup/ipconfig

parent 7ae81e7f
......@@ -51,6 +51,7 @@ const router = new Router({
...restBuilder("setup/project", "setup/project"), //项目部署管理
...restBuilder("setup/ipconfig", "setup/ipconfig"), //修改ip
//以下为基础路由配置
builder("", "Home"),
......
<template>
<div class="page">
<div class="biaodan">
<el-form :model="ippzForm" :rules="ippzRules" ref="ippzForm" label-width="80px">
<el-form-item prop="clientToServerIp">
<div class="elinput">
<el-input placeholder="请输入设备通讯ip,不能输入端口号" v-model="ippzForm.clientToServerIp">
<template slot="prepend">
<div style="width:80px;text-align: center;">设备通讯ip</div>
</template>
</el-input>
</div>
</el-form-item>
<el-form-item prop="domain">
<div class="elinput">
<el-input placeholder="请输入域名" v-model="ippzForm.domain">
<template slot="prepend">
<div style="width:80px;text-align: center;">
域名
</div>
</template>
</el-input>
</div>
</el-form-item>
<el-form-item prop="innerServerIp">
<div class="elinput">
<el-input placeholder="请输入内网ip,不能输入端口号" v-model="ippzForm.innerServerIp">
<template slot="prepend">
<div style="width:80px;text-align: center;">
内网ip
</div>
</template>
</el-input>
</div>
</el-form-item>
<div style="margin: 40px 0;"></div>
<div class="line"></div>
<div style="margin-left: 80px;">
<el-button type="primary" @click="submitJCForm('ippzForm')" :loading="loading">修改表单</el-button>
</div>
</el-form>
</div>
</div>
</template>
<script>
import axios from "axios";
export default {
data(){
return{
// 表单
ippzForm: {
clientToServerIp:"",//设备通讯ip
domain:"", //域名
innerServerIp:""//内网ip
},
// 表单验证
ippzRules: {
clientToServerIp: [
{ required: true, message: '请输入设备通讯ip', trigger: 'blur' },
{
pattern:/^((2[0-4]\d.)|(25[0-5].)|(1\d{2}.)|(\d{1,2}.))((2[0-5]{2}.)|(1\d{2}.)|(\d{1,2}.){2})((1\d{2})|(2[0-5]{2})|(\d{1,2}))/, //正则校验不用字符串
message: "请填写正确的设备通讯ip", trigger: "blur"
}
],
domain: [
{ required: true, message: '请输入域名', trigger: 'blur' }
],
innerServerIp: [
{ required: true, message: '请输入内网ip', trigger: 'blur' },
{
pattern:/^((2[0-4]\d.)|(25[0-5].)|(1\d{2}.)|(\d{1,2}.))((2[0-5]{2}.)|(1\d{2}.)|(\d{1,2}.){2})((1\d{2})|(2[0-5]{2})|(\d{1,2}))/, //正则校验不用字符串
message: "请填写正确的内网ip", trigger: "blur"
}
]
},
}
},
mounted() {
this.getFrom()
},
created() {
},
methods: {
// 获取表单内容
getFrom(){
this.$get("/setup/project/serverIp/view").then((res)=>{
console.log(111,res);
const data = res.data
this.ippzForm.clientToServerIp = data.clientToServerIp
this.ippzForm.domain = data.domain
this.ippzForm.innerServerIp = data.innerServerIp
}).catch((err)=>{
that.$message.error("提示报错");
})
},
// 修改提交
submitJCForm(formName){
let that = this
this.$refs[formName].validate((vaild)=>{
if (vaild) {
that.$post("/setup/project/serverIp/update", {
...that.ippzForm
}).then((res) => {
if (res.code == 1) {
that.$message.success("修改表单内容成功!");
}else{
that.$message.warning(res.msg);
}
}).catch((err)=>{
that.$message.warning("请输入正确的表单内容!");
})
} else {
that.$message.warning("请输入正确的表单内容!");
return false;
}
})
},
}
};
</script>
<style lang="less" scoped>
.biaodan{
margin: 60px 800px 20px 0;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment