修改前台添加和删除和表单校验
parent
3312b972b2
commit
678dc9420c
|
@ -46,7 +46,7 @@ export function structure(data){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//测试连接
|
//同步资产结构
|
||||||
export function connectionTest(data){
|
export function connectionTest(data){
|
||||||
return request({
|
return request({
|
||||||
url: "/source/source/connectionTest",
|
url: "/source/source/connectionTest",
|
||||||
|
@ -61,7 +61,16 @@ export function deleteSource(ids){
|
||||||
return request({
|
return request({
|
||||||
url: "/source/source/"+ids,
|
url: "/source/source/"+ids,
|
||||||
method: "delete",
|
method: "delete",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//修改
|
||||||
|
export function update(data){
|
||||||
|
return request({
|
||||||
|
url: "/source/source/update",
|
||||||
|
method: "post",
|
||||||
|
data:data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,9 +56,9 @@
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
|
|
||||||
<el-dialog title="添加数据源接入" :visible.sync="dialogFormVisible" append-to-body width="60%">
|
<el-dialog title="title" :visible.sync="dialogFormVisible" append-to-body width="60%">
|
||||||
|
|
||||||
<el-form ref="form" :model="sourceAddReq" label-width="140px" :inline="true" class="demo-form-inline">
|
<el-form ref="form" :model="sourceAddReq" :rules="rules" label-width="140px" :inline="true" class="demo-form-inline">
|
||||||
<el-form-item label="接入源名称">
|
<el-form-item label="接入源名称">
|
||||||
<el-input v-model="sourceAddReq.dataResourceName"></el-input>
|
<el-input v-model="sourceAddReq.dataResourceName"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -262,7 +262,7 @@
|
||||||
<script>
|
<script>
|
||||||
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等),
|
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等),
|
||||||
//例如:import 《组件名称》 from '《组件路径》,
|
//例如:import 《组件名称》 from '《组件路径》,
|
||||||
import {selectSourceList} from "@/api/etl/switch";
|
import {selectSourceList, update} from "@/api/etl/switch";
|
||||||
import {selectSourceExport} from "@/api/etl/switch";
|
import {selectSourceExport} from "@/api/etl/switch";
|
||||||
import {connectionTest} from "@/api/etl/switch";
|
import {connectionTest} from "@/api/etl/switch";
|
||||||
import {insertAdd} from "@/api/etl/switch";
|
import {insertAdd} from "@/api/etl/switch";
|
||||||
|
@ -278,6 +278,17 @@ export default {
|
||||||
//这里存放数据"
|
//这里存放数据"
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
rules: {
|
||||||
|
dataResourceName: [
|
||||||
|
{required: true, message: "接入源名称不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
dataSourcesSystemName: [
|
||||||
|
{required: true, message: "数据来源系统名称不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
host: [
|
||||||
|
{required: true, message: "主机地址不能为空", trigger: "blur"}
|
||||||
|
]
|
||||||
|
},
|
||||||
ids:[],
|
ids:[],
|
||||||
dialogFormVisible:false,
|
dialogFormVisible:false,
|
||||||
SourceReq:{
|
SourceReq:{
|
||||||
|
@ -295,6 +306,20 @@ export default {
|
||||||
watch: {},
|
watch: {},
|
||||||
//方法集合",
|
//方法集合",
|
||||||
methods: {
|
methods: {
|
||||||
|
reset() {
|
||||||
|
this.sourceAddReq = {
|
||||||
|
};
|
||||||
|
this.resetForm("sourceAddReq");
|
||||||
|
},
|
||||||
|
//修改
|
||||||
|
update(row){
|
||||||
|
this.reset();
|
||||||
|
getInfo(row.id).then(res=>{
|
||||||
|
this.sourceAddReq=res.data;
|
||||||
|
this.dialogFormVisible=true;
|
||||||
|
this.title="修改岗位"
|
||||||
|
})
|
||||||
|
},
|
||||||
struceure(row){
|
struceure(row){
|
||||||
structure(row).then(res=>{
|
structure(row).then(res=>{
|
||||||
if (res ===200){
|
if (res ===200){
|
||||||
|
@ -326,11 +351,25 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
addSource(){
|
addSource(){
|
||||||
insertAdd(this.sourceAddReq).then(res=>{
|
this.$refs["sourceAddReq"].validate(valid => {
|
||||||
if(res.code===200){
|
if (valid){
|
||||||
location.reload();
|
if (this.sourceAddReq.id!=undefined){
|
||||||
|
update(this.sourceAddReq).then(res=>{
|
||||||
|
if (res.code===200){
|
||||||
|
alert("修改成功")
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else {
|
||||||
|
insertAdd(this.sourceAddReq).then(res=>{
|
||||||
|
if(res.code===200){
|
||||||
|
alert("添加成功")
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
//测试连接
|
//测试连接
|
||||||
textConnect(row){
|
textConnect(row){
|
||||||
|
@ -343,7 +382,9 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//新增
|
||||||
insertAdd(){
|
insertAdd(){
|
||||||
|
this.reset();
|
||||||
this.dialogFormVisible=true
|
this.dialogFormVisible=true
|
||||||
},
|
},
|
||||||
findSelectSourceList(){
|
findSelectSourceList(){
|
||||||
|
|
Loading…
Reference in New Issue