Commit 7b0efbf0 by 李耀琨

更新代码

parent a6f2ba8a
......@@ -43,7 +43,7 @@
<el-button size="mini">向导</el-button></el-col
>
<el-col class="line" :span="5">
<el-button size="mini" @click="SQLPopup()"
<el-button size="mini" @click="scanTree('')"
>获取SQL查询语句</el-button
></el-col
>
......@@ -83,7 +83,7 @@
</el-form-item>
</el-form>
<!--
<el-dialog
title="数据库浏览"
:visible.sync="browsing"
......@@ -101,12 +101,14 @@
<el-button @click="browsing = false">取 消</el-button>
<el-button type="primary" @click="browsing = false">确 定</el-button>
</span>
</el-dialog>
</el-dialog> -->
<estab-dialog ref="establishDia" :dialogVisibleFourth.sync='dialogVisibleFourth' @getSonValue="getSonValue" :listNames="listNames"></estab-dialog>
<estab-dialog ref="establishDia" :dialogVisibleFourth.sync='dialogVisibleFourth' @getSonValue="getSonValue" :listNames="listNames" :scanDialogVisible.sync='scanDialogVisible'  :form="newForm" :chooseType="chooseType" :chooseFlag.sync="chooseFlag"></estab-dialog>
</div>
</template>
......@@ -124,7 +126,8 @@ export default {
return {
browsing: false,
dialogVisibleFourth:false,
scanDialogVisible:false,
newForm:{},
form: {
wLazyConversion: false,
wVariables: false,
......@@ -138,23 +141,88 @@ export default {
children: "children",
label: "text",
},
dataBaseName:"",
curNode:{},
chooseType:"",
chooseFlag:false,
};
},
created() {
this.listDatabasesFun();
},
 // 监听编号好后获取选择的数据库的树形里列表
  watch: {
    dataBaseName:{
       handler (newValue, oldValue) {
        console.log('obj changed');
        if(newValue){
          this.$refs.establishDia.scanDialogOpen();
          this.chooseFlag=true;
        }
      },
      deep: true
    },
    // form(newValue, oldValue){
    //   this.form=newValue;
    // }
  },
methods: {
 //获取新建弹窗返回来的值
    getSonValue(res){
      if(typeof(res)=='string'){
        this.dataBaseName = res
         console.log('接收子组件的值1111111----',this.dataBaseName);
      }else if(typeof(res)=='object'){
        console.log('接收子组件的值55555----',res);
        this.curNode=res;
         // DOM 更新后
        // this.$nextTick(() => {
        //   this.form.text=this.curNode.data.text;
        //   // this.$refs.goal.values=this.curNode.data.text;
        //   // this.$refs.goal.refreshData(this.from)
        // })
//         this.$set(this.newForm,'text',this.curNode.data.text)
//         this.$forceUpdate()
        // this.form.text=this.curNode.data.text;
        console.log('chuanhuo=====', this.newForm);
      }else if(typeof(res)=='boolean'){
         this.dialogVisibleFourth=res;
         console.log('接收子组件的值2222222----',this.dialogVisibleFourth);
      }    
    },
   //浏览
scanTree(type){
      if(this.form.connection){       
        this.$refs.establishDia.database(this.form.connection);
        console.log('当前选中数据库***************',this.form.connection);
        if(this.form.connection){
          this.$refs.establishDia.scanDialogOpen();
          this.chooseFlag=true;
          this.chooseType=type;
        }         
      }else{
        this.$message.error('请选择数据库')
      }
      
    },
//获取新建弹窗返回来的值
getSonValue(res){
this.dialogVisibleFourth=res;
this.linkCheckedIdx=this.initlinkTypeIdx;//关闭弹窗后初始化选择oracle数据
this.methodHoverIdx=0;//关闭弹窗后初始化选择oracle数据对应第一条
this.methodCheckedIdx=0;//关闭弹窗后初始化选择oracle数据对应第一条
// this.addFlag=true;//增减变量改为编辑变量
},
// getSonValue(res){
// this.dialogVisibleFourth=res;
// this.linkCheckedIdx=this.initlinkTypeIdx;//关闭弹窗后初始化选择oracle数据
// this.methodHoverIdx=0;//关闭弹窗后初始化选择oracle数据对应第一条
// this.methodCheckedIdx=0;//关闭弹窗后初始化选择oracle数据对应第一条
// // this.addFlag=true;//增减变量改为编辑变量
// },
 //获取新建弹窗返回来的值
//查询已经建立的所有数据库列表
listNames(){
......@@ -223,28 +291,28 @@ let pam = new FormData(); // 创建form对象
},
loadNode(node, resolve) {
if (node.level === 0) {
return resolve([{ name: 'region' }]);
}
if (node.level > this.PopupFrom.length) return resolve([]);
// loadNode(node, resolve) {
// if (node.level === 0) {
// return resolve([{ name: 'region' }]);
// }
// if (node.level > this.PopupFrom.length) return resolve([]);
setTimeout(() => {
// setTimeout(() => {
const data = [{
// const data = [{
name: 'leaf',
leaf: true
}, {
name: 'zone'
}];
resolve(data);
}, 500);
},
// name: 'leaf',
// leaf: true
// }, {
// name: 'zone'
// }];
// resolve(data);
// }, 500);
// },
handleNodeClick(data) {
// handleNodeClick(data) {
// console.log(data);
// let pam = new FormData(); // 创建form对象
// pam.append("databaseInfo", JSON.stringify(this.library));
......@@ -256,7 +324,7 @@ let pam = new FormData(); // 创建form对象
// })
},
// },
......
......@@ -456,7 +456,7 @@ export default {
}
console.log("新的对象====", newObject);
this.createModel = newObject;
this.$emit("getSonValue", this.createModel); //组件要传回父组件的值
this.$emit("getSonValue", this.createModel.name); //组件要传回父组件的值
console.log("编辑赋值当前对象====", this.createModel);
this.accessData(); //获取连接类型
},
......
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