<template>
  <p-modal title="详情" :visible="isvisible" width="50%" :footer="null" @cancel="handleCancel">
    <p-grid-form
      :span="8"
      ref="form"
      :label-col="{ span: 9 }"
      class="plg-form"
      :items="items"
      @submit="hanlderSubmit"
    />
  </p-modal>
</template>
<script>
const items = [
  {
    span: 20,
    type: 'input',
    disabled: true,
    name: 'name',
    label: '权限名称',
    value: ''
  },
  {
    span: 20,
    type: 'input',
    disabled: true,
    name: 'enabled',
    label: '是否启用',
    value: ''
  },
  {
    span: 20,
    type: 'textarea',
    disabled: true,
    name: 'remark',
    label: '权限描述',
    ellipsis: true,
    value: ''
  }
]
export default {
  data() {
    return {
      items,
      isvisible: false // 详情弹窗
    }
  },
  props: {
    visibleDetial: {
      type: Boolean,
      default: false
    },
    setRecord: {
      type: Object,
      default: {}
    }
  },
  watch: {
    visibleDetial(newVal) {
      this.isvisible = newVal
      this.$nextTick(() => {
        this.$refs.form.form.resetFields()
        this.$refs.form.form.setFieldsValue({
          name: this.setRecord.name,
          enabled: this.setRecord.enabled == 1 ? '启用' : '停用',
          remark: this.setRecord.remark
        })
      })
    }
  },
  mounted() {},
  methods: {
    handleOk() {
      // this.$nextTick(() => {
      //   this.$refs.child.form.getFieldValue((error, values) => {
      //     console.log(error, values, '44444444')
      //   })
      // })
      // this.$nextTick(() => {
      //   this.$refs.form.form.resetFields()
      //   this.$refs.form.form.setFieldsValue({
      //     'field-input': 33366666666,
      //   })
      // })
    },
    hanlderSubmit() {},
    handleCancel() {
      // 取消
      this.isvisible = false
      this.$emit('requestDetial', false)
    }
  }
}
</script>
<style lang="less" scoped>
</style>