Commit 1e1f973b by 莫晓莉

表输出获取字段

parent 59306197
......@@ -87,11 +87,15 @@ export default {
}
},
watch:{
graph(n,o){
console.log("表输出拿到的画布2222===",n);
}
},
// watch:{
// graph(n,o){
// console.log("表输出拿到的画布2222===",n);
// },
// },
props:["form","getXmlVal","graph"],
created() {
......@@ -183,7 +187,7 @@ export default {
},
//浏览
scanTree(type){
console.log('当前选中链接***************',this.form.selectName);
console.log('当前选中链接***************',this.form.connection);
this.chooseType=type;
if(this.form.connection){
// this.$refs.establishDia.database(this.selectName);
......@@ -226,10 +230,23 @@ export default {
},
deep: true
},
'form.connection': {
handler: function() {
this.form.schema="",
this.form.table=""
},
}
},
// 监听如果改变数据库链接把目标表和模式初始化为空,之前设置好字段为空,该字段不是对应数据库链接下面表对应的字段--start---
// watch: {
// 'form.connection': {
// handler: function() {
// this.form.schema="",
// this.form.table=""
// },
// }
// },
// 监听如果改变数据库链接把目标表和模式初始化为空,之前设置好字段为空,该字段不是对应数据库链接下面表对应的字段--end---
};
</script>
<style>
......
......@@ -216,6 +216,7 @@ export default ({
},
handleClose(){
this.$emit("update:transGraphVisible", false);
this.activeName='first';
},
//打开弹窗执行方法
openFunc(){
......
......@@ -136,9 +136,9 @@
<el-card class="box-card">
<div slot="header" class="clearfix">
<el-button style="padding: 3px 0" type="text" @click="fieldClick(true)">新增字段</el-button>
<!-- <el-button style="padding: 3px 0" type="text">删除字段</el-button>
<el-button style="padding: 3px 0" type="text">获取字段</el-button>
<el-button style="padding: 3px 0" type="text">输入字段映射</el-button> -->
<el-button style="padding: 3px 0" type="text" @click="deleteFields">删除字段</el-button>
<el-button style="padding: 3px 0" type="text" @click="inputOutputFields('get')">获取字段</el-button>
<!--<el-button style="padding: 3px 0" type="text">输入字段映射</el-button><-->
</div>
<table-list ref="tableDia" :tableHead="tableHead" :tableData="tableData" :field.sync="editDia" :fieldClick="fieldClick"></table-list>
<!-- <table-list ref="tableDia" :tableHead="tableHead" :tableData="tableData" :field.sync="editDia" :fieldClick="fieldClick"></table-list> -->
......@@ -205,6 +205,7 @@ import { mapGetters,mapMutations } from "vuex";
export default ({
data(){
return{
newTableOutForm:{},
field:false,//编辑弹窗
checkedCities: ['上海', '北京'],
editDia:false,//编辑表字段
......@@ -258,18 +259,18 @@ export default ({
],
// 表格数据
tableData: [
{
stream_name: '3',
column_name: '鞠婧祎',
},
{
stream_name: '25',
column_name: '魏大勋',
},
{
stream_name: '18',
column_name: '关晓彤',
}
// {
// stream_name: '3',
// column_name: '鞠婧祎',
// },
// {
// stream_name: '25',
// column_name: '魏大勋',
// },
// {
// stream_name: '18',
// column_name: '关晓彤',
// }
],
newGraph:{} //获取的画布对象
......@@ -303,6 +304,22 @@ export default ({
},
created(){
// if(this.tableOutForm.connection!=''){
// this.tableData=JSON.parse(this.tableOutForm.fields);
// this.newTableOutForm=this.tableOutForm;
// }
// console.log("回显的表单数据===",n);
// if(n){
// var ny=JSON.parse(n.fields);
// this.tableData=ny;
// }
// },
// this.dialogOpen();
console.log(this.graph,'=========');
......@@ -329,10 +346,34 @@ export default ({
this.tableData=ny;
}
},
//如果修改了数据库链接或者另选表字段为空需要重置start================
// 'tableOutForm.connection':{
// handler: function(a,b) {
// if(this.newTableOutForm){
// if(a!=this.newTableOutForm.conection){
// this.tableData=[];
// }
// }
// },
// },
// 'tableOutForm.table': {
// handler: function(a,b) {
// if(this.newTableOutForm){
// if(a!=this.newTableOutForm.table){
// this.tableData=[];
// }
// }
// },
// },
//如果修改了数据库链接或者另选表字段为空需要重置end================
// graph(n,o){
// console.log("表输出拿到的画布1111===",n);
// }
graph(n,o){
console.log("表输出拿到的画布1111===",n);
}
},
methods:{
clickFun(graph){
......@@ -343,9 +384,8 @@ export default ({
}, 500);
},
confirm(){
// this.tableOutForm.label=this.doubleClickCell.title;
this.tableOutForm.fields=JSON.stringify(this.tableData);//字段复值
console.log('表输出表单数据=====',this.tableOutForm)
console.log('表输出表单数据=====',this.tableOutForm);
this.saveOutputDialog(this.tableOutForm);
this.handleClose();//关闭弹窗
},
......@@ -392,7 +432,7 @@ export default ({
})
},
//获取表输出
inputOutputFields(){
inputOutputFields(par){
if(this.doubleClickCell){
// var title=this.doubleClickCell.title
var title=this.doubleClickCell.value.attributes.label.value
......@@ -415,11 +455,22 @@ export default ({
pamer.append("query", '');
inputOutputFields(pamer).then(res=>{
console.log('字段',res);
this.fieldsList2=res;
if(par=="get"){
var newArray=[];
res.forEach(item => {
var newObj={};
newObj.column_name=item.name;
newObj.stream_name=item.name;
newArray.push(newObj);
});
this.tableData=newArray;
}
})
},
//新增或者编辑弹窗
fieldClick(state, val) {
this.field = !this.field;
......@@ -442,6 +493,10 @@ export default ({
this.tableData.push(this.fieldForm);
}
},
//删除字段
deleteFields(){
this.tableData=[];
}
......
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