From f4687be7659c3c3974a4a23a48a3ef5d2fc5b17d Mon Sep 17 00:00:00 2001 From: jyha00 Date: Wed, 4 Jun 2025 17:31:24 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EC=9A=94=EB=A7=A4=EC=B9=AD=EA=B2=80?= =?UTF-8?q?=ED=86=A0,=20=EC=9E=AC=EC=9D=B4=EC=9A=A9=EA=B2=80=ED=86=A0?= =?UTF-8?q?=EC=9D=B4=EB=A0=A5=20=EC=A1=B0=ED=9A=8C=EC=A1=B0=EA=B1=B4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/matDmd/coMatRvw/page.tsx | 43 +- .../app/matMng/matDmd/ruseRvwHstry/page.tsx | 624 +++++++++--------- 2 files changed, 351 insertions(+), 316 deletions(-) diff --git a/apps/wr/app/matMng/matDmd/coMatRvw/page.tsx b/apps/wr/app/matMng/matDmd/coMatRvw/page.tsx index 8e5bf6a75..b7bafc693 100644 --- a/apps/wr/app/matMng/matDmd/coMatRvw/page.tsx +++ b/apps/wr/app/matMng/matDmd/coMatRvw/page.tsx @@ -2,20 +2,25 @@ import { useWrStore } from "@/app/store"; import { formTableName } from "@/components/lib/class/comClass"; -import { ContentsDiv, Form, FormField, FormUi, ScrollArea, SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, SelectBox, Title, UiTable } from "@common/business_components/ui"; +import { getCity } from "@/components/lib/func/commom"; +import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; +import { ContentsDiv, Form, FormField, FormUi, ScrollArea, SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, SelectBox, Title, UiTable, type SelectDataType } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { Button, DatePicker, Input, Label } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { useFieldArray, useForm } from "react-hook-form"; import { z } from "zod"; export default function coMatRvw() { - const { coRvw, } = useWrStore((state) => state); + const { code, coRvw, } = useWrStore((state) => state); const { coRvwHeadList, } = coRvw; const [fromDate, setFromDate] = useState(new Date()); const [toDate, setToDate] = useState(new Date()); + const [selectSgg, setSelectSgg] = useState() + const [objSearch, setObjSearch] = useState({ sgg: "", city: "" }); + const schema = z.object({ fcltCpct: z.number().optional(), @@ -28,6 +33,18 @@ export default function coMatRvw() { } }); + const getSelCity = (val: string | number) => { + const cityValue = String(val); // Ensure val is treated as a string + const data = getCity(cityValue, code.sggCd); + setSelectSgg(data); + setObjSearch({ city: cityValue, sgg: '' }); + }; + + const getSgg = (val: string | number) => { + console.log(val); + setObjSearch({ ...objSearch, sgg: String(val) }) + }; + const { fields: [], append, @@ -37,6 +54,14 @@ export default function coMatRvw() { name: "", }); + useEffect(() => { + if (fromDate > toDate) { + const newFromDate = new Date(toDate); + newFromDate.setDate(toDate.getDate() - 1); + setFromDate(newFromDate); + } + }, [toDate]); + return ( <> @@ -50,19 +75,15 @@ export default function coMatRvw() { className="col-span-2 w-1/3 h-full text-2xl" label="시도" selectClass={""} - selectArray={[]} - value={""} - onSelectValue={(val: string | number) => { } - } + selectArray={code.cityCd || []} + onSelectValue={getSelCity} /> { } - } + selectArray={selectSgg || []} + onSelectValue={getSgg} />
diff --git a/apps/wr/app/matMng/matDmd/ruseRvwHstry/page.tsx b/apps/wr/app/matMng/matDmd/ruseRvwHstry/page.tsx index be8fe5472..9b3d2262f 100644 --- a/apps/wr/app/matMng/matDmd/ruseRvwHstry/page.tsx +++ b/apps/wr/app/matMng/matDmd/ruseRvwHstry/page.tsx @@ -2,23 +2,37 @@ import { useWrStore } from "@/app/store"; import { formTableName } from "@/components/lib/class/comClass"; -import { ContentsDiv, Form, FormField, FormUi, ScrollArea, SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, SelectBox, Title, UiTable } from "@common/business_components/ui"; +import { getCity } from "@/components/lib/func/commom"; +import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; +import { ContentsDiv, Form, FormField, FormUi, ScrollArea, SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, SelectBox, Title, UiTable, type SelectDataType } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { Button, DatePicker, Input, Label } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { useFieldArray, useForm } from "react-hook-form"; import { z } from "zod"; export default function ruseRvwHstry() { - const { ruseHstry, } = useWrStore((state) => state); + const { code, ruseHstry, } = useWrStore((state) => state); const { ruseHstryHeadList, } = ruseHstry; const [fromDate, setFromDate] = useState(new Date()); const [toDate, setToDate] = useState(new Date()); - const schema = z.object({ - fcltCpct: z.number().optional(), - }); + const schema = z.object({}); + const [selectSgg, setSelectSgg] = useState() + const [objSearch, setObjSearch] = useState({ sgg: "", city: "" }); + + const getSelCity = (val: string | number) => { + const cityValue = String(val); // Ensure val is treated as a string + const data = getCity(cityValue, code.sggCd); + setSelectSgg(data); + setObjSearch({ city: cityValue, sgg: '' }); + }; + + const getSgg = (val: string | number) => { + console.log(val); + setObjSearch({ ...objSearch, sgg: String(val) }) + }; const form = useForm>({ resolver: zodResolver(schema), @@ -36,318 +50,318 @@ export default function ruseRvwHstry() { name: "", }); - return ( - <> - -
-
- - <SearchDiv> - <SearchFormLeft> - <div className="col-span-8 flex flex-row"> - <SelectBox - className="col-span-2 w-1/3 h-full text-2xl" - label="시도" - selectClass={""} - selectArray={[]} - value={""} - onSelectValue={(val: string | number) => { } - } - /> - <SelectBox - className="col-span-2 w-1/3 h-full text-2xl" - label="시군구" - selectClass={""} - selectArray={[]} - value={""} - onSelectValue={(val: string | number) => { } - } - /> - <div className="col-span-5 w-full"> - <div className="flex flex-row items-center"> - <Label className="text-xl text-gray-600">수요신청년도</Label> - <div className="flex flex-row"> - <DatePicker mode={'single'} - className="w-full" - selected={fromDate} - onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} /> - <span>~</span> - <DatePicker mode={'single'} - selected={toDate} - onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> - </div> +return ( + <> + <ContentsDiv> + <div className="grid grid-cols-4 gap-4"> + <div className="col-span-4"> + <Title title={"재이용검토이력"} /> + <SearchDiv> + <SearchFormLeft> + <div className="col-span-8 flex flex-row"> + <SelectBox + className="col-span-2 w-1/3 h-full text-2xl" + label="시도" + selectClass={""} + selectArray={code.cityCd || []} + onSelectValue={getSelCity} + > + {""} + </SelectBox> + <SelectBox + className="col-span-2 w-1/3 h-full text-2xl" + label="시군구" + selectClass={""} + selectArray={selectSgg || []} + onSelectValue={getSgg} + > + {""} + </SelectBox> + <div className="col-span-5 w-full"> + <div className="flex flex-row items-center"> + <Label className="text-xl text-gray-600">수요신청년도</Label> + <div className="flex flex-row"> + <DatePicker mode={'single'} + className="w-full" + selected={fromDate} + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} /> + <span>~</span> + <DatePicker mode={'single'} + selected={toDate} + onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> </div> </div> - <SearchInput - className={"text-2xl"} - label="시설명" - textValue={""} - setText={(e) => { - }} - /> - <SearchInput - className={"text-2xl"} - label="회사명" - textValue={""} - setText={(e) => { - }} - /> </div> - </SearchFormLeft> - <SearchFormRight - className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> - <div className="space-y"> - <div className="flex flex-row space-x-2"> - <Button - size={"sm"} - onClick={(e) => { }} - > - 조회 - </Button> - <Button - size={"sm"} - onClick={(e) => { }} - > - 검토완료 - </Button> - </div> - </div> - </SearchFormRight> - </SearchDiv> - </div> - </div> - - <div className="grid grid-cols-6 gap-4 "> - <div className="col-span-6"> - <ListDiv> - <UiTable - headName={"재이용검토현황"} - tableData={[]} - children={undefined} - headlist={ruseHstryHeadList} - pageSize={20} - total={100000} - cellClick={(index: number | undefined, headId: string) => { - }} - onPageChange={() => { }} - ></UiTable> - <hr /> - <Form {...form}> - <h3 className="mt-4 ml-2 text-2xl font-medium text-label">수요신청 상세현황</h3> - <h1 className="mt-1 ml-3">표준공사비 산정</h1> - <div className="flex items-center mx-3 mb-3"> - <h1 className="">처리시설 표준공사비 산정</h1> + <SearchInput + className={"text-2xl"} + label="시설명" + textValue={""} + setText={(e) => { + }} + /> + <SearchInput + className={"text-2xl"} + label="회사명" + textValue={""} + setText={(e) => { + }} + /> + </div> + </SearchFormLeft> + <SearchFormRight + className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> + <div className="space-y"> + <div className="flex flex-row space-x-2"> <Button size={"sm"} onClick={(e) => { }} > - 재계산 + 조회 </Button> <Button size={"sm"} onClick={(e) => { }} > - 저장 + 검토완료 </Button> - </div> - <div className="grid grid-cols-12 gap-4 ml-4 mr-4"> - <div className="col-span-3 mt-4"> - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label="용도"> - <Input - placeholder="" - type="text" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? ""} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-3 mt-4"> - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label="요구수량(M3/d)"> - <Input - placeholder="" - type="number" - step="0.1" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-3 mt-4"> - <Label className="">용도에 따른 처리공정<i className="diveicon di-search" /></Label> - - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label=""> - <Input - placeholder="" - type="text" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value || ""} - className="mt-2" - /> - </FormUi> - )} - /> - </div> - <div className="col-span-3 mt-4"> - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label="처리시설 용량(요구수량 * 365일)"> - <Input - placeholder="" - type="number" - step="0.001" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-3 mt-4"> - <div className="flex items-center justify-between"> - <Label>처리시설용량에 따른 공사비(백만원)</Label> - <Button - size={"sm"} - onClick={(e) => { }} - className="bg-none" - > - 공사비 산정표 보기 - </Button> - </div> - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label=""> - <Input - placeholder="" - type="number" - step="0.001" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-3 mt-4"> - <div className="flex items-center justify-between"> - <Label>시설부대경비 요율(%)</Label> - <Button - size={"sm"} - onClick={(e) => { }} - > - 요율표 보기 - </Button> - </div> - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label=""> - <Input - placeholder="" - type="number" - step="0.01" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - </FormUi> - )} - /> - </div> - - <div className="col-span-3 mt-4"> - <Label>총사업비 (백만원)<i className="diveicon di-search" /></Label> - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label=""> - <Input - placeholder="" - className="mt-2" - type="number" - step="0.01" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-3 mt-4"> - <div className="flex items-center justify-between"> - <Label>공급처 선정</Label> - <Button - size={"sm"} - onClick={(e) => { }} - className="bg-none" - > - 후보지 선택 - </Button> - </div> - <FormField - control={form.control} - name="" - render={({ field }) => ( - <FormUi label=""> - <Input - placeholder="" - type="text" - onChange={(e) => { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? ""} - /> - </FormUi> - )} - /> - </div> - - <div className="col-span-4 mt-4"> - <div className="mt-4"> - <Label>관로 표준공사비 산정</Label> - </div> - </div> - </div> - </Form> - </ListDiv> - </div> + </div> + </SearchFormRight> + </SearchDiv> </div> - </ContentsDiv > - </> - ) + </div> + + <div className="grid grid-cols-6 gap-4 "> + <div className="col-span-6"> + <ListDiv> + <UiTable + headName={"재이용검토현황"} + tableData={[]} + children={undefined} + headlist={ruseHstryHeadList} + pageSize={20} + total={100000} + cellClick={(index: number | undefined, headId: string) => { + }} + onPageChange={() => { }} + ></UiTable> + <hr /> + <Form {...form}> + <h3 className="mt-4 ml-2 text-2xl font-medium text-label">수요신청 상세현황</h3> + <h1 className="mt-1 ml-3">표준공사비 산정</h1> + <div className="flex items-center mx-3 mb-3"> + <h1 className="">처리시설 표준공사비 산정</h1> + <Button + size={"sm"} + onClick={(e) => { }} + > + 재계산 + </Button> + <Button + size={"sm"} + onClick={(e) => { }} + > + 저장 + </Button> + + </div> + <div className="grid grid-cols-12 gap-4 ml-4 mr-4"> + <div className="col-span-3 mt-4"> + <FormField + control={form.control} + name="" + render={({ field }) => ( + <FormUi label="용도"> + <Input + placeholder="" + type="text" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? ""} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3 mt-4"> + <FormField + control={form.control} + name="" + render={({ field }) => ( + <FormUi label="요구수량(M3/d)"> + <Input + placeholder="" + type="number" + step="0.1" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? 0} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3 mt-4"> + <Label className="">용도에 따른 처리공정<i className="diveicon di-search" /></Label> + + <FormField + control={form.control} + name="" + render={({ field }) => ( + <FormUi label=""> + <Input + placeholder="" + type="text" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={field.value || ""} + className="mt-2" + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3 mt-4"> + <FormField + control={form.control} + name="" + render={({ field }) => ( + <FormUi label="처리시설 용량(요구수량 * 365일)"> + <Input + placeholder="" + type="number" + step="0.001" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? 0} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3 mt-4"> + <div className="flex items-center justify-between"> + <Label>처리시설용량에 따른 공사비(백만원)</Label> + <Button + size={"sm"} + onClick={(e) => { }} + className="bg-none" + > + 공사비 산정표 보기 + </Button> + </div> + <FormField + control={form.control} + name="" + render={({ field }) => ( + <FormUi label=""> + <Input + placeholder="" + type="number" + step="0.001" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? 0} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3 mt-4"> + <div className="flex items-center justify-between"> + <Label>시설부대경비 요율(%)</Label> + <Button + size={"sm"} + onClick={(e) => { }} + > + 요율표 보기 + </Button> + </div> + <FormField + control={form.control} + name="" + render={({ field }) => ( + <FormUi label=""> + <Input + placeholder="" + type="number" + step="0.01" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? 0} + /> + </FormUi> + )} + /> + </div> + + <div className="col-span-3 mt-4"> + <Label>총사업비 (백만원)<i className="diveicon di-search" /></Label> + <FormField + control={form.control} + name="" + render={({ field }) => ( + <FormUi label=""> + <Input + placeholder="" + className="mt-2" + type="number" + step="0.01" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? 0} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3 mt-4"> + <div className="flex items-center justify-between"> + <Label>공급처 선정</Label> + <Button + size={"sm"} + onClick={(e) => { }} + className="bg-none" + > + 후보지 선택 + </Button> + </div> + <FormField + control={form.control} + name="" + render={({ field }) => ( + <FormUi label=""> + <Input + placeholder="" + type="text" + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? ""} + /> + </FormUi> + )} + /> + </div> + + <div className="col-span-4 mt-4"> + <div className="mt-4"> + <Label>관로 표준공사비 산정</Label> + </div> + </div> + </div> + </Form> + </ListDiv> + </div> + </div> + </ContentsDiv > + </> +) } \ No newline at end of file