|
|
@@ -3,6 +3,8 @@ import { Select, Button, Space, message } from 'antd';
|
|
|
import { showNotImplemented } from '@/utils/notificationHelper';
|
|
|
import { useAppSelector } from '@/states/store';
|
|
|
import { getPrintManager } from '@/services/print';
|
|
|
+import { selectFilmHasImage } from '@/states/print/selectors';
|
|
|
+import { useSelector } from 'react-redux';
|
|
|
|
|
|
const PrintControl: React.FC = () => {
|
|
|
const [selectedNode, setSelectedNode] = useState<string>('');
|
|
|
@@ -16,7 +18,7 @@ const PrintControl: React.FC = () => {
|
|
|
const activeId = state.print.activeFilmId;
|
|
|
return films.find(f => f.id === activeId);
|
|
|
});
|
|
|
-
|
|
|
+ const hasImage = useSelector(() => selectFilmHasImage(activeFilm));
|
|
|
// 创建打印管理器实例
|
|
|
const printManager = useMemo(() => getPrintManager(), []);
|
|
|
|
|
|
@@ -27,9 +29,7 @@ const PrintControl: React.FC = () => {
|
|
|
];
|
|
|
// 检查当前胶片是否有图像
|
|
|
const checkIfCanPrint = () => {
|
|
|
- const hasImages = activeFilm?.hasImage(activeFilm.images)
|
|
|
- console.log(`开始计算有效图像数量 ${hasImages}`)
|
|
|
- if (activeFilm && activeFilm.hasImage(activeFilm.images)) {
|
|
|
+ if (activeFilm && hasImage) {
|
|
|
setCanPrint(true);
|
|
|
} else {
|
|
|
setCanPrint(false);
|
|
|
@@ -38,7 +38,7 @@ const PrintControl: React.FC = () => {
|
|
|
|
|
|
useEffect(() => {
|
|
|
checkIfCanPrint();
|
|
|
- }, [activeFilm,activeFilm?.images]);
|
|
|
+ }, [activeFilm, activeFilm?.images]);
|
|
|
|
|
|
const handleLocalPrint = async () => {
|
|
|
if (isPrinting) {
|