Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba56426947 | ||
|
|
1e650a72ba | ||
|
|
2c6327bc3a | ||
|
|
9973b35802 | ||
|
|
8653335aa9 |
@@ -162,10 +162,11 @@ export default function CoSttn() {
|
||||
const initPassword = () => {
|
||||
if (upadateData) {
|
||||
const dmdInfoId = upadateData.dmdInfoId;
|
||||
const dmdInfoSliceId = `${dmdInfoId.slice(0, 3)}-${dmdInfoId.slice(3, 5)}-${dmdInfoId.slice(5, 10)}-${dmdInfoId.slice(10)}`
|
||||
const handleConfirm = () => {
|
||||
coSttnPwInit(dmdInfoId);
|
||||
};
|
||||
confirmToast(t('isInitPw'), handleConfirm);
|
||||
confirmToast( t('isInitPw', { dmdInfoId: dmdInfoSliceId }), handleConfirm, 'text-2xl');
|
||||
} else {
|
||||
toast.error("비밀번호 초기화를 원하는 행을 선택해주세요.")
|
||||
}
|
||||
|
||||
@@ -118,13 +118,33 @@ export default function Page() {
|
||||
const rainPageChange = (pageNo: number) => {
|
||||
if (pageNo > 0) {
|
||||
setRainPageNation(pageNo);
|
||||
rainChkInit(pageNo, rainPageSize, searchYear, commonCd);
|
||||
if (fcltNm) {
|
||||
rainChkNmSearch(
|
||||
pageNo,
|
||||
rainPageSize,
|
||||
searchYear,
|
||||
commonCd,
|
||||
fcltNm
|
||||
);
|
||||
} else {
|
||||
rainChkInit(pageNo, rainPageSize, searchYear, commonCd);
|
||||
}
|
||||
}
|
||||
};
|
||||
const rswtPageChange = (pageNo: number) => {
|
||||
if (pageNo > 0) {
|
||||
setRswtPageNation(pageNo);
|
||||
rswtChkgdnInit(pageNo, rswtPageSize, searchYear, commonCd);
|
||||
if (fcltNm) {
|
||||
rswtChkNmSearch(
|
||||
pageNo,
|
||||
rainPageSize,
|
||||
searchYear,
|
||||
commonCd,
|
||||
fcltNm
|
||||
);
|
||||
} else {
|
||||
rswtChkgdnInit(pageNo, rswtPageSize, searchYear, commonCd);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -83,14 +83,34 @@ export default function Page() {
|
||||
const rainPageChange = (pageNo: number) => {
|
||||
if (pageNo > 0) {
|
||||
setRainPageNation(pageNo);
|
||||
rainChkSttnInit(pageNo, rainPageSize, searchYear, commonCd);
|
||||
if (fcltNm) {
|
||||
rainChkSttnNmSearch(
|
||||
pageNo,
|
||||
rainPageSize,
|
||||
searchYear,
|
||||
commonCd,
|
||||
fcltNm
|
||||
);
|
||||
} else {
|
||||
rainChkSttnInit(pageNo, rainPageSize, searchYear, commonCd);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const rswtPageChange = (pageNo: number) => {
|
||||
if (pageNo > 0) {
|
||||
setRswtPageNation(pageNo);
|
||||
rswtChkSttnInit(pageNo, rswtPageSize, searchYear, commonCd);
|
||||
if (fcltNm) {
|
||||
rswtChkNmSttnSearch(
|
||||
pageNo,
|
||||
rainPageSize,
|
||||
searchYear,
|
||||
commonCd,
|
||||
fcltNm
|
||||
);
|
||||
} else {
|
||||
rswtChkSttnInit(pageNo, rswtPageSize, searchYear, commonCd);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -132,20 +132,20 @@ export const excelToRainChkData = (excelData: any, year: string) => {
|
||||
bdstNm: item["시설명"] ?? "",
|
||||
bdstRuseFcltSn: Number(item["NO"]),
|
||||
chckYmd: checkYmd,
|
||||
spwtPositn: item["유량측정방법"] ?? "",
|
||||
rgtr: TEST_UUID,
|
||||
oilqMeasMthd: item["운영관리형태"] ?? "",
|
||||
operMngCd: item["운영관리형태"] ?? "",
|
||||
anlOperCst: parseRawValue(item["연간운영비(원/년)"]),
|
||||
operMngCd: item["유량측정방법"] ?? "",
|
||||
oilqMeasMthd: item["유량측정방법"] ?? "",
|
||||
guideDetails: makeGuidDetail,
|
||||
rainyDetails: [
|
||||
{
|
||||
ph: item["PH"],
|
||||
utztnUsgCd: item["이용용도"],
|
||||
trbt: parseRawValue(item["탁도"]),
|
||||
grssClfg: parseRawValue(item["총대장균군수"]),
|
||||
etc: item["기타"] || "", // 필드 누락 방지
|
||||
vltnDt: vltnDt || "-",
|
||||
vltnMttr: item["위반사항"] || "-",
|
||||
vltnDt: vltnDt || "",
|
||||
vltnMttr: item["위반사항"] || "",
|
||||
levyAmt: parseRawValue(item["과태료부과금액(천원)"]),
|
||||
rgtr: TEST_UUID,
|
||||
},
|
||||
@@ -177,12 +177,6 @@ console.log("rainChkgdData", rainChkgdData);
|
||||
defaultMessage + `유량측정방법: 위탁 혹은 자체 만 허용) /입력값:${rain.oilqMeasMthd}`
|
||||
);
|
||||
}
|
||||
if (rain.spwtPositn.length > 1 && !chkSpwtPositnType.includes(rain.spwtPositn)) {
|
||||
issues.push(
|
||||
defaultMessage + `측정위치: 유량계, 수위계, 펌프적산전력계, 기타 중 하나만 허용) /입력값:${rain.spwtPositn}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
rain.rainyDetails?.forEach((key) => {
|
||||
if (key.ph?.length > 1 && isInvalidNumber(key.ph)) {
|
||||
|
||||
@@ -63,7 +63,7 @@ export const rainChkZod = z.object({
|
||||
z.object({
|
||||
chkgdnSn: z.number().nullable(),
|
||||
utztnUsgCd: z.string(),
|
||||
ph: z.number().nullable(),
|
||||
ph:z.string().nullish(),
|
||||
trbt: z.number().nullable(),
|
||||
grssClfg: z.number().nullable(),
|
||||
etc: z.string().nullable(),
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import {
|
||||
chkMngType,
|
||||
chkSpwtPositnType,
|
||||
useTypes,
|
||||
type Buildingtype,
|
||||
} from "../rainChkgdn/excel";
|
||||
import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { rswtChkZodType } from ".";
|
||||
import {
|
||||
isInvalidDate,
|
||||
isInvalidNumber,
|
||||
parseRawValue,
|
||||
} from "@/components/lib/func/excelFunc";
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import type { rswtChkZodType } from ".";
|
||||
import {
|
||||
chkSpwtPositnType,
|
||||
useTypes,
|
||||
type Buildingtype
|
||||
} from "../rainChkgdn/excel";
|
||||
|
||||
export const rswtMakeExcelSample = (
|
||||
buildings: Buildingtype[],
|
||||
@@ -284,15 +283,6 @@ const rswtExcelDataCheck = (
|
||||
defaultMessage + ` 처리용량(m³): 숫자 형식 아님 (${rswt.prcsCpct})`
|
||||
);
|
||||
}
|
||||
if (
|
||||
rswt.oilqMeasMthd.length > 1 &&
|
||||
!chkMngType.includes(rswt.oilqMeasMthd)
|
||||
) {
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
`유량측정방법: 위탁 혹은 자체 만 허용) /입력값:${rswt.oilqMeasMthd}`
|
||||
);
|
||||
}
|
||||
if (
|
||||
rswt.spwtPositn.length > 1 &&
|
||||
!chkSpwtPositnType.includes(rswt.spwtPositn)
|
||||
|
||||
@@ -163,11 +163,11 @@ export const rswtChkHeadListExport: TableUpperProps[] = [
|
||||
},
|
||||
{ id: "trbt", title: "탁도(NTU)", upName: "useQuilty", upSequnce: 3 ,type: "number"},
|
||||
{ id: "bod", title: "BOD(mg/L)", upName: "useQuilty", upSequnce: 4 ,type: "number"},
|
||||
{ id: "smll", title: "냄새", upName: "useQuilty", upSequnce: 5 ,type: "number"},
|
||||
{ id: "smll", title: "냄새", upName: "useQuilty", upSequnce: 5 ,type: "text"},
|
||||
{ id: "crmty", title: "색도(도)", upName: "useQuilty", upSequnce: 6 ,type: "number"},
|
||||
{ id: "tn", title: "총질소(T-N)(mg/L)", upName: "useQuilty", upSequnce: 7 ,type: "number"},
|
||||
{ id: "tph", title: "총인(T-P)(mg/L)", upName: "useQuilty", upSequnce: 8 ,type: "number"},
|
||||
{ id: "ph", title: "수소이온농도(PH)", upName: "useQuilty", upSequnce: 9,type: "number" },
|
||||
{ id: "ph", title: "수소이온농도(PH)", upName: "useQuilty", upSequnce: 9,type: "text" },
|
||||
{ id: "clIonQnt", title: "염화물(mg/L)", upName: "useQuilty", upSequnce: 10 ,type: "number"},
|
||||
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ export const rswtChkSttnHeadListExport: TableUpperProps[] = [
|
||||
title: "냄새",
|
||||
upName: "useQuilty",
|
||||
upSequnce: 5,
|
||||
type: "number",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
id: "crmty",
|
||||
@@ -64,7 +64,7 @@ export const rswtChkSttnHeadListExport: TableUpperProps[] = [
|
||||
upSequnce: 8,
|
||||
type: "number",
|
||||
},
|
||||
{ id: "ph", title: "수소이온농도(PH)", upName: "useQuilty", upSequnce: 9, type: "number" },
|
||||
{ id: "ph", title: "수소이온농도(PH)", upName: "useQuilty", upSequnce: 9, type: "text" },
|
||||
{
|
||||
id: "clIonQnt",
|
||||
title: "염화물(mg/L)",
|
||||
|
||||
@@ -2,8 +2,18 @@ import { numSize } from "@/app/store/common/code/basicCode";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
|
||||
import { Checkbox, Input, TableCell, TableRow } from "@common/components/ui";
|
||||
import { formatCommaNumber, handleCommaNumberChange } from "./commom";
|
||||
import {
|
||||
Checkbox,
|
||||
Input,
|
||||
TableCell,
|
||||
TableRow,
|
||||
} from "@common/components/ui";
|
||||
import moment from "moment";
|
||||
import {
|
||||
formatCommaNumber,
|
||||
formatYyyymmdd,
|
||||
handleCommaNumberChange
|
||||
} from "./commom";
|
||||
|
||||
export const rainChkTableData = (chkData: rainChkZodType[]) => {
|
||||
// 1. chkgdnSn + utztnUsgCd 기준 누계 정보 만들기
|
||||
@@ -57,9 +67,7 @@ export const rswtChkTableData = (chkData: rswtChkZodType[]) => {
|
||||
// 1. chkgdnSn + utztnUsgCd 기준 누계 정보 만들기
|
||||
const makeRswtData: any[] = [];
|
||||
|
||||
|
||||
if (chkData && chkData.length > 0) {
|
||||
|
||||
chkData?.forEach((root) => {
|
||||
root.rswtrDetails.forEach((detail) => {
|
||||
let flatRswtChk = {};
|
||||
@@ -96,20 +104,19 @@ export const chRowspanTable = (
|
||||
toggleSelection: (pk: number, checked: boolean) => void,
|
||||
selectedIds: number[],
|
||||
handleCellClick: (index: number, headId: string) => void,
|
||||
disable? : boolean
|
||||
disable?: boolean
|
||||
) => {
|
||||
let order = 0
|
||||
let order = 0;
|
||||
// rowspan된 셀 렌더링 여부 추적용
|
||||
const renderedMap = new Map<string, Set<number>>();
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* {makeTableData.map((row, rowIndex) => ( */}
|
||||
{makeTableData && makeTableData.length > 0 ? (makeTableData.map((row, rowIndex) => (
|
||||
<TableRow key={rowIndex}>
|
||||
{headList
|
||||
.map((head) => {
|
||||
|
||||
{makeTableData && makeTableData.length > 0 ? (
|
||||
makeTableData.map((row, rowIndex) => (
|
||||
<TableRow key={rowIndex}>
|
||||
{headList.map((head) => {
|
||||
const key = head.id;
|
||||
const isMerged = head.mergeCell;
|
||||
const value = row[key];
|
||||
@@ -118,7 +125,6 @@ export const chRowspanTable = (
|
||||
if (isMerged) {
|
||||
const renderedSet = renderedMap.get(key) ?? new Set<number>();
|
||||
if (renderedSet.has(rowIndex)) {
|
||||
|
||||
return null; // 이미 렌더링된 셀은 skip
|
||||
}
|
||||
|
||||
@@ -143,14 +149,17 @@ export const chRowspanTable = (
|
||||
></Checkbox>
|
||||
) : key === "order" ? (
|
||||
++order
|
||||
) : (
|
||||
// value
|
||||
(["anlOperCst", "dtfcltCpct", "prcsCpct"].includes(head.id)) ? (
|
||||
) : // value
|
||||
["anlOperCst", "dtfcltCpct", "prcsCpct"].includes(
|
||||
head.id
|
||||
) ? (
|
||||
formatCommaNumber(value)
|
||||
) : (
|
||||
<>{value}</>
|
||||
)
|
||||
)}
|
||||
) : key === "chckYmd" ? (
|
||||
<>{formatYyyymmdd(value)}</>
|
||||
) :
|
||||
(
|
||||
<>{value}</>
|
||||
)}
|
||||
</TableCell>
|
||||
);
|
||||
}
|
||||
@@ -163,23 +172,48 @@ export const chRowspanTable = (
|
||||
onClick={() => handleCellClick(rowIndex, head.id)}
|
||||
>
|
||||
{head.edit === true ? (
|
||||
(["levyAmt", "anlOperCst", "dtfcltCpct", "prcsCpct"].includes(head.id)) ? (
|
||||
[
|
||||
"levyAmt",
|
||||
"anlOperCst",
|
||||
"dtfcltCpct",
|
||||
"prcsCpct",
|
||||
].includes(head.id) ? (
|
||||
<Input
|
||||
className={`${head.type === "number" ? "text-right" : "text-center"} !text-xl`}
|
||||
type={head.type}
|
||||
onChange={(e) => {
|
||||
handleCommaNumberChange(e, val =>
|
||||
handleChange(rowIndex, head.id, val))
|
||||
handleCommaNumberChange(e, (val) =>
|
||||
handleChange(rowIndex, head.id, val)
|
||||
);
|
||||
}}
|
||||
value={formatCommaNumber(value) || ""}
|
||||
disabled={!selectedIds.includes(row.chkgdnSn)}
|
||||
maxLength={numSize}
|
||||
onInput={(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
if (head.type === 'number' && e.target.value.length > numSize) {
|
||||
if (
|
||||
head.type === "number" &&
|
||||
e.target.value.length > numSize
|
||||
) {
|
||||
e.target.value = e.target.value.slice(0, numSize);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
) : ["vltnDt"].includes(head.id) ? (
|
||||
<Input
|
||||
type="date"
|
||||
onChange={(e) => {
|
||||
// 브라우저에서 선택한 값은 "YYYY-MM-DD"
|
||||
const rawDate = e.target.value; // e.g. "2025-06-01"
|
||||
const yyyymmdd = moment(rawDate).format("YYYYMMDD");
|
||||
handleChange(rowIndex, head.id, yyyymmdd);
|
||||
}}
|
||||
value={
|
||||
value
|
||||
? moment(value, "YYYYMMDD").format("YYYY-MM-DD")
|
||||
: ""
|
||||
}
|
||||
disabled={!selectedIds.includes(row.chkgdnSn)}
|
||||
/>
|
||||
) : (
|
||||
<Input
|
||||
className={`${head.type === "number" ? "text-right" : "text-center"} !text-xl`}
|
||||
@@ -191,28 +225,52 @@ export const chRowspanTable = (
|
||||
disabled={!selectedIds.includes(row.chkgdnSn)}
|
||||
maxLength={numSize}
|
||||
onInput={(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
if (head.type === 'number' && e.target.value.length > numSize) {
|
||||
if (
|
||||
head.type === "number" &&
|
||||
e.target.value.length > numSize
|
||||
) {
|
||||
e.target.value = e.target.value.slice(0, numSize);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
) : ["smll", "ph"].includes(head.id) && head.type === "text" ? (
|
||||
<>-</>
|
||||
) : [
|
||||
"totalSplyUswtrUtztnQnt",
|
||||
"totalRuseFcltUtztnQnt",
|
||||
"splyUswtrUtztnQnt",
|
||||
"ruseFcltUtztnQnt",
|
||||
"levyAmt",
|
||||
].includes(head.id) ? (
|
||||
<span
|
||||
className={
|
||||
[
|
||||
"totalSplyUswtrUtztnQnt",
|
||||
"totalRuseFcltUtztnQnt",
|
||||
"splyUswtrUtztnQnt",
|
||||
"ruseFcltUtztnQnt",
|
||||
].includes(head.id)
|
||||
? "underline text-blue-600 cursor-pointer"
|
||||
: ""
|
||||
}
|
||||
>
|
||||
{formatCommaNumber(value)}
|
||||
</span>
|
||||
) : (
|
||||
(["totalSplyUswtrUtztnQnt", "totalRuseFcltUtztnQnt", "splyUswtrUtztnQnt", "ruseFcltUtztnQnt", "levyAmt"].includes(head.id)) ? (
|
||||
<span className={["totalSplyUswtrUtztnQnt", "totalRuseFcltUtztnQnt", "splyUswtrUtztnQnt", "ruseFcltUtztnQnt"].includes(head.id) ? "underline text-blue-600 cursor-pointer" : ""}>
|
||||
{formatCommaNumber(value)}
|
||||
</span>
|
||||
) : (
|
||||
<>{value}</>
|
||||
)
|
||||
<>{value}</>
|
||||
)}
|
||||
</TableCell>
|
||||
);
|
||||
})}
|
||||
</TableRow>
|
||||
))) : (
|
||||
</TableRow>
|
||||
))
|
||||
) : (
|
||||
<TableRow>
|
||||
<TableCell colSpan={headList.length} className="h-24 text-center text-gray-500">
|
||||
<TableCell
|
||||
colSpan={headList.length}
|
||||
className="h-24 text-center text-gray-500"
|
||||
>
|
||||
조회된 결과가 없습니다.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
@@ -221,16 +279,17 @@ export const chRowspanTable = (
|
||||
);
|
||||
};
|
||||
|
||||
export const headVisibleChange = (headList: TableUpperProps[], isEdit: boolean) => {
|
||||
export const headVisibleChange = (
|
||||
headList: TableUpperProps[],
|
||||
isEdit: boolean
|
||||
) => {
|
||||
return headList.forEach((head) => {
|
||||
if (head.edit !== undefined)
|
||||
head.edit = isEdit;
|
||||
if (head.id === 'checkBox') {
|
||||
head.visible = false
|
||||
if (head.edit !== undefined) head.edit = isEdit;
|
||||
if (head.id === "checkBox") {
|
||||
head.visible = false;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleChange = (
|
||||
rowIndex: number,
|
||||
@@ -253,8 +312,6 @@ const handleChange = (
|
||||
})
|
||||
);
|
||||
};
|
||||
;
|
||||
|
||||
export const InputTableBody = (
|
||||
chgRes: any[] | [],
|
||||
headList: TableUpperProps[],
|
||||
@@ -289,8 +346,21 @@ export const InputTableBody = (
|
||||
return (
|
||||
<TableRow key={dataIndex + "row"}>
|
||||
{headList.map((head, headIndex) => {
|
||||
const isTextColumn = head.id === '구분' || head.id === '용수명';
|
||||
const textAlignClass = isTextColumn ? 'text-center' : 'text-right';
|
||||
//냄새, ph면 계산 못하게 - 로 수정
|
||||
if (["smll", "ph"].includes(head.id)) {
|
||||
return (
|
||||
<TableCell
|
||||
key={head.id + headIndex}
|
||||
className={`w-36 ${bgClass} text-center !text-xl`}
|
||||
>
|
||||
<span>-</span>
|
||||
</TableCell>
|
||||
);
|
||||
}
|
||||
const isTextColumn = head.id === "구분" || head.id === "용수명";
|
||||
const textAlignClass = isTextColumn
|
||||
? "text-center"
|
||||
: "text-right";
|
||||
|
||||
// 총합계 행이면 "구분"에서 colSpan=2로 병합
|
||||
if (
|
||||
@@ -318,8 +388,13 @@ export const InputTableBody = (
|
||||
// 총합계 행의 나머지 셀에도 색상 적용
|
||||
if (data["구분"] === 0 || data["용수명"] === 0) {
|
||||
return (
|
||||
<TableCell key={head.id + headIndex} className="bg-[#d5e1eb] font-bold text-right">
|
||||
{Number(data[head.id]) ? formatCommaNumber(data[head.id as keyof any]) : data[head.id as keyof any] ?? ""}
|
||||
<TableCell
|
||||
key={head.id + headIndex}
|
||||
className="bg-[#d5e1eb] font-bold text-right"
|
||||
>
|
||||
{Number(data[head.id])
|
||||
? formatCommaNumber(data[head.id as keyof any])
|
||||
: (data[head.id as keyof any] ?? "")}
|
||||
</TableCell>
|
||||
);
|
||||
}
|
||||
@@ -328,21 +403,35 @@ export const InputTableBody = (
|
||||
const rowSpan = getRowSpan(chgRes, head.id, dataIndex);
|
||||
if (rowSpan === 0) return null;
|
||||
return (
|
||||
<TableCell key={head.id + headIndex} rowSpan={rowSpan} className={`w-36 align-middle text-center whitespace-nowrap ${bgClass}`}>
|
||||
{Number(data[head.id]) ? formatCommaNumber(data[head.id as keyof any]) : data[head.id as keyof any] ?? ""}
|
||||
<TableCell
|
||||
key={head.id + headIndex}
|
||||
rowSpan={rowSpan}
|
||||
className={`w-36 align-middle text-center whitespace-nowrap ${bgClass}`}
|
||||
>
|
||||
{Number(data[head.id])
|
||||
? formatCommaNumber(data[head.id as keyof any])
|
||||
: (data[head.id as keyof any] ?? "")}
|
||||
</TableCell>
|
||||
);
|
||||
}
|
||||
// 기본 셀
|
||||
// return head.edit === true && data.edit !== false ? (
|
||||
return isEditable && head.edit === true && data.edit !== false ? (
|
||||
<TableCell key={head.id + headIndex} className={`w-36 ${bgClass}`}>
|
||||
<TableCell
|
||||
key={head.id + headIndex}
|
||||
className={`w-36 ${bgClass}`}
|
||||
>
|
||||
<Input
|
||||
// className={`${head.id !== "utztnUsgCd" ? "text-right" : "text-center"} !text-xl h-10 w-full`}
|
||||
className={`${textAlignClass} !text-xl h-10 w-full`}
|
||||
onChange={(e) =>
|
||||
handleCommaNumberChange(e, val =>
|
||||
handleChange(dataIndex, head.id, String(val), setInputData)
|
||||
handleCommaNumberChange(e, (val) =>
|
||||
handleChange(
|
||||
dataIndex,
|
||||
head.id,
|
||||
String(val),
|
||||
setInputData
|
||||
)
|
||||
)
|
||||
}
|
||||
value={formatCommaNumber(data[head.id as keyof any]) ?? ""}
|
||||
@@ -350,15 +439,20 @@ export const InputTableBody = (
|
||||
/>
|
||||
</TableCell>
|
||||
) : (
|
||||
<TableCell key={head.id + headIndex} className={`w-36 ${bgClass}`}>
|
||||
<TableCell
|
||||
key={head.id + headIndex}
|
||||
className={`w-36 ${bgClass}`}
|
||||
>
|
||||
<div
|
||||
// className={`
|
||||
// ${head.id !== "utztnUsgCd" ? "text-right" : "text-center"}
|
||||
// !text-xl w-full h-10
|
||||
// ${head.id !== "utztnUsgCd" ? "text-right" : "text-center"}
|
||||
// !text-xl w-full h-10
|
||||
// `}
|
||||
className={`${textAlignClass} !text-xl w-full h-10`}
|
||||
>
|
||||
{Number(data[head.id]) ? formatCommaNumber(data[head.id as keyof any]) : data[head.id as keyof any] ?? ""}
|
||||
{Number(data[head.id])
|
||||
? formatCommaNumber(data[head.id as keyof any])
|
||||
: (data[head.id as keyof any] ?? "")}
|
||||
</div>
|
||||
</TableCell>
|
||||
);
|
||||
@@ -368,11 +462,14 @@ export const InputTableBody = (
|
||||
})}
|
||||
{chgRes.length === 0 && (
|
||||
<TableRow>
|
||||
<TableCell colSpan={headList.length} className="h-24 text-center text-gray-500">
|
||||
<TableCell
|
||||
colSpan={headList.length}
|
||||
className="h-24 text-center text-gray-500"
|
||||
>
|
||||
조회된 결과가 없습니다.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
type SheetParameter,
|
||||
} from "@common/business_components/ui";
|
||||
import { Button } from "@common/components/ui";
|
||||
import moment from "moment";
|
||||
import type { RefObject } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
@@ -150,6 +151,15 @@ export const formatCommaNumber = (
|
||||
return num.toLocaleString();
|
||||
};
|
||||
|
||||
//내가 쓰는 값이 숫자이냐 아니냐
|
||||
export const isNumeric =(value: string) => {
|
||||
if(value&&value.length>0){
|
||||
return value?.trim() !== "" && !isNaN(Number(value));
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export const getCityOrSgg = (ref: RefObject<ReturnType>) => {
|
||||
let con;
|
||||
if (ref.current != null)
|
||||
@@ -163,6 +173,7 @@ export const getCityOrSgg = (ref: RefObject<ReturnType>) => {
|
||||
|
||||
export const safeDate = (value: any): Date | undefined => {
|
||||
const date = new Date(value);
|
||||
console.log(' date ', date)
|
||||
return isNaN(date.getTime()) ? undefined : date;
|
||||
};
|
||||
|
||||
@@ -201,11 +212,11 @@ export const formatPhoneNumber = (tel: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const confirmToast = (content: string, saveFunc: () => void) => {
|
||||
export const confirmToast = (content: string, saveFunc: () => void, contentClass?:string) => {
|
||||
toast(
|
||||
(t) => (
|
||||
<span className="flex flex-col items-center">
|
||||
<div className="mb-6">{content}</div>
|
||||
<div className={`mb-6 ${contentClass}`} >{content}</div>
|
||||
<div className="flex flex-row space-x-2">
|
||||
<Button
|
||||
size={"sm"}
|
||||
@@ -253,3 +264,13 @@ export const showConfirmToast = (message: string) => {
|
||||
{ duration: Infinity }
|
||||
); // 수동 닫기
|
||||
};
|
||||
|
||||
// yyyy-mm-dd 형태로 포맷
|
||||
export const formatYyyymmdd = (val: string | undefined) => {
|
||||
if (!val) return "";
|
||||
if (/^\d{8}$/.test(val)) {
|
||||
return moment(val, "YYYYMMDD").format("YYYY-MM-DD");
|
||||
}
|
||||
const m = moment(val);
|
||||
return m.isValid() ? m.format("YYYY-MM-DD") : val;
|
||||
};
|
||||
@@ -24,10 +24,11 @@ import { SelectBox } from "@common/business_components";
|
||||
import { DatePicker, FormUi, UiModal } from "@common/business_components/ui";
|
||||
import { Form, FormField } from "@common/business_components/ui/form";
|
||||
import { Button, Input, Label } from "@common/components";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { useFieldArray, type UseFormReturn } from "react-hook-form";
|
||||
import MngRegFormDetail from "../mngReg/mngRegFormDetail/mngRegFormDetail";
|
||||
import {
|
||||
//confirmToast,
|
||||
formatCommaNumber,
|
||||
handleCommaNumberChange,
|
||||
safeDate,
|
||||
@@ -38,6 +39,9 @@ import type { DemandCompType } from "@common/business_components/ui/sdmInsertFor
|
||||
import RuseMngTableForm from "@/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm";
|
||||
import type { SelectDataType } from "@common/business_components";
|
||||
import { BuseWaterQulity } from "./buseWaterQulity/buseWaterQulity";
|
||||
import toast from "react-hot-toast";
|
||||
import { useTranslation } from "react-i18next";
|
||||
//import { useTranslation } from "react-i18next";
|
||||
|
||||
export function PbnstBuseForm({
|
||||
indexMng = 0,
|
||||
@@ -54,6 +58,8 @@ export function PbnstBuseForm({
|
||||
setIndexBiz: (index: number) => void;
|
||||
readonly?: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation("base");
|
||||
|
||||
const {
|
||||
code,
|
||||
pbnst,
|
||||
@@ -157,22 +163,25 @@ export function PbnstBuseForm({
|
||||
}
|
||||
}, [fcBizs, indexBiz, setIndexBiz]);
|
||||
// 2. Define a submit handler.
|
||||
function addRuseFcltObj() {
|
||||
const addRuseFcltObj = useCallback(async () => {
|
||||
|
||||
const formRuse = form.getValues(`items.${indexMng}`);
|
||||
const formBizs = form.getValues(`items.${indexMng}.fcBizs`);
|
||||
const pbnstBizCycle = formBizs.length;
|
||||
|
||||
// 🧩 새로운 fcBizs 기본 객체 생성 (필수값만 채우고 나머지는 default로)
|
||||
const newItem = fcBizSchema.parse({
|
||||
cycl: pbnstBizCycle + 1,
|
||||
pbnstRuseFcltId: formRuse.pbnstRuseFcltId,
|
||||
fcOrgwts: undefined,
|
||||
pplInstls: undefined,
|
||||
fcDemands: undefined,
|
||||
});
|
||||
appendBiz(newItem);
|
||||
setIndexBiz(pbnstBizCycle); // 새로 추가된 차수로 포커스 이동
|
||||
}
|
||||
const newItem = fcBizSchema.parse({
|
||||
cycl: pbnstBizCycle + 1,
|
||||
pbnstRuseFcltId: formRuse.pbnstRuseFcltId,
|
||||
fcOrgwts: [],
|
||||
|
||||
pplInstls: [],
|
||||
fcDemands: [],
|
||||
});
|
||||
await appendBiz(newItem);
|
||||
toast.success(t('insertRuseBiz',{cycle: pbnstBizCycle + 1}))
|
||||
setIndexBiz(pbnstBizCycle);
|
||||
}, [form, indexMng, indexBiz, appendBiz, setIndexBiz]);
|
||||
|
||||
const { fields: fcDemands, append: appendDemand } = useFieldArray({
|
||||
control: form.control,
|
||||
name: `items.${indexMng}.fcBizs.${indexBiz}.fcDemands`,
|
||||
@@ -206,7 +215,7 @@ export function PbnstBuseForm({
|
||||
}
|
||||
}, [ppiYn, indexMng, indexBiz]);
|
||||
|
||||
const plusHist = () => {
|
||||
const plusHist = useCallback(() => {
|
||||
if (
|
||||
form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.pbnstRuseFcltBizSn`)
|
||||
) {
|
||||
@@ -227,9 +236,9 @@ export function PbnstBuseForm({
|
||||
cpct: 0,
|
||||
});
|
||||
}
|
||||
};
|
||||
}, [indexMng, indexBiz, appendPpl, form]);
|
||||
|
||||
const plusArray = () => {
|
||||
const plusArray = useCallback(() => {
|
||||
appendDemand({
|
||||
dmdCoNm: "",
|
||||
daddr: "",
|
||||
@@ -248,7 +257,7 @@ export function PbnstBuseForm({
|
||||
dmdInfoId: "",
|
||||
//telno: "",
|
||||
});
|
||||
};
|
||||
}, [indexMng, indexBiz, appendDemand, form]);
|
||||
|
||||
const removeSelected = () => {
|
||||
const nowPPl = form.getValues(
|
||||
@@ -293,7 +302,7 @@ export function PbnstBuseForm({
|
||||
}, [form.formState, indexMng, indexBiz]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("form.formState ", form.formState);
|
||||
//console.log("form.formState ", form.formState);
|
||||
}, [form.formState]);
|
||||
|
||||
const pbnstBiz = form.watch(`items.${indexMng}.fcBizs`);
|
||||
@@ -489,17 +498,16 @@ export function PbnstBuseForm({
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<BuseWaterQulity
|
||||
h1Title={`하수처리수 재이용시설 보증수질 `}
|
||||
subTitle="※재처리시설이 있는 경우만 작성"
|
||||
form={form}
|
||||
moClass="grid grid-cols-12 gap-4"
|
||||
sonClass="col-span-4"
|
||||
indexMng={indexMng}
|
||||
indexBiz={indexBiz}
|
||||
readonly={readonly}
|
||||
/>
|
||||
<BuseWaterQulity
|
||||
h1Title={`하수처리수 재이용시설 보증수질 `}
|
||||
subTitle="※재처리시설이 있는 경우만 작성"
|
||||
form={form}
|
||||
moClass="grid grid-cols-12 gap-4"
|
||||
sonClass="col-span-4"
|
||||
indexMng={indexMng}
|
||||
indexBiz={indexBiz}
|
||||
readonly={readonly}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div key={"hasu"}>
|
||||
@@ -533,7 +541,10 @@ export function PbnstBuseForm({
|
||||
수요처 신규등록
|
||||
</Button>
|
||||
</div>
|
||||
<div ref={demandsContainerRef}>
|
||||
<div
|
||||
key={`fcDemands-${indexMng}-${indexBiz}`}
|
||||
ref={demandsContainerRef}
|
||||
>
|
||||
{fcDemands.map((field, index) => (
|
||||
<div
|
||||
key={field.id} // useFieldArray의 고유 id를 key로 사용
|
||||
|
||||
-1
@@ -39,7 +39,6 @@ export function BuseWaterQulity({
|
||||
form.getValues(`items.${indexMng}.pbnstRuseFcltId`) +
|
||||
String(form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.cycl`));
|
||||
|
||||
console.log("checkPkAndCycle ", checkPkAndCycle);
|
||||
if (chekcPk !== checkPkAndCycle) {
|
||||
if (watchPH && watchPH !== undefined) {
|
||||
const [frontPH, backPH] = watchPH.split("~");
|
||||
|
||||
@@ -78,16 +78,26 @@ export default function RainChkgdTable({
|
||||
useEffect(() => {
|
||||
setSelectedIds([])// 셀렉트 초기화를 위한 작업
|
||||
if (rainChkData && rainChkData.length > 0) {
|
||||
|
||||
const rainChg = rainChkData?.map((item: any) => {
|
||||
const bud = tableData([item.building], { code });
|
||||
const rainyDetails= item.rainyDetails.map((detail)=>{
|
||||
return(
|
||||
{
|
||||
...detail,
|
||||
// 일단 테이블에서 사용하기 위해 넘버 전환
|
||||
ph: detail.ph&& !isNaN(detail.ph)?Number(detail.ph):detail.ph
|
||||
}
|
||||
)
|
||||
})
|
||||
return {
|
||||
...item,
|
||||
...bud[0],
|
||||
rainyDetails:rainyDetails,
|
||||
rowspan: item.rainyDetails?.length,
|
||||
};
|
||||
});
|
||||
|
||||
console.log('rainChg ', rainChg)
|
||||
setMakeTableData(rainChkTableData(rainChg));
|
||||
} else {
|
||||
setMakeTableData([]);
|
||||
@@ -116,7 +126,8 @@ export default function RainChkgdTable({
|
||||
if (findRain != undefined) {
|
||||
return {
|
||||
...rd,
|
||||
ph: Number(findRain.ph),
|
||||
// 조드 타입과 맞추기위해 스트링
|
||||
ph: String(findRain.ph),
|
||||
trbt: Number(findRain.trbt),
|
||||
grssClfg: Number(findRain.grssClfg),
|
||||
etc: findRain.etc,
|
||||
|
||||
@@ -17,10 +17,11 @@
|
||||
"isMatchFinishMsg": " 매칭완료를 진행하시겠습니까?",
|
||||
"isNotMatchFinishMsg": "검토완료중 매칭완료 여부를 체크한 항목이 없습니다.",
|
||||
"canNotChangeMatStateMsg": "매칭완료된 항목은 상태를 변경할 수 없습니다.",
|
||||
"isInitPw": "비밀번호를 초기화하시겠습니까?",
|
||||
"isInitPw":"사업자번호 {{dmdInfoId}} 의 비밀번호를 초기화하시겠습니까? (초기화비밀번호는 해당 사업자의 사업자 번호입니다)",
|
||||
"alreadyInsertedErrMsg": "사업자번호 {{num}}(은)는 이미 등록되었습니다. 다시 등록해주세요.",
|
||||
"saveRowErrMsg": "수정을 원하는 행을 선택하고 저장버튼을 눌러주세요.",
|
||||
"costCalcErrMsg": "공사비 계산 진행 후 저장을 눌러주세요",
|
||||
"maxYearErrMsg": "최대 {{year}}년까지 선택가능합니다.",
|
||||
"checkQtyMsg": "요구수량(m³/일)을 확인해주세요 계산할 수 없습니다."
|
||||
"checkQtyMsg": "요구수량(m³/일)을 확인해주세요 계산할 수 없습니다.",
|
||||
"insertRuseBiz": "{{cycle}}차 사업이 추가되었습니다."
|
||||
}
|
||||
Reference in New Issue
Block a user