<script setup lang="ts">
import { ref, onMounted } from "vue";
import ActionTable from "./components/action-table.vue";
import EditModel from "./components/edit-dialog.vue";
import { useUserStoreHook } from "/@/store/modules/user";
const actionTableRef = ref<InstanceType<typeof ActionTable>>(null);
const modelRef = ref<InstanceType<typeof EditModel>>(null);
const powers = ref([]);
//新建/编辑/查看
function handleAddChangeCheck(item: any, id: string, type: string) {
  modelRef.value.show(item, id, type);
}
onMounted(() => {
  powers.value = [
    "001",
    "002",
    "003",
    "004",
    "005",
    "006",
    "007",
    "008",
    "009",
    "010",
    "011"
  ];
  //useUserStoreHook().getMenuActions("menuOperator");
  if (powers.value.some(i => i == "001")) {
    actionTableRef.value.onSearch();
  }
});
</script>

<template>
  <div class="main">
    <!-- <PagePower :isShow="powers.some(i => i == '001')"> -->
      <ActionTable
        ref="actionTableRef"
        :powers="powers"
        @edit="handleAddChangeCheck"
        @create="handleAddChangeCheck"
        @view="handleAddChangeCheck"
      />
      <EditModel ref="modelRef" @reload="actionTableRef.onSearch()" />
    <!-- </PagePower> -->
  </div>
</template>
