Merge pull request '[1205] DXF => PNG 추가, 메시지 일본어 추가' (#243) from dev into prd-deploy
Reviewed-on: #243
This commit is contained in:
commit
0dc7b62fae
@ -10,7 +10,8 @@ SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y="
|
||||
|
||||
# NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3"
|
||||
# NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_yAS4QDalL9jgQ7vS"
|
||||
NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK"
|
||||
NEXT_PUBLIC_CONVERTER_DWG_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK"
|
||||
NEXT_PUBLIC_CONVERTER_DXF_API_URL="https://v2.convertapi.com/convert/dxf/to/png?Secret=secret_a0FLEK6M2oTpXInK"
|
||||
|
||||
NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-stg.q-cells.jp:8120/eos/login/autoLogin"
|
||||
NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-stg.q-cells.jp:8120/qm/login/autoLogin"
|
||||
|
||||
@ -10,7 +10,8 @@ SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y="
|
||||
|
||||
# NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3"
|
||||
# NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_yAS4QDalL9jgQ7vS"
|
||||
NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK"
|
||||
NEXT_PUBLIC_CONVERTER_DWG_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK"
|
||||
NEXT_PUBLIC_CONVERTER_DXF_API_URL="https://v2.convertapi.com/convert/dxf/to/png?Secret=secret_a0FLEK6M2oTpXInK"
|
||||
|
||||
NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-stg.q-cells.jp:8120/eos/login/autoLogin"
|
||||
NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-stg.q-cells.jp:8120/qm/login/autoLogin"
|
||||
@ -29,4 +30,7 @@ AWS_ACCESS_KEY_ID="AKIA3K4QWLZHFZRJOM2E"
|
||||
AWS_SECRET_ACCESS_KEY="Cw87TjKwnTWRKgORGxYiFU6GUTgu25eUw4eLBNcA"
|
||||
NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp"
|
||||
|
||||
S3_PROFILE="dev"
|
||||
S3_PROFILE="dev"
|
||||
|
||||
#logging
|
||||
NEXT_PUBLIC_ENABLE_LOGGING=false
|
||||
|
||||
@ -10,7 +10,8 @@ SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y="
|
||||
|
||||
# NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3"
|
||||
# NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_yAS4QDalL9jgQ7vS"
|
||||
NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK"
|
||||
NEXT_PUBLIC_CONVERTER_DWG_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK"
|
||||
NEXT_PUBLIC_CONVERTER_DXF_API_URL="https://v2.convertapi.com/convert/dxf/to/png?Secret=secret_a0FLEK6M2oTpXInK"
|
||||
|
||||
NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="https://q-order.q-cells.jp/eos/login/autoLogin"
|
||||
NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="https://q-musubi.q-cells.jp/qm/login/autoLogin"
|
||||
|
||||
Binary file not shown.
@ -9,6 +9,8 @@ import { deleteBackGroundImage, setBackGroundImage } from '@/lib/imageActions'
|
||||
import { settingModalFirstOptionsState } from '@/store/settingAtom'
|
||||
import { popSpinnerState } from '@/store/popupAtom'
|
||||
import Config from '@/config/config.export'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
import { logger } from '@/util/logger'
|
||||
|
||||
/**
|
||||
* 배경 이미지 관리
|
||||
@ -23,7 +25,9 @@ import Config from '@/config/config.export'
|
||||
* @returns {object}
|
||||
*/
|
||||
export function useRefFiles() {
|
||||
const converterUrl = process.env.NEXT_PUBLIC_CONVERTER_API_URL
|
||||
const converterDwgUrl = process.env.NEXT_PUBLIC_CONVERTER_DWG_API_URL
|
||||
const converterDxfUrl = process.env.NEXT_PUBLIC_CONVERTER_DXF_API_URL
|
||||
const { getMessage } = useMessage()
|
||||
const [refImage, setRefImage] = useState(null)
|
||||
const [refFileMethod, setRefFileMethod] = useState('1')
|
||||
const [mapPositionAddress, setMapPositionAddress] = useState('')
|
||||
@ -50,12 +54,12 @@ export function useRefFiles() {
|
||||
* @param {*} file
|
||||
*/
|
||||
const handleRefFile = (file) => {
|
||||
console.log('handleRefFile', file)
|
||||
console.log('refImage', refImage)
|
||||
logger.log('handleRefFile', file)
|
||||
logger.log('refImage', refImage)
|
||||
|
||||
if (refImage) {
|
||||
swalFire({
|
||||
text: '파일을 변경하시겠습니까?',
|
||||
text: getMessage('common.message.ref.file.change'),
|
||||
type: 'confirm',
|
||||
confirmFn: () => {
|
||||
refFileSetting(file)
|
||||
@ -71,15 +75,29 @@ export function useRefFiles() {
|
||||
* @param {File} file
|
||||
*/
|
||||
const refFileSetting = (file) => {
|
||||
console.log('🚀 ~ refFileSetting ~ file:', file)
|
||||
logger.log('🚀 ~ refFileSetting ~ file:', file)
|
||||
|
||||
setPopSpinnerStore(true)
|
||||
const newOption1 = settingModalFirstOptions.option1.map((option) => ({
|
||||
...option,
|
||||
selected: option.column === 'imageDisplay' ? true : option.selected,
|
||||
}))
|
||||
|
||||
setSettingModalFirstOptions((prev) => ({
|
||||
...prev,
|
||||
option1: newOption1,
|
||||
}))
|
||||
|
||||
if (file.name.split('.').pop() === 'dwg') {
|
||||
handleUploadConvertRefFile(file)
|
||||
handleUploadConvertRefFile(file, converterDwgUrl);
|
||||
} else if (file.name.split('.').pop() === 'dxf') {
|
||||
handleUploadConvertRefFile(file, converterDxfUrl);
|
||||
} else {
|
||||
if (file && ['image/png', 'image/jpg', 'image/jpeg', 'image/bmp', 'image/gif'].includes(file.type)) {
|
||||
handleUploadImageRefFile(file)
|
||||
} else {
|
||||
swalFire({
|
||||
text: '이미지가 아닙니다.',
|
||||
text: getMessage('common.message.ref.file.noImage'),
|
||||
type: 'alert',
|
||||
icon: 'error',
|
||||
})
|
||||
@ -92,12 +110,12 @@ export function useRefFiles() {
|
||||
*/
|
||||
const handleFileDelete = async () => {
|
||||
swalFire({
|
||||
text: '삭제하시겠습니까?',
|
||||
text: getMessage('common.message.data.delete'),
|
||||
type: 'confirm',
|
||||
confirmFn: async () => {
|
||||
setPopSpinnerStore(true)
|
||||
console.log('🚀 ~ handleFileDelete ~ handleFileDelete:', refImage)
|
||||
console.log('🚀 ~ handleFileDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName)
|
||||
logger.log('🚀 ~ handleFileDelete ~ handleFileDelete:', refImage)
|
||||
logger.log('🚀 ~ handleFileDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName)
|
||||
await del({ url: `${Config().baseUrl}/api/image/upload?fileName=${currentCanvasPlan.bgImageName}` })
|
||||
setCurrentBgImage(null)
|
||||
await deleteBackGroundImage({
|
||||
@ -114,11 +132,11 @@ export function useRefFiles() {
|
||||
*/
|
||||
const handleAddressDelete = async () => {
|
||||
swalFire({
|
||||
text: '삭제하시겠습니까?',
|
||||
text: getMessage('common.message.data.delete'),
|
||||
type: 'confirm',
|
||||
confirmFn: async () => {
|
||||
console.log('🚀 ~ handleAddressDelete ~ handleAddressDelete:', refImage)
|
||||
console.log('🚀 ~ handleAddressDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName)
|
||||
logger.log('🚀 ~ handleAddressDelete ~ handleAddressDelete:', refImage)
|
||||
logger.log('🚀 ~ handleAddressDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName)
|
||||
await del({ url: `${Config().baseUrl}/api/image/map?fileName=${currentCanvasPlan.bgImageName}` })
|
||||
setMapPositionAddress('')
|
||||
setCurrentBgImage(null)
|
||||
@ -134,7 +152,7 @@ export function useRefFiles() {
|
||||
* 주소로 구글 맵 이미지 다운로드하여 캔버스 배경으로 로드
|
||||
*/
|
||||
const handleMapImageDown = async () => {
|
||||
console.log('🚀 ~ handleMapImageDown ~ handleMapImageDown:')
|
||||
debugger; logger.log('🚀 ~ handleMapImageDown ~ handleMapImageDown:')
|
||||
if (queryRef.current.value === '' || queryRef.current.value === null) {
|
||||
return
|
||||
}
|
||||
@ -152,7 +170,7 @@ export function useRefFiles() {
|
||||
const res = await get({
|
||||
url: `${Config().baseUrl}/api/image/map?q=${queryRef.current.value}&fileNm=${currentCanvasPlan.id}&zoom=20`,
|
||||
})
|
||||
console.log('🚀 ~ handleMapImageDown ~ res:', res)
|
||||
logger.log('🚀 ~ handleMapImageDown ~ res:', res)
|
||||
setCurrentBgImage(`${process.env.NEXT_PUBLIC_AWS_S3_BASE_URL}/${res.fileName}`)
|
||||
|
||||
await setBackGroundImage({
|
||||
@ -170,9 +188,11 @@ export function useRefFiles() {
|
||||
// if (!currentBgImage) {
|
||||
// return
|
||||
// }
|
||||
console.log('🚀 ~ useEffect ~ currentBgImage:', currentBgImage)
|
||||
logger.log('🚀 ~ useEffect ~ currentBgImage:', currentBgImage)
|
||||
if (currentBgImage) {
|
||||
handleBackImageLoadToCanvas(currentBgImage)
|
||||
handleBackImageLoadToCanvas(currentBgImage, () => {
|
||||
logger.log('Background image loaded successfully')
|
||||
})
|
||||
setCurrentCanvasPlan((prev) => ({
|
||||
...prev,
|
||||
// bgImageName: refImage?.name ?? null,
|
||||
@ -194,16 +214,16 @@ export function useRefFiles() {
|
||||
* @param {*} file
|
||||
*/
|
||||
const handleUploadImageRefFile = async (file) => {
|
||||
setPopSpinnerStore(true)
|
||||
const newOption1 = settingModalFirstOptions.option1.map((option) => ({
|
||||
...option,
|
||||
selected: option.column === 'imageDisplay' ? true : option.selected,
|
||||
}))
|
||||
|
||||
setSettingModalFirstOptions((prev) => ({
|
||||
...prev,
|
||||
option1: newOption1,
|
||||
}))
|
||||
// setPopSpinnerStore(true)
|
||||
// const newOption1 = settingModalFirstOptions.option1.map((option) => ({
|
||||
// ...option,
|
||||
// selected: option.column === 'imageDisplay' ? true : option.selected,
|
||||
// }))
|
||||
//
|
||||
// setSettingModalFirstOptions((prev) => ({
|
||||
// ...prev,
|
||||
// option1: newOption1,
|
||||
// }))
|
||||
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
@ -212,7 +232,7 @@ export function useRefFiles() {
|
||||
url: `${Config().baseUrl}/api/image/upload`,
|
||||
data: formData,
|
||||
})
|
||||
console.log('🚀 ~ handleUploadImageRefFile ~ res:', res)
|
||||
logger.log('🚀 ~ handleUploadImageRefFile ~ res:', res)
|
||||
setCurrentBgImage(`${process.env.NEXT_PUBLIC_AWS_S3_BASE_URL}/${res.fileName}`)
|
||||
setRefImage(file)
|
||||
|
||||
@ -222,7 +242,7 @@ export function useRefFiles() {
|
||||
// imagePath: `${process.env.NEXT_PUBLIC_HOST_URL}${res.filePath}`,
|
||||
imagePath: `${res.filePath}`,
|
||||
}
|
||||
console.log('🚀 ~ handleUploadImageRefFile ~ params:', params)
|
||||
logger.log('🚀 ~ handleUploadImageRefFile ~ params:', params)
|
||||
await setBackGroundImage(params)
|
||||
setPopSpinnerStore(false)
|
||||
}
|
||||
@ -230,14 +250,15 @@ export function useRefFiles() {
|
||||
/**
|
||||
* RefFile이 캐드 도면 파일일 경우 변환하여 이미지로 저장
|
||||
* @param {*} file
|
||||
* @param converterUrl
|
||||
*/
|
||||
const handleUploadConvertRefFile = async (file) => {
|
||||
const handleUploadConvertRefFile = async (file, converterUrl) => {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
|
||||
/** 캐드 도면 파일 변환 */
|
||||
const res = await post({ url: converterUrl, data: formData })
|
||||
console.log('🚀 ~ handleUploadConvertRefFile ~ res:', res)
|
||||
logger.log('🚀 ~ handleUploadConvertRefFile ~ res:', res)
|
||||
|
||||
// Convert Base64 to Blob
|
||||
const base64Data = res.Files[0].FileData
|
||||
@ -269,7 +290,7 @@ export function useRefFiles() {
|
||||
url: `${Config().baseUrl}/api/image/cad`,
|
||||
data: newFormData,
|
||||
})
|
||||
console.log('🚀 ~ handleUploadConvertRefFile ~ result:', result)
|
||||
logger.log('🚀 ~ handleUploadConvertRefFile ~ result:', result)
|
||||
|
||||
setCurrentBgImage(`${process.env.NEXT_PUBLIC_AWS_S3_BASE_URL}/${result.fileName}`)
|
||||
// setCurrentBgImage(result.filePath)
|
||||
@ -281,8 +302,9 @@ export function useRefFiles() {
|
||||
// imagePath: `${process.env.NEXT_PUBLIC_HOST_URL}${res.filePath}`,
|
||||
imagePath: `${result.filePath}`,
|
||||
}
|
||||
console.log('🚀 ~ handleUploadImageRefFile ~ params:', params)
|
||||
logger.log('🚀 ~ handleUploadImageRefFile ~ params:', params)
|
||||
await setBackGroundImage(params)
|
||||
setPopSpinnerStore(false)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -551,6 +551,8 @@
|
||||
"common.message.writeToConfirm": "作成解除を実行しますか?",
|
||||
"common.message.password.init.success": "パスワード[{0}]に初期化されました。",
|
||||
"common.message.no.edit.save": "このドキュメントは変更できません。",
|
||||
"common.message.ref.file.change": "ファイルを変更しますか?",
|
||||
"common.message.ref.file.noImage": "画像ではありません。",
|
||||
"common.load": "読込",
|
||||
"common.input.file": "ファイルを読み込む",
|
||||
"common.input.file.load": "読込",
|
||||
|
||||
@ -551,6 +551,8 @@
|
||||
"common.message.writeToConfirm": "작성 해제를 실행하시겠습니까?",
|
||||
"common.message.password.init.success": "비밀번호 [{0}]로 초기화 되었습니다.",
|
||||
"common.message.no.edit.save": "This document cannot be changed.",
|
||||
"common.message.ref.file.change": "파일을 변경하시겠습니까?",
|
||||
"common.message.ref.file.noImage": "이미지가 아닙니다.",
|
||||
"common.load": "불러오기",
|
||||
"common.input.file": "파일 불러오기",
|
||||
"common.input.file.load": "불러오기",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user