<template>
  <p-modal title="Title" :visible="visible" :confirm-loading="confirmLoading" @ok="handleOk" @cancel="handleCancel">
    <p-grid-form
      ref="aaa"
      :span="18"
      :label-col="{ span: 4 }"
      :wrapper-col="{ span: 14 }"
      :items="items"
      @submit="hanlderSubmit"
    >
      <!-- <div slot="check" slot-scope="vaule" style="margin: 0">
        <p-checkbox-group :options="vaule" v-model="value" />
      </div> -->
    </p-grid-form>
  </p-modal>
</template>

<script>
export default {
  name: 'EditModel',
  data() {
    return {
      value: [],
      ModalText: 'Content of the modal',
      //   visible: false,
      confirmLoading: false
    }
  },
  props: {
    visible: {
      type: Boolean,
      default: true
    },
    items: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    setvalue(value) {
      //   this.$refs.aaa.setFieldsValue({ aaa: 'true' })
      this.$nextTick(() => {
        this.$refs.aaa.form.setFieldsValue(value)
      })
      //   setTimeout(() => {

      //   }, 0)
    },
    reset() {
      this.$nextTick(() => {
        this.$refs.aaa.form.resetFields()
      })
    },
    hanlderSubmit(evnet, form) {
      evnet.preventDefault()
    },
    handleOk(e) {
      let that = this
      let a = {
        check: that.value
      }
      let data = Object.assign({}, this.$refs.aaa.form.getFieldsValue(), a)
      this.ModalText = 'The modal will be closed after two seconds'
      this.confirmLoading = true
      setTimeout(() => {
        // this.$eivisible = false
        this.$emit('hidemodel')
        this.confirmLoading = false
      }, 200)
    },
    handleCancel(e) {
      this.$emit('hidemodel')
    }
  }
}
</script>

<style></style>
