파이프 길이 계산 및 엑셀 내보내기 버그 수정
- 자재 비교에서 파이프 길이 합산 로직 수정 - 프론트엔드에서 혼란스러운 '평균단위' 표시 제거 - 파이프 변경사항에 실제 이전/현재 총길이 표시 - 엑셀 내보내기에서 '초기화되지 않은 변수' 오류 수정 - 리비전 비교에서 파이프 길이 변화 계산 개선
This commit is contained in:
@@ -25,8 +25,9 @@ import {
|
||||
} from '@mui/material';
|
||||
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
||||
import ShoppingCart from '@mui/icons-material/ShoppingCart';
|
||||
import { Compare as CompareIcon } from '@mui/icons-material';
|
||||
import { Compare as CompareIcon, Download } from '@mui/icons-material';
|
||||
import { api, fetchFiles } from '../api';
|
||||
import { exportMaterialsToExcel } from '../utils/excelExport';
|
||||
|
||||
const MaterialsPage = () => {
|
||||
const [materials, setMaterials] = useState([]);
|
||||
@@ -580,6 +581,25 @@ const MaterialsPage = () => {
|
||||
return colors[category] || 'default';
|
||||
};
|
||||
|
||||
// 엑셀 내보내기 함수
|
||||
const handleExportToExcel = () => {
|
||||
if (materials.length === 0) {
|
||||
alert('내보낼 자재 데이터가 없습니다.');
|
||||
return;
|
||||
}
|
||||
|
||||
const additionalInfo = {
|
||||
filename: fileName,
|
||||
jobNo: jobNo,
|
||||
revision: currentRevision,
|
||||
uploadDate: new Date().toLocaleDateString()
|
||||
};
|
||||
|
||||
const baseFilename = `자재목록_${jobNo}_${currentRevision}`;
|
||||
|
||||
exportMaterialsToExcel(materials, baseFilename, additionalInfo);
|
||||
};
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<Box display="flex" justifyContent="center" alignItems="center" minHeight="400px">
|
||||
@@ -645,6 +665,16 @@ const MaterialsPage = () => {
|
||||
</Button>
|
||||
)}
|
||||
|
||||
<Button
|
||||
variant="outlined"
|
||||
color="primary"
|
||||
startIcon={<Download />}
|
||||
onClick={handleExportToExcel}
|
||||
disabled={materials.length === 0}
|
||||
>
|
||||
엑셀 내보내기
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
variant="contained"
|
||||
color="success"
|
||||
|
||||
Reference in New Issue
Block a user