<template>
  <CommonListPage 
    title="保护单位"
    itemType="simple-text"
    detailsPage="disabled"
    showTotal
    :dropDownNames="dropdownNames"
    :detailsParams="{
      mainBodyColumnId: UnitContent.mainBodyColumnId,
      modelId: UnitContent.modelId,
    }"
    :load="loadData" 
  />
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { GetContentListParams } from '@/api/CommonContent';
import UnitContent from '@/api/inheritor/UnitContent';
import CommonListPage, { type DropDownNames } from '@/pages/article/common/CommonListPage.vue';

const dropdownNames = ref<DropDownNames[]>([]);

async function loadData(
  page: number, 
  pageSize: number,
  searchText: string,
  dropDownValues: number[]
) {
  const res = (await UnitContent.getContentList(new GetContentListParams()
    .setKeywords(searchText)
  , page, pageSize));
  res.list.forEach((p) => {
    p.desc = '';
    p.bottomTags = [
      p.levelText, 
      p.ichTypeText, 
      p.batchText,
      p.regionText,
    ] as string[];
  })
  return res;
}

onMounted(async () => {
  
})
</script>
