Commit 276aa26a authored by 王玉鑫's avatar 王玉鑫

feat: 开发区详情,重点企业、产业政策

parent 14b6aa3a
...@@ -10,6 +10,7 @@ declare module 'vue' { ...@@ -10,6 +10,7 @@ declare module 'vue' {
CommonHeader: typeof import('./src/components/common/CommonHeader.vue')['default'] CommonHeader: typeof import('./src/components/common/CommonHeader.vue')['default']
DetailInfo: typeof import('./src/components/detail/DetailInfo.vue')['default'] DetailInfo: typeof import('./src/components/detail/DetailInfo.vue')['default']
DetailInfoCell: typeof import('./src/components/detail/DetailInfoCell.vue')['default'] DetailInfoCell: typeof import('./src/components/detail/DetailInfoCell.vue')['default']
DetailInfoTab: typeof import('./src/components/detail/DetailInfoTab.vue')['default']
DetailMain: typeof import('./src/components/detail/DetailMain.vue')['default'] DetailMain: typeof import('./src/components/detail/DetailMain.vue')['default']
ElButton: typeof import('element-plus/es')['ElButton'] ElButton: typeof import('element-plus/es')['ElButton']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
......
...@@ -37,6 +37,6 @@ withDefaults( ...@@ -37,6 +37,6 @@ withDefaults(
const handleValue = (col: Info) => { const handleValue = (col: Info) => {
const { value, unit = '' } = col; const { value, unit = '' } = col;
return haveValue(value) ? value.toString() + unit : ''; return haveValue(value) ? value.toString() + unit : '--';
}; };
</script> </script>
<template>
<div>
<div class="flex items-center space-x-[5px]">
<div
v-for="(tab, index) of tabs"
:key="tab.name"
class="flex h-8 cursor-pointer items-center justify-center px-5 text-sm leading-4"
:class="{ 'text-[#C0322B]': index === modelValue }"
@click="handleTabChange(index)"
>
<div>{{ tab.name }}</div>
<div>{{ tab.count }}</div>
</div>
</div>
<slot></slot>
</div>
</template>
<script setup lang="ts">
export interface InfoTab {
name: string;
count: number;
}
withDefaults(
defineProps<{
tabs: InfoTab[];
modelValue: number;
}>(),
{
tabs: () => [],
modelValue: 0,
},
);
const emit = defineEmits(['update:modelValue']);
const handleTabChange = (index: number) => {
emit('update:modelValue', index);
};
</script>
import type { Info, Infos } from '@/components/detail/DetailInfo.vue';
import type { InfoTab } from '@/components/detail/DetailInfoTab.vue';
import type { ListInfo } from '@/types/common';
import { computed, ref, type ComputedRef } from 'vue';
/**
* 带tab的详情信息块
*/
export function useInfoTab<T>(getInfo: (item: T) => Info[], list: ComputedRef<ListInfo<T>[]>) {
const index = ref(0);
const tabs = computed<InfoTab[]>(() => {
const result =
list.value.map(({ type, info }) => {
return {
count: info.length,
name: type,
};
}) || [];
return result;
});
const infos = computed<Infos[]>(() => {
const result =
list.value.map(({ info }) => {
return info.map(getInfo);
}) || [];
return result;
});
return [index, tabs, infos] as [typeof index, typeof tabs, typeof infos];
}
import type { Enterprise, ListInfo, Policy } from '../common';
import type { AuthStatus } from '../enum'; import type { AuthStatus } from '../enum';
/** /**
...@@ -21,7 +22,7 @@ export interface DevelopZoneDetailResp { ...@@ -21,7 +22,7 @@ export interface DevelopZoneDetailResp {
/** 开发区简介 */ /** 开发区简介 */
description: string; description: string;
/** 重点企业详情 */ /** 重点企业详情 */
enterpriseList: string[]; enterpriseList: ListInfo<Enterprise>[];
/** 环评要求 */ /** 环评要求 */
environmentalEquirements: string; environmentalEquirements: string;
/** 产业基金 */ /** 产业基金 */
...@@ -137,7 +138,7 @@ export interface DevelopZoneDetailResp { ...@@ -137,7 +138,7 @@ export interface DevelopZoneDetailResp {
/** 规划面积(平方公里) */ /** 规划面积(平方公里) */
planArea: number; planArea: number;
/** 产业政策详情 */ /** 产业政策详情 */
policyList: string[]; policyList: ListInfo<Policy>[];
/** 主导产业 */ /** 主导产业 */
primaryIndustry: string; primaryIndustry: string;
/** 禁限目录 */ /** 禁限目录 */
......
...@@ -45,3 +45,29 @@ export interface CommonListParams<T> { ...@@ -45,3 +45,29 @@ export interface CommonListParams<T> {
property?: string; property?: string;
}[]; }[];
} }
/**
* 列表属性信息如重点企业等
*/
export interface ListInfo<T> {
type: string;
info: T[];
}
/**
* 代表企业
*/
export interface Enterprise {
enterpriseName: string;
industryDirection: string;
track: string;
}
/**
* 产业政策
*/
export interface Policy {
content: string;
name: string;
type: string;
}
...@@ -12,12 +12,20 @@ ...@@ -12,12 +12,20 @@
</div> </div>
</DetailInfoCell> </DetailInfoCell>
<DetailInfoCell title="要素成本"> <DetailInfoCell title="要素成本">
<DetailInfo :infos="requireds"></DetailInfo> <DetailInfo :infos="elementCost"></DetailInfo>
</DetailInfoCell>
<DetailInfoCell title="重点企业">
<DetailInfoTab v-model="importantEnterpriseIndex" :tabs="importantEnterpriseTabs">
<DetailInfo :infos="importantEnterprise[importantEnterpriseIndex]"></DetailInfo>
</DetailInfoTab>
</DetailInfoCell>
<DetailInfoCell title="产业政策">
<DetailInfoTab v-model="industryPolicyIndex" :tabs="industryPolicyTabs">
<DetailInfo :infos="industryPolicy[industryPolicyIndex]"></DetailInfo>
</DetailInfoTab>
</DetailInfoCell> </DetailInfoCell>
<DetailInfoCell title="入驻要求"></DetailInfoCell>
<DetailInfoCell title="重点企业"></DetailInfoCell>
<DetailInfoCell title="产业政策"></DetailInfoCell>
<DetailInfoCell title="产业基金"></DetailInfoCell> <DetailInfoCell title="产业基金"></DetailInfoCell>
<DetailInfoCell title="入驻要求"></DetailInfoCell>
<DetailInfoCell title="配套设施"></DetailInfoCell> <DetailInfoCell title="配套设施"></DetailInfoCell>
<DetailInfoCell title="开发区内产业园" to-list-text="更多产业园"></DetailInfoCell> <DetailInfoCell title="开发区内产业园" to-list-text="更多产业园"></DetailInfoCell>
<DetailInfoCell title="开发区内土地" to-list-text="更多土地"></DetailInfoCell> <DetailInfoCell title="开发区内土地" to-list-text="更多土地"></DetailInfoCell>
...@@ -31,15 +39,51 @@ import DetailInfo, { type Infos } from '@/components/detail/DetailInfo.vue'; ...@@ -31,15 +39,51 @@ import DetailInfo, { type Infos } from '@/components/detail/DetailInfo.vue';
import DetailMain from '@/components/detail/DetailMain.vue'; import DetailMain from '@/components/detail/DetailMain.vue';
import { useDetail } from '@/composable/useDetail.ts'; import { useDetail } from '@/composable/useDetail.ts';
import { RequestUrl } from '@/types/api.ts'; import { RequestUrl } from '@/types/api.ts';
import type { DevelopZoneDetailResp } from '@/types/api/developZoneDetail'; import type { DevelopZoneDetailResp } from '@/types/api/developZoneDetail.ts';
import { computed } from 'vue'; import { computed } from 'vue';
import DetailInfoTab from '@/components/detail/DetailInfoTab.vue';
import { useInfoTab } from '@/composable/useInfoTab.ts';
import type { Enterprise, Policy } from '@/types/common';
const { detail, initDetail } = useDetail<DevelopZoneDetailResp>(RequestUrl.developZoneDetail);
// eslint-disable-next-line @typescript-eslint/no-unused-vars /** 重点企业 */
const { detail, detailId, initDetail } = useDetail<DevelopZoneDetailResp>( const [importantEnterpriseIndex, importantEnterpriseTabs, importantEnterprise] =
RequestUrl.developZoneDetail, useInfoTab<Enterprise>(
({ enterpriseName, track }) => {
return [
{
name: '企业名称',
value: enterpriseName,
},
{
name: '所属赛道',
value: track,
},
];
},
computed(() => detail.value?.enterpriseList || []),
);
/** 产业政策 */
const [industryPolicyIndex, industryPolicyTabs, industryPolicy] = useInfoTab<Policy>(
({ name, content }) => {
return [
{
name: '政策名称',
value: name,
},
{
name: '政策内容',
value: content,
},
];
},
computed(() => detail.value?.policyList || []),
); );
const requireds = computed(() => { /** 要素成本 */
const elementCost = computed(() => {
if (detail.value) { if (detail.value) {
const { const {
steamPrice, steamPrice,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment