<!--
 * @Descripttion: sql 详情
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2020-11-10 13:46:26
 * @LastEditors: 无尘
 * @LastEditTime: 2020-11-10 15:06:15
-->

<template>
  <el-dialog title="SQL 详情" :visible.sync="dialogVisible" width="600px" :before-close="handleClose">
    <div class="">
      <el-form :model="ruleForm"  ref="ruleForm" label-width="10px" class="demo-ruleForm" @submit.native.prevent>
        <el-form-item label="项目名称" prop="">
          {{ruleForm.projectName || '--'}}
        </el-form-item>
        <el-form-item label="表名称" prop="">
          {{ruleForm.tableName || '--'}}
        </el-form-item>
        <el-form-item label="SQL" prop="">
          <el-input class="w-440" readonly type="textarea" rows="3" v-model="ruleForm.sqlIndex" maxlength="500" show-word-limit></el-input>
        </el-form-item>
         <el-form-item label="完善状态" prop="">
          {{ruleForm.projectName || '--'}}
        </el-form-item>
        <el-form-item label="上线状态" prop="">
          {{ruleForm.tableName || '--'}}
        </el-form-item>
      </el-form>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: '',
  components: {},
  props: {
    sqlRow: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  data() {
    return {
      dialogVisible: true,
      loadBtn: false,
      ruleForm: {
        sqlId: '',
        sqlIndex: '',
        projectName: '',
        tableName: ''
      }
    };
  },
  // 生命周期 - 挂载完成（访问DOM元素）
  mounted() {
    const that = this;
    if (Object.keys(that.sqlRow).length) {
      that.ruleForm = JSON.parse(JSON.stringify(that.sqlRow));
    }
  },
  // methods
  methods: {
    /**
     * @description: 关闭弹窗
     * @author: 无尘
     */
    handleClose() {
      const that = this;
      that.$emit('closeText');
      that.$refs['ruleForm'].resetFields();
    },

  },
  watch: {
    sqlRow(newData) {
      const that = this;
      if (Object.keys(newData).length) {
        that.ruleForm = JSON.parse(JSON.stringify(newData));
      }
    }
  }
};
</script>
<style lang='less' scoped>


</style>
