style: BranchesPanel 组件调整为黑金风格
- 卡片使用深色渐变背景,金色边框 + hover 发光效果 - 顶部添加金色渐变装饰线 - 状态徽章改为黑金风格(存续金色/非存续红色) - 标题区域添加金色背景图标 - 信息项提取为 InfoItem 组件,优化布局 - 空状态使用金色圆形背景装饰 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// src/views/Company/components/CompanyOverview/BasicInfoTab/components/BranchesPanel.tsx
|
// src/views/Company/components/CompanyOverview/BasicInfoTab/components/BranchesPanel.tsx
|
||||||
// 分支机构 Tab Panel
|
// 分支机构 Tab Panel - 黑金风格
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {
|
import {
|
||||||
@@ -7,14 +7,11 @@ import {
|
|||||||
VStack,
|
VStack,
|
||||||
HStack,
|
HStack,
|
||||||
Text,
|
Text,
|
||||||
Badge,
|
|
||||||
Icon,
|
Icon,
|
||||||
Card,
|
|
||||||
CardBody,
|
|
||||||
SimpleGrid,
|
SimpleGrid,
|
||||||
Center,
|
Center,
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import { FaSitemap } from "react-icons/fa";
|
import { FaSitemap, FaBuilding, FaCheckCircle, FaTimesCircle } from "react-icons/fa";
|
||||||
|
|
||||||
import { useBranchesData } from "../../hooks/useBranchesData";
|
import { useBranchesData } from "../../hooks/useBranchesData";
|
||||||
import { THEME } from "../config";
|
import { THEME } from "../config";
|
||||||
@@ -25,6 +22,49 @@ interface BranchesPanelProps {
|
|||||||
stockCode: string;
|
stockCode: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 黑金卡片样式
|
||||||
|
const cardStyles = {
|
||||||
|
bg: "linear-gradient(145deg, rgba(30, 30, 35, 0.95), rgba(20, 20, 25, 0.98))",
|
||||||
|
border: "1px solid",
|
||||||
|
borderColor: "rgba(212, 175, 55, 0.3)",
|
||||||
|
borderRadius: "12px",
|
||||||
|
overflow: "hidden",
|
||||||
|
transition: "all 0.3s ease",
|
||||||
|
_hover: {
|
||||||
|
borderColor: "rgba(212, 175, 55, 0.6)",
|
||||||
|
boxShadow: "0 4px 20px rgba(212, 175, 55, 0.15), inset 0 1px 0 rgba(212, 175, 55, 0.1)",
|
||||||
|
transform: "translateY(-2px)",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// 状态徽章样式
|
||||||
|
const getStatusBadgeStyles = (isActive: boolean) => ({
|
||||||
|
display: "inline-flex",
|
||||||
|
alignItems: "center",
|
||||||
|
gap: "4px",
|
||||||
|
px: 2,
|
||||||
|
py: 0.5,
|
||||||
|
borderRadius: "full",
|
||||||
|
fontSize: "xs",
|
||||||
|
fontWeight: "medium",
|
||||||
|
bg: isActive ? "rgba(212, 175, 55, 0.15)" : "rgba(255, 100, 100, 0.15)",
|
||||||
|
color: isActive ? THEME.gold : "#ff6b6b",
|
||||||
|
border: "1px solid",
|
||||||
|
borderColor: isActive ? "rgba(212, 175, 55, 0.3)" : "rgba(255, 100, 100, 0.3)",
|
||||||
|
});
|
||||||
|
|
||||||
|
// 信息项组件
|
||||||
|
const InfoItem: React.FC<{ label: string; value: string | number }> = ({ label, value }) => (
|
||||||
|
<VStack align="start" spacing={0.5}>
|
||||||
|
<Text fontSize="xs" color={THEME.textSecondary} letterSpacing="0.5px">
|
||||||
|
{label}
|
||||||
|
</Text>
|
||||||
|
<Text fontSize="sm" fontWeight="semibold" color={THEME.textPrimary}>
|
||||||
|
{value || "-"}
|
||||||
|
</Text>
|
||||||
|
</VStack>
|
||||||
|
);
|
||||||
|
|
||||||
const BranchesPanel: React.FC<BranchesPanelProps> = ({ stockCode }) => {
|
const BranchesPanel: React.FC<BranchesPanelProps> = ({ stockCode }) => {
|
||||||
const { branches, loading } = useBranchesData(stockCode);
|
const { branches, loading } = useBranchesData(stockCode);
|
||||||
|
|
||||||
@@ -35,9 +75,19 @@ const BranchesPanel: React.FC<BranchesPanelProps> = ({ stockCode }) => {
|
|||||||
if (branches.length === 0) {
|
if (branches.length === 0) {
|
||||||
return (
|
return (
|
||||||
<Center h="200px">
|
<Center h="200px">
|
||||||
<VStack>
|
<VStack spacing={3}>
|
||||||
<Icon as={FaSitemap} boxSize={12} color={THEME.textSecondary} />
|
<Box
|
||||||
<Text color={THEME.textSecondary}>暂无分支机构信息</Text>
|
p={4}
|
||||||
|
borderRadius="full"
|
||||||
|
bg="rgba(212, 175, 55, 0.1)"
|
||||||
|
border="1px solid"
|
||||||
|
borderColor="rgba(212, 175, 55, 0.2)"
|
||||||
|
>
|
||||||
|
<Icon as={FaSitemap} boxSize={10} color={THEME.gold} opacity={0.6} />
|
||||||
|
</Box>
|
||||||
|
<Text color={THEME.textSecondary} fontSize="sm">
|
||||||
|
暂无分支机构信息
|
||||||
|
</Text>
|
||||||
</VStack>
|
</VStack>
|
||||||
</Center>
|
</Center>
|
||||||
);
|
);
|
||||||
@@ -45,49 +95,72 @@ const BranchesPanel: React.FC<BranchesPanelProps> = ({ stockCode }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<SimpleGrid columns={{ base: 1, md: 2 }} spacing={4}>
|
<SimpleGrid columns={{ base: 1, md: 2 }} spacing={4}>
|
||||||
{branches.map((branch: any, idx: number) => (
|
{branches.map((branch: any, idx: number) => {
|
||||||
<Card key={idx} bg={THEME.tableBg} border="1px solid" borderColor={THEME.border}>
|
const isActive = branch.business_status === "存续";
|
||||||
<CardBody>
|
|
||||||
<VStack align="start" spacing={3}>
|
return (
|
||||||
<HStack justify="space-between" w="full">
|
<Box key={idx} sx={cardStyles}>
|
||||||
<Text fontWeight="bold" color={THEME.textPrimary}>{branch.branch_name}</Text>
|
{/* 顶部金色装饰线 */}
|
||||||
<Badge
|
<Box
|
||||||
colorScheme={branch.business_status === "存续" ? "green" : "red"}
|
h="2px"
|
||||||
|
bgGradient="linear(to-r, transparent, rgba(212, 175, 55, 0.6), transparent)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Box p={4}>
|
||||||
|
<VStack align="start" spacing={4}>
|
||||||
|
{/* 标题行 */}
|
||||||
|
<HStack justify="space-between" w="full" align="flex-start">
|
||||||
|
<HStack spacing={2} flex={1}>
|
||||||
|
<Box
|
||||||
|
p={1.5}
|
||||||
|
borderRadius="md"
|
||||||
|
bg="rgba(212, 175, 55, 0.1)"
|
||||||
>
|
>
|
||||||
{branch.business_status}
|
<Icon as={FaBuilding} boxSize={3.5} color={THEME.gold} />
|
||||||
</Badge>
|
</Box>
|
||||||
|
<Text
|
||||||
|
fontWeight="bold"
|
||||||
|
color={THEME.textPrimary}
|
||||||
|
fontSize="sm"
|
||||||
|
noOfLines={2}
|
||||||
|
lineHeight="tall"
|
||||||
|
>
|
||||||
|
{branch.branch_name}
|
||||||
|
</Text>
|
||||||
</HStack>
|
</HStack>
|
||||||
|
|
||||||
<SimpleGrid columns={2} spacing={2} w="full">
|
{/* 状态徽章 */}
|
||||||
<VStack align="start" spacing={1}>
|
<Box sx={getStatusBadgeStyles(isActive)}>
|
||||||
<Text fontSize="xs" color={THEME.textSecondary}>注册资本</Text>
|
<Icon
|
||||||
<Text fontSize="sm" fontWeight="medium" color={THEME.textPrimary}>
|
as={isActive ? FaCheckCircle : FaTimesCircle}
|
||||||
{branch.register_capital || "-"}
|
boxSize={3}
|
||||||
</Text>
|
/>
|
||||||
</VStack>
|
<Text>{branch.business_status}</Text>
|
||||||
<VStack align="start" spacing={1}>
|
</Box>
|
||||||
<Text fontSize="xs" color={THEME.textSecondary}>法人代表</Text>
|
</HStack>
|
||||||
<Text fontSize="sm" fontWeight="medium" color={THEME.textPrimary}>
|
|
||||||
{branch.legal_person || "-"}
|
{/* 分隔线 */}
|
||||||
</Text>
|
<Box
|
||||||
</VStack>
|
w="full"
|
||||||
<VStack align="start" spacing={1}>
|
h="1px"
|
||||||
<Text fontSize="xs" color={THEME.textSecondary}>成立日期</Text>
|
bgGradient="linear(to-r, rgba(212, 175, 55, 0.3), transparent)"
|
||||||
<Text fontSize="sm" fontWeight="medium" color={THEME.textPrimary}>
|
/>
|
||||||
{formatDate(branch.register_date)}
|
|
||||||
</Text>
|
{/* 信息网格 */}
|
||||||
</VStack>
|
<SimpleGrid columns={2} spacing={3} w="full">
|
||||||
<VStack align="start" spacing={1}>
|
<InfoItem label="注册资本" value={branch.register_capital} />
|
||||||
<Text fontSize="xs" color={THEME.textSecondary}>关联企业</Text>
|
<InfoItem label="法人代表" value={branch.legal_person} />
|
||||||
<Text fontSize="sm" fontWeight="medium" color={THEME.textPrimary}>
|
<InfoItem label="成立日期" value={formatDate(branch.register_date)} />
|
||||||
{branch.related_company_count || 0} 家
|
<InfoItem
|
||||||
</Text>
|
label="关联企业"
|
||||||
</VStack>
|
value={`${branch.related_company_count || 0} 家`}
|
||||||
|
/>
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</VStack>
|
</VStack>
|
||||||
</CardBody>
|
</Box>
|
||||||
</Card>
|
</Box>
|
||||||
))}
|
);
|
||||||
|
})}
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user