Merge branch 'dev' into dev-yj

This commit is contained in:
yjnoh 2025-01-06 10:37:44 +09:00
commit 22a9b97085
4 changed files with 98 additions and 22 deletions

View File

@ -49,7 +49,6 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
}, [])
useEffect(() => {
if (currentRoof.roofMatlCd.length > 0) {
setBasicSettings({
...basicSetting,
roofsData: {
@ -63,7 +62,6 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
roofLayout: currentRoof.layout,
},
})
}
}, [basicSetting.roofSizeSet, basicSetting.roofAngleSet, currentRoof])
// Function to update the roofType and corresponding values
@ -245,13 +243,11 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
options={roofMaterials.map((roof, index) => {
return { ...roof, name: globalLocale === 'ko' ? roof.roofMatlNm : roof.roofMatlNmJp }
})}
//value={roofMaterials.find((r) => r.roofMatlCd === basicSetting.roofs[0]?.roofMatlCd)}
//title={basicSetting.roofs[0]?.roofMatlNm}
value={basicSetting.roofSizeSet == 3 ? null : currentRoof.roofMatlCd}
onChange={(e) => handleRoofTypeChange(e.roofMatlCd)}
//sourceKey="id"
//targetKey="id"
//showKey="name"
sourceKey="id"
targetKey="id"
showKey="name"
disabled={basicSetting.roofSizeSet == 3}
/>
{/* <select

View File

@ -17,6 +17,7 @@ import QPagination from '../common/pagination/QPagination'
import { SessionContext } from '@/app/SessionProvider'
import { QcastContext } from '@/app/QcastProvider'
import { e } from 'mathjs'
export default function Stuff() {
const { setIsGlobalLoading } = useContext(QcastContext)
@ -41,11 +42,45 @@ export default function Stuff() {
//
const copyNo = async (value) => {
try {
await navigator.clipboard.writeText(value)
alert(getMessage('stuff.detail.header.successCopy'))
} catch (error) {
alert(getMessage('stuff.detail.header.failCopy'))
// try {
// await navigator.clipboard.writeText(value)
// alert(getMessage('stuff.detail.header.successCopy'))
// } catch (error) {
// alert(getMessage('stuff.detail.header.failCopy'))
// }
// Navigator clipboard api needs a secure context (https)
if (navigator.clipboard && window.isSecureContext) {
console.log('확인11', value)
await navigator.clipboard
.writeText(value)
.then(() => {
alert(getMessage('stuff.detail.header.successCopy'))
})
.catch((err) => {
alert(getMessage('stuff.detail.header.failCopy'))
})
} else {
console.log('확인22', value)
// Use the 'out of viewport hidden text area' trick
const textArea = document.createElement('textArea')
textArea.value = value
// Move textarea out of the viewport so it's not visible
textArea.style.position = 'absolute'
textArea.style.left = '-999999px'
document.body.prepend(textArea)
textArea.select()
try {
console.log('deprecated::document.execCommand(`copy`)', document.execCommand('copy'))
document.execCommand('copy')
alert(getMessage('stuff.detail.header.successCopy'))
} catch (err) {
alert(getMessage('stuff.detail.header.failCopy'))
} finally {
textArea.remove()
}
}
}

View File

@ -11,12 +11,48 @@ export default function StuffHeader() {
const { managementState } = useContext(GlobalDataContext)
//
// const copyObjectNo = async (objectNo) => {
// await navigator.clipboard.writeText(objectNo)
// alert(getMessage('stuff.detail.header.successCopy'))
// try {
// } catch (error) {
// alert(getMessage('stuff.detail.header.failCopy'))
// }
// }
const copyObjectNo = async (objectNo) => {
await navigator.clipboard.writeText(objectNo)
alert(getMessage('stuff.detail.header.successCopy'))
try {
} catch (error) {
alert(getMessage('stuff.detail.header.failCopy'))
if (navigator.clipboard && window.isSecureContext) {
console.log('확인11', objectNo)
await navigator.clipboard
.writeText(objectNo)
.then(() => {
alert(getMessage('stuff.detail.header.successCopy'))
})
.catch((err) => {
alert(getMessage('stuff.detail.header.failCopy'))
})
} else {
console.log('확인22', objectNo)
// Use the 'out of viewport hidden text area' trick
const textArea = document.createElement('textArea')
textArea.value = objectNo
// Move textarea out of the viewport so it's not visible
textArea.style.position = 'absolute'
textArea.style.left = '-999999px'
document.body.prepend(textArea)
textArea.select()
try {
console.log('deprecated::document.execCommand(`copy`)', document.execCommand('copy'))
document.execCommand('copy')
alert(getMessage('stuff.detail.header.successCopy'))
} catch (err) {
alert(getMessage('stuff.detail.header.failCopy'))
} finally {
textArea.remove()
}
}
}

View File

@ -1,4 +1,4 @@
import { useEffect, useState } from 'react'
import { useEffect, useState, useRef } from 'react'
import { useRecoilState, useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil'
import {
adsorptionPointModeState,
@ -145,11 +145,20 @@ export function useCanvasSetting() {
setBasicSettings({ ...basicSetting, selectedRoofMaterial: selectedRoofMaterial })
}
useEffect(() => {
if (roofMaterials) {
fetchBasicSettings()
const previousRoofMaterialsRef = useRef(null);
useEffect(() => { // 지붕재 select 정보 비교 후 변경된 것이 없으면 1회만 실행
if (JSON.stringify(previousRoofMaterialsRef.current) !== JSON.stringify(roofMaterials)) {
// 지붕재 select 정보가 존재해야 배치면초기설정 DB 정보 비교 후 지붕재 정보를 가져올 수 있음
if (roofMaterials) {
fetchBasicSettings();
}
// 이전 값을 업데이트
previousRoofMaterialsRef.current = roofMaterials;
}
}, [roofMaterials])
}, [roofMaterials]);
useEffect(() => {
if (!canvas) {