This commit is contained in:
hyojun.choi 2025-01-09 09:39:31 +09:00
commit 15100eda6d
9 changed files with 170 additions and 65 deletions

View File

@ -269,8 +269,8 @@ export default function StuffDetail() {
}
}
if (managementState?.createUser === 'T01' && session?.userId !== 'T01') {
//createUser T01 T01
buttonStyle = { display: 'none' }
//createUser T01 T01 !!!!!!!!
//buttonStyle = { display: 'none' }
}
return (
<>
@ -282,8 +282,6 @@ export default function StuffDetail() {
onClick={() => {
//mid:5(), /pid:
setFloorPlanObjectNo({ floorPlanObjectNo: params.data.objectNo })
// router.push(`/floor-plan/estimate/5/${params.data.planNo}`)
// /floor-plan/estimate/5?pid=&objectNo=
router.push(`/floor-plan/estimate/5?pid=${params.data.planNo}&objectNo=${objectNo}`)
}}
>
@ -332,7 +330,7 @@ export default function StuffDetail() {
//createUser T01 T01
setShowButton('none')
}
// console.log('::', res.data)
console.log('상세::', res.data)
if (isObjectNotEmpty(res.data)) {
let surfaceTypeValue
if (res.data.surfaceType === 'Ⅲ・Ⅳ') {
@ -482,8 +480,6 @@ export default function StuffDetail() {
}
})
//1 : X167 T01
//2 : 10X22, 201X112
let url
let firstList
let otherList
@ -928,10 +924,13 @@ export default function StuffDetail() {
const setPlanReqInfo = (info) => {
// console.log('session :::::::', session)
// console.log(' :::::::', info)
form.setValue('planReqNo', info.planReqNo)
form.setValue('objectStatusId', info.building)
setSelectObjectStatusId(info.building)
form.setValue('objectName', info.planReqName)
form.setValue('objectName', info.title)
form.setValue('zipNo', info.zipNo)
form.setValue('address', info.address2)
@ -1323,6 +1322,12 @@ export default function StuffDetail() {
return alert(getMessage('stuff.detail.tempSave.message2'))
}
}
// 2 otherSaleStoreId
if (session.storeLvl !== '1') {
if (params.saleStoreLevel === '1') {
return alert(getMessage('stuff.detail.tempSave.message4'))
}
}
if (editMode === 'NEW') {
await promisePost({ url: apiUrl, data: params })
@ -1731,7 +1736,10 @@ export default function StuffDetail() {
<tr>
<th>
<div className="flx-box">
<div className="title">{getMessage('stuff.detail.otherSaleStoreId')}</div>
<div className="title">
{getMessage('stuff.detail.otherSaleStoreId')}
{session.storeLvl !== '1' && <span className="important">*</span>}
</div>
<div className="tooltips">
<span>{getMessage('stuff.detail.tooltip.saleStoreId')}</span>
</div>
@ -1752,7 +1760,16 @@ export default function StuffDetail() {
onChange={onSelectionChange2}
getOptionLabel={(x) => x.saleStoreName}
getOptionValue={(x) => x.saleStoreId}
isDisabled={otherSaleStoreList != null && otherSaleStoreList.length === 1 ? true : false}
isDisabled={
session?.storeLvl === '1'
? otherSaleStoreList.length > 0
? false
: true
: otherSaleStoreList.length === 1
? true
: false
}
// isDisabled={otherSaleStoreList != null && otherSaleStoreList.length === 1 ? true : false}
isClearable={true}
value={otherSaleStoreList.filter(function (option) {
return option.saleStoreId === otherSelOptions
@ -2302,14 +2319,16 @@ export default function StuffDetail() {
onChange={onSelectionChange2}
getOptionLabel={(x) => x.saleStoreName}
getOptionValue={(x) => x.saleStoreId}
isDisabled={
managementState?.tempFlg === '0'
? true
: session?.storeLvl === '1' && form.watch('saleStoreId') != ''
? false
: true
}
isClearable={managementState?.tempFlg === '0' ? false : session?.storeLvl === '1' ? true : false}
// isDisabled={
// managementState?.tempFlg === '0'
// ? true
// : session?.storeLvl === '1' && form.watch('saleStoreId') != ''
// ? false
// : false
// }
isDisabled={managementState?.tempFlg === '0' ? true : false}
isClearable={managementState?.tempFlg === '0' ? false : true}
// isClearable={managementState?.tempFlg === '0' ? false : session?.storeLvl === '1' ? true : true}
value={otherSaleStoreList.filter(function (option) {
return option.saleStoreId === otherSelOptions
})}

View File

@ -40,7 +40,6 @@ export default function StuffPlanQGrid(props) {
rowData={rowData}
columnDefs={colDefs}
defaultColDef={defaultColDef}
rowSelection={'singleRow'}
pagination={isPageable}
domLayout="autoHeight"
suppressCellFocus={true}

View File

@ -56,7 +56,6 @@ export default function FindAddressPopGrid(props) {
rowData={rowData}
columnDefs={colDefs}
defaultColDef={defaultColDef}
rowSelection={'singleRow'}
pagination={isPageable}
onSelectionChanged={onSelectionChanged}
overlayNoRowsTemplate={`<span className="ag-overlay-loading-center">${getMessage('stuff.grid.noData')}</span>`}

View File

@ -50,7 +50,6 @@ export default function PlanRequestPop(props) {
const [schSaleStoreName, setSchSaleStoreName] = useState('') //
const [schPlanReqName, setSchPlanReqName] = useState('') //
const [schPlanStatCd, setSchPlanStatCd] = useState('') //
const [schDateGbn, setSchDateGbn] = useState('S') //(S/R)
//
const resetRecoil = () => {
@ -59,7 +58,6 @@ export default function PlanRequestPop(props) {
setSchAddress('')
setSchSaleStoreName('')
setSchPlanReqName('')
setSchDateGbn('S')
setStartDate(dayjs(new Date()).add(-3, 'month').format('YYYY-MM-DD'))
setEndDate(dayjs(new Date()).format('YYYY-MM-DD'))
setSchPlanStatCd('')
@ -85,10 +83,7 @@ export default function PlanRequestPop(props) {
//
const onSubmit = (page, type) => {
//2 201X112
const params = {
// saleStoreId: 'X112',
// saleStoreLevel: '1',
saleStoreId: props?.otherSaleStoreId ? props.otherSaleStoreId : props.saleStoreId,
saleStoreLevel: props?.otherSaleStoreLevel ? props.otherSaleStoreLevel : props.saleStoreLevel,
schPlanReqNo: schPlanReqNo,
@ -97,7 +92,7 @@ export default function PlanRequestPop(props) {
schSaleStoreName: schSaleStoreName,
schPlanReqName: schPlanReqName,
schPlanStatCd: schPlanStatCd,
schDateGbn: schDateGbn,
schDateGbn: 'R',
schStartDt: startDate ? dayjs(startDate).format('YYYY-MM-DD') : '',
schEndDt: endDate ? dayjs(endDate).format('YYYY-MM-DD') : '',
startRow: type === 'S' ? (1 - 1) * pageSize + 1 : (page - 1) * pageSize + 1,
@ -135,8 +130,6 @@ export default function PlanRequestPop(props) {
//
const onChangePerPage = (e) => {
const params = {
// saleStoreId: 'T100',
// saleStoreLevel: '1',
saleStoreId: props?.otherSaleStoreId ? props.otherSaleStoreId : props.saleStoreId,
saleStoreLevel: props?.otherSaleStoreLevel ? props.otherSaleStoreLevel : props.saleStoreLevel,
schTitle: schTitle,
@ -145,7 +138,7 @@ export default function PlanRequestPop(props) {
schSaleStoreName: schSaleStoreName,
schPlanReqName: schPlanReqName,
schPlanStatCd: schPlanStatCd,
schDateGbn: schDateGbn,
schDateGbn: 'R',
schStartDt: dayjs(startDate).format('YYYY-MM-DD'),
schEndDt: dayjs(endDate).format('YYYY-MM-DD'),
startRow: (1 - 1) * e.target.value + 1,
@ -412,34 +405,6 @@ export default function PlanRequestPop(props) {
<th>{getMessage('stuff.planReqPopup.search.period')}</th>
<td colSpan={5}>
<div className="form-flex-wrap">
<div className="radio-wrap mr10">
<div className="d-check-radio light mr10">
<input
type="radio"
name="radio04"
id="ra07"
checked={schDateGbn === 'S' ? true : false}
value={'S'}
onChange={(e) => {
setSchDateGbn(e.target.value)
}}
/>
<label htmlFor="ra07">{getMessage('stuff.planReqPopup.search.schDateGbnS')}</label>
</div>
<div className="d-check-radio light">
<input
type="radio"
name="radio04"
id="ra08"
checked={schDateGbn === 'R' ? true : false}
value={'R'}
onChange={(e) => {
setSchDateGbn(e.target.value)
}}
/>
<label htmlFor="ra08">{getMessage('stuff.planReqPopup.search.schDateGbnR')}</label>
</div>
</div>
<div className="date-picker-wrap">
<div className="date-picker" style={{ flex: 1 }}>
<SingleDatePicker {...rangeDatePickerProps1} />

View File

@ -56,7 +56,6 @@ export default function PlanRequestPopQGrid(props) {
rowData={rowData}
columnDefs={colDefs}
defaultColDef={defaultColDef}
rowSelection={'singleRow'}
pagination={isPageable}
onSelectionChanged={onSelectionChanged}
overlayNoRowsTemplate={`<span className="ag-overlay-loading-center">${getMessage('stuff.grid.noData')}</span>`}

View File

@ -273,7 +273,7 @@ export function useCanvasSetting() {
// 기본설정(PlacementShapeSetting) 조회 및 초기화
const fetchBasicSettings = async () => {
try {
await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/0/${correntObjectNo}` }).then((res) => {
await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/1/${correntObjectNo}` }).then((res) => {
let roofsRow = {}
let roofsArray = {}
@ -288,7 +288,7 @@ export function useCanvasSetting() {
roofsArray = res.map((item) => {
return {
roofApply: true,
roofSeq: 1,
roofSeq: 0,
roofMatlCd: item.roofMatlCd,
roofWidth: item.roofWidth,
roofHeight: item.roofHeight,
@ -308,7 +308,7 @@ export function useCanvasSetting() {
roofsArray = [
{
roofApply: true,
roofSeq: 1,
roofSeq: 0,
roofMatlCd: 'ROOF_ID_WA_53A',
roofWidth: 265,
roofHeight: 235,
@ -391,7 +391,7 @@ export function useCanvasSetting() {
setCanvasSetting({ ...basicSetting })
fetchBasicSettings()
} catch (error) {
swalFire({ text: getMessage(res.returnMessage), icon: 'error' })
swalFire({ text: error.message, icon: 'error' })
}
}

View File

@ -1,9 +1,10 @@
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
import { canvasState, currentMenuState, currentObjectState } from '@/store/canvasAtom'
import { useEffect, useRef, useState } from 'react'
import { useAxios } from '@/hooks/useAxios'
import { useSwal } from '@/hooks/useSwal'
import { usePolygon } from '@/hooks/usePolygon'
import { addedRoofsState, basicSettingState, roofDisplaySelector, roofMaterialsSelector, selectedRoofMaterialSelector } from '@/store/settingAtom'
import { correntObjectNoState, addedRoofsState, basicSettingState, roofDisplaySelector, roofMaterialsSelector, selectedRoofMaterialSelector } from '@/store/settingAtom'
import { usePopup } from '@/hooks/usePopup'
import { POLYGON_TYPE } from '@/common/common'
import { v4 as uuidv4 } from 'uuid'
@ -14,10 +15,12 @@ import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
import { menuTypeState } from '@/store/menuAtom'
import { useRoofFn } from '@/hooks/common/useRoofFn'
import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting'
import { globalLocaleStore } from '@/store/localeAtom'
// 지붕면 할당
export function useRoofAllocationSetting(id) {
const canvas = useRecoilValue(canvasState)
const [correntObjectNo, setCorrentObjectNo] = useRecoilState(correntObjectNoState)
const roofDisplay = useRecoilValue(roofDisplaySelector)
const { drawDirectionArrow, addLengthText, splitPolygonWithLines, splitPolygonWithSeparate } = usePolygon()
const [popupId, setPopupId] = useState(uuidv4())
@ -35,6 +38,9 @@ export function useRoofAllocationSetting(id) {
const [editingLines, setEditingLines] = useState([])
const [currentRoofList, setCurrentRoofList] = useState(roofList)
const globalLocaleState = useRecoilValue(globalLocaleStore)
const { get, post } = useAxios(globalLocaleState)
const { setSurfaceShapePattern } = useRoofFn()
useEffect(() => {
@ -74,8 +80,120 @@ export function useRoofAllocationSetting(id) {
swalFire({ text: '할당할 지붕이 없습니다.' })
closePopup(id)
}
// console.log('🚀 ~ useEffect ~ roofMaterials >>>>>>>>>>>>> :', roofMaterials)
// console.log('🚀 ~ useEffect ~ basicSetting >>>>>>>>>>>>> :', basicSetting)
// console.log('🚀 ~ useEffect ~ roofList >>>>>>>>>>>>> :', roofList)
// console.log('🚀 ~ useEffect ~ currentRoofList >>>>>>>>>>>>> :', currentRoofList)
fetchBasicSettings()
}, [])
// 조회 및 초기화
const fetchBasicSettings = async () => {
try {
await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/1/${correntObjectNo}` }).then((res) => {
console.log('🚀 ~ useRoofAllocationSetting ~ fetchBasicSettings ~ res >>>>>>>>>>>>>>>>>>>>> :', res)
let roofsArray = {}
if (res.length > 0) {
roofsArray = res.map((item) => {
return {
roofApply: item.roofApply,
roofSeq: item.roofSeq,
roofMatlCd: item.roofMatlCd,
roofWidth: item.roofWidth,
roofHeight: item.roofHeight,
roofHajebichi: item.roofHajebichi,
roofGap: item.roofGap,
roofLayout: item.roofLayout,
}
})
} else {
roofsArray = [
{
roofApply: true,
roofSeq: 0,
roofMatlCd: 'ROOF_ID_WA_53A',
roofWidth: 265,
roofHeight: 235,
roofHajebichi: 0,
roofGap: 'HEI_455',
roofLayout: 'P',
},
]
}
// 나머지 데이터와 함께 'roofs' 배열을 patternData에 넣음
const patternData = {
roofs: roofsArray, // 만들어진 roofs 배열
}
console.log('fetchBasicSettings roofsArray', roofsArray)
// 데이터 설정
const selectRoofs = []
for (let i = 0; i < roofsArray.length; i++) {
roofMaterials?.map((material) => {
if (material.roofMatlCd === roofsArray[i].roofMatlCd) {
selectRoofs.push({ ...material
, selected: roofsArray[i].roofApply
, index: roofsArray[i].roofSeq
, id: roofsArray[i].roofMatlCd
, width: roofsArray[i].roofWidth
, length: roofsArray[i].roofHeight
, hajebichi: roofsArray[i].roofHajebichi
, raft: roofsArray[i].roofGap
, layout: roofsArray[i].roofLayout
})
setCurrentRoofList(selectRoofs)
}
})
}
setBasicSetting({ ...basicSetting, roofsData: roofsArray})
})
} catch (error) {
console.error('Data fetching error:', error)
}
}
// 저장
const basicSettingSave = async () => {
const patternData = {
objectNo: correntObjectNo,
roofSizeSet: basicSetting.roofSizeSet,
roofAngleSet: basicSetting.roofAngleSet,
roofMaterialsAddList: currentRoofList.map((item) => ({
roofApply: item.selected === null || item.selected === undefined ? 'true' : item.selected,
roofSeq: item.index === null || item.index === undefined ? 0 : item.index,
roofMatlCd: item.roofMatlCd === null || item.roofMatlCd === undefined ? 'ROOF_ID_WA_53A' : item.roofMatlCd,
roofWidth: item.width === null || item.width === undefined ? 0 : item.width,
roofHeight: item.length === null || item.length === undefined ? 0 : item.length,
roofHajebichi: item.hajebichi === null || item.hajebichi === undefined ? 0 : item.hajebichi,
roofGap: item.raft === null || item.raft === undefined ? 'HEI_455' : item.raft,
roofLayout: item.layout === null || item.layout === undefined ? 'P' : item.layout,
})
),
}
console.log('🚀 ~ basicSettingSave ~ patternData >>>>>>>>>>>>> :', patternData)
// HTTP POST 요청 보내기
await post({ url: `/api/canvas-management/canvas-basic-settings`, data: patternData })
.then((res) => {
swalFire({ text: getMessage(res.returnMessage) })
//Recoil 설정
// setCanvasSetting({ ...basicSetting })
fetchBasicSettings()
})
.catch((error) => {
swalFire({ text: error.message, icon: 'error' })
})
}
const onAddRoofMaterial = () => {
if (currentRoofList.length >= 4) {
swalFire({ type: 'alert', icon: 'error', text: getMessage('지붕재는 4개까지 선택 가능합니다.') })
@ -103,13 +221,17 @@ export function useRoofAllocationSetting(id) {
}
// 선택한 지붕재로 할당
const handleSave = () => {
const handleSave = () => {
basicSettingSave()
// 모두 actualSize 있으면 바로 적용 없으면 actualSize 설정
if (checkInnerLines()) {
if (checkInnerLines()) {
addPopup(popupId, 1, <ActualSizeSetting id={popupId} />)
} else {
apply()
}
}
// 지붕재 오른쪽 마우스 클릭 후 단일로 지붕재 변경 필요한 경우

View File

@ -685,6 +685,7 @@
"stuff.detail.save.valierror1": "垂直説説は0より大きい値を入力してください",
"stuff.detail.save.valierror2": "設置高さ0より大きい値を入力してください",
"stuff.detail.save.valierror3": "{0} 必須入力項目です.",
"stuff.detail.save.valierror4": "二次販売店名は必須オプションです.",
"stuff.planReqPopup.popTitle": "設計依頼検索",
"stuff.planReqPopup.btn1": "検索",
"stuff.planReqPopup.btn2": "初期化",

View File

@ -695,6 +695,7 @@
"stuff.detail.save.valierror1": "수직적설량은 0보다 큰 값을 입력하세요",
"stuff.detail.save.valierror2": "설치높이는 0보다 큰 값을 입력하세요",
"stuff.detail.save.valierror3": "{0} 필수 입력 항목입니다.",
"stuff.detail.save.valierror4": "2차 판매점명은 필수 선택사항입니다.",
"stuff.planReqPopup.popTitle": "설계 요청 검색",
"stuff.planReqPopup.btn1": "검색",
"stuff.planReqPopup.btn2": "초기화",