<template>
  <el-dialog :title="title" :visible.sync="visiable" center width="40%">
    <easy-data-form v-if="visiable" ref="AddDialogEasyDataList" :dataSourceName="dataSourceName"
                    :formData="formModel" :label-position="labelPosition" labelWidth="120px">

      <template v-slot:passModule="data">
        <el-cascader
            v-model="data.model.passModule"
            :options="options"
            :props="{ multiple: true }"
            :show-all-levels="false"
            clearable
            @change="changePassModule($event, data)"></el-cascader>
      </template>
    </easy-data-form>
    <span slot="footer" class="dialog-footer">
            <el-button @click="visiable = false">取 消</el-button>
            <el-button type="primary" @click="save">确 定</el-button>
        </span>
  </el-dialog>
</template>
<script>

export default {
  props: {
    dataSourceName: {
      type: String,
      default: null
    },
    labelPosition: {
      type: String,
      default: 'right'
    }
  },
  data() {
    return {
      //新增一级模块
      visiable: false,
      formModel: {},
      title: '',
      options: []
    }
  },
  methods: {
    showModel(formModel, title, options) {
      this.title = title
      this.formModel = formModel
      this.options = options
      this.visiable = true
    },
    async save() {
      const formData = await this.$refs.AddDialogEasyDataList.getFormData(true, true);
      this.$emit('ok', formData)
      this.visiable = false
    },
    changePassModule(value, data) {
    },
  }
}
</script>
