수요처관리 비밀번호 초기화 추가

This commit is contained in:
jyha00
2025-07-31 19:53:17 +09:00
parent fd55d2e3cf
commit d23f928ddb
3 changed files with 118 additions and 76 deletions
+25 -6
View File
@@ -5,6 +5,7 @@ import { btnClass } from "@/app/store/common/code";
import { excelCoSttnParsing } from "@/app/store/matDmd/coSttn/excel";
import { fetchType, getFetch } from "@/components/lib/api";
import {
confirmToast,
excelDownload,
formatPhoneNumber,
getCity,
@@ -30,6 +31,7 @@ import { Button } from "@common/components/ui";
import moment from "moment";
import { useCallback, useEffect, useState } from "react";
import toast, { Toaster } from "react-hot-toast";
import { useTranslation } from "react-i18next";
export default function CoSttn() {
const {
@@ -43,6 +45,7 @@ export default function CoSttn() {
updateDemandCompany,
coSttnTxtSearch,
demandCompList,
coSttnPwInit,
} = useWrStore((state) => state);
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
@@ -105,7 +108,6 @@ export default function CoSttn() {
regDt: moment(item.regDt).format("YYYY-MM-DD"),
dmdInfoId: `${item.dmdInfoId.slice(0, 3)}-${item.dmdInfoId.slice(3, 5)}-${item.dmdInfoId.slice(5, 10)}-${item.dmdInfoId.slice(10)}`
}));
console.log("chData:", chData)
// .filter((item: any) => item !== undefined);
setBdstTable(chData);
} else if (coSttnRes?.length == 0) {
@@ -156,6 +158,18 @@ export default function CoSttn() {
}
}
};
const { t } = useTranslation('base');
const initPassword = () => {
if (upadateData) {
const dmdInfoId = upadateData.dmdInfoId;
const handleConfirm = () => {
coSttnPwInit(dmdInfoId);
};
confirmToast(t('isInitPw'), handleConfirm);
} else {
toast.error("비밀번호 초기화를 원하는 행을 선택해주세요.")
}
}
return (
<>
@@ -167,7 +181,7 @@ export default function CoSttn() {
<SearchFormLeft>
<div className="col-span-10 flex flex-row">
<SelectBox
className="col-span-2 w-1/6 h-full text-2xl"
className="col-span-3 w-1/6 h-full text-2xl"
label="시도"
selectClass={""}
selectArray={code.cityCd || []}
@@ -178,7 +192,7 @@ export default function CoSttn() {
value={objSearch.city}
/>
<SelectBox
className="col-span-2 w-1/6 h-full text-2xl"
className="col-span-3 w-1/6 h-full text-2xl"
label="시군구"
selectClass={""}
selectArray={selectSgg || []}
@@ -195,7 +209,7 @@ export default function CoSttn() {
/>
</div>
</SearchFormLeft>
<SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<SearchFormRight className="w-3/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<div className="flex flex-row space-x-2">
<Button className="mt-2" size={"sm"} onClick={searchClick}>
조회
@@ -236,6 +250,13 @@ export default function CoSttn() {
>
다운로드
</Button>
<Button
size={"sm"}
className={`${btnClass}`}
onClick={(initPassword)}
>
비밀번호 초기화
</Button>
</div>
</SearchFormRight>
</SearchDiv>
@@ -286,9 +307,7 @@ export default function CoSttn() {
objSearch.sgg && objSearch.sgg !== "0"
? objSearch.sgg
: objSearch.city;
console.log("data ", data);
if (upadateData?.dmdInfoId) {
console.log("data ", data);
await updateDemandCompany(data as DemandCompType);
coSttnInit("1", "13", String(con));
setIsDmdModal({
+29 -2
View File
@@ -1,7 +1,8 @@
import type { CommonTableProps } from "@/app/store/common/type/header";
import { fetchType, getFetchWithCount } from "@/components/lib/api";
import { fetchType, getFetchWithCount, putFectch } from "@/components/lib/api";
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
import { coSttHeadListExport, coSttNodeListExport } from "./headList";
import toast from "react-hot-toast";
// 테이블 헤드 리스트
const coSttNodeList = coSttNodeListExport;
@@ -24,6 +25,7 @@ type coSttnActions = {
coSttnInit: (pageNo: string, pageCnt: string, con: string) => void;
coSttnSearch: (pageNo: string, pageCnt: string, con: string) => void;
coSttnTxtSearch: (pageNo: string, pageCnt: string, con: string, txt: string) => void;
coSttnPwInit: (dmdInfoId: string) => void;
};
export type coSttnType = coSttnState & coSttnActions;
@@ -113,10 +115,35 @@ export const coSttnActionsExport: (set: any) => coSttnActions = (
coSttnRes: coSttnRes.data,
coSttnResCount: coSttnRes.count,
isInit: false,
}}})
}
}
})
} catch (erTxt) {
console.log("error", erTxt);
}
},
coSttnPwInit: async (dmdInfoId: string) => {
try {
const response = await putFectch(`/reuseFc/request/chgPassword/${dmdInfoId}`,[])
if (response.status === 200) {
toast.success('비밀번호가 초기화 되었습니다.')
} else {
toast.error('비밀번호 초기화에 실패하였습니다')
}
set((state: coSttnState) => {
return {
...state,
coSttn: {
...state.coSttn,
isInit: false,
}
}
});
} catch (err) {
console.log(err);
toast.error('비밀번호 초기화에 실패하였습니다.')
}
}
}
}
+1 -5
View File
@@ -17,14 +17,10 @@
"isMatchFinishMsg": " 매칭완료를 진행하시겠습니까?",
"isNotMatchFinishMsg": "검토완료중 매칭완료 여부를 체크한 항목이 없습니다.",
"canNotChangeMatStateMsg": "매칭완료된 항목은 상태를 변경할 수 없습니다.",
"isInitPw": "비밀번호를 초기화하시겠습니까?",
"alreadyInsertedErrMsg": "사업자번호 {{num}}(은)는 이미 등록되었습니다. 다시 등록해주세요.",
"saveRowErrMsg": "수정을 원하는 행을 선택하고 저장버튼을 눌러주세요.",
"costCalcErrMsg": "공사비 계산 진행 후 저장을 눌러주세요",
"maxYearErrMsg": "최대 {{year}}년까지 선택가능합니다.",
"checkQtyMsg": "요구수량(m³/일)을 확인해주세요 계산할 수 없습니다."
}