<template>
  <div>
    <div>
      <el-dialog
        title="提示"
        :visible.sync="dialogVisible"
        width="30%"
      >
      <span>
          <el-radio-group v-model="labelPosition" size="small">
          <el-radio-button label="left">左对齐</el-radio-button>
          <el-radio-button label="right">右对齐</el-radio-button>
          <el-radio-button label="top">顶部对齐</el-radio-button>
        </el-radio-group>
        <div style="margin: 20px;"></div>
        <el-form :label-position="labelPosition" label-width="80px" :model="tableMsg">
          <el-form-item label="任务id">
            <el-input v-model="tableMsg.id" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="数据库id">
            <el-input v-model="tableMsg.databaseId" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="数据表">
                  <el-cascader
                    v-model="tableMsg.tableName"
                    :options="tables"
                    :props="{ expandTrigger: 'hover',value:'id',label:'name',children:'tableNames' }"
                    @change="handleChange"></el-cascader>
          </el-form-item>
          <el-form-item label="表别名">
            <el-input v-model="tableMsg.tableAsField"></el-input>
          </el-form-item>
        </el-form>
      </span>
        <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  </span>
      </el-dialog>
    </div>
  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）,
//例如：import 《组件名称》 from '《组件路径》,
import {extractDataName} from "../../../api/etl/etl";

export default {
  name: "task",
  //import引入的组件需要注入到对象中才能使用"
  components: {},
  props: {},
  data() {
    //这里存放数据"

    return {
      labelPosition: 'right',
      dialogVisible:false,
      tableMsg:{},
      tables:{}
    };
  },
  //计算属性 类似于data概念",
  computed: {},
  //监控data中的数据变化",
  watch: {},
  //方法集合",
  methods: {
    handleChange(value) {
      console.log(value);
    },
    getDatabaseMessage(){
      this.dialogVisible = true
      extractDataName().then(res => {
        console.log(res);
        this.tables = res.data
      })
    },
  },
  //生命周期 - 创建完成（可以访问当前this实例）",
  created() {
  },
  //生命周期 - 挂载完成（可以访问DOM元素）",
  mounted() {
  },
  beforeCreate() {
  }, //生命周期 - 创建之前",
  beforeMount() {
  }, //生命周期 - 挂载之前",
  beforeUpdate() {
  }, //生命周期 - 更新之前",
  updated() {
  }, //生命周期 - 更新之后",
  beforeDestroy() {
  }, //生命周期 - 销毁之前",
  destroyed() {
  }, //生命周期 - 销毁完成",
  activated() {
  } //如果页面有keep-alive缓存功能，这个函数会触发",
};

</script>
<style scoped>

</style>
