|
@@ -0,0 +1,262 @@
|
|
|
+<script setup lang="ts">
|
|
|
+const props = withDefaults(
|
|
|
+ defineProps<{
|
|
|
+ title: string
|
|
|
+ data?: any[] | (() => any[])
|
|
|
+ totalData?: any | (() => any)
|
|
|
+ reportGenDate?: string
|
|
|
+ reportType?: "COOP" | "EGG"
|
|
|
+ reportDateType?: "D" | "M" | "Q" | "Y"
|
|
|
+ }>(),
|
|
|
+ {
|
|
|
+ reportType: "COOP",
|
|
|
+ reportDateType: "D"
|
|
|
+ }
|
|
|
+)
|
|
|
+const emits = defineEmits<{ (e: "update:modelValue", v: string): void }>()
|
|
|
+const dateTypeStr = computed(() => {
|
|
|
+ if (props.reportDateType === "D") {
|
|
|
+ return "日"
|
|
|
+ } else if (props.reportDateType === "M") {
|
|
|
+ return "月"
|
|
|
+ } else if (props.reportDateType === "Q") {
|
|
|
+ return "季"
|
|
|
+ } else if (props.reportDateType === "Y") {
|
|
|
+ return "年"
|
|
|
+ }
|
|
|
+})
|
|
|
+const showEggReport = computed(() => {
|
|
|
+ return props.reportType === "EGG"
|
|
|
+})
|
|
|
+const reportData = computed(() => {
|
|
|
+ if (!props.data) {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ if (typeof props.data === "function") {
|
|
|
+ return props.data()
|
|
|
+ }
|
|
|
+ return props.data
|
|
|
+})
|
|
|
+const totalData = computed(() => {
|
|
|
+ if (!props.totalData) {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+ if (typeof props.totalData === "function") {
|
|
|
+ return props.totalData()
|
|
|
+ }
|
|
|
+ return props.totalData
|
|
|
+})
|
|
|
+
|
|
|
+function init() {
|
|
|
+ //
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(init)
|
|
|
+</script>
|
|
|
+<template>
|
|
|
+ <div class="report-container">
|
|
|
+ <table class="table table-bordered report-table">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th class="report-title" colspan="30">
|
|
|
+ <span class="report-title-text">
|
|
|
+ {{ title }}
|
|
|
+ </span>
|
|
|
+ <span v-if="reportGenDate" class="report-gen-date">生成时间:{{ reportGenDate }}</span>
|
|
|
+ </th>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th class="s-1 w-100px" rowspan="2">鸡舍</th>
|
|
|
+ <th class="s-1 w-150px" rowspan="2">品种</th>
|
|
|
+ <th class="s-3 w-50px" rowspan="2">
|
|
|
+ <div v-if="reportDateType != 'D'">{{ dateTypeStr }}末</div>
|
|
|
+ <div>日龄</div>
|
|
|
+ </th>
|
|
|
+ <th class="s-1" colspan="2">上{{ dateTypeStr }}存栏</th>
|
|
|
+ <th class="s-2" colspan="2">本{{ dateTypeStr }}转入</th>
|
|
|
+ <th class="s-1" colspan="2">本{{ dateTypeStr }}淘汰</th>
|
|
|
+ <th class="s-2" colspan="2">本{{ dateTypeStr }}转出</th>
|
|
|
+ <th class="s-1" colspan="2">本{{ dateTypeStr }}存栏</th>
|
|
|
+ <template v-if="showEggReport">
|
|
|
+ <th class="s-2 w-80px" rowspan="2">合格蛋</th>
|
|
|
+ <th class="s-1 w-80px" rowspan="2">畸形蛋</th>
|
|
|
+ <th class="s-2 w-80px" rowspan="2">破蛋</th>
|
|
|
+ <th class="s-1 w-80px" rowspan="2">种蛋合格率</th>
|
|
|
+ <th class="s-1 w-80px" rowspan="2">产蛋率</th>
|
|
|
+ </template>
|
|
|
+ <th class="s-2 w-80px" rowspan="2">成活率</th>
|
|
|
+ <!-- <th class="s-2 w-150px" rowspan="2">备注</th> -->
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th class="s-1 s-g">♂</th>
|
|
|
+ <th class="s-1 s-g">♀</th>
|
|
|
+ <th class="s-2 s-g">♂</th>
|
|
|
+ <th class="s-2 s-g">♀</th>
|
|
|
+ <th class="s-1 s-g">♂</th>
|
|
|
+ <th class="s-1 s-g">♀</th>
|
|
|
+ <th class="s-2 s-g">♂</th>
|
|
|
+ <th class="s-2 s-g">♀</th>
|
|
|
+ <th class="s-1 s-g">♂</th>
|
|
|
+ <th class="s-1 s-g">♀</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <template v-for="(data, index) in reportData" :key="index">
|
|
|
+ <tr v-for="(item, index2) in data.data" :key="index2">
|
|
|
+ <td v-if="index2 === 0" class="s-1 s-js" :rowspan="data.data.length">
|
|
|
+ {{ data.coopName }}
|
|
|
+ </td>
|
|
|
+ <td class="s-1 s-pc">{{ item.batchName }}</td>
|
|
|
+ <td class="s-3">{{ item.dayAge }}</td>
|
|
|
+ <td class="s-1">{{ item.last_save_0 }}</td>
|
|
|
+ <td class="s-1">{{ item.last_save_1 }}</td>
|
|
|
+ <td class="s-2">{{ item.in_0 }}</td>
|
|
|
+ <td class="s-2">{{ item.in_1 }}</td>
|
|
|
+ <td class="s-1">{{ item.cull_0 }}</td>
|
|
|
+ <td class="s-1">{{ item.cull_1 }}</td>
|
|
|
+ <td class="s-2">{{ item.out_0 }}</td>
|
|
|
+ <td class="s-2">{{ item.out_1 }}</td>
|
|
|
+ <td class="s-1">{{ item.save_0 }}</td>
|
|
|
+ <td class="s-1">{{ item.save_1 }}</td>
|
|
|
+ <template v-if="showEggReport">
|
|
|
+ <td class="s-2">{{ item.qualified_egg }}</td>
|
|
|
+ <td class="s-1">{{ item.deformed_egg }}</td>
|
|
|
+ <td class="s-2">{{ item.break_egg }}</td>
|
|
|
+ <td class="s-1">{{ item.egg_pass_rate }}</td>
|
|
|
+ <td class="s-1">{{ item.egg_production_rate }}</td>
|
|
|
+ </template>
|
|
|
+ <td class="s-1">{{ item.life_rate }}</td>
|
|
|
+ <!-- <td class="s-1">{{ item.remark }}</td> -->
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td class="s-4" colspan="3">合计</td>
|
|
|
+ <td class="s-4">{{ data.total.last_save_0 }}</td>
|
|
|
+ <td class="s-4">{{ data.total.last_save_1 }}</td>
|
|
|
+ <td class="s-4">{{ data.total.in_0 }}</td>
|
|
|
+ <td class="s-4">{{ data.total.in_1 }}</td>
|
|
|
+ <td class="s-4">{{ data.total.cull_0 }}</td>
|
|
|
+ <td class="s-4">{{ data.total.cull_1 }}</td>
|
|
|
+ <td class="s-4">{{ data.total.out_0 }}</td>
|
|
|
+ <td class="s-4">{{ data.total.out_1 }}</td>
|
|
|
+ <td class="s-4">{{ data.total.save_0 }}</td>
|
|
|
+ <td class="s-4">{{ data.total.save_1 }}</td>
|
|
|
+ <template v-if="showEggReport">
|
|
|
+ <td class="s-4">{{ data.total.qualified_egg }}</td>
|
|
|
+ <td class="s-4">{{ data.total.deformed_egg }}</td>
|
|
|
+ <td class="s-4">{{ data.total.break_egg }}</td>
|
|
|
+ <td class="s-4">{{ data.total.egg_pass_rate }}</td>
|
|
|
+ <td class="s-4">{{ data.total.egg_production_rate }}</td>
|
|
|
+ </template>
|
|
|
+ <td class="s-4">{{ data.total.life_rate }}</td>
|
|
|
+ <!-- <td class="s-4">{{ data.total.remark }}</td> -->
|
|
|
+ </tr>
|
|
|
+ </template>
|
|
|
+ <tr class="h-30px">
|
|
|
+ <td colspan="30"></td>
|
|
|
+ </tr>
|
|
|
+ <tr class="total-row">
|
|
|
+ <td colspan="3">总合计</td>
|
|
|
+ <td>{{ totalData.last_save_0 }}</td>
|
|
|
+ <td>{{ totalData.last_save_1 }}</td>
|
|
|
+ <td>{{ totalData.in_0 }}</td>
|
|
|
+ <td>{{ totalData.in_1 }}</td>
|
|
|
+ <td>{{ totalData.cull_0 }}</td>
|
|
|
+ <td>{{ totalData.cull_1 }}</td>
|
|
|
+ <td>{{ totalData.out_0 }}</td>
|
|
|
+ <td>{{ totalData.out_1 }}</td>
|
|
|
+ <td>{{ totalData.save_0 }}</td>
|
|
|
+ <td>{{ totalData.save_1 }}</td>
|
|
|
+ <template v-if="showEggReport">
|
|
|
+ <td>{{ totalData.qualified_egg }}</td>
|
|
|
+ <td>{{ totalData.deformed_egg }}</td>
|
|
|
+ <td>{{ totalData.break_egg }}</td>
|
|
|
+ <td>{{ totalData.egg_pass_rate }}</td>
|
|
|
+ <td>{{ totalData.egg_production_rate }}</td>
|
|
|
+ </template>
|
|
|
+ <td>{{ totalData.life_rate }}</td>
|
|
|
+ <!-- <td>{{ totalData.remark }}</td> -->
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+.report-container {
|
|
|
+ width: 100%;
|
|
|
+ overflow: auto;
|
|
|
+ padding: 10px;
|
|
|
+ margin: 0;
|
|
|
+ box-sizing: border-box;
|
|
|
+ .report-title {
|
|
|
+ text-align: center;
|
|
|
+ position: relative;
|
|
|
+ padding: 0;
|
|
|
+ .report-title-text {
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: bold;
|
|
|
+ line-height: 40px;
|
|
|
+ }
|
|
|
+ .report-gen-date {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 1px;
|
|
|
+ right: 15px;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.report-table {
|
|
|
+ width: auto;
|
|
|
+ margin: 0 auto;
|
|
|
+
|
|
|
+ tr {
|
|
|
+ border-color: #3c3c3c;
|
|
|
+ }
|
|
|
+ th,
|
|
|
+ td {
|
|
|
+ text-align: center;
|
|
|
+ vertical-align: middle;
|
|
|
+ padding: 5px 0;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ thead {
|
|
|
+ tr {
|
|
|
+ th {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+ vertical-align: middle;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ th {
|
|
|
+ width: 50px;
|
|
|
+ }
|
|
|
+ .s-js,
|
|
|
+ .s-pc {
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ .s-1 {
|
|
|
+ background: #92d050;
|
|
|
+ }
|
|
|
+ .s-2 {
|
|
|
+ background: #ffff00;
|
|
|
+ }
|
|
|
+ .s-3 {
|
|
|
+ background: #ed7d31;
|
|
|
+ }
|
|
|
+ .s-4 {
|
|
|
+ background: #5b9bd5;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ .s-g {
|
|
|
+ font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
|
|
|
+ }
|
|
|
+ .total-row td {
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 14px;
|
|
|
+ background: #ffff00;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|