Merge remote-tracking branch 'origin/feature/review-skeleton-sein' into iipbs/st/dev
This commit is contained in:
@@ -12,12 +12,15 @@ import { PumpingStationInfoList } from "@/components/util/column/review/PumpingS
|
||||
import { statisticsManagementApi } from "@/entities/statistics/api/statistics-management-service";
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import type { MediationPumpStationItem } from "@/entities/statistics/model/statistics-pumping-station-review-interface";
|
||||
|
||||
// 하수도 통계 검토 05.중계펌프장
|
||||
/**
|
||||
* 하수도 통계 검토 05.중계펌프장
|
||||
*/
|
||||
const PumpingStationRvw = () => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const [rowData, setRowData] = useState<Record<string, string | number>[]>([]);
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
|
||||
const columnInfo = useMemo(() => {
|
||||
const { columns, columnLayout, fixedColumns, rowStartNum } = PumpingStationInfoList;
|
||||
@@ -27,7 +30,7 @@ const PumpingStationRvw = () => {
|
||||
rowStartNum,
|
||||
columns: columns.map((col) => ({
|
||||
...col,
|
||||
editable: false as const, // 검토 화면이므로 읽기 전용
|
||||
editable: false as const,
|
||||
styleName: col.styleName ?? ("rg-cell-readonly" as const),
|
||||
})),
|
||||
};
|
||||
@@ -38,7 +41,7 @@ const PumpingStationRvw = () => {
|
||||
};
|
||||
|
||||
const handleSearch = async (values: SearchFormValues) => {
|
||||
if (values.sido === '' || values.sido === 'ALL') {
|
||||
if (!values.sido || values.sido === 'ALL') {
|
||||
alert('시도를 선택해주세요.');
|
||||
return;
|
||||
}
|
||||
@@ -47,15 +50,22 @@ const PumpingStationRvw = () => {
|
||||
setIsLoading(true);
|
||||
|
||||
const response = await statisticsManagementApi.getMediationPumpStationList({
|
||||
sido: values.sido,
|
||||
gugun: values.gugun === 'ALL' ? '' : values.gugun,
|
||||
bsnmCd: values.bsnmCd,
|
||||
yr: values.year,
|
||||
bscFctNm: values.fctName, // 시설명 검색
|
||||
ctpvNm: values.sido,
|
||||
sggNm: values.gugun === 'ALL' ? '' : values.gugun,
|
||||
sewerBzmnCd: values.bsnmCd,
|
||||
statsYr: values.year,
|
||||
pumpstNm: values.fctName,
|
||||
});
|
||||
|
||||
if (response.status === 'success' && response.data) {
|
||||
setRowData(toGridRows(response.data));
|
||||
const rawList = response.data as MediationPumpStationItem[];
|
||||
|
||||
const convertedData = rawList.map(item => ({
|
||||
...item,
|
||||
rmrk: item.rmrk || ''
|
||||
}));
|
||||
|
||||
setRowData(toGridRows(convertedData));
|
||||
} else {
|
||||
setRowData([]);
|
||||
alert(response.message || "데이터가 없습니다.");
|
||||
@@ -64,7 +74,7 @@ const PumpingStationRvw = () => {
|
||||
console.error("중계펌프장 조회 중 에러 발생:", error);
|
||||
alert('데이터 조회 중 오류가 발생했습니다.');
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -74,9 +84,9 @@ const PumpingStationRvw = () => {
|
||||
const returnFunc = () => console.log('returnFunc');
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<SearchForm onSubmit={handleSearch} onReset={handleReset} fctName={true} />
|
||||
|
||||
<div className="relative">
|
||||
<SearchForm onSubmit={handleSearch} onReset={handleReset} />
|
||||
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<ReviewOpinionButton reviewOpinionFunc={reviewOpinionFunc} />
|
||||
|
||||
@@ -101,7 +101,7 @@ const SewagePipeMaintainRvw = () => {
|
||||
if (tabKey === 'ST00030001') {
|
||||
response = await statisticsManagementApi.getSewerPipeMtcList(searchParamRef.current);
|
||||
} else if (tabKey === 'ST00030002') {
|
||||
// response = await statisticsManagementApi.getSewerPipeDrdgList(searchParamRef.current);
|
||||
response = await statisticsManagementApi.getSewerPipeDrdgList(searchParamRef.current);
|
||||
}
|
||||
|
||||
if (response?.status === 'success' && response.data) {
|
||||
|
||||
@@ -96,12 +96,11 @@ const SewagePipeRvw = () => {
|
||||
|
||||
if (tabKey === 'ST00020002') {
|
||||
response = await statisticsManagementApi.getSewagePipeFacilityList(searchParamRef.current);
|
||||
}else if(tabKey === 'ST00020003'){
|
||||
response = await statisticsManagementApi.getSewagePipeTypeList(searchParamRef.current);
|
||||
}else if(tabKey === 'ST00020004'){
|
||||
response = await statisticsManagementApi.getSewagePipeDiamList(searchParamRef.current);
|
||||
}
|
||||
// }else if(tabKey === 'ST00020003'){
|
||||
// response = await statisticsManagementApi.getSewagePipeTypeList(searchParamRef.current);
|
||||
// }else if(tabKey === 'ST00020004'){
|
||||
// response = await statisticsManagementApi.getSewagePipeDiamList(searchParamRef.current);
|
||||
// }
|
||||
|
||||
if (response?.status === 'success' && response.data) {
|
||||
|
||||
|
||||
@@ -13,11 +13,12 @@ import { SewageReservoirPumpInfoListRvw } from "@/components/util/column/review/
|
||||
import type { ColumnInfoList, ColumnConfig } from "@/components/type/DataGrid.type";
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import type { SewerReservoirRequestParams } from "@/entities/statistics/model/sewage-reservoir-pump-review-interface";
|
||||
|
||||
/**
|
||||
* 하수도 통계 검토 04. 하수저류 시설 및 빗물 펌프장
|
||||
* Tab A: 하수저류시설
|
||||
* Tab B: 빗물펌프장
|
||||
* Tab A: 하수저류시설 (ST00040001)
|
||||
* Tab B: 빗물펌프장 (ST00040002)
|
||||
*/
|
||||
const SewageReservoirPumpRvw = () => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
@@ -25,7 +26,7 @@ const SewageReservoirPumpRvw = () => {
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
const [activeTab, setActiveTab] = useState<string>('ST00040001');
|
||||
|
||||
const searchParamRef = useRef<SearchFormValues | null>(null);
|
||||
const searchParamRef = useRef<SewerReservoirRequestParams | null>(null);
|
||||
|
||||
const columnInfo = useMemo(() => {
|
||||
return SewageReservoirPumpInfoListRvw.map((tab: ColumnInfoList) => ({
|
||||
@@ -56,16 +57,15 @@ const SewageReservoirPumpRvw = () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
|
||||
const searchParam = {
|
||||
sido: values.sido,
|
||||
gugun: values.gugun === 'ALL' ? '' : values.gugun,
|
||||
bsnmCd: values.bsnmCd,
|
||||
yr: values.year,
|
||||
const searchParam: SewerReservoirRequestParams = {
|
||||
statsYr: values.year,
|
||||
sewerBzmnCd: values.bsnmCd,
|
||||
ctpvNm: values.sido,
|
||||
sggNm: values.gugun === 'ALL' ? '' : values.gugun,
|
||||
};
|
||||
|
||||
searchParamRef.current = searchParam;
|
||||
|
||||
//하수저류시설 (Tab A)
|
||||
|
||||
const response = await statisticsManagementApi.getSewerReservoirList(searchParam);
|
||||
|
||||
if (response?.status === 'success' && response.data) {
|
||||
@@ -85,15 +85,21 @@ const SewageReservoirPumpRvw = () => {
|
||||
const handleActiveTabChange = async (tabKey: string) => {
|
||||
setActiveTab(tabKey);
|
||||
|
||||
const existingAData = rowDataMap.get('ST00040001');
|
||||
const activeTabData = rowDataMap.get(tabKey);
|
||||
|
||||
const hasAData = Array.isArray(existingAData) && existingAData.length > 0;
|
||||
const hasActiveTabData = Array.isArray(activeTabData) && activeTabData.length > 0;
|
||||
|
||||
if (searchParamRef.current && !hasActiveTabData) {
|
||||
if (hasAData && !hasActiveTabData && searchParamRef.current) {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
|
||||
let response;
|
||||
|
||||
if (tabKey === 'ST00040002') {
|
||||
if (tabKey === 'ST00040001') {
|
||||
response = await statisticsManagementApi.getSewerReservoirList(searchParamRef.current);
|
||||
} else if (tabKey === 'ST00040002') {
|
||||
response = await statisticsManagementApi.getPumpStationList(searchParamRef.current);
|
||||
}
|
||||
|
||||
@@ -116,19 +122,19 @@ const SewageReservoirPumpRvw = () => {
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<SearchForm onSubmit={handleSearch} onReset={handleReset}/>
|
||||
<SearchForm onSubmit={handleSearch} onReset={handleReset} />
|
||||
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<ReviewOpinionButton reviewOpinionFunc={() => { /* 검토의견 로직 */ }} />
|
||||
<ApproveButton approveFunc={() => { /* 승인 로직 */ }} />
|
||||
<ReturnButton returnFunc={() => { /* 반려 로직 */ }} />
|
||||
<SaveButton saveFunc={() => { /* 저장 로직 */ }} />
|
||||
<ReviewOpinionButton reviewOpinionFunc={() => { }} />
|
||||
<ApproveButton approveFunc={() => { }} />
|
||||
<ReturnButton returnFunc={() => { }} />
|
||||
<SaveButton saveFunc={() => { }} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 rounded-lg flex justify-center items-center bg-white/50">
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user