<!-- 表格里的管理弹出框 -->
<template>
  <div>
    <MOSTY.PageTree :pageTitle="props.checktype === '1' ? '固有风险详情列表' : '现状风险详情列表'" :isShowLeftTree="true">false">
      <template #serach>
        <div class="btnBox">
          <el-button type="primary" @click="handleClose">
            <el-icon>
              <Close />
            </el-icon>
            <span>关闭</span>
          </el-button>
        </div>
      </template>
      <template #table>
        <div style="height: calc(100vh - 280px);">
          <el-table :data="tableData" border stripe height="100%">
            <el-table-column v-if='props.checktype === "1"' label="风险点名称" prop="orgname" align="center"
              show-overflow-tooltip />
            <el-table-column v-if='props.checktype === "1"' label="风险描述" property="orgname"
              show-overflow-tooltip></el-table-column>
            <el-table-column v-if='props.checktype === "1"' label="严重程度(S值)" property="orgname"
              show-overflow-tooltip></el-table-column>
            <el-table-column v-if='props.checktype === "1"' label="控制措施" property="orgname"
              show-overflow-tooltip></el-table-column>

            <el-table-column v-if='props.checktype === "2"' label="风险点名称" property="orgname"
              show-overflow-tooltip></el-table-column>
            <el-table-column v-if='props.checktype === "2"' label="固有风险描述" property="orgname"
              show-overflow-tooltip></el-table-column>
            <el-table-column v-if='props.checktype === "2"' label="控制措施" property="orgname"
              show-overflow-tooltip></el-table-column>
            <el-table-column v-if='props.checktype === "2"' label="现状风险描述" property="orgname"
              show-overflow-tooltip></el-table-column>
            <el-table-column v-if='props.checktype === "2"' label="可能性(L值)" property="orgname"
              show-overflow-tooltip></el-table-column>
            <el-table-column v-if='props.checktype === "2"' label="严重程度(S值)" property="orgname"
              show-overflow-tooltip></el-table-column>
            <el-table-column v-if='props.checktype === "2"' label="风险等级(值)" property="orgname"
              show-overflow-tooltip></el-table-column>
            <!-- <el-table-column property="ctype" label="类型">
              <template #default="{ row }">
                <dict-tag :options="D_TB_BMJCLX" :value="row.ctype" :tag="false" />
              </template>
</el-table-column>
<el-table-column label="检查类型" prop="checktype">
  <template #default="{ row }">
                <dict-tag :options="D_BZ_YHLX" :value="row.checktype" :tag="false" />
              </template>
</el-table-column> -->
            <!-- <el-table-column label="操作">
              <template #default="scope">
                <span class="operesee" @click="handleEdit(scope.row)"><el-icon>
                    <Compass />
                  </el-icon>详情</span>
              </template>
            </el-table-column> -->
          </el-table>
          <div class="fenye">
            <MOSTY.Pages :pageConfiger="listQuery" @changeNo="handleCurrentChange" @changeSize="handleSizeChange">
            </MOSTY.Pages>
          </div>
        </div>
      </template>
    </MOSTY.PageTree>
  </div>
</template>
<script setup>
// 引入
import {
  ref,
  onMounted,
  defineProps,
  defineEmits,
  getCurrentInstance,
  watch
} from "vue";
import * as MOSTY from "@/components/MyComponents/index";
import { getApi, } from "@/api/tobAcco_api.js";
const { proxy } = getCurrentInstance();
const { D_BZ_YHLX, D_TB_BMJCLX } = proxy.$dict(
  "D_BZ_YHLX",
  "D_TB_BMJCLX",
);
// 数据
const props = defineProps({
  checktype: {
    type: String,
    default: "1"
  },

  typeList: {
    type: Object,
    required: true,
    default: () => { }
  }

});
watch(
  () => props.typeList?.userid,
  (val) => {
    if (val) {
      getPcxData()
    }
  },
)

const emits = defineEmits(["close"]);
const tableData = ref([
]);
// 分页
const listQuery = ref({
  pageCurrent: 1,
  pageSize: 20,
  total: 0,
  checktype: props.checktype
});

onMounted(() => {

});
// 关闭
const handleClose = () => {
  emits("close");
};


// 获取排查项列表
const getPcxData = () => {
  getApi(listQuery.value, "/mosty-jcgl/jctj/checkDetailList").then((res) => {
    tableData.value = res.records;
    listQuery.value.total = res.total
  });
};
//页码发生变化
const handleCurrentChange = val => {
  listQuery.value.pageCurrent = val
  getPcxData()
}
//查询条数发生变化
const handleSizeChange = val => {
  listQuery.value.pageSize = val
  getPcxData()
}

</script>

<style lang="scss" scoped>
.newAdd {
  margin-top: 6px;
  position: absolute;
  right: 20px;
}


.btnBox {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 12px;
}
</style>