Commit 41c2c8c5 by 李耀锟

Merge branch 'master' of http://139.159.239.83:9093/mxl/ETL-admin into master

# Conflicts:
#	src/views/kettle/home.vue
parents 093c0952 2bf9da3c
import request from '@/utils/request'
import { Dropdown } from 'element-ui'
//获取连接类型
export function types(data) {
......@@ -70,7 +71,7 @@ export function database(data) {
})
}
//连接资源库
export function login(data){
export function loginRepository(data){
return request({
url: 'etlweb/repository/login',
data,
......@@ -78,6 +79,42 @@ export function login(data){
})
}
//资源库信息确定
export function addRepository(data){
return request({
url: 'etlweb/repository/add',
data,
method: 'post'
})
}
//测试连接
export function test(data){
return request({
url: 'etlweb/database/test',
data,
method: 'post'
})
}
// 删除数据库
export function removeLink(data){
return request({
url: 'etlweb/database/remove',
data,
method: 'post'
})
}
// 删除数据库表
export function drop(data){
return request({
url: 'etlweb/database/drop',
data,
method: 'post'
})
}
//etl工具列表
export function steps(data){
......
<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>
......@@ -137,14 +137,14 @@
<el-input v-model="loginModel.username"></el-input>
</el-form-item>
<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>
<span slot="footer" class="dialog-footer">
<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>
<!-- </el-form> -->
</el-dialog>
......@@ -184,7 +184,7 @@
width="600px"
top="19%"
: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-select v-model="ruleForm.region" placeholder="请选择选择数据库连接">
<el-option label="区域一" value="shanghai"></el-option>
......@@ -196,20 +196,20 @@
<span style="margin-left:15px;">
<el-button @click="editDataBaseModal()">编辑</el-button>
<el-button @click="showModalFourth()">新建</el-button>
<el-button @click="dialogVisibleThree = false">删除</el-button>
<el-button @click="deleteLink(selectName)">删除</el-button>
</span>
</el-form-item>
<el-form-item label="资源库标识" prop="pass">
<el-input type="password" v-model="ruleForm.pass" autocomplete="off"></el-input>
<el-form-item label="资源库标识" prop="name">
<el-input v-model="repositoryInfoModel.name" ></el-input>
</el-form-item>
<el-form-item label="资源库名称" prop="checkPass">
<el-input type="password" v-model="ruleForm.checkPass" autocomplete="off"></el-input>
<el-form-item label="资源库名称" prop="description">
<el-input v-model="repositoryInfoModel.description" ></el-input>
</el-form-item>
</el-form>
<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 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 type="primary" @click="dialogVisibleTwo = false">确 定</el-button> -->
</span>
......@@ -232,7 +232,8 @@
</ul>
</div>
<!-- 右边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">
<el-form-item label="连接名称" prop="name" >
<el-input v-model="createModel.name" ></el-input>
......@@ -272,6 +273,10 @@
</div>
<div class="input-container">
<div class="input-container-title">设置</div>
<!-- 仅仅实现mysql -->
<!-- 判断连接方式Native(JDBC) -->
<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>
......@@ -280,17 +285,32 @@
<el-input v-model="createModel.databaseName" ></el-input>
</el-form-item>
<!-- <el-form-item label="数据表空间:" prop="pass" label-width="90px">
<el-input v-model="createModel.pass" ></el-input>
<!-- <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 label="索引表空间:" prop="pass" label-width="90px">
<el-input v-model="createModel.pass"></el-input>
<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> -->
<el-form-item label="端口号:" prop="port" label-width="100px">
<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>
<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>
......@@ -300,6 +320,46 @@
<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 -->
</div>
</div>
</div>
......@@ -343,8 +403,8 @@
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleTwo = false">取 消</el-button>
<el-button @click="dialogVisibleTwo = false">测 试</el-button>
<el-button @click="handleCloseFourth">取 消</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="comfirmCreate('createFrom')">确 定</el-button>
......@@ -444,6 +504,9 @@
</el-dialog>
<!-- 弹窗6end -->
<testDialogue ref="testDialogue" :dialogVisible.sync='testDialogueFlag'></testDialogue>
<dialogRemind ref="testDialogueRemind" @getValue="getValueFromChild" :dialogVisibleOne.sync='dialogVisibleRemind' :repositoryInfoModel="repositoryInfoModel" :drop="dropFunction"></dialogRemind>
......@@ -463,6 +526,14 @@ import nodeMenu from '../dashboard-kettle/components/designer/modules/node_menu'
// 流程设计图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 {
types,
getLinkList,
......@@ -472,7 +543,8 @@ import {
listNames,//获取已经创建的数据库列表
database,//编辑数据库信息
check,//编辑数据库
login,//连接数据库
loginRepository,//连接数据库
addRepository,//资源库信息
} from "@/api/kettle/link";
......@@ -480,11 +552,22 @@ import {
export default {
components: {
FlowDesigner,
nodeMenu
nodeMenu,
testDialogue,//测试连接弹窗
dialogRemind,////删除提示弹窗
},
data() {
return {
<<<<<<< HEAD
prefix:'http://192.168.0.44:9700/etlweb/',
=======
inputValue:'',// 密码
dropFunction,//删除数据库表
deleteLink,//删除资源库模块的方法
dialogVisibleRemind:false,//资源库信息删除提示弹窗
testDialogueFlag:false,//测试弹弹窗
>>>>>>> 2bf9da3cc4c394dfd74392d098aa9b3619082cd2
tabShowFlag:true,//控制选项卡的显示和隐藏
picName:'',//画板的标签明名称
accessDataList:[],//连接类型
......@@ -501,7 +584,27 @@ export default {
methodCheckedIdx: 0,//当前选择连接方式列表
initlinkTypeIdx:0,//初始化默认选择oracle
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:'',//当前选中的下拉框的数据
dataBaseDetail:{},//数据库详情
addFlag:true,//新增还是编辑数据库判断
......@@ -514,6 +617,8 @@ export default {
{required:true,message:'请输入密码',trigger:'blur'}
],
},//连接验证
repositoryInfoModel:{},//资源库信息
methodCheckedText:'Native (JDBC)',//当前选择的连接方式test
rulesOne:{
name:[
{required:true,message:'请输入名称',trigger:'blur'}
......@@ -627,7 +732,7 @@ export default {
this.dragControllerDiv();//左右窗体调整宽度
this.treeRevert(this.jobTreeList);
this.accessData();//页面一加载就获取连接类型
this.test();
// this.test();
},
methods: {
......@@ -744,6 +849,7 @@ export default {
showModalFourth(){
this.dialogVisibleFourth=true;
this.database();
// this.accessData();//获取连接类型
this.accessMethod();//获取连接方式
console.log('this.methodHoverIdx==',this.methodHoverIdx);
console.log('this.methodCheckedIdx==',this.methodCheckedIdx);
......@@ -807,6 +913,7 @@ export default {
chooseAccess(item,idx){
console.log('选择连接方式:',item);
this.methodCheckedIdx=idx;
this.methodCheckedText=item.text;//当前选择的连接方式
this.createModel.access=item.value;
console.log('选择连接方式赋值表单:',this.createModel);
},
......@@ -823,8 +930,21 @@ export default {
accessMethod(data).then(res=>{
if (res) {
console.log('获取连接方式:',res);
console.log('获取连接方式当前编辑对象:',this.createModel);
this.accessMethods=res;
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);
}else {
this.$message.error(res.errMsg)
......@@ -838,6 +958,11 @@ export default {
console.log('获取连接类型:',res);
var data=res;
if(data){
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('-----------------');
......@@ -849,6 +974,22 @@ export default {
}
}
}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;
......@@ -883,7 +1024,35 @@ export default {
formData.append('databaseInfo', JSON.stringify(params));
console.log('表单提交参数==',params);
// 判断新增还是编辑start===============
if(this.addFlag){
// if(this.addFlag){
// create(formData).then(res=>{
// console.log('提交数据:',res);
// if (res.success) {
// this.$message.success('成功!');
// this.dialogVisibleFourth=false;//关闭弹窗
// this.linkCheckedIdx=this.initlinkTypeIdx;//关闭弹窗后初始化选择的数据
// this.listNames();//刷新已经创建的数据库列表
// // this.formThree={};
// // this.getKettleJobList();//刷新列表
// }else {
// this.$message.error(res.errMsg)
// }
// })
// }else{
console.log('编辑表单提交参数==',formData);
check(formData).then(res=>{
console.log('提交数据:',res);
if (res.success) {
// this.$message.success('成功!');
// this.dialogVisibleFourth=false;//关闭弹窗
// this.linkCheckedIdx=this.initlinkTypeIdx;//关闭弹窗后初始化选择的数据
// this.listNames();//刷新已经创建的数据库列表
// this.addFlag=true;//更改新增或者编辑变量
create(formData).then(res=>{
console.log('提交数据:',res);
if (res.success) {
......@@ -891,33 +1060,23 @@ export default {
this.dialogVisibleFourth=false;//关闭弹窗
this.linkCheckedIdx=this.initlinkTypeIdx;//关闭弹窗后初始化选择的数据
this.listNames();//刷新已经创建的数据库列表
// this.formThree={};
// this.getKettleJobList();//刷新列表
}else {
this.$message.error(res.errMsg)
this.$message.error(res.message)
}
})
}else{
console.log('编辑表单提交参数==',formData);
check(formData).then(res=>{
console.log('提交数据:',res);
if (res.success) {
this.$message.success('成功!');
this.dialogVisibleFourth=false;//关闭弹窗
this.linkCheckedIdx=this.initlinkTypeIdx;//关闭弹窗后初始化选择的数据
this.listNames();//刷新已经创建的数据库列表
this.addFlag=true;//更改新增或者编辑变量
}else {
this.$message.error(res.errMsg)
this.$message.error(res.message)
}
})
}
// 判断新增还是编辑end===============
} else {
console.log('error submit!!');
return false;
}
// } else {
// console.log('error submit!!');
// return false;
// }
});
},
//查询已经建立的所有数据库列表
......@@ -947,6 +1106,7 @@ export default {
editDataBaseModal(){
if(this.selectName){
this.dialogVisibleFourth=true;
this.addFlag=false;//增减变量改为编辑变量
}
this.database(this.selectName);
......@@ -963,7 +1123,9 @@ export default {
if (res) {
console.log('数据库详情:',res);
this.dataBaseDetail=res;
this.createModel=res;
// this.createModel=res;
// 选出需要传到后台的参数集合
this.chooseParams(this.dataBaseDetail);
}else {
this.$message.error(res.errMsg)
}
......@@ -975,20 +1137,25 @@ export default {
// },
// 资源库连接
login(formName){
loginRepository(formName){
console.log('进入登录==========');
this.$refs[formName].validate((valid) => {
if (valid) {
// JSON对象转成formData对象
var params=this.loginModel;
params.atStartupShown=false;//在启动时显示此对话框默认为 false
console.log('登录提交参数==',params);
var formData = new FormData();
formData.append('loginInfo', JSON.stringify(params));
console.log('登录提交参数==',params);
login(formData).then(res=>{
console.log('提交数据:',res);
console.log('提交转换数据:',formData);
loginRepository(formData).then(res=>{
console.log('返回数据:',res);
if (res.success) {
this.$message.success('连接成功!');
// this.dialogVisibleFourth=false;//关闭弹窗
this.handleCloseOne();//关闭弹窗
// this.linkCheckedIdx=this.initlinkTypeIdx;//关闭弹窗后初始化选择的数据
}else {
this.$message.error(res.errMsg)
......@@ -1001,10 +1168,13 @@ export default {
}
});
},
// 选择资源库
chooselink(item,index){
this.listCheckedIdx=index;
this.loginModel.reposityId=item.name;
console.log('当前选择连接的数据库reposityId==',this.loginModel.reposityId);
},
......@@ -1015,7 +1185,7 @@ export default {
* @param nodeMenu 被添加的节点对象
* @param mousePosition 鼠标拖拽结束的坐标
*/
// addNode(evt, nodeMenu, mousePosition) {
//addNode(evt, nodeMenu, mousePosition) {
addNode(evt, draggingNode, mousePosition) {
console.log('天加evt==',evt);
console.log('天加nodeMenu==',draggingNode.data);
......@@ -1046,6 +1216,7 @@ export default {
// var origName = nodeMenu.name
var origName = nodeMenu.path
var nodeName = origName
<<<<<<< HEAD
// var index = 1
// while (index < 10000) {
......@@ -1066,6 +1237,9 @@ export default {
// break
// }
console.log('-------003',nodeMenu);
=======
console.log('-------003',nodeMenu.type);
>>>>>>> 2bf9da3cc4c394dfd74392d098aa9b3619082cd2
var node = {
id: nodeId, //节点id--前端唯一的
name: nodeMenu.text, //节点名称
......@@ -1097,56 +1271,74 @@ export default {
},
removeTab(){},
test1(){
var arr=[{a:3},{b:4},{qqQue:535880373}];
var arr=[{a:5},{b:6},{qqQue:535880373},{c:8}];
arr.forEach((v,i)=>{
Object.keys(v).forEach(v=>{
console.log('key====',v)//取到了key
// console.log(arr[i][v])//取到了值
})
})
//选出要传给后台的参数集合便于编辑方法 check
chooseParams(objParams){
var newObject={};
for(var key in this.createModel){
console.log(key,this.createModel[key])
newObject[key]=objParams[key];
}
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('成功!');
test(){
var arr1=[{a:3},{b:4},{qqQue:535880373}];
var arr2=[{a:5},{b:6},{qqQue:535880373},{c:8}];
var arriKeys=[];
var newArray=[];
// arr1.forEach((v,i)=>{
// Object.keys(v).forEach(v=>{
// console.log('key====',v)//取到了key
// // console.log(arr[i][v])//取到了值
// })
// })
arr1.forEach((v,i)=>{
arriKeys.push(Object.keys(v));
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);
this.handleCloseThree();// 关闭弹窗1
this.handleCloseTwo();//关闭弹窗2
this.getLinkList();//刷新列表
}else {
this.$message.error(res.errMsg)
}
})
console.log('新的数组====',newArray);
} else {
console.log('error submit!!');
return false;
}
});
},
testDialogueOpen(){
// JSON对象转成formData对象
var params=this.createModel;
// 由于高级选项连接池集群页面没有画完,保存默认参数
params.supportBooleanDataType=true;
params.supportTimestampDataType=true;
params.preserveReservedCaseCheck=true;
params.extraOptions = [];
params.usingConnectionPool='N';
params.initialPoolSize='5';
params.maximumPoolSize='10';
params.partitioned='N';
params.partitionInfo=[];
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