<!-- 通用抽屉 -->
<template>
  <a-drawer
    v-model:visible="vdata.visible"
    title="流水记录"
    :closable="true"
    :body-style="{ paddingBottom: '80px' }"
    :drawer-style="{ backgroundColor: '#f0f2f5' }"
    width="85%"
    @close="vdata.visible = false"
  >
    <div>
      <HistoryPanel v-if="vdata.visible" ref="historyPanelRef" :showSearch="vdata.showSearch" :defaultQueryCondition="vdata.defaultQueryCondition" />
    </div>
  </a-drawer>
</template>

<script lang="ts" setup >
import { ref, reactive, defineExpose } from 'vue'
import HistoryPanel from './HistoryPanel.vue'

const historyPanelRef = ref()


const vdata : any = reactive({
    visible: false, // 一级抽屉开关
    defaultQueryCondition: { type: Object, default: () => {}  }, // 查询集合的条件
    showSearch: { type: Boolean, default: true } //是否显示搜索面板
})

// 弹层打开事件
function show (queryObject, isShow) {
  vdata.defaultQueryCondition = queryObject
  vdata.showSearch = isShow
  vdata.visible = true
}

defineExpose({ show })
</script>
