수요처 관리 페이지처리 (진행중)
iipbs_wr / build (push) Waiting to run

This commit is contained in:
YangJinSoo94
2025-06-20 14:28:39 +09:00
parent d9ad9e0701
commit 5ea098b7bf
+19 -17
View File
@@ -2,12 +2,14 @@
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
import { fetchType, getFetch } from "@/components/lib/api";
import {
excelDownload,
getCity,
getCityOrSgg,
tableData,
tableData
} from "@/components/lib/func/commom";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
import {
ContentsDiv,
SearchDiv,
@@ -21,15 +23,11 @@ import {
type SelectDataType,
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import SdmInsertForm from "@common/business_components/ui/sdmInsertForm";
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
import { Button } from "@common/components/ui";
import { useCallback, useEffect, useState } from "react";
import SdmInsertForm, {
} from "@common/business_components/ui/sdmInsertForm";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import toast, { Toaster } from "react-hot-toast";
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
import { fetchType, getFetch } from "@/components/lib/api";
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
export default function CoSttn() {
const {
@@ -41,7 +39,6 @@ export default function CoSttn() {
regDemandCompany,
updateDemandCompany,
coSttnTxtSearch,
checkDemand,
demandCompList,
dmdIsSucees
} = useWrStore((state) => state);
@@ -61,8 +58,7 @@ export default function CoSttn() {
const [seartchTxt, setSearchTxt] = useState<string>();
const [upadateData, setUpdateData] = useState<DemandCompType>();
const getSelCity = (val: string | number) => {
const cityValue = String(val); // Ensure val is treated as a string
const data = getCity(cityValue, code.sggCd);
@@ -76,7 +72,6 @@ export default function CoSttn() {
useEffect(() => {
if (!coSttn.isInit) {
coSttnInit("1", "13", "0");
}
}, [coSttn.isInit, coSttnInit]);
@@ -92,7 +87,7 @@ export default function CoSttn() {
} else if (coSttnRes.length == 0) {
setBdstTable([]);
}
}, [coSttnRes]);
}, [coSttnRes, code]);
useEffect(() => {
if (coSttn.excelList.length > 0) {
@@ -107,13 +102,20 @@ export default function CoSttn() {
}
}, [coSttn.excelList]);
useEffect(() => {
const con = (objSearch.sgg && objSearch.sgg !== "0") ? objSearch.sgg : objSearch.city ? objSearch.city : "0";
if(con){
coSttnSearch(String(pageNation), "13", String(con));
}
}, [coSttnSearch, objSearch.city, objSearch.sgg, pageNation]);
const excelClick = useCallback(() => {
const con = objSearch.sgg ? objSearch.sgg : objSearch.city;
if (con) coSttnSearch("1", "10000", String(con));
}, [coSttnSearch, objSearch.city, objSearch.sgg]);
const searchClick = () => {
const con = objSearch.sgg ? objSearch.sgg : objSearch.city;
const con = (objSearch.sgg && objSearch.sgg !== "0") ? objSearch.sgg : objSearch.city;
if (con) {
if (seartchTxt && seartchTxt?.length > 0) {
coSttnTxtSearch("1", "13", String(con), seartchTxt ?? "");
@@ -142,7 +144,7 @@ export default function CoSttn() {
className="col-span-2 w-1/6 h-full text-2xl"
label="시군구"
selectClass={""}
selectArray={selectSgg || []}
selectArray={selectSgg?selectSgg : [{text:"전체",val:"0"}]}
onSelectValue={getSgg}
/>
<SearchInput
@@ -206,8 +208,8 @@ export default function CoSttn() {
headName={[]}
tableData={bdstTable || []}
headlist={coSttn.coSttHeadList}
pageSize={20}
total={10000}
pageSize={bdstTable?.length ? Math.ceil(bdstTable.length / 13) : 0}
total={bdstTable?.length || 10000}
cellClick={(index: number | undefined, headId: string) => {
setUpdateData(coSttnRes[index as number]);
}}