수요처관리 비밀번호 초기화 추가
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -103,9 +106,8 @@ export default function CoSttn() {
|
||||
...item,
|
||||
telno: formatPhoneNumber(item.telno || undefined),
|
||||
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)}`
|
||||
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({
|
||||
|
||||
@@ -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;
|
||||
@@ -21,9 +22,10 @@ export type coSttnState = {
|
||||
};
|
||||
|
||||
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;
|
||||
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;
|
||||
@@ -44,7 +46,7 @@ export const coSttnActionsExport: (set: any) => coSttnActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
coSttnInit: async (pageNo:string, pageCnt:string, con: string) => {
|
||||
coSttnInit: async (pageNo: string, pageCnt: string, con: string) => {
|
||||
try {
|
||||
|
||||
const coSttnRes = await getFetchWithCount(
|
||||
@@ -67,7 +69,7 @@ export const coSttnActionsExport: (set: any) => coSttnActions = (
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
coSttnSearch: async (pageNo:string, pageCnt:string, con: string) => {
|
||||
coSttnSearch: async (pageNo: string, pageCnt: string, con: string) => {
|
||||
try {
|
||||
const coSttnRes = await getFetchWithCount(
|
||||
fetchType.WR,
|
||||
@@ -92,7 +94,7 @@ export const coSttnActionsExport: (set: any) => coSttnActions = (
|
||||
...state.coSttn,
|
||||
coSttnRes: coSttnRes.data,
|
||||
isInit: false,
|
||||
coSttnResCount : coSttnRes.count,
|
||||
coSttnResCount: coSttnRes.count,
|
||||
},
|
||||
};
|
||||
});
|
||||
@@ -100,7 +102,7 @@ export const coSttnActionsExport: (set: any) => coSttnActions = (
|
||||
console.log("error", erTxt);
|
||||
}
|
||||
},
|
||||
coSttnTxtSearch: async (pageNo:string, pageCnt:string, con: string, txt: string) => {
|
||||
coSttnTxtSearch: async (pageNo: string, pageCnt: string, con: string, txt: string) => {
|
||||
try {
|
||||
const coSttnRes = await getFetchWithCount(
|
||||
fetchType.WR,
|
||||
@@ -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 +1,5 @@
|
||||
{
|
||||
"deleteMsg" : "{{name}}가 삭제되었습니다.",
|
||||
"deleteMsg": "{{name}}가 삭제되었습니다.",
|
||||
"insertMsg": "{{name}}가 저장되었습니다.",
|
||||
"updateMsg": "{{name}}가 수정되었습니다.",
|
||||
"errorMsg": "{{name}} 중 오류가 발생했습니다.",
|
||||
@@ -12,19 +12,15 @@
|
||||
"isUpdateMsg": "수정한 정보를 저장하시겠습니까?",
|
||||
"isInsertMsg": "등록하시겠습니까?",
|
||||
"isUpdatetMsg": "수정하시겠습니까?",
|
||||
"matchFinishMsg" : "{{name}}이(가) 완료되었습니다.",
|
||||
"matchFinishMsg": "{{name}}이(가) 완료되었습니다.",
|
||||
"excelDownErrMsg": "다운로드할 데이터가 없습니다.",
|
||||
"isMatchFinishMsg":" 매칭완료를 진행하시겠습니까?",
|
||||
"isNotMatchFinishMsg":"검토완료중 매칭완료 여부를 체크한 항목이 없습니다.",
|
||||
"canNotChangeMatStateMsg":"매칭완료된 항목은 상태를 변경할 수 없습니다.",
|
||||
|
||||
|
||||
|
||||
"isMatchFinishMsg": " 매칭완료를 진행하시겠습니까?",
|
||||
"isNotMatchFinishMsg": "검토완료중 매칭완료 여부를 체크한 항목이 없습니다.",
|
||||
"canNotChangeMatStateMsg": "매칭완료된 항목은 상태를 변경할 수 없습니다.",
|
||||
"isInitPw": "비밀번호를 초기화하시겠습니까?",
|
||||
"alreadyInsertedErrMsg": "사업자번호 {{num}}(은)는 이미 등록되었습니다. 다시 등록해주세요.",
|
||||
"saveRowErrMsg": "수정을 원하는 행을 선택하고 저장버튼을 눌러주세요.",
|
||||
"costCalcErrMsg":"공사비 계산 진행 후 저장을 눌러주세요",
|
||||
"costCalcErrMsg": "공사비 계산 진행 후 저장을 눌러주세요",
|
||||
"maxYearErrMsg": "최대 {{year}}년까지 선택가능합니다.",
|
||||
"checkQtyMsg": "요구수량(m³/일)을 확인해주세요 계산할 수 없습니다."
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user