<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="100px">
    </el-form>

    <el-table
      v-loading="loading"
      :data="stockOutDetailList"
      @selection-change="handleSelectionChange"
      height="calc(100vh - 300px)"
    >
      <el-table-column type="selection" width="50" align="center" />
      <el-table-column
        label="单据号"
        align="center"
        key="supplyBusno"
        prop="supplyBusno"
        width="200"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="出库类型"
        align="center"
        key="type"
        prop="type"
        width="140"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="药品名称"
        align="center"
        key="medName"
        prop="medName"
        width="140"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="院内药品唯一码"
        align="center"
        key="busNo"
        prop="busNo"
        width="140"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="药品类型"
        align="center"
        key="itemTableText"
        prop="itemTableText"
        width="140"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="批次号"
        align="center"
        key="lotNumber"
        prop="lotNumber"
        width="140px"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="存放仓库"
        align="center"
        key="locationName"
        prop="locationName"
        width="140"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="货位"
        align="center"
        key="locationStoreName"
        prop="locationStoreName"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="计量单位"
        align="center"
        key="unitCode_dictText"
        prop="unitCode_dictText"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="采购数量"
        align="center"
        key="quantity"
        prop="quantity"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="采购单价"
        align="center"
        key="price"
        prop="price"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="采购金额"
        align="center"
        key="totalPrice"
        prop="totalPrice"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="售价"
        align="center"
        key="salePrice"
        prop="salePrice"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="售价金额"
        align="center"
        key="totalSalePrice"
        prop="totalSalePrice"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="出库科室"
        align="center"
        key="orgId_dictText"
        prop="orgId_dictText"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="供应商"
        align="center"
        key="supplier"
        prop="supplier"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="审核人"
        align="center"
        key="approverId_dictText"
        prop="approverId_dictText"
        :show-overflow-tooltip="true"
      />

      <el-table-column
        label="审批日期"
        align="center"
        key="approvalTime"
        prop="approvalTime"
        width="160"
        :show-overflow-tooltip="true"
      >
        <template #default="scope">
          <span>{{ parseTime(scope.row.approvalTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="出库原因"
        align="center"
        key="reason"
        prop="reason"
        :show-overflow-tooltip="true"
      />
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      v-model:page="queryParams.pageNo"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

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

const { proxy } = getCurrentInstance();
const route = useRoute();

const stockOutDetailList = ref([]);
const loading = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const approvalTime = ref([]);
const supplierListOptions = ref([]);
const locationIdList = ref([]);

const data = reactive({
  form: {},
  queryParams: {
    pageNo: 1,
    pageSize: 10,
    searchKey: undefined,
    occurrenceTimeSTime: undefined,
    occurrenceTimeETime: undefined,
  },
  rules: {},
});

const { queryParams, form, rules } = toRefs(data);

/** 药剂科报表_常规报表:出库明细表的查询 */
function getList() {
  loading.value = true;
  getStockOutDetail(queryParams.value).then((res) => {
    loading.value = false;
    stockOutDetailList.value = res.data.records;
    total.value = res.data.total;
  });
}

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

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