@@ -46,7 +46,7 @@ import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/b
|
||||
export default function CoMatRvw() {
|
||||
const { code, coRvw, coMatRvwInit, coMatRvwSearch, coMatRvwInqua } =
|
||||
useWrStore((state) => state);
|
||||
const { coMatRvwRes } = coRvw;
|
||||
const { coMatRvwRes,coMatRvwCount } = coRvw;
|
||||
//init, sub, match
|
||||
const initRef = useRef<boolean>(false);
|
||||
const { coRvwHeadList } = coRvw;
|
||||
@@ -276,7 +276,7 @@ export default function CoMatRvw() {
|
||||
tableData={dmdMatData || []}
|
||||
headlist={coRvwHeadList}
|
||||
pageSize={20}
|
||||
total={100000}
|
||||
total={coMatRvwCount}
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
if (index !== undefined && index >= 0) {
|
||||
TableCellClick(index);
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
type RvwHistTableType,
|
||||
} from "@/app/store/matDmd/coMatRvw/type";
|
||||
import {
|
||||
formatPhoneNumber,
|
||||
getCity,
|
||||
getdmdMatFlag,
|
||||
yearOptions,
|
||||
@@ -43,7 +44,7 @@ export default function RuseRvwHstry() {
|
||||
ruseRvwInqua,
|
||||
ruseRvwComplete,
|
||||
} = useWrStore((state) => state);
|
||||
const { rvwHistRes, ruseHistHeadList } = ruseHist;
|
||||
const { rvwHistRes, ruseHistHeadList,rvwHistCount } = ruseHist;
|
||||
const [pageNation, setPageNatiion] = useState<number>(1);
|
||||
|
||||
const [dmdCoNm, setDmdCoNm] = useState<string>("");
|
||||
@@ -69,6 +70,36 @@ export default function RuseRvwHstry() {
|
||||
setObjSearch({ city: cityValue, sgg: "0" });
|
||||
};
|
||||
|
||||
useEffect(() =>{
|
||||
getButtonSearch()
|
||||
},[pageNation])
|
||||
|
||||
const getButtonSearch=()=>{
|
||||
if (fromDate && toDate) {
|
||||
const fromNum = Number(fromDate);
|
||||
const toNum = Number(toDate);
|
||||
if (fromNum > toNum) {
|
||||
toast.error(
|
||||
"시작년도가 종료년도 이후로 설정할 수 없습니다."
|
||||
);
|
||||
} else {
|
||||
let con: string | number = "";
|
||||
if (String(objSearch.city).length > 0) {
|
||||
con = String(objSearch.city);
|
||||
}
|
||||
if (String(objSearch.sgg).length > 0 && objSearch.sgg !== "0") {
|
||||
con = String(objSearch.sgg);
|
||||
}
|
||||
getSearch(
|
||||
fromNum,
|
||||
toNum,
|
||||
con,
|
||||
dmdCoNm,
|
||||
ruseUtztnFcltNm
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
const getSgg = (val: string | number) => {
|
||||
console.log(val);
|
||||
setObjSearch({ ...objSearch, sgg: String(val) });
|
||||
@@ -163,23 +194,29 @@ export default function RuseRvwHstry() {
|
||||
const data = rvwHistRes?.map((item, index) => {
|
||||
let flag = "";
|
||||
flag = getdmdMatFlag(item.demandMatching?.splyFcltFlg ?? "");
|
||||
|
||||
const formatDate = (dateStr: string | null | undefined) => {
|
||||
// null, undefined, 빈 문자열인 경우 '없음'을 반환합니다.
|
||||
if (!dateStr) return "없음";
|
||||
// "YYYYMMDD" 형식으로 날짜를 파싱합니다.
|
||||
const d = moment(dateStr, "YYYYMMDD");
|
||||
// 파싱된 날짜가 유효한 경우에만 포맷하고, 그렇지 않으면 '없음'을 반환합니다.
|
||||
return d.isValid() ? d.format("YYYY-MM-DD") : "없음";
|
||||
};
|
||||
|
||||
return {
|
||||
...item,
|
||||
ctpvCd: item.demandCo?.ctpvCd,
|
||||
sggCd: item.demandCo?.sggCd,
|
||||
dmdCoNm: item.demandCo?.dmdCoNm,
|
||||
daddr: item.demandCo?.daddr,
|
||||
telno: item.demandCo?.telno,
|
||||
regDt: item?.demandCo?.regDt
|
||||
? moment(item?.demandCo?.regDt).format("YYYY-MM-DD")
|
||||
: "없음",
|
||||
rvwCmptnYmd: item?.rvwCmptnYmd
|
||||
? moment(item?.rvwCmptnYmd).format("YYYY-MM-DD")
|
||||
: "없음",
|
||||
mtchnCmptnYmd: item?.mtchnCmptnYmd
|
||||
? moment(item?.mtchnCmptnYmd).format("YYYY-MM-DD")
|
||||
telno: formatPhoneNumber(item.demandCo?.telno ||''),
|
||||
dmndTmng: item?.dmndTmng
|
||||
? moment(item?.dmndTmng).format("YYYY-MM-DD")
|
||||
: "없음",
|
||||
|
||||
rvwCmptnYmd: formatDate(item.demandMatching?.rvwCmptnYmd),
|
||||
mtchnCmptnYmd: formatDate(item.demandMatching?.mtchnCmptnYmd),
|
||||
|
||||
ruseUtztnFcltNm: item.ruseUtztnFcltNm,
|
||||
dmndQty: item.dmndQty,
|
||||
splyFcltFlg: flag,
|
||||
@@ -272,30 +309,7 @@ export default function RuseRvwHstry() {
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={(e) => {
|
||||
if (fromDate && toDate) {
|
||||
const fromNum = Number(fromDate);
|
||||
const toNum = Number(toDate);
|
||||
if (fromNum > toNum) {
|
||||
toast.error(
|
||||
"시작년도가 종료년도 이후로 설정할 수 없습니다."
|
||||
);
|
||||
} else {
|
||||
let con: string | number = "";
|
||||
if (String(objSearch.city).length > 0) {
|
||||
con = String(objSearch.city);
|
||||
}
|
||||
if (String(objSearch.sgg).length > 0 && objSearch.sgg !== "0") {
|
||||
con = String(objSearch.sgg);
|
||||
}
|
||||
getSearch(
|
||||
fromNum,
|
||||
toNum,
|
||||
con,
|
||||
dmdCoNm,
|
||||
ruseUtztnFcltNm
|
||||
);
|
||||
}
|
||||
}
|
||||
getButtonSearch()
|
||||
}}
|
||||
>
|
||||
조회
|
||||
@@ -318,17 +332,23 @@ export default function RuseRvwHstry() {
|
||||
tableData={rvwHistData || []}
|
||||
headlist={ruseHistHeadList}
|
||||
pageSize={20}
|
||||
total={100000}
|
||||
total={rvwHistCount}
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
TableCellClick(index);
|
||||
}}
|
||||
onPageChange={setPageNatiion}
|
||||
onPageChange={
|
||||
(page)=>{
|
||||
setPageNatiion(page)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
></UiTable>
|
||||
<hr />
|
||||
{/* <hr />
|
||||
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">
|
||||
수요신청 상세현황
|
||||
</h3>
|
||||
<ConCostForm form={form} type={"hist"} />
|
||||
<ConCostForm form={form} type={"hist"} selectionVersion={0} /> */}
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
} from "./headList";
|
||||
import type { CommonTableProps } from "../../common/type/header";
|
||||
import type { DedMatUpdateType, DmdCoReqType } from "./type";
|
||||
import { fetchType, getFetch, putFectch } from "@/components/lib/api";
|
||||
import { fetchType, getFetch, getFetchWithCount, putFectch } from "@/components/lib/api";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
const coRvwHeadList = coRvwHeadListExport;
|
||||
@@ -21,6 +21,7 @@ export type coRvwState = {
|
||||
coRvwNodeList: CommonTableProps[];
|
||||
rateFeeHeadList: CommonTableProps[];
|
||||
constCostHeadList: CommonTableProps[];
|
||||
coMatRvwCount:number;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -32,6 +33,7 @@ export const coRvwStateExport: coRvwState = {
|
||||
coRvwNodeList: coRvwNodeList,
|
||||
rateFeeHeadList: rateFeeHeadList,
|
||||
constCostHeadList: constCostHeadList,
|
||||
coMatRvwCount:1
|
||||
},
|
||||
};
|
||||
|
||||
@@ -72,8 +74,8 @@ const coMatInit = async (
|
||||
startYear: string,
|
||||
endYear: string
|
||||
) => {
|
||||
const url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
const coMatRvwRes = await getFetch(fetchType.WR, url);
|
||||
const url = `/reuseFc/request/infoList/Sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
const coMatRvwRes = await getFetchWithCount(fetchType.WR, url);
|
||||
|
||||
return coMatRvwRes;
|
||||
};
|
||||
@@ -93,7 +95,8 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
coRvw: {
|
||||
...state.coRvw,
|
||||
init: false,
|
||||
coMatRvwRes: coMatRvwRes,
|
||||
coMatRvwRes: coMatRvwRes.data,
|
||||
coMatRvwCount:coMatRvwRes.count
|
||||
},
|
||||
}));
|
||||
},
|
||||
@@ -119,7 +122,8 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
...state,
|
||||
coRvw: {
|
||||
...state.coRvw,
|
||||
coMatRvwRes: coMatRvwRes,
|
||||
coMatRvwRes: coMatRvwRes.data,
|
||||
coMatRvwCount:coMatRvwRes.count,
|
||||
init: false,
|
||||
},
|
||||
}));
|
||||
@@ -138,7 +142,7 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
sggCd: string,
|
||||
dmdCoNm: string
|
||||
) => {
|
||||
let url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/Sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
|
||||
if (sggCd.length > 0) {
|
||||
url += `/${sggCd}`;
|
||||
@@ -152,13 +156,14 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
}
|
||||
|
||||
console.log(" url ", url);
|
||||
const coMatRvwRes = await getFetch(fetchType.WR, url);
|
||||
const coMatRvwRes = await getFetchWithCount(fetchType.WR, url);
|
||||
|
||||
return set((state: coRvwState) => ({
|
||||
...state,
|
||||
coRvw: {
|
||||
...state.coRvw,
|
||||
coMatRvwRes: coMatRvwRes,
|
||||
coMatRvwRes: coMatRvwRes.data,
|
||||
coMatRvwCount:coMatRvwRes.count,
|
||||
},
|
||||
}));
|
||||
},
|
||||
@@ -170,18 +175,19 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
sggCd: string
|
||||
) => {
|
||||
try {
|
||||
let url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/Sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
if (sggCd.length > 0) {
|
||||
url += `/${sggCd}/0`;
|
||||
} else if (sggCd === "0") {
|
||||
url += `/0/0`;
|
||||
}
|
||||
const coMatRvwRes = await getFetch(fetchType.WR, url);
|
||||
const coMatRvwRes = await getFetchWithCount(fetchType.WR, url);
|
||||
return set((state: coRvwState) => ({
|
||||
...state,
|
||||
coRvw: {
|
||||
...state.coRvw,
|
||||
coMatRvwRes: coMatRvwRes,
|
||||
coMatRvwRes: coMatRvwRes.data,
|
||||
coMatRvwCount:coMatRvwRes.count,
|
||||
},
|
||||
}));
|
||||
} catch (e) {
|
||||
|
||||
@@ -19,8 +19,6 @@ const DemandInfoSchema = z.object({
|
||||
cdtnv: z.number().nullish(),
|
||||
rmrk: z.string().nullish(),
|
||||
useUsgCd: z.string().nullish(),
|
||||
mtchnCmptnYmd: z.string().nullish(),
|
||||
rvwCmptnYmd: z.string().nullish(),
|
||||
});
|
||||
|
||||
const DemandMatchingSchema = z.object({
|
||||
@@ -35,6 +33,8 @@ const DemandMatchingSchema = z.object({
|
||||
useUsgCd: z.string().nullish(),
|
||||
dmdInfoSn: z.number().nullish(),
|
||||
splyCndtList: z.array(z.string().nullish()).nullish(),
|
||||
mtchnCmptnYmd: z.string().nullish(),
|
||||
rvwCmptnYmd: z.string().nullish(),
|
||||
});
|
||||
|
||||
const DemandCoSchema = z.object({
|
||||
@@ -114,6 +114,7 @@ export type DedMatUpdateType = {
|
||||
fcltSbsdCstrnCst: number;
|
||||
prcsFcltCpctCstrnCst: number;
|
||||
rgtr: string;
|
||||
flg?:string;
|
||||
};
|
||||
|
||||
export type RvwHistTableType = {
|
||||
|
||||
@@ -28,7 +28,7 @@ export const ruseHstryHeadListExport:TableUpperProps[]= [
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "regDt", //바꾸기
|
||||
id: "dmndTmng", //바꾸기
|
||||
title: "신청일자",
|
||||
visible: true,
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
TableUpperProps,
|
||||
} from "../../common/type/header";
|
||||
import { ruseHstryHeadListExport } from "./headList";
|
||||
import { fetchType, getFetch, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { fetchType, getFetch, getFetchWithCount, postFectch, putFectch } from "@/components/lib/api";
|
||||
import type { DmdCoReqType } from "../coMatRvw/type";
|
||||
import toast from "react-hot-toast";
|
||||
import { TEST_UUID } from "../../ruseFcltMng/fcltReg/rainReg";
|
||||
@@ -16,6 +16,7 @@ export type ruseHstryState = {
|
||||
ruseHist: {
|
||||
isInit: boolean;
|
||||
rvwHistRes: DmdCoReqType[];
|
||||
rvwHistCount:number;
|
||||
ruseHistHeadList: TableUpperProps[];
|
||||
};
|
||||
};
|
||||
@@ -25,6 +26,7 @@ export const ruseHstryStateExport: ruseHstryState = {
|
||||
isInit: false,
|
||||
rvwHistRes: [],
|
||||
ruseHistHeadList: ruseHistHeadList,
|
||||
rvwHistCount:1,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -79,14 +81,14 @@ const irvwHistInit = async (
|
||||
startYear: string,
|
||||
endYear: string,
|
||||
) => {
|
||||
let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/Matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
|
||||
// console.log("sggCd ", sggCd);
|
||||
// if (sggCd) {
|
||||
// url += `/${sggCd}`;
|
||||
// }
|
||||
|
||||
const rvwHistRes = await getFetch(fetchType.WR, url);
|
||||
const rvwHistRes = await getFetchWithCount(fetchType.WR, url);
|
||||
|
||||
return rvwHistRes;
|
||||
};
|
||||
@@ -115,7 +117,8 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
ruseHist: {
|
||||
...state.ruseHist,
|
||||
init: false,
|
||||
rvwHistRes: rvwHistRes,
|
||||
rvwHistRes: rvwHistRes.data,
|
||||
rvwHistCount:rvwHistRes.count
|
||||
},
|
||||
}));
|
||||
},
|
||||
@@ -140,8 +143,8 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
ruseHist: {
|
||||
...state.ruseHist,
|
||||
init: false,
|
||||
rvwHistRes: rvwHistRes,
|
||||
},
|
||||
rvwHistRes: rvwHistRes.data,
|
||||
rvwHistCount:rvwHistRes.count },
|
||||
}));
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -158,7 +161,7 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
dmdCoNm: string,
|
||||
ruseUtztnFcltNm: string
|
||||
) => {
|
||||
let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/Matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
|
||||
if (sggCd.length > 0) {
|
||||
url += `/${sggCd}`;
|
||||
@@ -175,14 +178,14 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
} else {
|
||||
url += `/0`;
|
||||
}
|
||||
const rvwHistRes = await getFetch(fetchType.WR, url);
|
||||
const rvwHistRes = await getFetchWithCount(fetchType.WR, url);
|
||||
|
||||
return set((state: ruseHstryState) => ({
|
||||
...state,
|
||||
ruseHist: {
|
||||
...state.ruseHist,
|
||||
rvwHistRes: rvwHistRes,
|
||||
},
|
||||
rvwHistRes: rvwHistRes.data,
|
||||
rvwHistCount:rvwHistRes.count },
|
||||
}));
|
||||
},
|
||||
ruseRvwInqua: async (
|
||||
@@ -193,16 +196,17 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
sggCd: string
|
||||
) => {
|
||||
try {
|
||||
let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/Matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
if (sggCd.length > 0) {
|
||||
url += `/${sggCd}/0`;
|
||||
}
|
||||
const rvwHistRes = await getFetch(fetchType.WR, url);
|
||||
const rvwHistRes = await getFetchWithCount(fetchType.WR, url);
|
||||
return set((state: ruseHstryState) => ({
|
||||
...state,
|
||||
ruseHist: {
|
||||
...state.ruseHist,
|
||||
rvwHistRes: rvwHistRes,
|
||||
rvwHistRes: rvwHistRes.data,
|
||||
rvwHistCount:rvwHistRes.count
|
||||
},
|
||||
}));
|
||||
} catch (e) {
|
||||
@@ -224,6 +228,15 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
new Date().getFullYear().toString(),
|
||||
new Date().getFullYear().toString(),
|
||||
);
|
||||
|
||||
return set((state: ruseHstryState) => ({
|
||||
...state,
|
||||
ruseHist: {
|
||||
...state.ruseHist,
|
||||
rvwHistRes: rvwHistRes.data,
|
||||
rvwHistCount:rvwHistRes.count
|
||||
},
|
||||
}));
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(" error ", e);
|
||||
|
||||
Reference in New Issue
Block a user