<template>
    <el-dialog :close-on-click-modal="false" append-to-body v-dialogDrag width="600px" powerId="form" :title="title" :visible.sync="dialogFormVisible" :before-close="handleClose">
      <div style="padding-left:80px">
        <el-form :model="form" ref="form" label-width="120px">
          <div class="form">
            <el-form-item label="归属名称" prop="memberName">
              <el-input ref="memberName" v-model="form.memberName" @change="handleChange" autocomplete="on"></el-input>
            </el-form-item>
            <!-- <el-form-item label="所属编码" prop="memberName">
              <el-input ref="memberName" v-model="form.memberName" @change="handleChange" autocomplete="on"></el-input>
            </el-form-item> -->
          </div>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button size="mini" type="primary" plain @click="(dialogFormVisible = false)">取 消</el-button>
        <el-button size="mini" type="primary" @click="confirm()">确 定</el-button>
      </div>
    </el-dialog>
  
  </template>
  
  <script>
  export default {
    data() {
      return {
        dialogFormVisible: false, //弹窗开关
        form: {}, //主对象
        title: "添加",
      };
    },
    methods: {
      handleChange(){
        if(this.title == '添加'){
          if(this.form.cashPassword){
            this.form.cashPassword = '' 
            this.form.label = ''
            this.$refs.form.clearValidate();
          }
        }
      },
      //关闭弹窗前的回调方法
      handleClose() {
        this.form = {};
        this.dialogFormVisible = false;
        this.$refs.form.clearValidate();
      },
      //组件传值
      show(row) {
        if (!row) {
          this.form = {};
          this.title = '添加';
        } else {
          this.form = { ...row };
          this.title = "修改";
        }
        this.dialogFormVisible = true;
      },
      //确定返回方法
      confirm() {
        
      },
    },
  };
  </script>
  
  <style scoped>
  .el-input {
    width: 260px;
  }
  </style>
  