<script setup lang="ts">
import { ref, onMounted } from "vue";
import ActionTable from "./components/action-table.vue";
import EditModel from "./components/edit-dialog.vue";

const actionTableRef = ref<InstanceType<typeof ActionTable>>(null);
const modelRef = ref<InstanceType<typeof EditModel>>(null);

//新建/编辑/查看
function handleAddChangeCheck(item: any, id: string, type: string) {
  modelRef.value.show(item, id, type);
}
onMounted(() => {
  actionTableRef.value.onSearch();
});
</script>

<template>
  <div class="main flex">
    <ActionTable
      ref="actionTableRef"
      @edit="handleAddChangeCheck"
      @create="handleAddChangeCheck"
      @view="handleAddChangeCheck"
    />
    <EditModel ref="modelRef" @reload="actionTableRef.onSearch()" />
  </div>
</template>
