<template>
  <!--   :class="state.fullscreen ? '' : 'record'"-->
  <lt-a-model
      v-model:open="state.showDlg"
      :title="props.dlgTitle"
      :width="props.dlgWidth"
      :destroyOnClose="true"
      @cancel="handleCancel"
      :afterClose="handleAfterClose"
  >
    <div :style="{height:props.dlgHeight,width:'100%'}">
      <slot name="dlg-content-slot"></slot>
    </div>
    <template #footer>
      <slot name="dlg-footer">
        <div style="display: flex;justify-content: center;padding-top: 5px">
          <a-button class="success-btn" v-if="props.ifShowConfirm" @click="handleConfirm">
            {{ $t("Formula.Common.confirm") }}
          </a-button>
          <a-button type="primary" danger v-if="props.ifShowCancel" @click="handleCancel" style="margin-left: 30px">
            {{ $t("Formula.Common.Cancel") }}
          </a-button>
        </div>
      </slot>
    </template>
  </lt-a-model>
</template>
<script setup lang="ts">
import {
  ref,
  PropType,
  onMounted,
  computed,
  unref,
  reactive,
  onBeforeMount,
  nextTick,
  watch,
  watchEffect,
  toRaw
} from "vue"
import {cloneDeep} from "lodash-es"

const emits = defineEmits(['dlgConfirm', 'dlgCancel'])
const props = defineProps({
  ifShowConfirm: {
    type: Boolean,
    default: true
  },
  ifShowCancel: {
    type: Boolean,
    default: true
  },
  dlgTitle: {
    type: String,
    default: "弹窗名称"
  },
  dlgWidth: {
    type: String,
    default: "500px"
  },
  dlgHeight: {
    type: String,
    default: "300px"
  },
})

const state = reactive({
  showDlg: false,
  fullscreen: false,
})

const handleConfirm = () => {
  // 不知为何会报错
  // state.showDlg=false
  emits('dlgConfirm')
}
const handleCancel = () => {
  // state.showDlg=false
  emits('dlgCancel')
}
const handleAfterClose = () => {
}

onBeforeMount(() => {
  nextTick(() => {
    state.showDlg = true
  })
})
onMounted(() => {

})
</script>

<style scoped lang="less">
.record .ant-modal-content {
  max-height: 600px
}
</style>