2024-06-30 21:39:37 +08:00
|
|
|
<script setup lang="ts">
|
|
|
|
const items = [{
|
2024-07-05 02:07:18 +08:00
|
|
|
title: '土壤统计',
|
|
|
|
value: 'soil',
|
2024-06-30 21:39:37 +08:00
|
|
|
}, {
|
2024-07-05 02:07:18 +08:00
|
|
|
title: '产业统计',
|
|
|
|
value: 'industry',
|
2024-06-30 21:39:37 +08:00
|
|
|
}]
|
2024-07-05 02:07:18 +08:00
|
|
|
const info = useInfoStore()
|
|
|
|
const data = computed(() => {
|
|
|
|
return info.data[info.showIndex]
|
|
|
|
})
|
2024-06-30 21:39:37 +08:00
|
|
|
|
|
|
|
const selected = ref(0)
|
|
|
|
|
|
|
|
function change(value: number) {
|
|
|
|
selected.value = value
|
|
|
|
}
|
|
|
|
|
2024-07-05 02:07:18 +08:00
|
|
|
const count = computed(() => {
|
|
|
|
return selected ? data.value.info.industry.length : data.value.info.soil.length
|
|
|
|
})
|
|
|
|
|
|
|
|
const value = computed(() => {
|
|
|
|
if (selected.value === 0) {
|
|
|
|
return {
|
|
|
|
count: data.value.info.soil.length,
|
|
|
|
unit: '种',
|
|
|
|
icon: 'solar:adhesive-plaster-line-duotone',
|
|
|
|
title: '区域内现土壤总计',
|
|
|
|
details: [{
|
|
|
|
title: '养分特征数量',
|
|
|
|
value: data.value.info.soil.reduce((a, b) => { return a + b.nutrient.length }, 0),
|
|
|
|
icon: 'solar:atom-bold-duotone',
|
|
|
|
}, {
|
|
|
|
title: '土壤环境数量',
|
|
|
|
value: data.value.info.soil.reduce((a, b) => { return a + b.env.length }, 0),
|
|
|
|
icon: 'solar:bacteria-bold-duotone',
|
|
|
|
}, {
|
|
|
|
title: '微生物数量共计',
|
|
|
|
value: data.value.info.soil.reduce((a, b) => { return a + b.microorganism_count }, 0),
|
|
|
|
icon: 'solar:bug-bold-duotone',
|
|
|
|
}],
|
|
|
|
table: {
|
|
|
|
columns: [{
|
|
|
|
title: '类型',
|
|
|
|
key: 'type',
|
|
|
|
}, {
|
|
|
|
title: '土壤养分特征',
|
|
|
|
key: 'nutrient',
|
|
|
|
}, {
|
|
|
|
title: '土壤环境',
|
|
|
|
key: 'env',
|
|
|
|
}, {
|
|
|
|
title: '微生物数量',
|
|
|
|
key: 'microorganism_count',
|
|
|
|
}],
|
|
|
|
list: data.value.info.soil,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return {
|
|
|
|
count: data.value.info.industry.length,
|
|
|
|
unit: '个',
|
|
|
|
icon: 'solar:buildings-broken',
|
|
|
|
title: '区域内现产业总计',
|
|
|
|
details: [{
|
|
|
|
title: '农作物共计',
|
|
|
|
value: data.value.info.industry.reduce((a, b) => { return a + b.crop.length }, 0),
|
|
|
|
icon: 'solar:floor-lamp-bold-duotone',
|
|
|
|
}, {
|
|
|
|
title: '畜产品共计',
|
|
|
|
value: data.value.info.industry.reduce((a, b) => { return a + b.livestock.length }, 0),
|
|
|
|
icon: 'solar:dumbbells-bold-duotone',
|
|
|
|
}, {
|
|
|
|
title: '产业结构共计',
|
|
|
|
value: new Set(data.value.info.industry.map(i => i.construction)).size,
|
|
|
|
icon: 'solar:buildings-bold-duotone',
|
|
|
|
}],
|
|
|
|
table: {
|
|
|
|
columns: [{
|
|
|
|
title: '名称',
|
|
|
|
key: 'name',
|
|
|
|
}, {
|
|
|
|
title: '产业结构',
|
|
|
|
key: 'construction',
|
|
|
|
}, {
|
|
|
|
title: '高值化需求',
|
|
|
|
key: 'premium_requirement',
|
|
|
|
}],
|
|
|
|
list: data.value.info.industry,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2024-06-30 21:39:37 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2024-07-05 02:07:18 +08:00
|
|
|
<FrameV1 title="概况统计">
|
|
|
|
<div class="space-y-6 ">
|
2024-06-30 21:39:37 +08:00
|
|
|
<TabsV2 v-model:model-value="selected" :items="items" :selected="selected" :change="change" />
|
2024-07-05 02:07:18 +08:00
|
|
|
<DigitalV4 :title="value.title" :value="value.count" :unit="value.unit" :icon="value.icon" />
|
2024-06-30 21:39:37 +08:00
|
|
|
<div class="flex justify-between">
|
2024-07-05 02:07:18 +08:00
|
|
|
<DigitalV5 v-for="item in value.details" :key="item.title" v-bind="item" />
|
2024-06-30 21:39:37 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-07-05 02:07:18 +08:00
|
|
|
|
|
|
|
<Table class="mt-6">
|
|
|
|
<TableHeader class=" bg-white/5">
|
|
|
|
<TableRow>
|
|
|
|
<TableHead v-for="(item, i) in value.table?.columns" :key="item.key" class="h-8" :class="{ 'text-right': i === value.table.columns.length - 1 }">
|
|
|
|
{{ item.title }}
|
|
|
|
</TableHead>
|
|
|
|
</TableRow>
|
|
|
|
</TableHeader>
|
|
|
|
<TableBody>
|
|
|
|
<TableRow v-for="item in value.table?.list" :key="item.type">
|
|
|
|
<TableCell v-for="(col, i) in value.table?.columns" :key="col.key" class="text-lg font-medium" :class="{ 'text-right': i === value.table.columns.length - 1 }">
|
|
|
|
{{ Array.isArray(item[col.key]) ? item[col.key].join(', ') : item[col.key] }}
|
|
|
|
</TableCell>
|
|
|
|
</TableRow>
|
|
|
|
</TableBody>
|
|
|
|
</Table>
|
2024-06-30 21:39:37 +08:00
|
|
|
</FrameV1>
|
|
|
|
</template>
|