공공 재이용 등록 수정
This commit is contained in:
@@ -16,7 +16,7 @@ export const pubFacHeadListExport: TableUpperProps[] = [
|
||||
{ id: "authoDay", title: "등록여부" },
|
||||
];
|
||||
|
||||
export const pubMngUpHeadListExport: TableUpperProps[] = [
|
||||
export const pbnstMngUpHeadListExport: TableUpperProps[] = [
|
||||
{ id: "mng", title: "운영방식" },
|
||||
{ id: "subCo", title: "대행업체" },
|
||||
{ id: "startDay", title: "시작일", upName: "upChangeRe", upSequnce: 1 },
|
||||
@@ -24,7 +24,7 @@ export const pubMngUpHeadListExport: TableUpperProps[] = [
|
||||
];
|
||||
|
||||
|
||||
export const pubOrgwtHeadListExport: TableUpperProps[] = [
|
||||
export const pbnstOrgwtHeadListRxport: TableUpperProps[] = [
|
||||
{ id: "ruseUtztnFcltNm", title: "운영방식" },
|
||||
{ id: "orgwtWtritQnt", title: "원수취수량" },
|
||||
{ id: "tmsYn", title: "하수처리량TMS 전후", },
|
||||
@@ -33,7 +33,7 @@ export const pubOrgwtHeadListExport: TableUpperProps[] = [
|
||||
];
|
||||
const date = new Date();
|
||||
|
||||
export const pubMngNmExport: chHeadType[] = [
|
||||
export const pbnstMngNmExport: chHeadType[] = [
|
||||
{ headNm: "upChangeRe", text: "운영대행기간", length: 2 },
|
||||
];
|
||||
|
||||
|
||||
@@ -2,34 +2,36 @@ import { z } from "zod";
|
||||
import type { TableUpperProps } from "../rainReg";
|
||||
import { getFetch } from "@/components/lib/api";
|
||||
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
|
||||
import { pubFacHeadListExport, pubMngNmExport, pubMngUpHeadListExport } from "./headList";
|
||||
import { exampleData, fcBizSchema, type customPbnst, type pubHasuType } from "./type";
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import { pbnstMngUpHeadListExport, pbnstOrgwtHeadListRxport, pbnstMngNmExport, pubFacHeadListExport } from "./headList";
|
||||
|
||||
|
||||
const selectLabel: SelectDataType[] = [{ text: "test", val: "1" }];
|
||||
const pubFacHeadList= pubFacHeadListExport;
|
||||
const pubMngUpHeadList = pubMngUpHeadListExport
|
||||
const pubMngNm= pubMngNmExport;
|
||||
const pbnstMngUpHeadList = pbnstMngUpHeadListExport
|
||||
const pbnstOrgwtHeadList =pbnstOrgwtHeadListRxport
|
||||
const pbnstMngNm= pbnstMngNmExport;
|
||||
|
||||
|
||||
export type pubFacState = {
|
||||
pbnst: {
|
||||
isInit: boolean;
|
||||
pubFacHeadList: TableUpperProps[];
|
||||
pubMngUpHeadList: TableUpperProps[];
|
||||
pubMngNm: chHeadType[];
|
||||
pbnstMngUpHeadList: TableUpperProps[];
|
||||
pbnstMngNm: chHeadType[];
|
||||
pbnstHasuRes: pubHasuType[]
|
||||
selectLabel: SelectDataType[];
|
||||
pbnstRes: customPbnst[];
|
||||
pbnstBizCycle: SelectDataType[];
|
||||
selectLabel: SelectDataType[];
|
||||
pbnstOrgwtHeadList:TableUpperProps[]
|
||||
};
|
||||
};
|
||||
type pubFacActions = {
|
||||
pubHasuInit: (txt: string | undefined) => void;
|
||||
pbnstRegInit: (sgg: string) => void;
|
||||
pbnstRegSearch: (txt: string | undefined, sgg: string) => void;
|
||||
pbnstReg: (txt: string | undefined) => void;
|
||||
pubHasuInit: (txt: string | undefined) => void;
|
||||
};
|
||||
|
||||
export type pubFacType = pubFacState & pubFacActions;
|
||||
@@ -38,12 +40,13 @@ export const pubFacStateExport: pubFacState = {
|
||||
pbnst: {
|
||||
isInit: false,
|
||||
pubFacHeadList: pubFacHeadList,
|
||||
pubMngUpHeadList: pubMngUpHeadList,
|
||||
selectLabel: selectLabel,
|
||||
pubMngNm: pubMngNm,
|
||||
pbnstMngUpHeadList: pbnstMngUpHeadList,
|
||||
pbnstMngNm: pbnstMngNm,
|
||||
pbnstOrgwtHeadList:pbnstOrgwtHeadList,
|
||||
pbnstHasuRes: [],
|
||||
pbnstRes: [],
|
||||
pbnstBizCycle:[]
|
||||
pbnstBizCycle:[{text:'없음', val:'1'}],
|
||||
selectLabel: selectLabel,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -55,13 +58,14 @@ const initFetch = async (txt: string | undefined) => {
|
||||
return rainRes;
|
||||
};
|
||||
|
||||
const getBizCycle = async (fcBizs: z.infer<typeof fcBizSchema>[] ) => {
|
||||
const getBizCycle = (fcBizs: z.infer<typeof fcBizSchema>[] ) => {
|
||||
const pbnstBizCycle =fcBizs.map((item: z.infer<typeof fcBizSchema>) => {
|
||||
return {
|
||||
text: `${item.cycl}차수`,
|
||||
text: `${item.cycl}차`,
|
||||
val: item.cycl,
|
||||
};
|
||||
});
|
||||
|
||||
return pbnstBizCycle;
|
||||
}
|
||||
export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
|
||||
@@ -92,6 +96,7 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
|
||||
const pbnstRes = exampleData;
|
||||
|
||||
const pbnstBizCycle = getBizCycle(pbnstRes?.fcBizs);
|
||||
|
||||
return set((state: pubFacState) => ({
|
||||
...state,
|
||||
pbnst: {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { SelectBox } from "@common/business_components";
|
||||
import {
|
||||
FormUi,
|
||||
} from "@common/business_components/ui";
|
||||
import { FormUi } from "@common/business_components/ui";
|
||||
import { Form, FormField } from "@common/business_components/ui/form";
|
||||
import { Button, Input, TableHead, TableRow } from "@common/components";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
@@ -28,18 +26,16 @@ import {
|
||||
ruseFcltinfo,
|
||||
wasteWaterFcltINfo,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/headList";
|
||||
import { pbnstRegZod } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
|
||||
import { pbnstRegZod } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import RuseMngTable from "@/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable";
|
||||
|
||||
export function PbnstBuseForm() {
|
||||
const { code, pbnst } = useWrStore((state) => state);
|
||||
const { pubMngUpHeadList,pbnstBizCycle } = pbnst;
|
||||
const [getBizCycle, setBizCycle] = useState('');
|
||||
|
||||
const { pbnstBizCycle } = pbnst;
|
||||
const [getBizCycle, setBizCycle] = useState([{ text: "없음", val: "1" }]);
|
||||
|
||||
const form = useForm<z.infer<typeof pbnstRegZod>>({
|
||||
resolver: zodResolver(pbnstRegZod),
|
||||
|
||||
});
|
||||
|
||||
// 2. Define a submit handler.
|
||||
@@ -56,13 +52,16 @@ export function PbnstBuseForm() {
|
||||
const [bizCmcnDate, setBizCmcnDate] = useState(new Date());
|
||||
const [files, setFiles] = useState(null);
|
||||
useEffect(() => {
|
||||
if (getBizCycle ) {
|
||||
console.log("getBizCycle", getBizCycle);
|
||||
|
||||
form.reset()
|
||||
console.log("getBizCycle", getBizCycle);
|
||||
if (getBizCycle) {
|
||||
form.reset();
|
||||
}
|
||||
}, [getBizCycle]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("pbnstBizCycle", pbnstBizCycle);
|
||||
}, [pbnstBizCycle]);
|
||||
|
||||
return (
|
||||
<div className=" !mx-[1.6rem] !p-0r">
|
||||
{/* 차수별 등록 현황 폼 */}
|
||||
@@ -76,18 +75,22 @@ export function PbnstBuseForm() {
|
||||
<h1 className=" text-xl"></h1>
|
||||
<div className="flex items-center gap-2 mx-3">
|
||||
<h1 className={formTableName}>등록차수</h1>
|
||||
|
||||
<SelectBox
|
||||
label=""
|
||||
selectArray={pbnstBizCycle}
|
||||
value={pbnstBizCycle.length > 0 && pbnstBizCycle[0]? pbnstBizCycle[0].val : ""}
|
||||
className={""}
|
||||
selectClass={selectClass}
|
||||
onSelectValue={(val) => {setBizCycle}}
|
||||
>
|
||||
|
||||
</SelectBox>
|
||||
|
||||
<SelectBox
|
||||
label=""
|
||||
selectArray={pbnstBizCycle}
|
||||
value={
|
||||
pbnstBizCycle.length > 0 && pbnstBizCycle[0]
|
||||
? pbnstBizCycle[0].val
|
||||
: ""
|
||||
}
|
||||
className={""}
|
||||
selectClass={selectClass}
|
||||
onSelectValue={(val) => {
|
||||
setBizCycle;
|
||||
}}
|
||||
></SelectBox>
|
||||
|
||||
<Button size={commonButonSize}>저장</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -98,7 +101,7 @@ export function PbnstBuseForm() {
|
||||
moClass="grid grid-cols-12 gap-4"
|
||||
sonClass="col-span-4"
|
||||
/>
|
||||
|
||||
|
||||
<MngRegFormDetail
|
||||
formList={businessMoneyInfo}
|
||||
h1Title={"사업비"}
|
||||
@@ -129,6 +132,15 @@ export function PbnstBuseForm() {
|
||||
/>
|
||||
|
||||
<h1 className={formH1Class}>재이용 원수취수 현황</h1>
|
||||
<div>
|
||||
<Button size={commonButonSize}>
|
||||
추가등록
|
||||
</Button>
|
||||
<RuseMngTable
|
||||
tableData={[]}
|
||||
headList={pbnst.pbnstOrgwtHeadList}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
</div>
|
||||
|
||||
@@ -37,7 +37,7 @@ const formSchema = z.object({
|
||||
|
||||
export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
|
||||
const { pbnst } = useWrStore((state) => state);
|
||||
const { pubMngUpHeadList, isInit } = pbnst;
|
||||
const { pbnstMngUpHeadList, isInit } = pbnst;
|
||||
const [ruseOperData, setRuseOperData] = useState<fcltOperInfoType[]>();
|
||||
const [planFiles, setPlanFiles] = useState<File[] | null>(null);
|
||||
const [relationfiles, setRelationFiles] = useState<File[] | null>(null);
|
||||
@@ -114,33 +114,7 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
|
||||
// handleSuccess: setUpload,
|
||||
// })
|
||||
}, [relationfiles]);
|
||||
const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
|
||||
return (
|
||||
<>
|
||||
<TableRow>
|
||||
{upHeadList.map((head: TableUpperProps) =>
|
||||
!head.upSequnce ? (
|
||||
<TableHead rowSpan={2} key={head.id}>
|
||||
{head.title}
|
||||
</TableHead>
|
||||
) : head.upName === "upChangeRe" && head.upSequnce === 1 ? (
|
||||
<TableHead key={head.id} rowSpan={1} colSpan={2}>
|
||||
{"운영대행기간"}
|
||||
</TableHead>
|
||||
) : null
|
||||
)}
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
{upHeadList.map((head: TableUpperProps) =>
|
||||
head.upName === "upChangeRe" ? (
|
||||
<TableHead key={head.id}>{head.title}</TableHead>
|
||||
) : null
|
||||
)}
|
||||
</TableRow>
|
||||
</>
|
||||
);
|
||||
};
|
||||
const nodeList = headMakeColSpan(pubMngUpHeadList);
|
||||
|
||||
|
||||
return (
|
||||
<div className=" !mx-[1.6rem] !p-0r">
|
||||
@@ -186,8 +160,8 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
|
||||
</div>
|
||||
<RuseMngTable
|
||||
tableData={[]}
|
||||
headList={pbnst.pubMngUpHeadList}
|
||||
upHeadList={pbnst.pubMngNm}
|
||||
headList={pbnst.pbnstMngUpHeadList}
|
||||
upHeadList={pbnst.pbnstMngNm}
|
||||
></RuseMngTable>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead";
|
||||
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { Input, Table, TableBody, TableCell, TableHeader, TableRow } from "@common/components/ui";
|
||||
import {
|
||||
Input,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@common/components/ui";
|
||||
|
||||
export default function RuseMngTable({
|
||||
tableData,
|
||||
@@ -10,13 +18,23 @@ export default function RuseMngTable({
|
||||
}: {
|
||||
tableData: any[];
|
||||
headList: TableUpperProps[];
|
||||
upHeadList: chHeadType[];
|
||||
upHeadList?: chHeadType[];
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Table variant="secondary">
|
||||
<TableHeader className="font-bold">
|
||||
{headMakeprfmnc(headList, upHeadList)}
|
||||
{upHeadList ? (
|
||||
headMakeprfmnc(headList, upHeadList)
|
||||
) : (
|
||||
<TableRow key={"table-row-test"}>
|
||||
{headList.map((head) => (
|
||||
<TableHead className={`border border-gray-600 px-2 py-1 `}>
|
||||
{head.title}
|
||||
</TableHead>
|
||||
))}
|
||||
</TableRow>
|
||||
)}
|
||||
</TableHeader>
|
||||
|
||||
<TableBody>
|
||||
@@ -32,9 +50,7 @@ export default function RuseMngTable({
|
||||
<Input
|
||||
className={`${head.type === "number" ? "text-right" : "text-center"} !text-xl`}
|
||||
type={head.type}
|
||||
onChange={(e) => {
|
||||
;
|
||||
}}
|
||||
onChange={(e) => {}}
|
||||
value={item[head.id] || ""}
|
||||
/>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user