Commit f90bb78c by 莫晓莉

mxl20213.15

parent f7f8aad7
<template>
<div>
<el-dialog
title="系统提示"
:visible.sync="dialogVisibleOne"
width="30%"
:before-close="handleCloseOne">
<span>您确定要删除该数据库中所有的资源库列表</span>
<span slot="footer" class="dialog-footer">
<el-button @click="handleCloseOne()">取 消</el-button>
<el-button type="primary" @click="dialogVisibleTwo = true">确 定</el-button>
</span>
</el-dialog>
<el-dialog
title="系统提示"
:visible.sync="dialogVisibleTwo"
width="30%"
:before-close="handleCloseTwo">
<span>请输入管理员密码:</span>
<el-input style="margin-top:15px;" v-model="inputValue" placeholder="请输入管理员密码"></el-input>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="confirm()">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default ({
data(){
return{
dialogVisibleTwo:false,
inputValue:''
}
},
// props:['dialogVisibleOne','drop'],
props:{
dialogVisibleOne:{
type: Boolean,
default:false
},
// drop:Function
drop: {
type: Function,
default: null
}
},
mounted(){
// this.test();
},
methods:{
handleCloseOne(){
this.$emit("update:dialogVisibleOne", false);
},
handleCloseTwo(){
this.dialogVisibleTwo=false;
},
confirm(){
// this.drop();
this.drop();
this.$emit('getValue',this.inputValue);
}
//资源库信息删除
// drop(){
// var formData = new FormData();
// formData.append('databaseName', params);
// // JSON对象转成formData对象
// var params=this.repositoryInfoModel;
// params.type='KettleDatabaseRepository';//写死
// var extraOptions={database:this.selectName}
// params.extraOptions=extraOptions;
// var formData = new FormData();
// formData.append('reposityInfo', JSON.stringify(params));
// // formData.append('password', true);
// console.log('资源库信息确认提交参数==',params);
// removeLink(formData).then(res=>{
// if (res) {
// this.$message.success('删除成功!');
// this.listNames();//刷新列表
// this.selectName='';
// }else {
// this.$message.error(res.errMsg)
// }
// })
// }
}
})
</script>
import {
removeLink
} from "@/api/kettle/link";
// 删除本地测试连接1
function deleteLink(params){
var formData = new FormData();
formData.append('databaseName', params);
removeLink(formData).then(res=>{
if (res) {
this.$message.success('删除成功!');
this.listNames();//刷新列表
this.selectName='';
}else {
this.$message.error(res.errMsg)
}
})
}
//资源库信息删除
function dropFunction(params){
var formData = new FormData();
console.log('进入方法==');
// var password=this.$refs.testDialogueRemind.inputValue;
// JSON对象转成formData对象
var params=this.repositoryInfoModel;
console.log('进入方法333==',this.repositoryInfoModel);
params.type='KettleDatabaseRepository';//写死
var extraOptions={database:this.selectName}
params.extraOptions=extraOptions;
var formData = new FormData();
formData.append('reposityInfo', JSON.stringify(params));
formData.append('password', this.inputValue);
console.log('资源库信息确认提交参数==',params);
drop(formData).then(res=>{
if (res) {
this.$message.success('删除成功!');
}else {
this.$message.error(res.errMsg)
}
})
}
export{deleteLink,dropFunction}
\ No newline at end of file
<template>
<!--数据库连接start -->
<el-dialog
title="数据库连接测试"
encodeURIComponent
:visible.sync="dialogVisible"
width="650px"
top="15%"
:close-on-click-modal="false"
:before-close="handleClose"
>
<div class="table-container table-container-repos" style="height:42vh;">
{{linkInfo}}
</div>
<span slot="footer" class="dialog-footer">
<!-- <el-button @click="handleClose">取 消</el-button> -->
<el-button type="primary" @click="handleClose">确 定</el-button>
</span>
</el-dialog>
<!-- 数据库连接测试end -->
</template>
<script>
import {
test
} from "@/api/kettle/link";
export default ({
data(){
return{
linkInfo:''
}
},
props:{
dialogVisible:{
type: Boolean,
default:false
}
},
mounted(){
// this.test();
},
methods:{
// 测试连接
test(params){
test(params).then(res=>{
if (res) {
console.log('测试:');
// this.linkInfo=res.message;
// var test2=decodeURI(res.message);
var test2=decodeURIComponent(res.message);
console.log('解码====:',test2);
this.linkInfo=test2;
}else {
this.$message.error(res.errMsg)
}
})
},
handleClose(){
this.$emit("update:dialogVisible", false);
}
}
})
</script>
...@@ -136,14 +136,14 @@ ...@@ -136,14 +136,14 @@
<el-input v-model="loginModel.username"></el-input> <el-input v-model="loginModel.username"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="密码" prop="password"> <el-form-item label="密码" prop="password">
<el-input type="password" v-model="loginModel.password" ></el-input> <el-input v-model="loginModel.password" ></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="handleCloseOne">取 消</el-button> <el-button @click="handleCloseOne">取 消</el-button>
<el-button type="primary" @click="login('loginForm')">确 定</el-button> <el-button type="primary" @click.native="loginRepository('loginForm')">确 定</el-button>
</span> </span>
<!-- </el-form> --> <!-- </el-form> -->
</el-dialog> </el-dialog>
...@@ -183,7 +183,7 @@ ...@@ -183,7 +183,7 @@
width="600px" width="600px"
top="19%" top="19%"
:before-close="handleCloseThree"> :before-close="handleCloseThree">
<el-form style="margin-top:15px;" :model="ruleForm" status-icon ref="ruleForm" label-width="150px" class="demo-ruleForm"> <el-form style="margin-top:15px;" :model="repositoryInfoModel" status-icon ref="repositoryInfoForm" label-width="150px" class="demo-ruleForm">
<el-form-item label="选择数据库连接"> <el-form-item label="选择数据库连接">
<!-- <el-select v-model="ruleForm.region" placeholder="请选择选择数据库连接"> <!-- <el-select v-model="ruleForm.region" placeholder="请选择选择数据库连接">
<el-option label="区域一" value="shanghai"></el-option> <el-option label="区域一" value="shanghai"></el-option>
...@@ -195,20 +195,20 @@ ...@@ -195,20 +195,20 @@
<span style="margin-left:15px;"> <span style="margin-left:15px;">
<el-button @click="editDataBaseModal()">编辑</el-button> <el-button @click="editDataBaseModal()">编辑</el-button>
<el-button @click="showModalFourth()">新建</el-button> <el-button @click="showModalFourth()">新建</el-button>
<el-button @click="dialogVisibleThree = false">删除</el-button> <el-button @click="deleteLink(selectName)">删除</el-button>
</span> </span>
</el-form-item> </el-form-item>
<el-form-item label="资源库标识" prop="pass"> <el-form-item label="资源库标识" prop="name">
<el-input type="password" v-model="ruleForm.pass" autocomplete="off"></el-input> <el-input v-model="repositoryInfoModel.name" ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="资源库名称" prop="checkPass"> <el-form-item label="资源库名称" prop="description">
<el-input type="password" v-model="ruleForm.checkPass" autocomplete="off"></el-input> <el-input v-model="repositoryInfoModel.description" ></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleThree = false">确 定</el-button> <el-button @click="repositoryInfoConfirm('repositoryInfoForm')">确 定</el-button>
<el-button @click="dialogVisibleThree = false">创建或更新</el-button> <el-button @click="dialogVisibleThree = false">创建或更新</el-button>
<el-button type="primary" @click="dialogVisibleThree = false">删 除</el-button> <el-button type="primary" @click="dialogVisibleRemind = true">删 除</el-button>
<el-button @click="dialogVisibleThree = false">取 消</el-button> <el-button @click="dialogVisibleThree = false">取 消</el-button>
<!-- <el-button type="primary" @click="dialogVisibleTwo = false">确 定</el-button> --> <!-- <el-button type="primary" @click="dialogVisibleTwo = false">确 定</el-button> -->
</span> </span>
...@@ -231,7 +231,8 @@ ...@@ -231,7 +231,8 @@
</ul> </ul>
</div> </div>
<!-- 右边start --> <!-- 右边start -->
<el-form style="flex:1;" label-width="100px" :model="createModel" ref="createFrom" :rules="rulesOne"> <!-- <el-form style="flex:1;" label-width="100px" :model="createModel" ref="createFrom" :rules="rulesOne"> -->
<el-form style="flex:1;" label-width="100px" :model="createModel" ref="createFrom" >
<div v-if="nowTypeIndex==0"> <div v-if="nowTypeIndex==0">
<el-form-item label="连接名称" prop="name" > <el-form-item label="连接名称" prop="name" >
<el-input v-model="createModel.name" ></el-input> <el-input v-model="createModel.name" ></el-input>
...@@ -271,33 +272,92 @@ ...@@ -271,33 +272,92 @@
</div> </div>
<div class="input-container"> <div class="input-container">
<div class="input-container-title">设置</div> <div class="input-container-title">设置</div>
<el-form-item label="主机名称:" prop="hostname" label-width="100px">
<el-input v-model="createModel.hostname"></el-input>
</el-form-item>
<el-form-item label="数据库名称:" prop="databaseName" label-width="100px"> <!-- 仅仅实现mysql -->
<el-input v-model="createModel.databaseName" ></el-input> <!-- 判断连接方式Native(JDBC) -->
</el-form-item> <div v-if="methodCheckedText=='Native (JDBC)'">
<el-form-item label="主机名称:" prop="hostname" label-width="100px">
<el-input v-model="createModel.hostname"></el-input>
</el-form-item>
<!-- <el-form-item label="数据表空间:" prop="pass" label-width="90px"> <el-form-item label="数据库名称:" prop="databaseName" label-width="100px">
<el-input v-model="createModel.pass" ></el-input> <el-input v-model="createModel.databaseName" ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="索引表空间:" prop="pass" label-width="90px"> <!-- <el-form-item v-if="createModel.type=='ORACLE'" label="数据表空间:" prop="dataTablespace" label-width="90px">
<el-input v-model="createModel.pass"></el-input> <el-input v-model="createModel.dataTablespace" ></el-input>
</el-form-item> --> </el-form-item>
<el-form-item label="端口号:" prop="port" label-width="100px"> <el-form-item v-if="createModel.type=='ORACLE'" label="索引表空间:" prop="indexTablespace" label-width="90px">
<el-input v-model="createModel.port"></el-input> <el-input v-model="createModel.indexTablespace"></el-input>
</el-form-item> </el-form-item> -->
<el-form-item label="用户名:" prop="username" label-width="100px"> <el-form-item label="端口号:" prop="port" label-width="100px">
<el-input v-model="createModel.username"></el-input> <el-input v-model="createModel.port"></el-input>
</el-form-item>
</div>
<!-- 判断连接方式odbc -->
<el-form-item v-if="methodCheckedText=='ODBC'" label="ODBC DSN源名称:" prop="databaseName" label-width="100px">
<el-input v-model="createModel.databaseName"></el-input>
</el-form-item> </el-form-item>
<div v-if="methodCheckedText=='JNDI'">
<el-form-item label="JNDI名称:" prop="port" label-width="100px">
<el-input v-model="createModel.databaseName"></el-input>
</el-form-item>
</div>
<div v-if="methodCheckedText=='OCI'">
<el-form-item label="SID:" prop="port" label-width="100px">
<el-input v-model="createModel.databaseName"></el-input>
</el-form-item>
<el-form-item label="用户名:" prop="username" label-width="100px">
<el-input v-model="createModel.username"></el-input>
</el-form-item>
<el-form-item label="密码:" prop="password" label-width="100px">
<el-input v-model="createModel.password"></el-input>
</el-form-item>
</div>
<el-form-item v-if="createModel.type=='ORACLE'" label="数据表空间:" prop="dataTablespace" label-width="90px">
<el-input v-model="createModel.dataTablespace" ></el-input>
</el-form-item>
<el-form-item v-if="createModel.type=='ORACLE'" label="索引表空间:" prop="indexTablespace" label-width="90px">
<el-input v-model="createModel.indexTablespace"></el-input>
</el-form-item>
<div v-if="methodCheckedText=='Native (JDBC)' || methodCheckedText=='ODBC'">
<el-form-item label="用户名:" prop="username" label-width="100px">
<el-input v-model="createModel.username"></el-input>
</el-form-item>
<el-form-item label="密码:" prop="password" label-width="100px">
<el-input v-model="createModel.password"></el-input>
</el-form-item>
</div>
<!-- 判断连接方式JNDY -->
<el-form-item label="密码:" prop="password" label-width="100px">
<el-input v-model="createModel.password"></el-input>
</el-form-item>
</div> </div>
</div> </div>
</div> </div>
...@@ -342,8 +402,8 @@ ...@@ -342,8 +402,8 @@
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleTwo = false">取 消</el-button> <el-button @click="handleCloseFourth">取 消</el-button>
<el-button @click="dialogVisibleTwo = false">测 试</el-button> <el-button @click="testDialogueOpen()">测 试</el-button>
<el-button @click="dialogVisibleTwo = false">特征列表</el-button> <el-button @click="dialogVisibleTwo = false">特征列表</el-button>
<el-button @click="dialogVisibleTwo = false">浏 览</el-button> <el-button @click="dialogVisibleTwo = false">浏 览</el-button>
<el-button @click="comfirmCreate('createFrom')">确 定</el-button> <el-button @click="comfirmCreate('createFrom')">确 定</el-button>
...@@ -442,6 +502,9 @@ ...@@ -442,6 +502,9 @@
</el-dialog> </el-dialog>
<!-- 弹窗6end --> <!-- 弹窗6end -->
<testDialogue ref="testDialogue" :dialogVisible.sync='testDialogueFlag'></testDialogue>
<dialogRemind ref="testDialogueRemind" @getValue="getValueFromChild" :dialogVisibleOne.sync='dialogVisibleRemind' :repositoryInfoModel="repositoryInfoModel" :drop="dropFunction"></dialogRemind>
...@@ -461,6 +524,14 @@ import nodeMenu from '../dashboard-kettle/components/designer/modules/node_menu' ...@@ -461,6 +524,14 @@ import nodeMenu from '../dashboard-kettle/components/designer/modules/node_menu'
// 流程设计图end---------------------------------- // 流程设计图end----------------------------------
// 弹窗组件start==================
import testDialogue from '../dialogs-components/test'//左边tab
// 弹窗组件end====================
// 删除
import {deleteLink,dropFunction} from '../dialogs-components/dialog'//左边tab
import dialogRemind from '../dialogs-components/dialog-remind'//删除提示弹窗
import { import {
types, types,
getLinkList, getLinkList,
...@@ -470,15 +541,24 @@ import { ...@@ -470,15 +541,24 @@ import {
listNames,//获取已经创建的数据库列表 listNames,//获取已经创建的数据库列表
database,//编辑数据库信息 database,//编辑数据库信息
check,//编辑数据库 check,//编辑数据库
login,//连接数据库 loginRepository,//连接数据库
addRepository,//资源库信息
} from "@/api/kettle/link"; } from "@/api/kettle/link";
export default { export default {
components: { components: {
FlowDesigner, FlowDesigner,
nodeMenu nodeMenu,
testDialogue,//测试连接弹窗
dialogRemind,////删除提示弹窗
}, },
data() { data() {
return { return {
inputValue:'',// 密码
dropFunction,//删除数据库表
deleteLink,//删除资源库模块的方法
dialogVisibleRemind:false,//资源库信息删除提示弹窗
testDialogueFlag:false,//测试弹弹窗
tabShowFlag:true,//控制选项卡的显示和隐藏 tabShowFlag:true,//控制选项卡的显示和隐藏
picName:'',//画板的标签明名称 picName:'',//画板的标签明名称
accessDataList:[],//连接类型 accessDataList:[],//连接类型
...@@ -495,7 +575,27 @@ export default { ...@@ -495,7 +575,27 @@ export default {
methodCheckedIdx: 0,//当前选择连接方式列表 methodCheckedIdx: 0,//当前选择连接方式列表
initlinkTypeIdx:0,//初始化默认选择oracle initlinkTypeIdx:0,//初始化默认选择oracle
namesList:[],//已经创建的数据库列表 namesList:[],//已经创建的数据库列表
createModel:{},//创建数据库 createModel:{
name:'',
type:'',
access:'',
hostname:'',
databaseName:'',
port:'',
username:'',
password:'',
stramingReasults:'',
supportBooleanDataType:'',
supportTimestampDataType:'',
preserveReservedCaseCheck:'',
extraOptions:[],
usingConnectionPool:'N',
initialPoolSize:'5',
maximumPoolSize:'10',
partitioned:'N',
partitionInfo:[]
},//创建数据库
selectName:'',//当前选中的下拉框的数据 selectName:'',//当前选中的下拉框的数据
dataBaseDetail:{},//数据库详情 dataBaseDetail:{},//数据库详情
addFlag:true,//新增还是编辑数据库判断 addFlag:true,//新增还是编辑数据库判断
...@@ -508,6 +608,8 @@ export default { ...@@ -508,6 +608,8 @@ export default {
{required:true,message:'请输入密码',trigger:'blur'} {required:true,message:'请输入密码',trigger:'blur'}
], ],
},//连接验证 },//连接验证
repositoryInfoModel:{},//资源库信息
methodCheckedText:'Native (JDBC)',//当前选择的连接方式test
rulesOne:{ rulesOne:{
name:[ name:[
{required:true,message:'请输入名称',trigger:'blur'} {required:true,message:'请输入名称',trigger:'blur'}
...@@ -621,7 +723,7 @@ export default { ...@@ -621,7 +723,7 @@ export default {
this.dragControllerDiv();//左右窗体调整宽度 this.dragControllerDiv();//左右窗体调整宽度
this.treeRevert(this.jobTreeList); this.treeRevert(this.jobTreeList);
this.accessData();//页面一加载就获取连接类型 this.accessData();//页面一加载就获取连接类型
this.test(); // this.test();
}, },
methods: { methods: {
// 左边文件夹和右边画布的宽度可以拖拽调整 // 左边文件夹和右边画布的宽度可以拖拽调整
...@@ -730,6 +832,7 @@ export default { ...@@ -730,6 +832,7 @@ export default {
showModalFourth(){ showModalFourth(){
this.dialogVisibleFourth=true; this.dialogVisibleFourth=true;
this.database(); this.database();
// this.accessData();//获取连接类型
this.accessMethod();//获取连接方式 this.accessMethod();//获取连接方式
console.log('this.methodHoverIdx==',this.methodHoverIdx); console.log('this.methodHoverIdx==',this.methodHoverIdx);
console.log('this.methodCheckedIdx==',this.methodCheckedIdx); console.log('this.methodCheckedIdx==',this.methodCheckedIdx);
...@@ -793,6 +896,7 @@ export default { ...@@ -793,6 +896,7 @@ export default {
chooseAccess(item,idx){ chooseAccess(item,idx){
console.log('选择连接方式:',item); console.log('选择连接方式:',item);
this.methodCheckedIdx=idx; this.methodCheckedIdx=idx;
this.methodCheckedText=item.text;//当前选择的连接方式
this.createModel.access=item.value; this.createModel.access=item.value;
console.log('选择连接方式赋值表单:',this.createModel); console.log('选择连接方式赋值表单:',this.createModel);
}, },
...@@ -809,8 +913,21 @@ export default { ...@@ -809,8 +913,21 @@ export default {
accessMethod(data).then(res=>{ accessMethod(data).then(res=>{
if (res) { if (res) {
console.log('获取连接方式:',res); console.log('获取连接方式:',res);
console.log('获取连接方式当前编辑对象:',this.createModel);
this.accessMethods=res; this.accessMethods=res;
this.createModel.access=res[0].value; if( this.createModel.name==''){//如果是新增就默认
this.createModel.access=res[0].value;
this.methodCheckedText=res[0].text;//当前选择的连接方式
}else{
for(var i =0;i< this.accessMethods.length;i++){
if(this.accessMethods[i].value==this.createModel.access){
this.methodCheckedIdx=i;
this.methodCheckedText=this.accessMethods[i].text;//当前选择的连接方式
}
}
}
console.log('表单赋值连接方式:',this.createModel); console.log('表单赋值连接方式:',this.createModel);
}else { }else {
this.$message.error(res.errMsg) this.$message.error(res.errMsg)
...@@ -824,17 +941,38 @@ export default { ...@@ -824,17 +941,38 @@ export default {
console.log('获取连接类型:',res); console.log('获取连接类型:',res);
var data=res; var data=res;
if(data){ if(data){
for(var i =0;i<data.length;i++){
if(data[i].value=='ORACLE'){
console.log('-----------------');
this.linkCheckedIdx=i;
this.initlinkTypeIdx=i;//初始化默认选择oracle
this.methodHoverIdx=0;
this.createModel.type='ORACLE';
console.log('表单赋值连接类型:',this.createModel);
if(this.createModel.name==''){
console.log('新建获取连接类型===========:',this.createModel.type);
console.log('新建获取连接类型对象===========:',this.createModel);
// 设置初始化连接类型
for(var i =0;i<data.length;i++){
if(data[i].value=='ORACLE'){
console.log('-----------------');
this.linkCheckedIdx=i;
this.initlinkTypeIdx=i;//初始化默认选择oracle
this.methodHoverIdx=0;
this.createModel.type='ORACLE';
console.log('表单赋值连接类型:',this.createModel);
}
}
}else{
console.log('编辑获取连接类型=======:',this.createModel.type);
console.log('编辑获取连接类型对象=======:',this.createModel);
for(var i =0;i<data.length;i++){
if(data[i].value==this.createModel.type){
console.log('-----------------');
this.linkCheckedIdx=i;
this.initlinkTypeIdx=i;//初始化默认选择oracle
// this.methodHoverIdx=0;
// this.createModel.type='ORACLE';
console.log('表单赋值连接类型:',this.createModel);
}
}
} }
}
} }
this.accessDataList=data; this.accessDataList=data;
...@@ -869,41 +1007,59 @@ export default { ...@@ -869,41 +1007,59 @@ export default {
formData.append('databaseInfo', JSON.stringify(params)); formData.append('databaseInfo', JSON.stringify(params));
console.log('表单提交参数==',params); console.log('表单提交参数==',params);
// 判断新增还是编辑start=============== // 判断新增还是编辑start===============
if(this.addFlag){ // if(this.addFlag){
create(formData).then(res=>{ // create(formData).then(res=>{
console.log('提交数据:',res); // console.log('提交数据:',res);
if (res.success) { // if (res.success) {
this.$message.success('成功!'); // this.$message.success('成功!');
this.dialogVisibleFourth=false;//关闭弹窗 // this.dialogVisibleFourth=false;//关闭弹窗
this.linkCheckedIdx=this.initlinkTypeIdx;//关闭弹窗后初始化选择的数据 // this.linkCheckedIdx=this.initlinkTypeIdx;//关闭弹窗后初始化选择的数据
this.listNames();//刷新已经创建的数据库列表 // this.listNames();//刷新已经创建的数据库列表
// this.formThree={}; // // this.formThree={};
// this.getKettleJobList();//刷新列表 // // this.getKettleJobList();//刷新列表
}else { // }else {
this.$message.error(res.errMsg) // this.$message.error(res.errMsg)
} // }
}) // })
}else{ // }else{
console.log('编辑表单提交参数==',formData); console.log('编辑表单提交参数==',formData);
check(formData).then(res=>{ check(formData).then(res=>{
console.log('提交数据:',res); console.log('提交数据:',res);
if (res.success) { if (res.success) {
this.$message.success('成功!'); // this.$message.success('成功!');
this.dialogVisibleFourth=false;//关闭弹窗 // this.dialogVisibleFourth=false;//关闭弹窗
this.linkCheckedIdx=this.initlinkTypeIdx;//关闭弹窗后初始化选择的数据 // this.linkCheckedIdx=this.initlinkTypeIdx;//关闭弹窗后初始化选择的数据
this.listNames();//刷新已经创建的数据库列表
this.addFlag=true;//更改新增或者编辑变量 // this.listNames();//刷新已经创建的数据库列表
// this.addFlag=true;//更改新增或者编辑变量
create(formData).then(res=>{
console.log('提交数据:',res);
if (res.success) {
this.$message.success('成功!');
this.dialogVisibleFourth=false;//关闭弹窗
this.linkCheckedIdx=this.initlinkTypeIdx;//关闭弹窗后初始化选择的数据
this.listNames();//刷新已经创建的数据库列表
}else {
this.$message.error(res.message)
}
})
}else { }else {
this.$message.error(res.errMsg) this.$message.error(res.message)
} }
}) })
} }
// 判断新增还是编辑end=============== // 判断新增还是编辑end===============
} else { // } else {
console.log('error submit!!'); // console.log('error submit!!');
return false; // return false;
} // }
}); });
}, },
//查询已经建立的所有数据库列表 //查询已经建立的所有数据库列表
...@@ -933,6 +1089,7 @@ export default { ...@@ -933,6 +1089,7 @@ export default {
editDataBaseModal(){ editDataBaseModal(){
if(this.selectName){ if(this.selectName){
this.dialogVisibleFourth=true; this.dialogVisibleFourth=true;
this.addFlag=false;//增减变量改为编辑变量 this.addFlag=false;//增减变量改为编辑变量
} }
this.database(this.selectName); this.database(this.selectName);
...@@ -949,7 +1106,9 @@ export default { ...@@ -949,7 +1106,9 @@ export default {
if (res) { if (res) {
console.log('数据库详情:',res); console.log('数据库详情:',res);
this.dataBaseDetail=res; this.dataBaseDetail=res;
this.createModel=res; // this.createModel=res;
// 选出需要传到后台的参数集合
this.chooseParams(this.dataBaseDetail);
}else { }else {
this.$message.error(res.errMsg) this.$message.error(res.errMsg)
} }
...@@ -961,20 +1120,25 @@ export default { ...@@ -961,20 +1120,25 @@ export default {
// }, // },
// 资源库连接 // 资源库连接
login(formName){ loginRepository(formName){
console.log('进入登录==========');
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
// JSON对象转成formData对象 // JSON对象转成formData对象
var params=this.loginModel; var params=this.loginModel;
params.atStartupShown=false;//在启动时显示此对话框默认为 false params.atStartupShown=false;//在启动时显示此对话框默认为 false
var formData = new FormData();
formData.append('loginInfo', JSON.stringify(params));
console.log('登录提交参数==',params); console.log('登录提交参数==',params);
login(formData).then(res=>{ var formData = new FormData();
console.log('提交数据:',res); formData.append('loginInfo', JSON.stringify(params));
console.log('提交转换数据:',formData);
loginRepository(formData).then(res=>{
console.log('返回数据:',res);
if (res.success) { if (res.success) {
this.$message.success('连接成功!'); this.$message.success('连接成功!');
// this.dialogVisibleFourth=false;//关闭弹窗 this.handleCloseOne();//关闭弹窗
// this.linkCheckedIdx=this.initlinkTypeIdx;//关闭弹窗后初始化选择的数据 // this.linkCheckedIdx=this.initlinkTypeIdx;//关闭弹窗后初始化选择的数据
}else { }else {
this.$message.error(res.errMsg) this.$message.error(res.errMsg)
...@@ -987,21 +1151,24 @@ export default { ...@@ -987,21 +1151,24 @@ export default {
} }
}); });
}, },
// 选择资源库 // 选择资源库
chooselink(item,index){ chooselink(item,index){
this.listCheckedIdx=index; this.listCheckedIdx=index;
this.loginModel.reposityId=item.name; this.loginModel.reposityId=item.name;
console.log('当前选择连接的数据库reposityId==',this.loginModel.reposityId);
}, },
/** /**
* 拖拽结束后添加新的节点 * 拖拽结束后添加新的节点
* @param evt * @param evt
* @param nodeMenu 被添加的节点对象 * @param nodeMenu 被添加的节点对象
* @param mousePosition 鼠标拖拽结束的坐标 * @param mousePosition 鼠标拖拽结束的坐标
*/ */
// addNode(evt, nodeMenu, mousePosition) { //addNode(evt, nodeMenu, mousePosition) {
addNode(evt, draggingNode, mousePosition) { addNode(evt, draggingNode, mousePosition) {
console.log('天加evt==',evt); console.log('天加evt==',evt);
console.log('天加nodeMenu==',draggingNode.data); console.log('天加nodeMenu==',draggingNode.data);
...@@ -1031,25 +1198,6 @@ export default { ...@@ -1031,25 +1198,6 @@ export default {
// var origName = nodeMenu.name // var origName = nodeMenu.name
var origName = nodeMenu.path var origName = nodeMenu.path
var nodeName = origName var nodeName = origName
// var index = 1
// while (index < 10000) {
// var repeat = false
// // for (var i = 0; i < this.flowData.nodeList.length; i++) {
// // let node = this.flowData.nodeList[i]
// for (var i = 0; i < this.$refs['pic'].flowData.nodeList.length; i++) {
// let node =this.$refs['pic'].flowData.nodeList[i]
// if (node.name === nodeName) {
// nodeName = origName + index
// repeat = true
// }
// }
// if (repeat) {
// index++
// continue
// }
// break
// }
console.log('-------003',nodeMenu.type); console.log('-------003',nodeMenu.type);
var node = { var node = {
id: nodeId, //节点id--前端唯一的 id: nodeId, //节点id--前端唯一的
...@@ -1081,57 +1229,75 @@ export default { ...@@ -1081,57 +1229,75 @@ export default {
}, },
removeTab(){}, removeTab(){},
test1(){ //选出要传给后台的参数集合便于编辑方法 check
var arr=[{a:3},{b:4},{qqQue:535880373}]; chooseParams(objParams){
var arr=[{a:5},{b:6},{qqQue:535880373},{c:8}]; var newObject={};
arr.forEach((v,i)=>{ for(var key in this.createModel){
Object.keys(v).forEach(v=>{ console.log(key,this.createModel[key])
console.log('key====',v)//取到了key newObject[key]=objParams[key];
// console.log(arr[i][v])//取到了值 }
}) console.log('新的对象====',newObject);
}) this.createModel=newObject;
console.log('编辑赋值当前对象====',this.createModel);
this.accessData();//获取连接类型
},
// 资源库信息确定新建
repositoryInfoConfirm(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
// JSON对象转成formData对象
var params=this.repositoryInfoModel;
params.type='KettleDatabaseRepository';//写死
var extraOptions={database:this.selectName}
params.extraOptions=extraOptions;
var formData = new FormData();
formData.append('reposityInfo', JSON.stringify(params));
formData.append('add', true);
console.log('资源库信息确认提交参数==',params);
addRepository(formData).then(res=>{
console.log('提交数据:',res);
if (res.success) {
this.$message.success('成功!');
this.handleCloseThree();// 关闭弹窗1
this.handleCloseTwo();//关闭弹窗2
this.getLinkList();//刷新列表
}else {
this.$message.error(res.errMsg)
}
})
} else {
console.log('error submit!!');
return false;
}
});
}, },
test(){ testDialogueOpen(){
var arr1=[{a:3},{b:4},{qqQue:535880373}]; // JSON对象转成formData对象
var arr2=[{a:5},{b:6},{qqQue:535880373},{c:8}]; var params=this.createModel;
var arriKeys=[]; // 由于高级选项连接池集群页面没有画完,保存默认参数
var newArray=[]; params.supportBooleanDataType=true;
// arr1.forEach((v,i)=>{ params.supportTimestampDataType=true;
// Object.keys(v).forEach(v=>{ params.preserveReservedCaseCheck=true;
// console.log('key====',v)//取到了key params.extraOptions = [];
// // console.log(arr[i][v])//取到了值 params.usingConnectionPool='N';
// }) params.initialPoolSize='5';
// }) params.maximumPoolSize='10';
arr1.forEach((v,i)=>{ params.partitioned='N';
arriKeys.push(Object.keys(v)); params.partitionInfo=[];
console.log('key值集合---',arriKeys);
})
arr2=JSON.stringify(arr2);
arriKeys.forEach((v,i)=>{
var obj={}
var myKey=v;
arr2.forEach((item,j)=>{
// console.log('单个对象---',item);
// console.log('单个对象key---',myKey);
// console.log('下标---',j);
// console.log('获取值---',arr2[j].myKey);
obj[myKey]= item.myKey;
console.log('新的对象---',obj);
})
newArray.push(obj);
})
console.log('新的数组====',newArray);
var formData = new FormData();
} formData.append('databaseInfo', JSON.stringify(params));
console.log('表单提交参数==',params);
this.$refs.testDialogue.test(formData);
this.testDialogueFlag = true;
},
getValueFromChild(input){
this.inputValue = input; //接收子组件的值,然后赋予自己的变量
// this.showChild = false; //关闭子组件dialog
}
......
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