<template>
  <div>
    <MOSTY.PageTree :pageTitle="'检查频率管理'" :isShowLeftTree="false">
      <template #table>
        <!-- 表格 -->
        <section class="eltab3">
          <MOSTY.Table :table-columns="data.tableColumn" :tableData="data.tableData" :tableloading="tableloading"
            :isSelect="false" :isSort="false" :tableHeight="'100%'">
            <template #actions="{ row }">
              <span class="operesee" @click="foundationFn(row)">
                <el-icon>
                  <EditPen />
                </el-icon>
                配置
              </span>
            </template>

          </MOSTY.Table>
        </section>
      </template>
    </MOSTY.PageTree>

    <div v-if="comprehensiveShow" class="dialog-box">
      <Jcplgl @closeback="closeEven" :rowId="rowId" :orgids="orgids" />
    </div>
  </div>
</template>

<script setup>
import { getApi } from "@/api/tobAcco_api.js";
import * as MOSTY from "@/components/MyComponents/index";
import { reactive, onMounted, ref } from "vue";
import Jcplgl from "./jcplgl.vue";
const orgids = ref(null)
const bigHeight = ref(); //整个高度
const tableloading = ref(false);
const rowId = ref(null)
const comprehensiveShow = ref(false);
const data = reactive({
  searchObj: {},
  tableData: [],
  tableColumn: [
    {
      title: "单位类目",
      prop: "name",
    },
    {
      title: "说明",
      prop: "note",
    },
    {
      title: "操作",
      prop: "actions",
      fixed: 'right',
      slot: true
    }
  ],

});
const tableHeight = ref();
// 控制新增与检查配置修改的标题
onMounted(() => {
  bigHeightFn();
  tabHeightFn();
  getTableData();
});
// 方法
const bigHeightFn = () => {
  bigHeight.value = window.innerHeight - 147 + "px";
};

// 表格高度计算
const tabHeightFn = () => {
  tableHeight.value = window.innerHeight - 210;
};
// 获取表格数据
const getTableData = () => {
  tableloading.value = true;
  getApi({}, "/mosty-jcgl/checklibOrg/getList").then((res) => {
    if (res) {
      tableloading.value = false;
      data.tableData = res;
    }
  }).catch(() => {
    data.tableData = [];
    tableloading.value = false;
  });
};
const foundationFn = (row) => {
  comprehensiveShow.value = true;
  rowId.value = row.id
  orgids.value = row.orgids
};

function closeEven() {
  comprehensiveShow.value = false;
}

</script>

<style lang="scss" scoped>
.eltab3 {
  height: calc(100vh - 192px);
}
</style>
