<template>
  <div class="app-container">
    <el-table
      v-loading="loading"
      :data="offlinePurchaseRatioList"
      @selection-change="handleSelectionChange"
    >
      <el-table-column
        type="selection"
        width="50"
        align="center"
      />
      <el-table-column
        key="itemName"
        label="项目名称"
        align="center"
        prop="itemName"
        width="200"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        key="orgName"
        label="医疗机构名称"
        align="center"
        prop="orgName"
        width="200"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        key="actualDrugPurchasePrice"
        label="实际药品采购金额（元）"
        align="center"
        prop="actualDrugPurchasePrice"
        width="200"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        key="platformPurchasePrice"
        label="平台采购金额（元）"
        align="center"
        prop="platformPurchasePrice"
        width="200"
        :show-overflow-tooltip="true"
      />
    </el-table>
    <pagination
      v-show="total > 0"
      v-model:page="queryParams.pageNo"
      v-model:limit="queryParams.pageSize"
      :total="total"
      @pagination="getList"
    />
  </div>
</template>

<script setup name="offlinePurchaseRatioDetails">
import {getReportOfflinePurchaseRatio} from './statisticalManagent';

const offlinePurchaseRatioList = ref([]);
const loading = ref(true);
const ids = ref([]);
const total = ref(0);

const queryParams = ref({
    pageNo: 1,
    pageSize: 10,
    searchKey: undefined,
    occurrenceTimeSTime: undefined,
    occurrenceTimeETime: undefined,
});

/** 查询调拨管理项目列表 */
function getList() {
  loading.value = true;
  getReportOfflinePurchaseRatio(queryParams.value).then((res) => {
    loading.value = false;
    offlinePurchaseRatioList.value = res.data.records;
    total.value = res.data.total;
  })
}

/** 选择条数  */
function handleSelectionChange(selection) {
  ids.value = selection.map((item) => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}

// 页面加载时获取数据
onMounted(() => {
  getList();
});

</script>
<style scoped>
.custom-tree-node {
  display: flex;
  align-items: center;
}

.title {
  font-weight: bold;
  font-size: large;
  margin-bottom: 10px;
}
</style>