dm: 로그아웃처리
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
"use client";
|
||||
|
||||
/**
|
||||
* 수요정보등록 화면
|
||||
*
|
||||
* 🔗 사용 API
|
||||
* - 수요정보등록: POST /reuseFc/request/demandInfo
|
||||
*/
|
||||
import { useDmStore } from "@/app/store";
|
||||
import { sdmInfoFormSchema, type DemandCompBizType, type SdmInfoFormData } from "@/app/store/sdmMng";
|
||||
import { SdmInfoRegForm } from "@/components/ui/sdmInfoInsertForm/component";
|
||||
@@ -60,7 +66,7 @@ function SdmInfoInsertContent() {
|
||||
...prev,
|
||||
sdmNm: searchParams.get("dmdCoNm") || "",
|
||||
}));
|
||||
if(searchParams.get("dmdInfoId")){
|
||||
if (searchParams.get("dmdInfoId")) {
|
||||
// const data = {
|
||||
// dmdCoNm: searchParams.get("dmdCoNm") || '',
|
||||
// ctpvCd: searchParams.get("ctpvCd") || '',
|
||||
@@ -69,8 +75,8 @@ function SdmInfoInsertContent() {
|
||||
// daddr: searchParams.get("daddr") || '',
|
||||
// telno: searchParams.get("telno") || '',
|
||||
// }
|
||||
|
||||
// sessionStorage.setItem("user", JSON.stringify(data || {}));
|
||||
|
||||
// sessionStorage.setItem("user", JSON.stringify(data || {}));
|
||||
}
|
||||
//sessionStorage.setItem("user", JSON.parse(user||'') || "");
|
||||
setIsLogin(user || searchParams.get("dmdInfoId") ? true : false);
|
||||
@@ -121,7 +127,7 @@ function SdmInfoInsertContent() {
|
||||
const userData = JSON.parse(user);
|
||||
if (userData.dmdCoNm) {
|
||||
setFacilityName(userData.dmdCoNm);
|
||||
form.setValue("sdmNm", userData.dmdCoNm);
|
||||
form.setValue("sdmNm", userData.dmdCoNm); // 수요처명(회사명)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error parsing user data:", error);
|
||||
@@ -203,10 +209,10 @@ function SdmInfoInsertContent() {
|
||||
tph: Number(data.tph) || null,
|
||||
trbt: Number(data.trbt) || null,
|
||||
ph: data.ph || "",
|
||||
blgcOxygDmndQnt: Number(data.bod) ||null,
|
||||
blgcOxygDmndQnt: Number(data.bod) || null,
|
||||
clIonQnt: Number(data.clIonQnt) || null,
|
||||
smll: data.smll || "",
|
||||
cdtnv: Number(data.cdtnv) ||null,
|
||||
cdtnv: Number(data.cdtnv) || null,
|
||||
crmty: Number(data.crmty) || null,
|
||||
rmrk: data.rmrk || "",
|
||||
bzmnNo: "",
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
"use client";
|
||||
/**
|
||||
* 수요처 로그아웃 화면
|
||||
*
|
||||
* 🔗 사용 API
|
||||
*
|
||||
*/
|
||||
import { useDmStore } from "@/app/store";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useEffect } from "react";
|
||||
|
||||
export default function SdmLogout() {
|
||||
const router = useRouter();
|
||||
const { actionLogout } = useDmStore((state) => state);
|
||||
|
||||
useEffect(() => {
|
||||
actionLogout();
|
||||
router.push("/pages/sdmMng/sdmInfoInsert");
|
||||
}, [actionLogout, router]);
|
||||
|
||||
return null;
|
||||
}
|
||||
+314
-303
@@ -50,8 +50,8 @@ export const sdmInfoFormSchema = z.object({
|
||||
// 모든 수질 관련 필드
|
||||
// 총대장균군수는 null 값을 불검출로 표시하기때문에 해당 검사에서 제외함.
|
||||
const allFields: (keyof typeof data)[] = [
|
||||
"tn", "combResdch", "tph",
|
||||
"trbt", "ph", "bod", "clIonQnt",
|
||||
"tn", "combResdch", "tph",
|
||||
"trbt", "ph", "bod", "clIonQnt",
|
||||
"smll", "cdtnv", "crmty",
|
||||
];
|
||||
|
||||
@@ -104,38 +104,38 @@ export type SdmInfoFormData = z.infer<typeof sdmInfoFormSchema>;
|
||||
|
||||
// 수요처 정보
|
||||
export type DemandCompBizType = {
|
||||
index : number | '';
|
||||
dmdInfoId : string | '';
|
||||
dmdInfoFk : string | '';
|
||||
bzmnNo : string | '';
|
||||
dmdCoNm : string | '';
|
||||
daddr : string | '';
|
||||
telno : string | '';
|
||||
rgtr : string | '';
|
||||
useUsgCd : string | '';
|
||||
ctpvCd : string | '';
|
||||
sggCd : string | '';
|
||||
dmdAplyPswd : string | '';
|
||||
wntUntprc : number | '';
|
||||
dmndTmng : Date | '';
|
||||
dmndQty : number | '';
|
||||
grssClfg : number | null //총대장균군수
|
||||
tn : number | null //총질소
|
||||
combResdch : number | null //결합잔류염소
|
||||
tph : number | null //총인
|
||||
trbt : number | null //탁도
|
||||
ph : string | ''; //수소이온농
|
||||
blgcOxygDmndQnt : number | null //생물학적산소요구량
|
||||
clIonQnt : number | null //염화물
|
||||
smll : string | ''; //냄새
|
||||
cdtnv : number | null; //전기전도도
|
||||
crmty : number | null //색도
|
||||
rmrk : string | '';
|
||||
reqDt : string | '';
|
||||
dmdInfoSn : number | '';
|
||||
status : string | '';
|
||||
splyCndtList:SupplyCandidate[]|[],
|
||||
ruseUtztnFcltNm?:string|''
|
||||
index: number | '';
|
||||
dmdInfoId: string | '';
|
||||
dmdInfoFk: string | '';
|
||||
bzmnNo: string | '';
|
||||
dmdCoNm: string | '';
|
||||
daddr: string | '';
|
||||
telno: string | '';
|
||||
rgtr: string | '';
|
||||
useUsgCd: string | '';
|
||||
ctpvCd: string | '';
|
||||
sggCd: string | '';
|
||||
dmdAplyPswd: string | '';
|
||||
wntUntprc: number | '';
|
||||
dmndTmng: Date | '';
|
||||
dmndQty: number | '';
|
||||
grssClfg: number | null //총대장균군수
|
||||
tn: number | null //총질소
|
||||
combResdch: number | null //결합잔류염소
|
||||
tph: number | null //총인
|
||||
trbt: number | null //탁도
|
||||
ph: string | ''; //수소이온농
|
||||
blgcOxygDmndQnt: number | null //생물학적산소요구량
|
||||
clIonQnt: number | null //염화물
|
||||
smll: string | ''; //냄새
|
||||
cdtnv: number | null; //전기전도도
|
||||
crmty: number | null //색도
|
||||
rmrk: string | '';
|
||||
reqDt: string | '';
|
||||
dmdInfoSn: number | '';
|
||||
status: string | '';
|
||||
splyCndtList: SupplyCandidate[] | [],
|
||||
ruseUtztnFcltNm?: string | ''
|
||||
|
||||
}
|
||||
|
||||
@@ -147,107 +147,107 @@ export type SupplyCandidate = {
|
||||
|
||||
|
||||
export type DemandMatchings = {
|
||||
splyFcltFk : string | '';
|
||||
splyFcltFlg : string | '';
|
||||
pbnstRuseFcltBizFk : number | '';
|
||||
splyBgngDay : string | '';
|
||||
splyEndDay : string | '';
|
||||
splyCpct : number | '';
|
||||
splyFmYn : string | '';
|
||||
useUsgCd : string | '';
|
||||
dmdInfoSn : number | '';
|
||||
splyCndtList : string | '';
|
||||
mtchnCmptnYmd : string | '';
|
||||
rvwCmptnYmd : string | '';
|
||||
regDt : string | '';
|
||||
rgtr : string | '';
|
||||
mdfcnDt : string | '';
|
||||
mdfr : string | '';
|
||||
splyFcltFk: string | '';
|
||||
splyFcltFlg: string | '';
|
||||
pbnstRuseFcltBizFk: number | '';
|
||||
splyBgngDay: string | '';
|
||||
splyEndDay: string | '';
|
||||
splyCpct: number | '';
|
||||
splyFmYn: string | '';
|
||||
useUsgCd: string | '';
|
||||
dmdInfoSn: number | '';
|
||||
splyCndtList: string | '';
|
||||
mtchnCmptnYmd: string | '';
|
||||
rvwCmptnYmd: string | '';
|
||||
regDt: string | '';
|
||||
rgtr: string | '';
|
||||
mdfcnDt: string | '';
|
||||
mdfr: string | '';
|
||||
}
|
||||
|
||||
// 유사사례
|
||||
export type SimilarCaseType = {
|
||||
ruseBizNm : string | ''; // 사업명
|
||||
bizBgngDate : string | '';
|
||||
bizEndDate : string | '';
|
||||
splyFcltKnd : string | '';
|
||||
splyFcltNm : string | '';
|
||||
splyFcltCpct : string | '';
|
||||
dmdFcltNm : string | '';
|
||||
dmdFcltAddr : string | '';
|
||||
ruseFcltCpct : string | '';
|
||||
ruseFcltPplLen : string | '';
|
||||
ruseFcltUsg : string | '';
|
||||
ruseFcltSplyCpct : string | '';
|
||||
ruseFcltPrcsMsrc : string | '';
|
||||
grnteWqUsg : string | '';
|
||||
grnteWqGrssClfg : string | '';
|
||||
grnteWqCombResdch : string | '';
|
||||
grnteWqTrbt : string | '';
|
||||
grnteWqBod : string | '';
|
||||
grnteWqSmll : string | '';
|
||||
grnteWqCrmty : string | '';
|
||||
grnteWqTn : string | '';
|
||||
grnteWqTp : string | '';
|
||||
grnteWqPh : string | '';
|
||||
grnteWqClIonQnt : string | '';
|
||||
grnteWqCndctStat : string | '';
|
||||
grnteWqRmrk : string | '';
|
||||
reqBizReuseFcltCst : string | '';
|
||||
reqBizPplCst : string | '';
|
||||
reqBizArchCst : string | '';
|
||||
reqBizMchnCst : string | '';
|
||||
reqBizMtrngCst : string | '';
|
||||
reqBizGisCst : string | '';
|
||||
reqBizCctvCst : string | '';
|
||||
reqBizCmcnCst : string | '';
|
||||
reqBizWstCst : string | '';
|
||||
reqBizDesignCst : string | '';
|
||||
reqBizSpvsCst : string | '';
|
||||
reqBizSbsdCst : string | '';
|
||||
reqBizEtc : string | '';
|
||||
reqBizGrssCst : string | '';
|
||||
prcmPlanNlep : string | '';
|
||||
prcmPlanLcep : string | '';
|
||||
prcmPlanBrdnCst : string | '';
|
||||
prcmPlanEcqrRt : string | '';
|
||||
prcmPlanGrssCst : string | '';
|
||||
clclnNlep : string | '';
|
||||
clclnLcep : string | '';
|
||||
clclnBrdnCst : string | '';
|
||||
clclnEcqrRt : string | '';
|
||||
clclnGrssCst : string | '';
|
||||
ruseBizNm: string | ''; // 사업명
|
||||
bizBgngDate: string | '';
|
||||
bizEndDate: string | '';
|
||||
splyFcltKnd: string | '';
|
||||
splyFcltNm: string | '';
|
||||
splyFcltCpct: string | '';
|
||||
dmdFcltNm: string | '';
|
||||
dmdFcltAddr: string | '';
|
||||
ruseFcltCpct: string | '';
|
||||
ruseFcltPplLen: string | '';
|
||||
ruseFcltUsg: string | '';
|
||||
ruseFcltSplyCpct: string | '';
|
||||
ruseFcltPrcsMsrc: string | '';
|
||||
grnteWqUsg: string | '';
|
||||
grnteWqGrssClfg: string | '';
|
||||
grnteWqCombResdch: string | '';
|
||||
grnteWqTrbt: string | '';
|
||||
grnteWqBod: string | '';
|
||||
grnteWqSmll: string | '';
|
||||
grnteWqCrmty: string | '';
|
||||
grnteWqTn: string | '';
|
||||
grnteWqTp: string | '';
|
||||
grnteWqPh: string | '';
|
||||
grnteWqClIonQnt: string | '';
|
||||
grnteWqCndctStat: string | '';
|
||||
grnteWqRmrk: string | '';
|
||||
reqBizReuseFcltCst: string | '';
|
||||
reqBizPplCst: string | '';
|
||||
reqBizArchCst: string | '';
|
||||
reqBizMchnCst: string | '';
|
||||
reqBizMtrngCst: string | '';
|
||||
reqBizGisCst: string | '';
|
||||
reqBizCctvCst: string | '';
|
||||
reqBizCmcnCst: string | '';
|
||||
reqBizWstCst: string | '';
|
||||
reqBizDesignCst: string | '';
|
||||
reqBizSpvsCst: string | '';
|
||||
reqBizSbsdCst: string | '';
|
||||
reqBizEtc: string | '';
|
||||
reqBizGrssCst: string | '';
|
||||
prcmPlanNlep: string | '';
|
||||
prcmPlanLcep: string | '';
|
||||
prcmPlanBrdnCst: string | '';
|
||||
prcmPlanEcqrRt: string | '';
|
||||
prcmPlanGrssCst: string | '';
|
||||
clclnNlep: string | '';
|
||||
clclnLcep: string | '';
|
||||
clclnBrdnCst: string | '';
|
||||
clclnEcqrRt: string | '';
|
||||
clclnGrssCst: string | '';
|
||||
}
|
||||
|
||||
// 사업비 상세정보
|
||||
export type MoneyDetailType = {
|
||||
reqBizGrssCst : string | '';
|
||||
reqBizReuseFcltCst : string | '';
|
||||
reqBizPplCst : string | '';
|
||||
reqBizArchCst : string | '';
|
||||
reqBizMchnCst : string | '';
|
||||
reqBizMtrngCst : string | '';
|
||||
reqBizGisCst : string | '';
|
||||
reqBizCctvCst : string | '';
|
||||
reqBizCmcnCst : string | '';
|
||||
reqBizWstCst : string | '';
|
||||
reqBizDesignCst : string | '';
|
||||
reqBizSpvsCst : string | '';
|
||||
reqBizSbsdCst : string | '';
|
||||
reqBizEtc : string | '';
|
||||
|
||||
reqBizGrssCst: string | '';
|
||||
reqBizReuseFcltCst: string | '';
|
||||
reqBizPplCst: string | '';
|
||||
reqBizArchCst: string | '';
|
||||
reqBizMchnCst: string | '';
|
||||
reqBizMtrngCst: string | '';
|
||||
reqBizGisCst: string | '';
|
||||
reqBizCctvCst: string | '';
|
||||
reqBizCmcnCst: string | '';
|
||||
reqBizWstCst: string | '';
|
||||
reqBizDesignCst: string | '';
|
||||
reqBizSpvsCst: string | '';
|
||||
reqBizSbsdCst: string | '';
|
||||
reqBizEtc: string | '';
|
||||
|
||||
/** 재원조달계획(백만원원) */
|
||||
prcmPlanGrssCst : string | '';
|
||||
prcmPlanNlep : string | '';
|
||||
prcmPlanLcep : string | '';
|
||||
prcmPlanBrdnCst : string | '';
|
||||
prcmPlanEcqrRt : string | '';
|
||||
prcmPlanGrssCst: string | '';
|
||||
prcmPlanNlep: string | '';
|
||||
prcmPlanLcep: string | '';
|
||||
prcmPlanBrdnCst: string | '';
|
||||
prcmPlanEcqrRt: string | '';
|
||||
/** 사업비 정산(백만원) */
|
||||
clclnGrssCst : string | '';
|
||||
clclnNlep : string | '';
|
||||
clclnLcep : string | '';
|
||||
clclnBrdnCst : string | '';
|
||||
clclnEcqrRt : string | '';
|
||||
clclnGrssCst: string | '';
|
||||
clclnNlep: string | '';
|
||||
clclnLcep: string | '';
|
||||
clclnBrdnCst: string | '';
|
||||
clclnEcqrRt: string | '';
|
||||
}
|
||||
// 규칙 타입 선언
|
||||
export type DisableRulesType = Record<string, string[]>;
|
||||
@@ -255,144 +255,144 @@ export type DisableRulesType = Record<string, string[]>;
|
||||
* Store - 데이터
|
||||
====================================*/
|
||||
// 수요처 정보
|
||||
const demandCompList : DemandCompType[] = [
|
||||
const demandCompList: DemandCompType[] = [
|
||||
]
|
||||
|
||||
|
||||
const disableRules: DisableRulesType = {
|
||||
"청소": ["tn", 'tph',"clIonQnt" ,'cdtnv'],
|
||||
"화장실용수": ["tn", 'tph',"clIonQnt" ,'cdtnv'],
|
||||
"세척": ["combResdch", "crmty",'tph','tn',"clIonQnt",'cdtnv'],
|
||||
"살수": ["combResdch", "crmty",'tph','tn',"clIonQnt",'cdtnv'],
|
||||
"조경": ["combResdch", "crmty",'tph','cdtnv'],
|
||||
"농업_간접용수": ["combResdch", "crmty",'tn','tph','clIonQnt'],
|
||||
"농업_직접용수": ["combResdch", "crmty",'tn','tph','clIonQnt'],
|
||||
"하천": ["combResdch", "trbt", "crmty" ,'clIonQnt','cdtnv'],
|
||||
'공업':[]
|
||||
};
|
||||
"청소": ["tn", 'tph', "clIonQnt", 'cdtnv'],
|
||||
"화장실용수": ["tn", 'tph', "clIonQnt", 'cdtnv'],
|
||||
"세척": ["combResdch", "crmty", 'tph', 'tn', "clIonQnt", 'cdtnv'],
|
||||
"살수": ["combResdch", "crmty", 'tph', 'tn', "clIonQnt", 'cdtnv'],
|
||||
"조경": ["combResdch", "crmty", 'tph', 'cdtnv'],
|
||||
"농업_간접용수": ["combResdch", "crmty", 'tn', 'tph', 'clIonQnt'],
|
||||
"농업_직접용수": ["combResdch", "crmty", 'tn', 'tph', 'clIonQnt'],
|
||||
"하천": ["combResdch", "trbt", "crmty", 'clIonQnt', 'cdtnv'],
|
||||
'공업': []
|
||||
};
|
||||
|
||||
const defaultRules: Record<string, object> = {
|
||||
"청소": {
|
||||
grssClfg: null,
|
||||
combResdch:0.2,
|
||||
trbt: 2,
|
||||
bod: 5,
|
||||
crmty: 20,
|
||||
ph: "5.8~8.5",
|
||||
smll:'불쾌하지않을것',
|
||||
tn:null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
cdtnv: null,
|
||||
const defaultRules: Record<string, object> = {
|
||||
"청소": {
|
||||
grssClfg: null,
|
||||
combResdch: 0.2,
|
||||
trbt: 2,
|
||||
bod: 5,
|
||||
crmty: 20,
|
||||
ph: "5.8~8.5",
|
||||
smll: '불쾌하지않을것',
|
||||
tn: null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
cdtnv: null,
|
||||
|
||||
},
|
||||
"화장실용수": {
|
||||
grssClfg: null,
|
||||
combResdch:0.2,
|
||||
trbt: 2,
|
||||
bod: 5,
|
||||
crmty: 20,
|
||||
smll:'불쾌하지않을것',
|
||||
ph: "5.8~8.5",
|
||||
tn:null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
cdtnv: null,
|
||||
},
|
||||
"세척": {
|
||||
grssClfg: null,
|
||||
trbt: 2,
|
||||
bod: 5,
|
||||
ph: "5.8~8.5",
|
||||
combResdch:null,
|
||||
smll:'불쾌하지않을것',
|
||||
crmty:null,
|
||||
tn:null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
cdtnv: null,
|
||||
},
|
||||
"살수": {
|
||||
grssClfg: null,
|
||||
trbt: 2,
|
||||
bod: 5,
|
||||
ph: "5.8~8.5",
|
||||
smll:'불쾌하지않을것',
|
||||
combResdch:null,
|
||||
crmty:null,
|
||||
tn:null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
cdtnv: null,
|
||||
},
|
||||
"조경": {
|
||||
grssClfg: null,
|
||||
trbt: 2,
|
||||
bod: 5,
|
||||
ph: "5.8~8.5",
|
||||
smll:'불쾌하지않을것',
|
||||
clIonQnt:250,
|
||||
combResdch:null,
|
||||
crmty:null,
|
||||
tn:null,
|
||||
tph: null,
|
||||
cdtnv: null,
|
||||
},
|
||||
"농업_간접용수": {
|
||||
grssClfg: null,
|
||||
trbt: 5,
|
||||
bod: 8,
|
||||
ph: "5.8~8.5",
|
||||
cdtnv:2000,
|
||||
combResdch:null,
|
||||
crmty:null,
|
||||
tn:null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
},
|
||||
"농업_직접용수": {
|
||||
grssClfg: null,
|
||||
trbt: 2,
|
||||
bod: 8,
|
||||
smll:'불쾌하지않을것',
|
||||
ph: "5.8~8.5",
|
||||
cdtnv:700,
|
||||
combResdch:null,
|
||||
crmty:null,
|
||||
tn:null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
},
|
||||
"하천": {
|
||||
grssClfg: 1000,
|
||||
bod: 5,
|
||||
tn: 10,
|
||||
tph: 0.5,
|
||||
smll:'불쾌하지않을것',
|
||||
ph: "5.8~8.5",
|
||||
combResdch:null,
|
||||
trbt:null,
|
||||
crmty:null,
|
||||
clIonQnt: null,
|
||||
cdtnv:null
|
||||
},
|
||||
'공업':{
|
||||
grssClfg: null,
|
||||
bod: null,
|
||||
tn: null,
|
||||
tph: null,
|
||||
ph: "~",
|
||||
combResdch:null,
|
||||
smll:'불쾌하지않을것',
|
||||
trbt:null,
|
||||
crmty:null,
|
||||
clIonQnt: null,
|
||||
cdtnv:null
|
||||
}
|
||||
};
|
||||
},
|
||||
"화장실용수": {
|
||||
grssClfg: null,
|
||||
combResdch: 0.2,
|
||||
trbt: 2,
|
||||
bod: 5,
|
||||
crmty: 20,
|
||||
smll: '불쾌하지않을것',
|
||||
ph: "5.8~8.5",
|
||||
tn: null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
cdtnv: null,
|
||||
},
|
||||
"세척": {
|
||||
grssClfg: null,
|
||||
trbt: 2,
|
||||
bod: 5,
|
||||
ph: "5.8~8.5",
|
||||
combResdch: null,
|
||||
smll: '불쾌하지않을것',
|
||||
crmty: null,
|
||||
tn: null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
cdtnv: null,
|
||||
},
|
||||
"살수": {
|
||||
grssClfg: null,
|
||||
trbt: 2,
|
||||
bod: 5,
|
||||
ph: "5.8~8.5",
|
||||
smll: '불쾌하지않을것',
|
||||
combResdch: null,
|
||||
crmty: null,
|
||||
tn: null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
cdtnv: null,
|
||||
},
|
||||
"조경": {
|
||||
grssClfg: null,
|
||||
trbt: 2,
|
||||
bod: 5,
|
||||
ph: "5.8~8.5",
|
||||
smll: '불쾌하지않을것',
|
||||
clIonQnt: 250,
|
||||
combResdch: null,
|
||||
crmty: null,
|
||||
tn: null,
|
||||
tph: null,
|
||||
cdtnv: null,
|
||||
},
|
||||
"농업_간접용수": {
|
||||
grssClfg: null,
|
||||
trbt: 5,
|
||||
bod: 8,
|
||||
ph: "5.8~8.5",
|
||||
cdtnv: 2000,
|
||||
combResdch: null,
|
||||
crmty: null,
|
||||
tn: null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
},
|
||||
"농업_직접용수": {
|
||||
grssClfg: null,
|
||||
trbt: 2,
|
||||
bod: 8,
|
||||
smll: '불쾌하지않을것',
|
||||
ph: "5.8~8.5",
|
||||
cdtnv: 700,
|
||||
combResdch: null,
|
||||
crmty: null,
|
||||
tn: null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
},
|
||||
"하천": {
|
||||
grssClfg: 1000,
|
||||
bod: 5,
|
||||
tn: 10,
|
||||
tph: 0.5,
|
||||
smll: '불쾌하지않을것',
|
||||
ph: "5.8~8.5",
|
||||
combResdch: null,
|
||||
trbt: null,
|
||||
crmty: null,
|
||||
clIonQnt: null,
|
||||
cdtnv: null
|
||||
},
|
||||
'공업': {
|
||||
grssClfg: null,
|
||||
bod: null,
|
||||
tn: null,
|
||||
tph: null,
|
||||
ph: "~",
|
||||
combResdch: null,
|
||||
smll: '불쾌하지않을것',
|
||||
trbt: null,
|
||||
crmty: null,
|
||||
clIonQnt: null,
|
||||
cdtnv: null
|
||||
}
|
||||
};
|
||||
|
||||
// 사용용도
|
||||
const useTypesData : SelectDataType[] = [
|
||||
const useTypesData: SelectDataType[] = [
|
||||
{ text: '청소', val: "청소" },
|
||||
{ text: "화장실용수", val: "화장실용수" },
|
||||
{ text: "세척", val: "세척" },
|
||||
@@ -440,8 +440,8 @@ export const similarCaseModalHeader: TableUpperProps[] = [
|
||||
]
|
||||
|
||||
// 유사사례 데이터
|
||||
const similarCaseList : SimilarCaseType[] = [
|
||||
|
||||
const similarCaseList: SimilarCaseType[] = [
|
||||
|
||||
]
|
||||
|
||||
// 사업비 상세정보 모달 헤더
|
||||
@@ -477,12 +477,12 @@ export const moneyDetailModalHeader: TableUpperProps[] = [
|
||||
]
|
||||
|
||||
// 사업비 상세정보
|
||||
const moneyDetailList : MoneyDetailType[] = [
|
||||
const moneyDetailList: MoneyDetailType[] = [
|
||||
]
|
||||
|
||||
// 수요정보 신청현황 헤더
|
||||
export const upHeadSdmInfoStatus: TableUpperProps[] = [
|
||||
{ id: "index", title: "No."},
|
||||
{ id: "index", title: "No." },
|
||||
{ id: "ctpvCd", title: "시도", row: 0, rowSpan: 2 },
|
||||
{ id: "sggCd", title: "시군구", row: 0, rowSpan: 2 },
|
||||
{ id: "dmdCoNm", title: "회사명", row: 0, rowSpan: 2 },
|
||||
@@ -501,7 +501,7 @@ export const upHeadSdmInfoStatus: TableUpperProps[] = [
|
||||
const postSdmData = async (data: DemandCompType) => {
|
||||
try {
|
||||
await postFetch("/reuseFc/request", data);
|
||||
sessionStorage.setItem("user", JSON.stringify(data) );
|
||||
sessionStorage.setItem("user", JSON.stringify(data));
|
||||
toast.success("수요처 등록에 성공하였습니다.");
|
||||
return true;
|
||||
} catch (error) {
|
||||
@@ -526,16 +526,16 @@ const postSdmLoginData = async (data: DemandCompType) => {
|
||||
try {
|
||||
const res = await postFetch("/reuseFc/request/login", data);
|
||||
const jsonData = await res.json();
|
||||
|
||||
|
||||
const status = jsonData.status;
|
||||
const loginData = jsonData.data;
|
||||
let loginSuccess = false;
|
||||
if(status === 200 && loginData != null) {
|
||||
if (status === 200 && loginData != null) {
|
||||
alert("수요처 로그인에 성공하였습니다.");
|
||||
sessionStorage.setItem("user", JSON.stringify(loginData));
|
||||
loginSuccess = true;
|
||||
} else if(status === 401) {
|
||||
alert("패스워드가 틀렸습니다.");
|
||||
} else if (status === 401) {
|
||||
alert("패스워드가 일치하지 않습니다.");
|
||||
loginSuccess = false;
|
||||
} else {
|
||||
alert("등록된 수요처가 없습니다.");
|
||||
@@ -553,35 +553,35 @@ const getDemandCompList = async (searchText: string, pageCnt: number) => {
|
||||
try {
|
||||
const url = '/reuseFc/request/' + (searchText ? searchText : '') + '/' + pageCnt;
|
||||
const res = await getFetch(fetchType.WR, url);
|
||||
return {
|
||||
data: res?.data || [],
|
||||
count: res?.count || 0
|
||||
return {
|
||||
data: res?.data || [],
|
||||
count: res?.count || 0
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error+' 수요처 정보를 불러오지 못했습니다.');
|
||||
console.error(error + ' 수요처 정보를 불러오지 못했습니다.');
|
||||
return { data: [], count: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
const getSdmInfoStatusList = async (dmdInfoId : string) => {
|
||||
const getSdmInfoStatusList = async (dmdInfoId: string) => {
|
||||
try {
|
||||
const url = '/reuseFc/request/' + dmdInfoId;
|
||||
const res = await getFetch(fetchType.WR, url);
|
||||
return res?.data || [];
|
||||
} catch (error) {
|
||||
console.error(error+' 수요정보 신청현황을 불러오지 못했습니다.');
|
||||
console.error(error + ' 수요정보 신청현황을 불러오지 못했습니다.');
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// 유사사례 조회
|
||||
const fetchGetSimilarCaseList = async (part: string, value: number|string) => {
|
||||
const fetchGetSimilarCaseList = async (part: string, value: number | string) => {
|
||||
try {
|
||||
const url = '/reuseFc/pubFcRuseCase/dm/' + part + '/' + (value ? value : 0);
|
||||
const res = await getFetch(fetchType.WR, url);
|
||||
return res?.data || [];
|
||||
} catch (error) {
|
||||
console.error(error+' 유사사례 조회에 실패하였습니다.');
|
||||
console.error(error + ' 유사사례 조회에 실패하였습니다.');
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -590,23 +590,24 @@ const fetchGetSimilarCaseList = async (part: string, value: number|string) => {
|
||||
* Store - expaort
|
||||
====================================*/
|
||||
export type SdmActions = {
|
||||
initializeSdmData: () => void;
|
||||
insertSdmData: (data: DemandCompType) => Promise<void>;
|
||||
insertSdmInfoData: (data: DemandCompBizType) => Promise<void>;
|
||||
getDemandCompList: (searchText: string, pageCnt: number) => Promise<void>;
|
||||
actionLogin: (data: DemandCompType) => Promise<void>;
|
||||
getSdmInfoStatusList: (dmdInfoId: string) => Promise<void>;
|
||||
getSimilarCaseList: (part: string, value: number|string) => Promise<void>;
|
||||
initializeSdmData: () => void;
|
||||
insertSdmData: (data: DemandCompType) => Promise<void>;
|
||||
insertSdmInfoData: (data: DemandCompBizType) => Promise<void>;
|
||||
getDemandCompList: (searchText: string, pageCnt: number) => Promise<void>;
|
||||
actionLogin: (data: DemandCompType) => Promise<void>;
|
||||
getSdmInfoStatusList: (dmdInfoId: string) => Promise<void>;
|
||||
getSimilarCaseList: (part: string, value: number | string) => Promise<void>;
|
||||
actionLogout: () => Promise<void>;
|
||||
}
|
||||
|
||||
export type SdmType ={
|
||||
Sdm :{
|
||||
export type SdmType = {
|
||||
Sdm: {
|
||||
isInit: boolean;
|
||||
useTypesData: SelectDataType[];
|
||||
demandCompList: DemandCompType[];
|
||||
upHeadSimilarCaseList: TableUpperProps[];
|
||||
similarCaseList: SimilarCaseType[];
|
||||
upHeadMoneyDetailList : TableUpperProps[];
|
||||
upHeadMoneyDetailList: TableUpperProps[];
|
||||
moneyDetailList: MoneyDetailType[];
|
||||
|
||||
// 수요정보 신청현황
|
||||
@@ -615,28 +616,28 @@ export type SdmType ={
|
||||
defaultRules: Record<string, object>
|
||||
disableRules: DisableRulesType;
|
||||
// 로그인관련
|
||||
successNextPage : boolean;
|
||||
successNextPage: boolean;
|
||||
successLogin: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export const SdmState: SdmType = {
|
||||
Sdm:{
|
||||
isInit:false,
|
||||
Sdm: {
|
||||
isInit: false,
|
||||
useTypesData: useTypesData,
|
||||
demandCompList: demandCompList,
|
||||
upHeadSimilarCaseList: similarCaseModalHeader,
|
||||
similarCaseList: similarCaseList,
|
||||
upHeadMoneyDetailList : moneyDetailModalHeader,
|
||||
upHeadMoneyDetailList: moneyDetailModalHeader,
|
||||
moneyDetailList: moneyDetailList,
|
||||
// 수요정보 신청현황
|
||||
sdmInfoStatusList: [],
|
||||
defaultRules:defaultRules,
|
||||
disableRules:disableRules,
|
||||
defaultRules: defaultRules,
|
||||
disableRules: disableRules,
|
||||
upHeadSdmInfoStatus: upHeadSdmInfoStatus,
|
||||
|
||||
// 로그인관련
|
||||
successNextPage : false,
|
||||
successNextPage: false,
|
||||
successLogin: false,
|
||||
}
|
||||
}
|
||||
@@ -648,13 +649,13 @@ export const SdmReducer = (set: any): SdmActions => {
|
||||
|
||||
insertSdmData: async (data: DemandCompType) => {
|
||||
const preRes = await getSdmInfoStatusList(data.dmdInfoId);
|
||||
if(preRes?.dmdInfoId) {
|
||||
if (preRes?.dmdInfoId) {
|
||||
toast.error('이미 등록된 수요처입니다.');
|
||||
return;
|
||||
}
|
||||
|
||||
const res = await postSdmData(data);
|
||||
if(res) {
|
||||
if (res) {
|
||||
set((state: SdmType) => ({
|
||||
Sdm: {
|
||||
...state.Sdm,
|
||||
@@ -671,7 +672,7 @@ export const SdmReducer = (set: any): SdmActions => {
|
||||
// 수요처 정보
|
||||
getDemandCompList: async (searchText: string, pageCnt: number) => {
|
||||
const res = await getDemandCompList(searchText, pageCnt);
|
||||
if(res.data.length === 0) {
|
||||
if (res.data.length === 0) {
|
||||
set((state: SdmType) => ({
|
||||
Sdm: {
|
||||
...state.Sdm,
|
||||
@@ -693,7 +694,7 @@ export const SdmReducer = (set: any): SdmActions => {
|
||||
getSdmInfoStatusList: async (dmdInfoId: string) => {
|
||||
const res = await getSdmInfoStatusList(dmdInfoId);
|
||||
|
||||
if(res.length === 0) {
|
||||
if (res.length === 0) {
|
||||
set((state: SdmType) => ({
|
||||
Sdm: {
|
||||
...state.Sdm,
|
||||
@@ -704,13 +705,13 @@ export const SdmReducer = (set: any): SdmActions => {
|
||||
}
|
||||
//const sdmInfoStatusList : DemandCompBizType[] = [];
|
||||
|
||||
const sdmInfoStatusList : DemandCompBizType[]= res.demandInfo.map((el: DemandCompBizType, index: number) => {
|
||||
const sdmInfoStatusList: DemandCompBizType[] = res.demandInfo.map((el: DemandCompBizType, index: number) => {
|
||||
const matchingInfo = res.demandMatchings.find((matching: DemandMatchings) => matching.dmdInfoSn === el.dmdInfoSn);
|
||||
const status = matchingInfo?.splyFcltFlg?.trim() === 'Sub' ? '검토' : matchingInfo?.splyFcltFlg?.trim() === 'matched' ? '매칭완료' : '신청';
|
||||
const ruseUtztnFcltNm = matchingInfo?.ruseUtztnFcltNm ? matchingInfo.ruseUtztnFcltNm : '';
|
||||
|
||||
|
||||
return( {
|
||||
return ({
|
||||
...el,
|
||||
index: ++index,
|
||||
bzmnNo: res.bzmnNo,
|
||||
@@ -723,8 +724,8 @@ export const SdmReducer = (set: any): SdmActions => {
|
||||
sggCd: res.sggCd,
|
||||
useUsgCd: el.useUsgCd,
|
||||
dmndTmng: el.dmndTmng,
|
||||
dmdInfoSn : el.dmdInfoSn,
|
||||
status : status,
|
||||
dmdInfoSn: el.dmdInfoSn,
|
||||
status: status,
|
||||
splyCndtList: el.splyCndtList,
|
||||
ruseUtztnFcltNm: ruseUtztnFcltNm || ''
|
||||
})
|
||||
@@ -749,7 +750,7 @@ export const SdmReducer = (set: any): SdmActions => {
|
||||
},
|
||||
|
||||
// 유사사례 조회
|
||||
getSimilarCaseList: async (part: string, value: number|string) => {
|
||||
getSimilarCaseList: async (part: string, value: number | string) => {
|
||||
const res = await fetchGetSimilarCaseList(part, value);
|
||||
const similarCaseList = res.map((el: SimilarCaseType) => {
|
||||
const maskedBizNm = el.ruseBizNm
|
||||
@@ -762,24 +763,34 @@ export const SdmReducer = (set: any): SdmActions => {
|
||||
};
|
||||
});
|
||||
console.log(similarCaseList);
|
||||
|
||||
if(similarCaseList && similarCaseList.length !== 0) {
|
||||
|
||||
if (similarCaseList && similarCaseList.length !== 0) {
|
||||
set((state: SdmType) => ({
|
||||
Sdm: {
|
||||
Sdm: {
|
||||
...state.Sdm,
|
||||
similarCaseList: similarCaseList,
|
||||
}
|
||||
}))
|
||||
return;
|
||||
}else{
|
||||
} else {
|
||||
set((state: SdmType) => ({
|
||||
Sdm: {
|
||||
Sdm: {
|
||||
...state.Sdm,
|
||||
similarCaseList: [],
|
||||
}
|
||||
}))
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
actionLogout: async () => {
|
||||
sessionStorage.removeItem("user");
|
||||
set((state: SdmType) => ({
|
||||
Sdm: {
|
||||
...state.Sdm,
|
||||
successLogin: false,
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user