ERPTurbo_Admin/packages/app-operation/src/components/Dealer/Module/OtherInfoModule.tsx
shenyifei 45dc1de523 feat(dealer): 优化发货单模板模块样式与打印功能
- 引入 classNames 库统一管理组件样式类名
- 调整模块选中状态与预览模式下的边框样式
- 优化 PackingSpecModule 模块的数据显示逻辑
- 增加 formatCurrency 工具函数格式化金额显示
- 重构 PreviewCanvas 打印预览页面样式与结构
- 移除无效的模块配置项 showBoxType
- 修复全屏事件监听器在不同浏览器的兼容性问题
- 优化打印样式,增加页面尺寸与边距控制
- 调整模块渲染逻辑,提升预览模式下的显示效果
2025-11-08 13:29:52 +08:00

154 lines
5.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react';
import { Button, Typography } from 'antd';
import {
MenuOutlined,
ArrowUpOutlined,
ArrowDownOutlined,
DeleteOutlined
} from '@ant-design/icons';
import classNames from 'classnames';
const { Text } = Typography;
interface ModuleProps {
config: any;
isSelected: boolean;
onSelect: () => void;
onDelete: () => void;
onMoveUp?: () => void;
onMoveDown?: () => void;
canMoveUp?: boolean;
canMoveDown?: boolean;
previewMode?: boolean; // 添加预览模式属性
}
const OtherInfoModule: React.FC<ModuleProps> = ({
config,
isSelected,
onSelect,
onDelete,
onMoveUp,
onMoveDown,
canMoveUp,
canMoveDown,
previewMode = false, // 默认为false
}) => {
return (
<div
className={classNames('bg-white transition-all duration-200', {
'border border-black': !previewMode,
'border-2 border-blue-500 shadow-[0_0_0_2px_rgba(24,144,255,0.2)] rounded p-2 mb-2':
isSelected && !previewMode,
'hover:border-blue-300 rounded p-2 mb-2': !isSelected && !previewMode,
})}
onClick={previewMode ? undefined : onSelect}
>
{!previewMode && (
<div className="flex justify-between items-center mb-2 pb-2 border-b border-gray-100">
<Text strong></Text>
<div className="flex gap-1">
<Button
type="text"
icon={<MenuOutlined />}
size="small"
style={{ cursor: 'move' }}
/>
<Button
type="text"
icon={<ArrowUpOutlined />}
onClick={(e) => {
e.stopPropagation();
if (onMoveUp) onMoveUp();
}}
size="small"
disabled={!canMoveUp}
/>
<Button
type="text"
icon={<ArrowDownOutlined />}
onClick={(e) => {
e.stopPropagation();
if (onMoveDown) onMoveDown();
}}
size="small"
disabled={!canMoveDown}
/>
<Button
type="text"
icon={<DeleteOutlined />}
onClick={(e) => {
e.stopPropagation();
onDelete();
}}
danger
size="small"
/>
</div>
</div>
)}
<div className="py-2 flex flex-col gap-2.5 text-base">
<table className="border-collapse text-sm leading-4">
<tbody>
<tr>
<td className="font-bold p-2 text-left border border-black w-1/3">:</td>
<td colSpan={2} className="p-2 text-left border border-black">175</td>
</tr>
<tr>
<td className="font-bold p-2 text-left border border-black w-1/3">:</td>
<td colSpan={2} className="p-2 text-left border border-black"></td>
</tr>
<tr>
<td className="font-bold p-2 text-left border border-black w-1/3"></td>
<td colSpan={2} className="p-2 text-left border border-black"></td>
</tr>
<tr>
<td className="font-bold p-2 text-left border border-black w-1/3">:</td>
<td colSpan={2} className="p-2 text-left border border-black"></td>
</tr>
<tr>
<td className="font-bold p-2 text-left border border-black w-1/3">:</td>
<td colSpan={2} className="p-2 text-left border border-black">98</td>
</tr>
<tr>
<td className="font-bold p-2 text-left border border-black w-1/3">:</td>
<td colSpan={2} className="p-2 text-left border border-black">99</td>
</tr>
<tr>
<td className="font-bold p-2 text-left border border-black w-1/3">:</td>
<td colSpan={2} className="p-2 text-left border border-black">A级-</td>
</tr>
<tr>
<td className="font-bold p-2 text-left border border-black w-1/3">:</td>
<td colSpan={2} className="p-2 text-left border border-black"></td>
</tr>
<tr>
<td className="font-bold p-2 text-left border border-black w-1/3"></td>
<td colSpan={2} className="p-2 text-left border border-black">3/</td>
</tr>
<tr>
<td className="font-bold p-2 text-left border border-black w-1/3"></td>
<td className="p-2 text-left border border-black">29062</td>
<td className="p-2 text-left border border-black"></td>
</tr>
<tr>
<td className="font-bold p-2 text-left border border-black w-1/3"></td>
<td className="p-2 text-left border border-black">688</td>
<td className="p-2 text-left border border-black"></td>
</tr>
<tr>
<td className="font-bold p-2 text-left border border-black w-1/3">:</td>
<td colSpan={2} className="p-2 text-left border border-black">L80367</td>
</tr>
<tr>
<td className="font-bold p-2 text-left border border-black w-1/3">:</td>
<td colSpan={2} className="p-2 text-left border border-black">15849849656</td>
</tr>
</tbody>
</table>
</div>
</div>
);
};
export default OtherInfoModule;