Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
cc5f5f85fe
@ -234,6 +234,7 @@ export default function Login() {
|
|||||||
onBlur={() => setSecFocus(false)}
|
onBlur={() => setSecFocus(false)}
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
|
type="button"
|
||||||
className={`password-hidden ${passwordVisible ? 'visible' : ''}`}
|
className={`password-hidden ${passwordVisible ? 'visible' : ''}`}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import { useRecoilValue } from 'recoil'
|
|||||||
import { currentObjectState } from '@/store/canvasAtom'
|
import { currentObjectState } from '@/store/canvasAtom'
|
||||||
import { useCanvasEvent } from '@/hooks/useCanvasEvent'
|
import { useCanvasEvent } from '@/hooks/useCanvasEvent'
|
||||||
import QContextMenu from '@/components/common/context-menu/QContextMenu'
|
import QContextMenu from '@/components/common/context-menu/QContextMenu'
|
||||||
|
import { useCanvasConfigInitialize } from '@/hooks/common/useCanvasConfigInitialize'
|
||||||
|
|
||||||
export default function CanvasFrame({ plan }) {
|
export default function CanvasFrame({ plan }) {
|
||||||
const canvasRef = useRef(null)
|
const canvasRef = useRef(null)
|
||||||
@ -21,7 +22,7 @@ export default function CanvasFrame({ plan }) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
const { checkCanvasObjectEvent, checkUnsavedCanvasPlan } = usePlan()
|
const { checkCanvasObjectEvent, checkUnsavedCanvasPlan } = usePlan()
|
||||||
|
const { canvasLoadInit } = useCanvasConfigInitialize()
|
||||||
const currentObject = useRecoilValue(currentObjectState)
|
const currentObject = useRecoilValue(currentObjectState)
|
||||||
|
|
||||||
useEvent()
|
useEvent()
|
||||||
@ -32,47 +33,14 @@ export default function CanvasFrame({ plan }) {
|
|||||||
if (plan?.canvasStatus) {
|
if (plan?.canvasStatus) {
|
||||||
canvas?.loadFromJSON(JSON.parse(plan.canvasStatus), function () {
|
canvas?.loadFromJSON(JSON.parse(plan.canvasStatus), function () {
|
||||||
canvas?.renderAll() // 캔버스를 다시 그립니다.
|
canvas?.renderAll() // 캔버스를 다시 그립니다.
|
||||||
|
canvasLoadInit() //config된 상태로 캔버스 객체를 그린다
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// const checkEventName = [
|
|
||||||
// 'object:modified',
|
|
||||||
// 'object:moving',
|
|
||||||
// 'object:scaling',
|
|
||||||
// 'object:rotating',
|
|
||||||
// 'object:skewing',
|
|
||||||
// 'object:resizing',
|
|
||||||
// 'object:selected',
|
|
||||||
// 'object:added',
|
|
||||||
// 'object:removed',
|
|
||||||
// ]
|
|
||||||
|
|
||||||
canvas?.off('object:added')
|
|
||||||
canvas?.off('object:modified')
|
|
||||||
canvas?.off('object:removed')
|
|
||||||
|
|
||||||
loadCanvas()
|
loadCanvas()
|
||||||
|
|
||||||
if (plan) {
|
|
||||||
canvas?.on('object:added', (e) => {
|
|
||||||
if (e?.target.name !== 'mouseLine') {
|
|
||||||
checkCanvasObjectEvent(e, plan.id)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
canvas?.on('object:modified', (e) => {
|
|
||||||
if (e?.target.name !== 'mouseLine') {
|
|
||||||
checkCanvasObjectEvent(e, plan.id)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
canvas?.on('object:removed', (e) => {
|
|
||||||
if (e?.target.name !== 'mouseLine') {
|
|
||||||
checkCanvasObjectEvent(e, plan.id)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}, [plan, canvas])
|
}, [plan, canvas])
|
||||||
|
|
||||||
const onClickContextMenu = (index) => {}
|
const onClickContextMenu = (index) => {}
|
||||||
|
|||||||
@ -69,7 +69,6 @@ export default function CanvasMenu(props) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const { commonFunctions } = useCommonUtils({
|
const { commonFunctions } = useCommonUtils({
|
||||||
canvas,
|
|
||||||
commonFunctionState,
|
commonFunctionState,
|
||||||
setCommonFunctionState,
|
setCommonFunctionState,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import WithDraggable from '@/components/common/draggable/WithDraggable'
|
|
||||||
import { usePopup } from '@/hooks/usePopup'
|
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
|
import { useRecoilValue } from 'recoil'
|
||||||
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
|
import WithDraggable from '@/components/common/draggable/WithDraggable'
|
||||||
|
import { canvasState } from '@/store/canvasAtom'
|
||||||
|
|
||||||
export default function PlanSizeSetting(props) {
|
export default function PlanSizeSetting(props) {
|
||||||
const { horizon, setHorizon, vertical, setVertical, id, pos = { x: 985, y: 180 }, setIsShow } = props
|
const { horizon, setHorizon, vertical, setVertical, id, pos = { x: 985, y: 180 }, setIsShow } = props
|
||||||
@ -9,6 +11,7 @@ export default function PlanSizeSetting(props) {
|
|||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const [originHorizon, setOriginHorizon] = useState(horizon)
|
const [originHorizon, setOriginHorizon] = useState(horizon)
|
||||||
const [originVertical, setOriginVertical] = useState(vertical)
|
const [originVertical, setOriginVertical] = useState(vertical)
|
||||||
|
const canvas = useRecoilValue(canvasState)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WithDraggable isShow={true} pos={pos}>
|
<WithDraggable isShow={true} pos={pos}>
|
||||||
@ -55,6 +58,9 @@ export default function PlanSizeSetting(props) {
|
|||||||
setVertical(originVertical)
|
setVertical(originVertical)
|
||||||
setIsShow(false)
|
setIsShow(false)
|
||||||
closePopup(id)
|
closePopup(id)
|
||||||
|
canvas.setWidth(originHorizon)
|
||||||
|
canvas.setHeight(originVertical)
|
||||||
|
canvas.renderAll()
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{getMessage('modal.common.save')}
|
{getMessage('modal.common.save')}
|
||||||
|
|||||||
@ -53,9 +53,9 @@ export default function Stuff() {
|
|||||||
const onDoubleClick = (e) => {
|
const onDoubleClick = (e) => {
|
||||||
let objectNo = e.target.innerText
|
let objectNo = e.target.innerText
|
||||||
if (objectNo.substring(0, 1) === 'R') {
|
if (objectNo.substring(0, 1) === 'R') {
|
||||||
router.push(`${pathname}/detail?objectNo=${objectNo.toString()}`)
|
router.push(`${pathname}/detail?objectNo=${objectNo.toString()}`, { scroll: false })
|
||||||
} else {
|
} else {
|
||||||
router.push(`${pathname}/tempdetail?objectNo=${objectNo.toString()}`)
|
router.push(`${pathname}/tempdetail?objectNo=${objectNo.toString()}`, { scroll: false })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,9 +157,9 @@ export default function Stuff() {
|
|||||||
//T 면 임시 R은 진짜
|
//T 면 임시 R은 진짜
|
||||||
if (event.data.objectNo) {
|
if (event.data.objectNo) {
|
||||||
if (event.data.objectNo.substring(0, 1) === 'R') {
|
if (event.data.objectNo.substring(0, 1) === 'R') {
|
||||||
router.push(`${pathname}/detail?objectNo=${event.data.objectNo.toString()}`)
|
router.push(`${pathname}/detail?objectNo=${event.data.objectNo.toString()}`, { scroll: false })
|
||||||
} else {
|
} else {
|
||||||
router.push(`${pathname}/tempdetail?objectNo=${event.data.objectNo.toString()}`)
|
router.push(`${pathname}/tempdetail?objectNo=${event.data.objectNo.toString()}`, { scroll: false })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,6 +228,7 @@ export default function Stuff() {
|
|||||||
//물건 메뉴 눌러서 최초 진입 sessionState
|
//물건 메뉴 눌러서 최초 진입 sessionState
|
||||||
if (stuffSearchParams?.code === 'S') {
|
if (stuffSearchParams?.code === 'S') {
|
||||||
const params = {
|
const params = {
|
||||||
|
saleStoreId: sessionState?.storeId,
|
||||||
schObjectNo: stuffSearchParams?.schObjectNo,
|
schObjectNo: stuffSearchParams?.schObjectNo,
|
||||||
schAddress: stuffSearchParams?.schAddress,
|
schAddress: stuffSearchParams?.schAddress,
|
||||||
schObjectName: stuffSearchParams?.schObjectName,
|
schObjectName: stuffSearchParams?.schObjectName,
|
||||||
@ -244,7 +245,7 @@ export default function Stuff() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
const apiUrl = `/api/object/list?saleStoreId=${sessionState?.storeId}&${queryStringFormatter(params)}`
|
const apiUrl = `/api/object/list?${queryStringFormatter(params)}`
|
||||||
await get({
|
await get({
|
||||||
url: apiUrl,
|
url: apiUrl,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
@ -258,6 +259,7 @@ export default function Stuff() {
|
|||||||
} else {
|
} else {
|
||||||
//메인화면에서 진입
|
//메인화면에서 진입
|
||||||
const params = {
|
const params = {
|
||||||
|
saleStoreId: sessionState?.storeId,
|
||||||
schObjectNo: stuffSearchParams.schObjectNo,
|
schObjectNo: stuffSearchParams.schObjectNo,
|
||||||
schAddress: '',
|
schAddress: '',
|
||||||
schObjectName: '',
|
schObjectName: '',
|
||||||
@ -274,8 +276,7 @@ export default function Stuff() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
const apiUrl = `/api/object/list?saleStoreId=${sessionState?.storeId}&${queryStringFormatter(params)}`
|
const apiUrl = `/api/object/list?${queryStringFormatter(params)}`
|
||||||
|
|
||||||
await get({
|
await get({
|
||||||
url: apiUrl,
|
url: apiUrl,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
@ -297,9 +298,8 @@ export default function Stuff() {
|
|||||||
stuffSearchParams.schSortType = defaultSortType
|
stuffSearchParams.schSortType = defaultSortType
|
||||||
|
|
||||||
setPageNo(1)
|
setPageNo(1)
|
||||||
|
//조회를 눌렀을때
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
// const apiUrl = `/api/object/list?saleStoreId=T01&${queryStringFormatter(stuffSearchParams)}`
|
|
||||||
const apiUrl = `/api/object/list?saleStoreId=${sessionState?.storeId}&${queryStringFormatter(stuffSearchParams)}`
|
const apiUrl = `/api/object/list?saleStoreId=${sessionState?.storeId}&${queryStringFormatter(stuffSearchParams)}`
|
||||||
await get({ url: apiUrl }).then((res) => {
|
await get({ url: apiUrl }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
@ -329,7 +329,6 @@ export default function Stuff() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
setPageNo(1)
|
setPageNo(1)
|
||||||
// const apiUrl = `/api/object/list?saleStoreId=T01&${queryStringFormatter(stuffSearchParams)}`
|
|
||||||
const apiUrl = `/api/object/list?saleStoreId=${sessionState?.storeId}&${queryStringFormatter(stuffSearchParams)}`
|
const apiUrl = `/api/object/list?saleStoreId=${sessionState?.storeId}&${queryStringFormatter(stuffSearchParams)}`
|
||||||
get({ url: apiUrl }).then((res) => {
|
get({ url: apiUrl }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
@ -360,7 +359,6 @@ export default function Stuff() {
|
|||||||
|
|
||||||
setPageNo(1)
|
setPageNo(1)
|
||||||
|
|
||||||
// const apiUrl = `/api/object/list?saleStoreId=T01&${queryStringFormatter(stuffSearchParams)}`
|
|
||||||
const apiUrl = `/api/object/list?saleStoreId=${sessionState?.storeId}&${queryStringFormatter(stuffSearchParams)}`
|
const apiUrl = `/api/object/list?saleStoreId=${sessionState?.storeId}&${queryStringFormatter(stuffSearchParams)}`
|
||||||
get({ url: apiUrl }).then((res) => {
|
get({ url: apiUrl }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
|
|||||||
@ -100,13 +100,13 @@ export default function StuffDetail() {
|
|||||||
field: 'planNo',
|
field: 'planNo',
|
||||||
headerName: getMessage('stuff.detail.planGridHeader.planNo'),
|
headerName: getMessage('stuff.detail.planGridHeader.planNo'),
|
||||||
width: 100,
|
width: 100,
|
||||||
cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' },
|
cellStyle: { justifyContent: 'center' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'orderFlg',
|
field: 'orderFlg',
|
||||||
headerName: getMessage('stuff.detail.planGridHeader.orderFlg'),
|
headerName: getMessage('stuff.detail.planGridHeader.orderFlg'),
|
||||||
width: 80,
|
width: 80,
|
||||||
cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' },
|
cellStyle: { justifyContent: 'center' },
|
||||||
cellRenderer: (params) => {
|
cellRenderer: (params) => {
|
||||||
//1일때만 동그라미
|
//1일때만 동그라미
|
||||||
let orderFlg
|
let orderFlg
|
||||||
@ -118,13 +118,13 @@ export default function StuffDetail() {
|
|||||||
field: 'moduleModel',
|
field: 'moduleModel',
|
||||||
headerName: getMessage('stuff.detail.planGridHeader.moduleModel'),
|
headerName: getMessage('stuff.detail.planGridHeader.moduleModel'),
|
||||||
flex: 1,
|
flex: 1,
|
||||||
cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' },
|
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/ },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'capacity',
|
field: 'capacity',
|
||||||
headerName: getMessage('stuff.detail.planGridHeader.capacity'),
|
headerName: getMessage('stuff.detail.planGridHeader.capacity'),
|
||||||
width: 120,
|
width: 120,
|
||||||
cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' },
|
cellStyle: { justifyContent: 'flex-end' /* 우측정렬*/ },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'roofMaterialIdMulti',
|
field: 'roofMaterialIdMulti',
|
||||||
@ -132,17 +132,18 @@ export default function StuffDetail() {
|
|||||||
width: 140,
|
width: 140,
|
||||||
wrapText: true,
|
wrapText: true,
|
||||||
autoHeight: true,
|
autoHeight: true,
|
||||||
cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' },
|
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/ },
|
||||||
cellRenderer: (params) => {
|
cellRenderer: (params) => {
|
||||||
|
//콤마가 아니라 、.. 일본콤마?
|
||||||
let origin = params.value
|
let origin = params.value
|
||||||
if (origin !== null) {
|
if (origin !== null) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{origin?.split(',').map((it) => (
|
{origin?.split('、').map((it, idx) => (
|
||||||
<>
|
<span key={idx} className="block">
|
||||||
{it}
|
{it}
|
||||||
<br />
|
<br />
|
||||||
</>
|
</span>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
@ -156,17 +157,17 @@ export default function StuffDetail() {
|
|||||||
headerName: getMessage('stuff.detail.planGridHeader.constructSpecification'),
|
headerName: getMessage('stuff.detail.planGridHeader.constructSpecification'),
|
||||||
wrapText: true,
|
wrapText: true,
|
||||||
autoHeight: true,
|
autoHeight: true,
|
||||||
cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' },
|
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/ },
|
||||||
cellRenderer: (params) => {
|
cellRenderer: (params) => {
|
||||||
let origin = params.value
|
let origin = params.value
|
||||||
if (origin !== null) {
|
if (origin !== null) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{origin?.split(',').map((it) => (
|
{origin?.split('、').map((it, idx) => (
|
||||||
<>
|
<span key={idx} className="block">
|
||||||
{it}
|
{it}
|
||||||
<br />
|
<br />
|
||||||
</>
|
</span>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
@ -180,17 +181,17 @@ export default function StuffDetail() {
|
|||||||
headerName: getMessage('stuff.detail.planGridHeader.supportMethodIdMulti'),
|
headerName: getMessage('stuff.detail.planGridHeader.supportMethodIdMulti'),
|
||||||
wrapText: true,
|
wrapText: true,
|
||||||
autoHeight: true,
|
autoHeight: true,
|
||||||
cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' },
|
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/ },
|
||||||
cellRenderer: (params) => {
|
cellRenderer: (params) => {
|
||||||
let origin = params.value
|
let origin = params.value
|
||||||
if (origin !== null) {
|
if (origin !== null) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{origin?.split(',').map((it) => (
|
{origin?.split('、').map((it, idx) => (
|
||||||
<>
|
<span key={idx} className="block">
|
||||||
{it}
|
{it}
|
||||||
<br />
|
<br />
|
||||||
</>
|
</span>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
@ -205,17 +206,17 @@ export default function StuffDetail() {
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
wrapText: true,
|
wrapText: true,
|
||||||
autoHeight: true,
|
autoHeight: true,
|
||||||
cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' },
|
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/ },
|
||||||
cellRenderer: (params) => {
|
cellRenderer: (params) => {
|
||||||
let origin = params.value
|
let origin = params.value
|
||||||
if (origin !== null) {
|
if (origin !== null) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{origin?.split(',').map((it) => (
|
{origin?.split('、').map((it, idx) => (
|
||||||
<>
|
<span key={idx} className="block">
|
||||||
{it}
|
{it}
|
||||||
<br />
|
<br />
|
||||||
</>
|
</span>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
@ -229,7 +230,7 @@ export default function StuffDetail() {
|
|||||||
headerName: getMessage('stuff.detail.planGridHeader.management'),
|
headerName: getMessage('stuff.detail.planGridHeader.management'),
|
||||||
width: 200,
|
width: 200,
|
||||||
autoHeight: true,
|
autoHeight: true,
|
||||||
cellStyle: { display: 'flex', justifyContent: 'center', alignItems: 'center' },
|
cellStyle: { justifyContent: 'center' },
|
||||||
cellRenderer: () => {
|
cellRenderer: () => {
|
||||||
return (
|
return (
|
||||||
<div className="grid-cell-btn">
|
<div className="grid-cell-btn">
|
||||||
@ -266,7 +267,7 @@ export default function StuffDetail() {
|
|||||||
setEditMode('EDIT')
|
setEditMode('EDIT')
|
||||||
|
|
||||||
if (objectNo.substring(0, 1) === 'R') {
|
if (objectNo.substring(0, 1) === 'R') {
|
||||||
//진짜
|
//벨리데이션 체크용..
|
||||||
setIsFormValid(true)
|
setIsFormValid(true)
|
||||||
}
|
}
|
||||||
promiseGet({ url: `/api/object/${objectNo}/detail` }).then((res) => {
|
promiseGet({ url: `/api/object/${objectNo}/detail` }).then((res) => {
|
||||||
@ -299,6 +300,7 @@ export default function StuffDetail() {
|
|||||||
//1차점 : X167 T01
|
//1차점 : X167 T01
|
||||||
//2차점 : 10X22, 201X112
|
//2차점 : 10X22, 201X112
|
||||||
get({ url: `/api/object/saleStore/${sessionState?.storeId}/list` }).then((res) => {
|
get({ url: `/api/object/saleStore/${sessionState?.storeId}/list` }).then((res) => {
|
||||||
|
// get({ url: `/api/object/saleStore/T01/list` }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
const firstList = res.filter((row) => row.saleStoreLevel === '1')
|
const firstList = res.filter((row) => row.saleStoreLevel === '1')
|
||||||
const otherList = res.filter((row) => row.saleStoreLevel !== '1')
|
const otherList = res.filter((row) => row.saleStoreLevel !== '1')
|
||||||
@ -355,6 +357,7 @@ export default function StuffDetail() {
|
|||||||
//1차점 : X167 T01
|
//1차점 : X167 T01
|
||||||
//2차점 : 10X22, 201X112
|
//2차점 : 10X22, 201X112
|
||||||
get({ url: `/api/object/saleStore/${sessionState?.storeId}/list` }).then((res) => {
|
get({ url: `/api/object/saleStore/${sessionState?.storeId}/list` }).then((res) => {
|
||||||
|
// get({ url: `/api/object/saleStore/T01/list` }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
const firstList = res.filter((row) => row.saleStoreLevel === '1')
|
const firstList = res.filter((row) => row.saleStoreLevel === '1')
|
||||||
const otherList = res.filter((row) => row.saleStoreLevel !== '1')
|
const otherList = res.filter((row) => row.saleStoreLevel !== '1')
|
||||||
@ -363,8 +366,10 @@ export default function StuffDetail() {
|
|||||||
//1차점 아닌 판매점 셀렉트박스
|
//1차점 아닌 판매점 셀렉트박스
|
||||||
setOriginOtherSaleStoreList(otherList)
|
setOriginOtherSaleStoreList(otherList)
|
||||||
setOtherSaleStoreList(otherList)
|
setOtherSaleStoreList(otherList)
|
||||||
|
|
||||||
|
// console.log('1차점리스트::', firstList)
|
||||||
|
// console.log('2차점리스트::', otherList)
|
||||||
}
|
}
|
||||||
console.log('상세데이타::세팅:::::', detailData)
|
|
||||||
//설계의뢰No.
|
//설계의뢰No.
|
||||||
form.setValue('planReqNo', detailData.planReqNo)
|
form.setValue('planReqNo', detailData.planReqNo)
|
||||||
//담당자
|
//담당자
|
||||||
@ -384,14 +389,16 @@ export default function StuffDetail() {
|
|||||||
//물건명 후리가나
|
//물건명 후리가나
|
||||||
form.setValue('objectNameKana', detailData.objectNameKana)
|
form.setValue('objectNameKana', detailData.objectNameKana)
|
||||||
|
|
||||||
// console.log('1차점리스트::', firstList)
|
console.log('상세데이타::세팅:::::', detailData)
|
||||||
// console.log('2차점리스트::', otherList)
|
//상세데이터에는 2차점까지 골랐으면 2차점 정보만 내려옴
|
||||||
setSelOptions(detailData.saleStoreId)
|
//로그인세션이 1차점이면 1차점은 본인으로 디폴트 셋팅하고 2차점에 상세데이터 넣어줌
|
||||||
form.setValue('saleStoreId', detailData.saleStoreId)
|
//1차점
|
||||||
form.setValue('saleStoreLevel', sessionState?.storeLvl)
|
// setSelOptions(detailData.saleStoreId)
|
||||||
|
// form.setValue('saleStoreId', detailData.saleStoreId)
|
||||||
|
// form.setValue('saleStoreLevel', sessionState?.storeLvl)
|
||||||
|
|
||||||
//2차점까지 고른경우 확인필요
|
//2차점까지 고른경우 확인필요
|
||||||
console.log('2차점까지 고른경우 확인필요')
|
// console.log('2차점까지 고른경우 확인필요')
|
||||||
// setOtherSelOptions(sessionState?.storeId)
|
// setOtherSelOptions(sessionState?.storeId)
|
||||||
// form.setValue('saleStoreId', firstList[0].saleStoreId)
|
// form.setValue('saleStoreId', firstList[0].saleStoreId)
|
||||||
// form.setValue('otherSaleStoreId', sessionState?.storeId)
|
// form.setValue('otherSaleStoreId', sessionState?.storeId)
|
||||||
@ -454,19 +461,60 @@ export default function StuffDetail() {
|
|||||||
//1차점 변경 이벤트
|
//1차점 변경 이벤트
|
||||||
const onSelectionChange = (key) => {
|
const onSelectionChange = (key) => {
|
||||||
const planReqNo = form.watch('planReqNo')
|
const planReqNo = form.watch('planReqNo')
|
||||||
|
|
||||||
let delFlg = false
|
let delFlg = false
|
||||||
if (planReqNo !== '') {
|
|
||||||
if (confirm('stuff.detail.confirm.message1')) {
|
if (editMode === 'NEW') {
|
||||||
delFlg = true
|
if (planReqNo !== '') {
|
||||||
} else {
|
if (confirm(getMessage('stuff.detail.confirm.message1'))) {
|
||||||
delFlg = false
|
delFlg = true
|
||||||
|
} else {
|
||||||
|
delFlg = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// EDIT
|
||||||
|
if (planReqNo !== null) {
|
||||||
|
if (confirm(getMessage('stuff.detail.confirm.message1'))) {
|
||||||
|
delFlg = true
|
||||||
|
} else {
|
||||||
|
delFlg = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (planReqNo !== '') {
|
let tempObjectNo = 'T'
|
||||||
if (delFlg) {
|
if (objectNo) {
|
||||||
form.setValue('planReqNo', '')
|
tempObjectNo = objectNo.substring(0, 1)
|
||||||
|
}
|
||||||
|
if (tempObjectNo !== 'R') {
|
||||||
|
if (planReqNo) {
|
||||||
|
if (delFlg) {
|
||||||
|
form.setValue('planReqNo', '')
|
||||||
|
if (isObjectNotEmpty(key)) {
|
||||||
|
setOtherSaleStoreList(otherSaleStoreList)
|
||||||
|
form.setValue('saleStoreId', key.saleStoreId)
|
||||||
|
form.setValue('saleStoreName', key.saleStoreName)
|
||||||
|
form.setValue('saleStoreLevel', key.saleStoreLevel)
|
||||||
|
setSelOptions(key.saleStoreId)
|
||||||
|
//선택한 1차점 정보로 2차점 list 추리기
|
||||||
|
//長府工産株式会社 大阪支社
|
||||||
|
let newOtherSaleStoreList = originOtherSaleStoreList.filter((row) => row.firstAgentId === key.saleStoreId)
|
||||||
|
setOtherSaleStoreList(newOtherSaleStoreList)
|
||||||
|
} else {
|
||||||
|
//X누름
|
||||||
|
setSelOptions('')
|
||||||
|
form.setValue('saleStoreId', '')
|
||||||
|
form.setValue('saleStoreName', '')
|
||||||
|
form.setValue('saleStoreLevel', '')
|
||||||
|
form.setValue('otherSaleStoreId', '')
|
||||||
|
form.setValue('otherSaleStoreName', '')
|
||||||
|
form.setValue('otherSaleStoreLevel', '')
|
||||||
|
//1차점 지웠을때 2차점 자동완성 초기화
|
||||||
|
setOtherSaleStoreList(originOtherSaleStoreList)
|
||||||
|
handleClear()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (isObjectNotEmpty(key)) {
|
if (isObjectNotEmpty(key)) {
|
||||||
setOtherSaleStoreList(otherSaleStoreList)
|
setOtherSaleStoreList(otherSaleStoreList)
|
||||||
form.setValue('saleStoreId', key.saleStoreId)
|
form.setValue('saleStoreId', key.saleStoreId)
|
||||||
@ -521,19 +569,47 @@ export default function StuffDetail() {
|
|||||||
//2차점 변경 이벤트
|
//2차점 변경 이벤트
|
||||||
const onSelectionChange2 = (key) => {
|
const onSelectionChange2 = (key) => {
|
||||||
const planReqNo = form.watch('planReqNo')
|
const planReqNo = form.watch('planReqNo')
|
||||||
|
|
||||||
let delFlg = false
|
let delFlg = false
|
||||||
if (planReqNo !== '') {
|
if (editMode === 'NEW') {
|
||||||
if (confirm('stuff.detail.confirm.message1')) {
|
if (planReqNo !== '') {
|
||||||
delFlg = true
|
if (confirm(getMessage('stuff.detail.confirm.message1'))) {
|
||||||
} else {
|
delFlg = true
|
||||||
delFlg = false
|
} else {
|
||||||
|
delFlg = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//EDIT
|
||||||
|
if (planReqNo !== null) {
|
||||||
|
if (confirm(getMessage('stuff.detail.confirm.message1'))) {
|
||||||
|
delFlg = true
|
||||||
|
} else {
|
||||||
|
delFlg = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (planReqNo !== '') {
|
let tempObjectNo = 'T'
|
||||||
if (delFlg) {
|
if (objectNo) {
|
||||||
form.setValue('planReqNo', '')
|
tempObjectNo = objectNo.substring(0, 1)
|
||||||
|
}
|
||||||
|
if (tempObjectNo !== 'R') {
|
||||||
|
if (planReqNo) {
|
||||||
|
if (delFlg) {
|
||||||
|
form.setValue('planReqNo', '')
|
||||||
|
if (isObjectNotEmpty(key)) {
|
||||||
|
setOtherSelOptions(key.saleStoreId)
|
||||||
|
form.setValue('otherSaleStoreId', key.saleStoreId)
|
||||||
|
form.setValue('otherSaleStoreName', key.saleStoreName)
|
||||||
|
form.setValue('otherSaleStoreLevel', key.saleStoreLevel)
|
||||||
|
} else {
|
||||||
|
setOtherSelOptions('')
|
||||||
|
form.setValue('otherSaleStoreId', '')
|
||||||
|
form.setValue('otherSaleStoreName', '')
|
||||||
|
form.setValue('otherSaleStoreLevel', '')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (isObjectNotEmpty(key)) {
|
if (isObjectNotEmpty(key)) {
|
||||||
setOtherSelOptions(key.saleStoreId)
|
setOtherSelOptions(key.saleStoreId)
|
||||||
form.setValue('otherSaleStoreId', key.saleStoreId)
|
form.setValue('otherSaleStoreId', key.saleStoreId)
|
||||||
@ -782,9 +858,9 @@ export default function StuffDetail() {
|
|||||||
//필수값 다 입력했을때
|
//필수값 다 입력했을때
|
||||||
const onValid = async () => {
|
const onValid = async () => {
|
||||||
const formData = form.getValues()
|
const formData = form.getValues()
|
||||||
// console.log('필수값 통과:::', formData)
|
|
||||||
const apiUrl = '/api/object/save-object'
|
const apiUrl = '/api/object/save-object'
|
||||||
const params = {
|
const params = {
|
||||||
|
planReqNo: formData.planReqNo,
|
||||||
saleStoreId: formData.otherSaleStoreId ? formData.otherSaleStoreId : formData.saleStoreId,
|
saleStoreId: formData.otherSaleStoreId ? formData.otherSaleStoreId : formData.saleStoreId,
|
||||||
saleStoreName: formData.otherSaleStoreName ? formData.otherSaleStoreName : formData.saleStoreName,
|
saleStoreName: formData.otherSaleStoreName ? formData.otherSaleStoreName : formData.saleStoreName,
|
||||||
saleStoreLevel: formData.otherSaleStoreLevel ? formData.otherSaleStoreLevel : formData.saleStoreLevel,
|
saleStoreLevel: formData.otherSaleStoreLevel ? formData.otherSaleStoreLevel : formData.saleStoreLevel,
|
||||||
@ -805,11 +881,24 @@ export default function StuffDetail() {
|
|||||||
conType: formData.conType,
|
conType: formData.conType,
|
||||||
coldRegionFlg: formData.coldRegionFlg === true ? '1' : '0',
|
coldRegionFlg: formData.coldRegionFlg === true ? '1' : '0',
|
||||||
saltAreaFlg: formData.saltAreaFlg === true ? '1' : '0',
|
saltAreaFlg: formData.saltAreaFlg === true ? '1' : '0',
|
||||||
|
remarks: formData.remarks,
|
||||||
tempFlg: '0',
|
tempFlg: '0',
|
||||||
workNo: null,
|
workNo: null,
|
||||||
workName: null,
|
workName: null,
|
||||||
}
|
}
|
||||||
// console.log('params::', params)
|
console.log('REAL저장::', params)
|
||||||
|
|
||||||
|
//수직적설량, 설치높이 0인지 체크
|
||||||
|
let snow = params.verticalSnowCover
|
||||||
|
let height = params.installHeight
|
||||||
|
|
||||||
|
if (snow === '0') {
|
||||||
|
return alert(getMessage('stuff.detail.save.valierror1'))
|
||||||
|
}
|
||||||
|
if (height === '0') {
|
||||||
|
return alert(getMessage('stuff.detail.save.valierror2'))
|
||||||
|
}
|
||||||
|
|
||||||
alert('작업중')
|
alert('작업중')
|
||||||
return
|
return
|
||||||
if (editMode === 'NEW') {
|
if (editMode === 'NEW') {
|
||||||
@ -832,6 +921,7 @@ export default function StuffDetail() {
|
|||||||
const onTempSave = async () => {
|
const onTempSave = async () => {
|
||||||
const formData = form.getValues()
|
const formData = form.getValues()
|
||||||
const params = {
|
const params = {
|
||||||
|
planReqNo: formData.planReqNo,
|
||||||
saleStoreId: formData.otherSaleStoreId ? formData.otherSaleStoreId : formData.saleStoreId,
|
saleStoreId: formData.otherSaleStoreId ? formData.otherSaleStoreId : formData.saleStoreId,
|
||||||
saleStoreName: formData.otherSaleStoreName ? formData.otherSaleStoreName : formData.saleStoreName,
|
saleStoreName: formData.otherSaleStoreName ? formData.otherSaleStoreName : formData.saleStoreName,
|
||||||
saleStoreLevel: formData.otherSaleStoreLevel ? formData.otherSaleStoreLevel : formData.saleStoreLevel,
|
saleStoreLevel: formData.otherSaleStoreLevel ? formData.otherSaleStoreLevel : formData.saleStoreLevel,
|
||||||
@ -852,6 +942,7 @@ export default function StuffDetail() {
|
|||||||
conType: formData.conType,
|
conType: formData.conType,
|
||||||
coldRegionFlg: formData.coldRegionFlg === true ? '1' : '0',
|
coldRegionFlg: formData.coldRegionFlg === true ? '1' : '0',
|
||||||
saltAreaFlg: formData.saltAreaFlg === true ? '1' : '0',
|
saltAreaFlg: formData.saltAreaFlg === true ? '1' : '0',
|
||||||
|
remarks: formData.remarks,
|
||||||
tempFlg: '1',
|
tempFlg: '1',
|
||||||
workNo: null,
|
workNo: null,
|
||||||
workName: null,
|
workName: null,
|
||||||
@ -862,7 +953,17 @@ export default function StuffDetail() {
|
|||||||
params.saleStoreId = sessionState.storeId
|
params.saleStoreId = sessionState.storeId
|
||||||
params.saleStoreLevel = sessionState.storeLvl
|
params.saleStoreLevel = sessionState.storeLvl
|
||||||
}
|
}
|
||||||
console.log('임시저장파람:::', params)
|
//수직적설량, 설치높이 0인지 체크
|
||||||
|
let snow = params.verticalSnowCover
|
||||||
|
let height = params.installHeight
|
||||||
|
|
||||||
|
if (snow === '0') {
|
||||||
|
return alert(getMessage('stuff.detail.save.valierror1'))
|
||||||
|
}
|
||||||
|
if (height === '0') {
|
||||||
|
return alert(getMessage('stuff.detail.save.valierror2'))
|
||||||
|
}
|
||||||
|
|
||||||
alert('작업중')
|
alert('작업중')
|
||||||
return
|
return
|
||||||
await promisePost({ url: '/api/object/save-object', data: params }).then((res) => {
|
await promisePost({ url: '/api/object/save-object', data: params }).then((res) => {
|
||||||
@ -1028,6 +1129,7 @@ export default function StuffDetail() {
|
|||||||
getOptionLabel={(x) => x.saleStoreName}
|
getOptionLabel={(x) => x.saleStoreName}
|
||||||
getOptionValue={(x) => x.saleStoreId}
|
getOptionValue={(x) => x.saleStoreId}
|
||||||
isClearable={sessionState?.storeLvl === '1' ? true : false}
|
isClearable={sessionState?.storeLvl === '1' ? true : false}
|
||||||
|
isDisabled={sessionState?.storeLel !== '1' ? true : false}
|
||||||
value={saleStoreList.filter(function (option) {
|
value={saleStoreList.filter(function (option) {
|
||||||
return option.saleStoreId === selOptions
|
return option.saleStoreId === selOptions
|
||||||
})}
|
})}
|
||||||
@ -1323,7 +1425,7 @@ export default function StuffDetail() {
|
|||||||
<div className="flx-box">
|
<div className="flx-box">
|
||||||
<div className="product-input-wrap mr5">
|
<div className="product-input-wrap mr5">
|
||||||
<input type="text" className="product-input" readOnly value={form.watch('planReqNo') || ''} />
|
<input type="text" className="product-input" readOnly value={form.watch('planReqNo') || ''} />
|
||||||
{objectNo.substring(0, 1) === 'T' && form.watch('planReqNo') !== '' ? (
|
{objectNo.substring(0, 1) === 'T' && form.watch('planReqNo') ? (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="product-delete"
|
className="product-delete"
|
||||||
@ -1436,6 +1538,7 @@ export default function StuffDetail() {
|
|||||||
getOptionLabel={(x) => x.saleStoreName}
|
getOptionLabel={(x) => x.saleStoreName}
|
||||||
getOptionValue={(x) => x.saleStoreId}
|
getOptionValue={(x) => x.saleStoreId}
|
||||||
isClearable={sessionState?.storeLvl === '1' ? true : false}
|
isClearable={sessionState?.storeLvl === '1' ? true : false}
|
||||||
|
isDisabled={sessionState?.storeLel !== '1' ? true : false}
|
||||||
value={saleStoreList.filter(function (option) {
|
value={saleStoreList.filter(function (option) {
|
||||||
return option.saleStoreId === selOptions
|
return option.saleStoreId === selOptions
|
||||||
})}
|
})}
|
||||||
@ -1742,7 +1845,7 @@ export default function StuffDetail() {
|
|||||||
</div>
|
</div>
|
||||||
{/* 진짜R 플랜끝 */}
|
{/* 진짜R 플랜끝 */}
|
||||||
<div className="sub-right-footer">
|
<div className="sub-right-footer">
|
||||||
<Link href="/management/stuff">
|
<Link href="/management/stuff" scroll={false}>
|
||||||
<button type="button" className="btn-origin grey mr5">
|
<button type="button" className="btn-origin grey mr5">
|
||||||
R상세: {getMessage('stuff.detail.btn.moveList')}
|
R상세: {getMessage('stuff.detail.btn.moveList')}
|
||||||
</button>
|
</button>
|
||||||
@ -1767,7 +1870,7 @@ export default function StuffDetail() {
|
|||||||
TEMP상세:{getMessage('stuff.detail.btn.save')}
|
TEMP상세:{getMessage('stuff.detail.btn.save')}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<Link href="/management/stuff">
|
<Link href="/management/stuff" scroll={false}>
|
||||||
<button type="button" className="btn-origin grey">
|
<button type="button" className="btn-origin grey">
|
||||||
TEMP상세:{getMessage('stuff.detail.btn.moveList')}
|
TEMP상세:{getMessage('stuff.detail.btn.moveList')}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -128,7 +128,6 @@ export default function StuffSearchCondition() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isObjectNotEmpty(sessionState)) {
|
if (isObjectNotEmpty(sessionState)) {
|
||||||
// storeId가 T01 이거나 1차점일때만 판매대리점 선택 활성화
|
// storeId가 T01 이거나 1차점일때만 판매대리점 선택 활성화
|
||||||
// get({ url: `/api/object/saleStore/TEMP02/list` }).then((res) => {
|
|
||||||
get({ url: `/api/object/saleStore/${sessionState?.storeId}/list` }).then((res) => {
|
get({ url: `/api/object/saleStore/${sessionState?.storeId}/list` }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
res.map((row) => {
|
res.map((row) => {
|
||||||
|
|||||||
32
src/hooks/common/useCanvasConfigInitialize.js
Normal file
32
src/hooks/common/useCanvasConfigInitialize.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { use, useEffect } from 'react'
|
||||||
|
import { useRecoilValue } from 'recoil'
|
||||||
|
import { settingModalFirstOptionsState } from '@/store/settingAtom'
|
||||||
|
import { canvasState } from '@/store/canvasAtom'
|
||||||
|
import { setSurfaceShapePattern } from '@/util/canvas-util'
|
||||||
|
|
||||||
|
export function useCanvasConfigInitialize() {
|
||||||
|
const canvas = useRecoilValue(canvasState)
|
||||||
|
const settingModalFirstOptions = useRecoilValue(settingModalFirstOptionsState)
|
||||||
|
|
||||||
|
const canvasLoadInit = () => {
|
||||||
|
roofInit() //화면표시 초기화
|
||||||
|
}
|
||||||
|
|
||||||
|
//치수표시, 화면표시, 글꼴등 초기화
|
||||||
|
const roofInit = () => {
|
||||||
|
if (canvas) {
|
||||||
|
const roofDisplay = settingModalFirstOptions.option2.filter((item) => item.selected)
|
||||||
|
|
||||||
|
canvas
|
||||||
|
.getObjects()
|
||||||
|
.filter((polygon) => polygon.name === 'roof')
|
||||||
|
.forEach((polygon) => {
|
||||||
|
setSurfaceShapePattern(polygon, roofDisplay[0].column)
|
||||||
|
})
|
||||||
|
|
||||||
|
canvas.renderAll()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { canvasLoadInit }
|
||||||
|
}
|
||||||
@ -2,13 +2,18 @@ import { useEffect } from 'react'
|
|||||||
import { useRecoilValue } from 'recoil'
|
import { useRecoilValue } from 'recoil'
|
||||||
import { wordDisplaySelector } from '@/store/settingAtom'
|
import { wordDisplaySelector } from '@/store/settingAtom'
|
||||||
import { useEvent } from '@/hooks/useEvent'
|
import { useEvent } from '@/hooks/useEvent'
|
||||||
import { checkLineOrientation, getDistance } from '@/util/canvas-util'
|
import { checkLineOrientation, getDistance, setSurfaceShapePattern } from '@/util/canvas-util'
|
||||||
import { dimensionLineSettingsState } from '@/store/commonUtilsAtom'
|
import { dimensionLineSettingsState } from '@/store/commonUtilsAtom'
|
||||||
|
import { fontSelector } from '@/store/fontAtom'
|
||||||
|
import { canvasState } from '@/store/canvasAtom'
|
||||||
|
|
||||||
export function useCommonUtils({ canvas, commonFunctionState, setCommonFunctionState }) {
|
export function useCommonUtils({ commonFunctionState, setCommonFunctionState }) {
|
||||||
|
const canvas = useRecoilValue(canvasState)
|
||||||
const wordDisplay = useRecoilValue(wordDisplaySelector)
|
const wordDisplay = useRecoilValue(wordDisplaySelector)
|
||||||
const { addCanvasMouseEventListener, addDocumentEventListener, initEvent } = useEvent()
|
const { addCanvasMouseEventListener, addDocumentEventListener, initEvent } = useEvent()
|
||||||
const dimensionSettings = useRecoilValue(dimensionLineSettingsState)
|
const dimensionSettings = useRecoilValue(dimensionLineSettingsState)
|
||||||
|
const dimensionLineTextFont = useRecoilValue(fontSelector('dimensionLineText'))
|
||||||
|
const commonTextFont = useRecoilValue(fontSelector('commonText'))
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
initEvent()
|
initEvent()
|
||||||
@ -19,7 +24,7 @@ export function useCommonUtils({ canvas, commonFunctionState, setCommonFunctionS
|
|||||||
} else if (commonFunctionState.distance) {
|
} else if (commonFunctionState.distance) {
|
||||||
commonDistanceMode()
|
commonDistanceMode()
|
||||||
}
|
}
|
||||||
}, [commonFunctionState, dimensionSettings])
|
}, [commonFunctionState, dimensionSettings, commonTextFont, dimensionLineTextFont])
|
||||||
|
|
||||||
const commonTextMode = () => {
|
const commonTextMode = () => {
|
||||||
let textbox
|
let textbox
|
||||||
@ -30,10 +35,13 @@ export function useCommonUtils({ canvas, commonFunctionState, setCommonFunctionS
|
|||||||
left: pointer.x,
|
left: pointer.x,
|
||||||
top: pointer.y,
|
top: pointer.y,
|
||||||
width: 200,
|
width: 200,
|
||||||
fontSize: 14,
|
|
||||||
editable: true,
|
editable: true,
|
||||||
name: 'commonText',
|
name: 'commonText',
|
||||||
visible: wordDisplay,
|
visible: wordDisplay,
|
||||||
|
fill: commonTextFont.fontColor.value,
|
||||||
|
fontFamily: commonTextFont.fontFamily.value,
|
||||||
|
fontSize: commonTextFont.fontSize.value,
|
||||||
|
fontStyle: commonTextFont.fontWeight.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
canvas?.add(textbox)
|
canvas?.add(textbox)
|
||||||
@ -187,21 +195,19 @@ export function useCommonUtils({ canvas, commonFunctionState, setCommonFunctionS
|
|||||||
canvas.add(arrow1)
|
canvas.add(arrow1)
|
||||||
canvas.add(arrow2)
|
canvas.add(arrow2)
|
||||||
|
|
||||||
console.log(dimensionSettings)
|
|
||||||
|
|
||||||
// 거리 텍스트가 이미 있으면 업데이트하고, 없으면 새로 생성
|
|
||||||
distanceText = new fabric.Text(`${distance * 10} `, {
|
distanceText = new fabric.Text(`${distance * 10} `, {
|
||||||
left: (p1CenterX + p2CenterX) / 2 + (lineDirection === 'horizontal' ? 0 : -15),
|
left: (p1CenterX + p2CenterX) / 2 + (lineDirection === 'horizontal' ? 0 : -15),
|
||||||
top: (p1CenterY + p2CenterY) / 2 + (lineDirection === 'horizontal' ? +15 : 0),
|
top: (p1CenterY + p2CenterY) / 2 + (lineDirection === 'horizontal' ? +15 : 0),
|
||||||
fill: dimensionSettings.fontColor,
|
fill: dimensionLineTextFont.fontColor.value,
|
||||||
fontSize: dimensionSettings.fontSize,
|
fontSize: dimensionLineTextFont.fontSize.value,
|
||||||
// fontFamily : dimensionSettings.font, //폰트
|
fontFamily: dimensionLineTextFont.fontFamily.value,
|
||||||
// fontStyle : dimensionSettings.fontStyle, //폰트스타일
|
fontStyle: dimensionLineTextFont.fontWeight.value,
|
||||||
selectable: true,
|
selectable: true,
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
originX: 'center',
|
originX: 'center',
|
||||||
originY: 'center',
|
originY: 'center',
|
||||||
angle: lineDirection === 'horizontal' ? 0 : 270,
|
angle: lineDirection === 'horizontal' ? 0 : 270,
|
||||||
|
name: 'dimensionLineText',
|
||||||
// lockMovementX: false,
|
// lockMovementX: false,
|
||||||
// lockMovementY: false,
|
// lockMovementY: false,
|
||||||
})
|
})
|
||||||
@ -272,50 +278,70 @@ export function useCommonUtils({ canvas, commonFunctionState, setCommonFunctionS
|
|||||||
addCanvasMouseEventListener('mouse:down', function (options) {
|
addCanvasMouseEventListener('mouse:down', function (options) {
|
||||||
const pointer = canvas.getPointer(options.e)
|
const pointer = canvas.getPointer(options.e)
|
||||||
let point
|
let point
|
||||||
|
let cross = {}
|
||||||
|
|
||||||
if (points.length === 0) {
|
if (points.length === 0) {
|
||||||
// 첫 번째 포인트는 그대로 클릭한 위치에 추가
|
point = new fabric.Line([pointer.x - 10, pointer.y, pointer.x + 10, pointer.y], {
|
||||||
point = new fabric.Circle({
|
stroke: 'black',
|
||||||
left: pointer.x - 5, // 반지름 반영
|
strokeWidth: 1,
|
||||||
top: pointer.y - 5, // 반지름 반영
|
originX: 'center',
|
||||||
...circleOptions,
|
originY: 'center',
|
||||||
})
|
})
|
||||||
points.push(point)
|
|
||||||
canvas.add(point)
|
canvas.add(point)
|
||||||
|
cross['x'] = parseInt(point.left.toFixed(0))
|
||||||
|
|
||||||
|
// 세로 선 생성 (십자 모양의 다른 축)
|
||||||
|
point = new fabric.Line([pointer.x, pointer.y - 10, pointer.x, pointer.y + 10], {
|
||||||
|
stroke: 'black',
|
||||||
|
strokeWidth: 1,
|
||||||
|
originX: 'center',
|
||||||
|
originY: 'center',
|
||||||
|
})
|
||||||
|
cross['y'] = parseInt(point.top.toFixed(0))
|
||||||
|
|
||||||
|
canvas.add(point)
|
||||||
|
points.push(cross)
|
||||||
} else if (points.length === 1) {
|
} else if (points.length === 1) {
|
||||||
// 두 번째 포인트는 첫 번째 포인트를 기준으로 수평 또는 수직으로만 배치
|
// 두 번째 포인트는 첫 번째 포인트를 기준으로 수평 또는 수직으로만 배치
|
||||||
const p1 = points[0]
|
const p1 = points[0]
|
||||||
|
|
||||||
point = new fabric.Circle({
|
point = new fabric.Line([pointer.x - 10, pointer.y, pointer.x + 10, pointer.y], {
|
||||||
left: pointer.x - 5, // 반지름 반영
|
stroke: 'black',
|
||||||
top: pointer.y - 5, // 반지름 반영
|
strokeWidth: 1,
|
||||||
...circleOptions,
|
originX: 'center',
|
||||||
|
originY: 'center',
|
||||||
})
|
})
|
||||||
|
|
||||||
points.push(point)
|
|
||||||
canvas.add(point)
|
canvas.add(point)
|
||||||
|
cross['x'] = parseInt(point.left.toFixed(0))
|
||||||
|
// 세로 선 생성 (십자 모양의 다른 축)
|
||||||
|
point = new fabric.Line([pointer.x, pointer.y - 10, pointer.x, pointer.y + 10], {
|
||||||
|
stroke: 'black',
|
||||||
|
strokeWidth: 1,
|
||||||
|
originX: 'center',
|
||||||
|
originY: 'center',
|
||||||
|
})
|
||||||
|
canvas.add(point)
|
||||||
|
cross['y'] = parseInt(point.top.toFixed(0))
|
||||||
|
points.push(cross)
|
||||||
|
|
||||||
|
let isParallel = false
|
||||||
|
|
||||||
|
if (points[0].x === points[1].x || points[0].y === points[1].y) {
|
||||||
|
isParallel = true
|
||||||
|
}
|
||||||
|
|
||||||
// 두 포인트의 중심 좌표 계산
|
// 두 포인트의 중심 좌표 계산
|
||||||
const p2 = points[1]
|
const p2 = points[1]
|
||||||
|
|
||||||
const p1CenterX = p1.left + p1.radius
|
const p1CenterX = p1.x
|
||||||
const p1CenterY = p1.top + p1.radius
|
const p1CenterY = p1.y
|
||||||
const p2CenterX = p2.left + p2.radius
|
const p2CenterX = p2.x
|
||||||
const p2CenterY = p2.top + p2.radius
|
const p2CenterY = p2.y
|
||||||
|
|
||||||
const p3 = new fabric.Point(p2CenterX, p1CenterY)
|
|
||||||
|
|
||||||
// 두 포인트 간에 직선을 그림 (중심을 기준으로)
|
// 두 포인트 간에 직선을 그림 (중심을 기준으로)
|
||||||
const line = new fabric.Line([p1CenterX, p1CenterY, p2CenterX, p2CenterY], lineOptions)
|
const line = new fabric.Line([p1CenterX, p1CenterY, p2CenterX, p2CenterY], lineOptions)
|
||||||
const line2 = new fabric.Line([p2CenterX, p2CenterY, p3.x, p3.y], lineOptions)
|
|
||||||
const line3 = new fabric.Line([p3.x, p3.y, p1CenterX, p1CenterY], lineOptions)
|
|
||||||
canvas.add(line)
|
canvas.add(line)
|
||||||
canvas.add(line2)
|
|
||||||
canvas.add(line3)
|
|
||||||
|
|
||||||
const distance1 = getDistance(p1CenterX, p1CenterY, p2CenterX, p2CenterY)
|
const distance1 = getDistance(p1CenterX, p1CenterY, p2CenterX, p2CenterY)
|
||||||
const distance2 = getDistance(p2CenterX, p2CenterY, p3.x, p3.y)
|
|
||||||
const distance3 = getDistance(p3.x, p3.y, p1CenterX, p1CenterY)
|
|
||||||
|
|
||||||
// 거리 텍스트가 이미 있으면 업데이트하고, 없으면 새로 생성
|
// 거리 텍스트가 이미 있으면 업데이트하고, 없으면 새로 생성
|
||||||
distanceText = new fabric.Text(`${distance1 * 10}`, {
|
distanceText = new fabric.Text(`${distance1 * 10}`, {
|
||||||
@ -324,18 +350,28 @@ export function useCommonUtils({ canvas, commonFunctionState, setCommonFunctionS
|
|||||||
...textOptions,
|
...textOptions,
|
||||||
})
|
})
|
||||||
canvas.add(distanceText)
|
canvas.add(distanceText)
|
||||||
distanceText = new fabric.Text(`${distance2 * 10}`, {
|
|
||||||
left: (p2CenterX + p3.x) / 2,
|
if (!isParallel) {
|
||||||
top: (p2CenterY + p3.y) / 2,
|
const p3 = new fabric.Point(p2CenterX, p1CenterY)
|
||||||
...textOptions,
|
const line2 = new fabric.Line([p2CenterX, p2CenterY, p3.x, p3.y], lineOptions)
|
||||||
})
|
const line3 = new fabric.Line([p3.x, p3.y, p1CenterX, p1CenterY], lineOptions)
|
||||||
canvas.add(distanceText)
|
canvas.add(line2)
|
||||||
distanceText = new fabric.Text(`${distance3 * 10}`, {
|
canvas.add(line3)
|
||||||
left: (p3.x + p1CenterX) / 2,
|
const distance2 = getDistance(p2CenterX, p2CenterY, p3.x, p3.y)
|
||||||
top: (p3.y + p1CenterY) / 2,
|
const distance3 = getDistance(p3.x, p3.y, p1CenterX, p1CenterY)
|
||||||
...textOptions,
|
distanceText = new fabric.Text(`${distance2 * 10}`, {
|
||||||
})
|
left: (p2CenterX + p3.x) / 2,
|
||||||
canvas.add(distanceText)
|
top: (p2CenterY + p3.y) / 2,
|
||||||
|
...textOptions,
|
||||||
|
})
|
||||||
|
canvas.add(distanceText)
|
||||||
|
distanceText = new fabric.Text(`${distance3 * 10}`, {
|
||||||
|
left: (p3.x + p1CenterX) / 2,
|
||||||
|
top: (p3.y + p1CenterY) / 2,
|
||||||
|
...textOptions,
|
||||||
|
})
|
||||||
|
canvas.add(distanceText)
|
||||||
|
}
|
||||||
|
|
||||||
// 거리 계산 후, 다음 측정을 위해 초기화
|
// 거리 계산 후, 다음 측정을 위해 초기화
|
||||||
points = []
|
points = []
|
||||||
@ -361,7 +397,7 @@ export function useCommonUtils({ canvas, commonFunctionState, setCommonFunctionS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setCommonFunctionState(tempStates)
|
if (setCommonFunctionState) setCommonFunctionState(tempStates)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -11,9 +11,35 @@ export function useFont() {
|
|||||||
const lengthText = useRecoilValue(fontSelector('lengthText'))
|
const lengthText = useRecoilValue(fontSelector('lengthText'))
|
||||||
const circuitNumberText = useRecoilValue(fontSelector('circuitNumberText'))
|
const circuitNumberText = useRecoilValue(fontSelector('circuitNumberText'))
|
||||||
|
|
||||||
useEffect(() => {}, [commonText])
|
useEffect(() => {
|
||||||
|
if (canvas) {
|
||||||
|
const textObjs = canvas?.getObjects().filter((obj) => obj.name === 'commonText')
|
||||||
|
textObjs.forEach((obj) => {
|
||||||
|
obj.set({
|
||||||
|
fontFamily: commonText.fontFamily.value,
|
||||||
|
fontWeight: commonText.fontWeight.value,
|
||||||
|
fontSize: commonText.fontSize.value,
|
||||||
|
fill: commonText.fontColor.value,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
canvas.renderAll()
|
||||||
|
}
|
||||||
|
}, [commonText])
|
||||||
|
|
||||||
useEffect(() => {}, [dimensionLineText])
|
useEffect(() => {
|
||||||
|
if (canvas) {
|
||||||
|
const textObjs = canvas?.getObjects().filter((obj) => obj.name === 'dimensionLineText')
|
||||||
|
textObjs.forEach((obj) => {
|
||||||
|
obj.set({
|
||||||
|
fontFamily: dimensionLineText.fontFamily.value,
|
||||||
|
fontWeight: dimensionLineText.fontWeight.value,
|
||||||
|
fontSize: dimensionLineText.fontSize.value,
|
||||||
|
fill: dimensionLineText.fontColor.value,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
canvas.renderAll()
|
||||||
|
}
|
||||||
|
}, [dimensionLineText])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (canvas) {
|
if (canvas) {
|
||||||
|
|||||||
@ -290,12 +290,12 @@ export function usePlan() {
|
|||||||
addPlan(userId, objectNo, currentCanvasData())
|
addPlan(userId, objectNo, currentCanvasData())
|
||||||
},
|
},
|
||||||
denyFn: () => {
|
denyFn: () => {
|
||||||
addPlan(userId, objectNo)
|
addPlan(userId, objectNo, '')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
: addPlan(userId, objectNo)
|
: addPlan(userId, objectNo, '')
|
||||||
}
|
}
|
||||||
const addPlan = (userId, objectNo, canvasStatus = '') => {
|
const addPlan = (userId, objectNo, canvasStatus) => {
|
||||||
const id = uuidv4()
|
const id = uuidv4()
|
||||||
const newPlan = {
|
const newPlan = {
|
||||||
id: id,
|
id: id,
|
||||||
|
|||||||
@ -516,6 +516,8 @@
|
|||||||
"stuff.detail.btn.moveList": "商品リスト",
|
"stuff.detail.btn.moveList": "商品リスト",
|
||||||
"stuff.detail.btn.save": "保存",
|
"stuff.detail.btn.save": "保存",
|
||||||
"stuff.detail.btn.tempSave": "一時保存",
|
"stuff.detail.btn.tempSave": "一時保存",
|
||||||
|
"stuff.detail.save.valierror1": "垂直説説は0より大きい値を入力してください",
|
||||||
|
"stuff.detail.save.valierror2": "設置高さ0より大きい値を入力してください",
|
||||||
"stuff.planReqPopup.popTitle": "設計依頼検索",
|
"stuff.planReqPopup.popTitle": "設計依頼検索",
|
||||||
"stuff.planReqPopup.btn1": "検索",
|
"stuff.planReqPopup.btn1": "検索",
|
||||||
"stuff.planReqPopup.btn2": "初期化",
|
"stuff.planReqPopup.btn2": "初期化",
|
||||||
|
|||||||
@ -521,6 +521,8 @@
|
|||||||
"stuff.detail.btn.moveList": "물건목록",
|
"stuff.detail.btn.moveList": "물건목록",
|
||||||
"stuff.detail.btn.save": "저장",
|
"stuff.detail.btn.save": "저장",
|
||||||
"stuff.detail.btn.tempSave": "임시저장",
|
"stuff.detail.btn.tempSave": "임시저장",
|
||||||
|
"stuff.detail.save.valierror1": "수직적설량은 0보다 큰 값을 입력하세요",
|
||||||
|
"stuff.detail.save.valierror2": "설치높이는 0보다 큰 값을 입력하세요",
|
||||||
"stuff.planReqPopup.popTitle": "설계 요청 검색",
|
"stuff.planReqPopup.popTitle": "설계 요청 검색",
|
||||||
"stuff.planReqPopup.btn1": "검색",
|
"stuff.planReqPopup.btn1": "검색",
|
||||||
"stuff.planReqPopup.btn2": "초기화",
|
"stuff.planReqPopup.btn2": "초기화",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user