From 9d328413407183cd2814096042fef6de5af115b7 Mon Sep 17 00:00:00 2001 From: basssy Date: Wed, 23 Oct 2024 17:52:25 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AC=BC=EA=B1=B4=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=ED=99=94=EB=A9=B4=20=ED=94=8C=EB=9E=9C=EB=AA=A9=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/management/stuff/detail/page.jsx | 2 + src/app/management/stuff/page.jsx | 2 +- src/components/management/Stuff.jsx | 1 - src/components/management/StuffDetail.jsx | 473 +++++++++++++++++-- src/components/management/StuffPlanQGrid.jsx | 51 ++ src/locales/ja.json | 12 + src/locales/ko.json | 12 + 7 files changed, 499 insertions(+), 54 deletions(-) create mode 100644 src/components/management/StuffPlanQGrid.jsx diff --git a/src/app/management/stuff/detail/page.jsx b/src/app/management/stuff/detail/page.jsx index 8c7dd731..7c5b0b0e 100644 --- a/src/app/management/stuff/detail/page.jsx +++ b/src/app/management/stuff/detail/page.jsx @@ -3,6 +3,8 @@ import '@/styles/contents.scss' import StuffSubHeader from '@/components/management/StuffSubHeader' import StuffHeader from '@/components/management/StuffHeader' import StuffDetail from '@/components/management/StuffDetail' +import '@/styles/contents.scss' +import '@/styles/grid.scss' export default function ManagementStuffDetailPage() { return ( <> diff --git a/src/app/management/stuff/page.jsx b/src/app/management/stuff/page.jsx index eb852712..414f377b 100644 --- a/src/app/management/stuff/page.jsx +++ b/src/app/management/stuff/page.jsx @@ -1,7 +1,7 @@ import StuffSearchCondition from '@/components/management/StuffSearchCondition' import Stuff from '@/components/management/Stuff' import StuffSubHeader from '@/components/management/StuffSubHeader' -import '@/styles/contents.scss' +import '@/styles/grid.scss' export default async function ManagementStuffPage() { return ( <> diff --git a/src/components/management/Stuff.jsx b/src/components/management/Stuff.jsx index 07119205..b5297420 100644 --- a/src/components/management/Stuff.jsx +++ b/src/components/management/Stuff.jsx @@ -16,7 +16,6 @@ import { appMessageStore, globalLocaleStore } from '@/store/localeAtom' import KO from '@/locales/ko.json' import JA from '@/locales/ja.json' import QPagination from '../common/pagination/QPagination' -import '@/styles/grid.scss' import { sessionStore } from '@/store/commonAtom' export default function Stuff() { diff --git a/src/components/management/StuffDetail.jsx b/src/components/management/StuffDetail.jsx index fd01fc41..5d49bc06 100644 --- a/src/components/management/StuffDetail.jsx +++ b/src/components/management/StuffDetail.jsx @@ -16,6 +16,7 @@ import FindAddressPop from './popup/FindAddressPop' import PlanRequestPop from './popup/PlanRequestPop' import WindSelectPop from './popup/WindSelectPop' import { useCommonCode } from '@/hooks/common/useCommonCode' +import StuffPlanQGrid from './StuffPlanQGrid' export default function StuffDetail() { //공통코드 @@ -31,12 +32,12 @@ export default function StuffDetail() { const { getMessage } = useMessage() const globalLocaleState = useRecoilValue(globalLocaleStore) const ref = useRef() - const { get, del, promisePost, promisePut } = useAxios(globalLocaleState) + const { get, promiseGet, del, promisePost, promisePut } = useAxios(globalLocaleState) //form const formInitValue = { // 물건번호 T...(임시) R...(진짜) planReqNo: '', //설계의뢰No - dispCompanyName: '', //담당자 + receiveUser: '', //담당자 objectStatusId: '0', //물건구분(신축:0 기축 : 1) objectName: '', //물건명 objectNameOmit: '', //경칭선택 @@ -91,6 +92,173 @@ export default function StuffDetail() { const [editMode, setEditMode] = useState('NEW') const [detailData, setDetailData] = useState({}) + const [planGridProps, setPlanGridProps] = useState({ + planGridData: [], + isPageable: false, + planGridColumns: [ + { + field: 'planNo', + headerName: getMessage('stuff.detail.planGridHeader.planNo'), + width: 100, + cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, + }, + { + field: 'orderFlg', + headerName: getMessage('stuff.detail.planGridHeader.orderFlg'), + width: 80, + cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, + cellRenderer: (params) => { + //1일때만 동그라미 + let orderFlg + orderFlg = params.value === '1' ? 'O' : 'X' + return orderFlg + }, + }, + { + field: 'moduleModel', + headerName: getMessage('stuff.detail.planGridHeader.moduleModel'), + flex: 1, + cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, + }, + { + field: 'capacity', + headerName: getMessage('stuff.detail.planGridHeader.capacity'), + width: 120, + cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, + }, + { + field: 'roofMaterialIdMulti', + headerName: getMessage('stuff.detail.planGridHeader.roofMaterialIdMulti'), + width: 140, + wrapText: true, + autoHeight: true, + cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, + cellRenderer: (params) => { + let origin = params.value + if (origin !== null) { + return ( + <> + {origin?.split(',').map((it) => ( + <> + {it} +
+ + ))} + + ) + } else { + return null + } + }, + }, + { + field: 'constructSpecification', + headerName: getMessage('stuff.detail.planGridHeader.constructSpecification'), + wrapText: true, + autoHeight: true, + cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, + cellRenderer: (params) => { + let origin = params.value + if (origin !== null) { + return ( + <> + {origin?.split(',').map((it) => ( + <> + {it} +
+ + ))} + + ) + } else { + return null + } + }, + }, + { + field: 'supportMethodIdMulti', + headerName: getMessage('stuff.detail.planGridHeader.supportMethodIdMulti'), + wrapText: true, + autoHeight: true, + cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, + cellRenderer: (params) => { + let origin = params.value + if (origin !== null) { + return ( + <> + {origin?.split(',').map((it) => ( + <> + {it} +
+ + ))} + + ) + } else { + return null + } + }, + }, + { + field: 'pcTypeNo', + headerName: getMessage('stuff.detail.planGridHeader.pcTypeNo'), + flex: 1, + wrapText: true, + autoHeight: true, + cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, + cellRenderer: (params) => { + let origin = params.value + if (origin !== null) { + return ( + <> + {origin?.split(',').map((it) => ( + <> + {it} +
+ + ))} + + ) + } else { + return null + } + }, + }, + { + field: 'management', + headerName: getMessage('stuff.detail.planGridHeader.management'), + width: 200, + autoHeight: true, + cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, + cellRenderer: () => { + return ( +
+ + +
+ ) + }, + }, + ], + }) + useEffect(() => { // console.log('objectNo::', objectNo) @@ -101,9 +269,22 @@ export default function StuffDetail() { //진짜 setIsFormValid(true) } - get({ url: `/api/object/${objectNo}/detail` }).then((res) => { - if (res != null) { - setDetailData(res) + promiseGet({ url: `/api/object/${objectNo}/detail` }).then((res) => { + if (res.status === 200) { + if (res.data != null) { + setDetailData(res.data) + } else { + setDetailData({}) + } + if (isNotEmptyArray(res.data.planList)) { + // console.log('플랜RES::::::::', res.data.planList) + setPlanGridProps({ ...planGridProps, planGridData: res.data.planList }) + } else { + setPlanGridProps({ ...planGridProps, planGridData: [] }) + } + } else { + setDetailData({}) + setPlanGridProps({ ...planGridProps, planGridData: [] }) } }) } else { @@ -187,7 +368,7 @@ export default function StuffDetail() { //설계의뢰No. form.setValue('planReqNo', detailData.planReqNo) //담당자 - form.setValue('dispCompanyName', detailData.dispCompanyName) + form.setValue('receiveUser', detailData.receiveUser) //물건구분objectStatusId setSelectObjectStatusId(detailData.objectStatusId) @@ -197,7 +378,6 @@ export default function StuffDetail() { form.setValue('objectName', detailData.objectName) //경칭코드 - setSelHonorificCode(detailData.objectNameOmit) form.setValue('objectNameOmit', detailData.objectNameOmit) @@ -217,7 +397,32 @@ export default function StuffDetail() { // form.setValue('otherSaleStoreId', sessionState?.storeId) // form.setValue('otherSaleStoreLevel', sessionState?.storeLvl) + //우편번호 form.setValue('zipNo', detailData.zipNo) + + //도도부현 / 주소 + setPrefValue(detailData.prefId) + form.setValue('prefId', detailData.prefId) + //prefName ??? + form.setValue('address', detailData.address) + + //수직적설량 + form.setValue('verticalSnowCover', detailData.verticalSnowCover) + //한랭지대책시행 coldRegionFlg 1이면 true + form.setValue('coldRegionFlg', detailData.coldRegionFlg === '1' ? true : false) + + //면조도구분surfaceType + // form.setValue('surfaceType', 'Ⅱ') + // form.setValue('surfaceType', 'III・IV') + form.setValue('surfaceType', detailData.surfaceType) + //염해지역용아이템사용 saltAreaFlg 1이면 true + form.setValue('saltAreaFlg', detailData.saltAreaFlg === '1' ? true : false) + //설치높이 + form.setValue('installHeight', detailData.installHeight) + //계약조건 + form.setValue('conType', detailData.conType) + //메모 + form.setValue('remarks', detailData.remarks) }) } }, [detailData, sessionState]) @@ -414,8 +619,8 @@ export default function StuffDetail() { form.setValue('standardWindSpeedId', info.windSpeed) } - //dispCompanyName: '', //담당자 - const _dispCompanyName = watch('dispCompanyName') + //receiveUser: '', //담당자 + const _receiveUser = watch('receiveUser') //objectName: '', //물건명 const _objectName = watch('objectName') // objectNameOmit: '', //경칭선택 @@ -441,8 +646,8 @@ export default function StuffDetail() { if (editMode === 'NEW') { const formData = form.getValues() let errors = {} - if (!formData.dispCompanyName || formData.dispCompanyName.trim().length === 0) { - errors.dispCompanyName = true + if (!formData.receiveUser || formData.receiveUser.trim().length === 0) { + errors.receiveUser = true } if (!formData.objectName || formData.objectName.trim().length === 0) { errors.objectName = true @@ -483,8 +688,8 @@ export default function StuffDetail() { console.log('상세일때 폼체크') const formData = form.getValues() let errors = {} - if (!formData.dispCompanyName || formData.dispCompanyName.trim().length === 0) { - errors.dispCompanyName = true + if (!formData.receiveUser || formData.receiveUser.trim().length === 0) { + errors.receiveUser = true } if (!formData.objectName || formData.objectName.trim().length === 0) { errors.objectName = true @@ -524,7 +729,7 @@ export default function StuffDetail() { setIsFormValid(Object.keys(errors).length === 0 ? true : false) } }, [ - _dispCompanyName, + _receiveUser, _objectName, _objectNameOmit, _saleStoreId, @@ -592,14 +797,14 @@ export default function StuffDetail() { prefName: formData.prefName, address: formData.address, areaId: formData.areaId, - receiveUser: formData.dispCompanyName, + receiveUser: formData.receiveUser, installHeight: formData.installHeight, standardWindSpeedId: formData.standardWindSpeedId, verticalSnowCover: formData.verticalSnowCover, surfaceType: formData.surfaceType, conType: formData.conType, - coldRegionFlg: formData.coldRegionFlg, - saltAreaFlg: formData.saltAreaFlg, + coldRegionFlg: formData.coldRegionFlg === true ? '1' : '0', + saltAreaFlg: formData.saltAreaFlg === true ? '1' : '0', tempFlg: '0', workNo: null, workName: null, @@ -623,13 +828,6 @@ export default function StuffDetail() { } } - //필수값 안넣었을때 임시저장 form required사용시 - // const onInvalid = (errors) => { - // console.log('22222222222222222222222') - // const formData = form.getValues() - // console.log('임시저장formData::::', formData) - // } - // 임시저장 const onTempSave = async () => { const formData = form.getValues() @@ -646,14 +844,14 @@ export default function StuffDetail() { prefName: formData.prefName, address: formData.address, areaId: formData.areaId, - receiveUser: formData.dispCompanyName, + receiveUser: formData.receiveUser, installHeight: formData.installHeight, standardWindSpeedId: formData.standardWindSpeedId, verticalSnowCover: formData.verticalSnowCover, surfaceType: formData.surfaceType, conType: formData.conType, - coldRegionFlg: formData.coldRegionFlg, - saltAreaFlg: formData.saltAreaFlg, + coldRegionFlg: formData.coldRegionFlg === true ? '1' : '0', + saltAreaFlg: formData.saltAreaFlg === true ? '1' : '0', tempFlg: '1', workNo: null, workName: null, @@ -685,7 +883,7 @@ export default function StuffDetail() { } else { if (confirm(getMessage('common.message.data.delete'))) { del({ url: `/api/object/${objectNo}` }).then((res) => { - console.log('삭제결과:::::::', res) + // console.log('삭제결과:::::::', res) router.push('/management/stuff') }) } @@ -743,7 +941,7 @@ export default function StuffDetail() {
- +
@@ -881,7 +1079,7 @@ export default function StuffDetail() { @@ -968,7 +1166,6 @@ export default function StuffDetail() {
- {/* 기준풍속sel시작 */}
- {/* 기준풍속sel끝 */} {getMessage('stuff.detail.windSpeedSpan')} -
@@ -1007,7 +1203,7 @@ export default function StuffDetail() { type="text" className="input-light" onKeyUp={handleKeyUp} - value={form.watch('verticalSnowCover')} + value={form.watch('verticalSnowCover') || ''} {...register('verticalSnowCover')} /> @@ -1037,7 +1233,9 @@ export default function StuffDetail() { -
+
+ {getMessage('stuff.detail.tooltip.surfaceType')} +
@@ -1052,7 +1250,7 @@ export default function StuffDetail() { type="text" className="input-light" onKeyUp={handleKeyUp} - value={form.watch('installHeight')} + value={form.watch('installHeight') || ''} {...register('installHeight')} /> @@ -1151,12 +1349,7 @@ export default function StuffDetail() {
- +
@@ -1224,7 +1417,9 @@ export default function StuffDetail() { {getMessage('stuff.detail.saleStoreId')} * -
+
+ {getMessage('stuff.detail.tooltip.saleStoreId')} +
@@ -1250,7 +1445,7 @@ export default function StuffDetail() { @@ -1292,7 +1487,7 @@ export default function StuffDetail() { @@ -1317,29 +1512,203 @@ export default function StuffDetail() { {/* 도도부현 /주소 시작*/} + + + {getMessage('stuff.detail.prefId')} + * + + +
+
+ {prefCodeList?.length > 0 && ( + +
+
+ + {/* 도도부현 /주소 끝 */} {/* 발전량시뮬레이션지역시작 */} + + + {getMessage('stuff.detail.areaId')} * + + +
+ x.clCodeNm} + getOptionValue={(x) => x.clCode} + isClearable={true} + isSearchable={false} + value={windSpeedList.filter(function (option) { + return option.clCode === watch('standardWindSpeedId') + })} + > +
+ {getMessage('stuff.detail.windSpeedSpan')} + + + + {/* 기준풍속끝 */} {/* 수직적설량시작 */} + + + {getMessage('stuff.detail.verticalSnowCover')} * + + +
+
+ +
+ cm +
+ + +
+
+ + {/* 수직적설량끝 */} {/* 면조도구분시작 */} + + + {getMessage('stuff.detail.surfaceType')} * + + +
+
+ + +
+
+ + +
+
+ + +
+
+ {getMessage('stuff.detail.tooltip.surfaceType')} +
+
+ + {/* 면조도구분끝 */} - {/* 설치높이싲가 */} + {/* 설치높이시작 */} + + + {getMessage('stuff.detail.installHeight')} * + + +
+
+ +
+ m +
+ + {/* 설치높이끝 */} {/* 계약조건시작 */} + + {getMessage('stuff.detail.conType')} + +
+
+ + +
+
+ + +
+
+ + {/* 계약조건끝 */} {/* 메모시작 */} - {/* 메모끝 */} - + {getMessage('stuff.detail.remarks')} + +
+ +
+ + {/* 메모끝 */} - {objectNo.substring(0, 1) === 'R' ? ( <> {/* 진짜R 플랜시작 */} @@ -1349,7 +1718,7 @@ export default function StuffDetail() { @@ -1367,8 +1736,8 @@ export default function StuffDetail() {
- 그리드영역 -
페이징영역
+ + {/*
페이징영역
*/}
{/* 진짜R 플랜끝 */} diff --git a/src/components/management/StuffPlanQGrid.jsx b/src/components/management/StuffPlanQGrid.jsx new file mode 100644 index 00000000..b4108342 --- /dev/null +++ b/src/components/management/StuffPlanQGrid.jsx @@ -0,0 +1,51 @@ +import { useState, useMemo, useCallback, useEffect } from 'react' +import { AgGridReact } from 'ag-grid-react' +import 'ag-grid-community/styles/ag-grid.css' +import 'ag-grid-community/styles/ag-theme-quartz.css' +export default function StuffPlanQGrid(props) { + const { planGridData, planGridColumns, isPageable = true } = props + + const [rowData, setRowData] = useState(null) + const [gridApi, setGridApi] = useState(null) + const [colDefs, setColDefs] = useState(planGridColumns) + + const defaultColDef = useMemo(() => { + return { + flex: 1, + minWidth: 100, + sortable: false, + suppressMovable: false, + resizable: false, + suppressSizeToFit: false, + } + }, []) + + const rowBuffer = 100 + + useEffect(() => { + planGridData ? setRowData(planGridData) : '' + }, [planGridData]) + + const onGridReady = useCallback( + (params) => { + setGridApi(params.api) + planGridData ? setRowData(planGridData) : '' + }, + [planGridData], + ) + + return ( +
+ +
+ ) +} diff --git a/src/locales/ja.json b/src/locales/ja.json index 359d313e..521f4ac6 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -502,6 +502,7 @@ "stuff.detail.conType1": "全量", "stuff.detail.remarks": "メモ", "stuff.detail.tooltip.saleStoreId": "販売代理店または販売代理店IDを1文字以上入力してください", + "stuff.detail.tooltip.surfaceType": "塩害地域の定義は各メーカーの設置マニュアルをご確認ください", "stuff.detail.tempSave.message1": "一時保存されました。商品番号を取得するには、必須項目をすべて入力してください。", "stuff.detail.confirm.message1": "販売店情報を変更すると、設計依頼文書番号が削除されます。変更しますか?", "stuff.detail.delete.message1": "仕様が確定したものは削除できません。", @@ -566,6 +567,17 @@ "stuff.windSelectPopup.search.address1": "県", "stuff.windSelectPopup.btn1": "閉じる", "stuff.windSelectPopup.btn2": "選択", + "stuff.detail.planGridHeader.planNo": "プラン番号", + "stuff.detail.planGridHeader.orderFlg": "発注可", + "stuff.detail.planGridHeader.moduleModel": "モジュール", + "stuff.detail.planGridHeader.capacity": "システム容量", + "stuff.detail.planGridHeader.roofMaterialIdMulti": "屋根材", + "stuff.detail.planGridHeader.constructSpecification": "施工方法", + "stuff.detail.planGridHeader.supportMethodIdMulti": "架台", + "stuff.detail.planGridHeader.pcTypeNo": "パワーコンディショナー", + "stuff.detail.planGridHeader.management": "管理", + "stuff.detail.planGrid.btn1": "見積書の照会", + "stuff.detail.planGrid.btn2": "Excel", "length": "長さ", "height": "高さ", "output": "出力", diff --git a/src/locales/ko.json b/src/locales/ko.json index fe228f22..693d94b4 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -507,6 +507,7 @@ "stuff.detail.conType1": "전량", "stuff.detail.remarks": "메모", "stuff.detail.tooltip.saleStoreId": "판매대리점 또는 판매대리점ID를 1자 이상 입력하세요", + "stuff.detail.tooltip.surfaceType": "염해지역 정의는 각 메이커의 설치 메뉴얼을 확인해주십시오", "stuff.detail.tempSave.message1": "임시저장 되었습니다. 물건번호를 획득하려면 필수 항목을 모두 입력해 주십시오.", "stuff.detail.confirm.message1": "판매점 정보를 변경하면, 설계의뢰 문서번호가 삭제됩니다. 변경하시겠습니까?", "stuff.detail.delete.message1": "사양이 확정된 물건은 삭제할 수 없습니다.", @@ -571,6 +572,17 @@ "stuff.windSelectPopup.search.address1": "현", "stuff.windSelectPopup.btn1": "닫기", "stuff.windSelectPopup.btn2": "선택", + "stuff.detail.planGridHeader.planNo": "플랜번호", + "stuff.detail.planGridHeader.orderFlg": "발주여부", + "stuff.detail.planGridHeader.moduleModel": "모듈", + "stuff.detail.planGridHeader.capacity": "시스템용량", + "stuff.detail.planGridHeader.roofMaterialIdMulti": "지붕재", + "stuff.detail.planGridHeader.constructSpecification": "시공방법", + "stuff.detail.planGridHeader.supportMethodIdMulti": "가대", + "stuff.detail.planGridHeader.pcTypeNo": "파워컨디셔너", + "stuff.detail.planGridHeader.management": "관리", + "stuff.detail.planGrid.btn1": "견적서 조회", + "stuff.detail.planGrid.btn2": "Excel", "length": "길이", "height": "높이", "output": "출력",