[1036] : [プランをコピー/移動する時の自動保存について]
[작업내용] : 탭간 이동, 복사시 저장 여부 확인 로직 추가
This commit is contained in:
parent
4b8287579c
commit
a652d09b8d
@ -37,7 +37,7 @@ export default function CanvasLayout({ children }) {
|
|||||||
<button
|
<button
|
||||||
key={`plan-${plan.id}`}
|
key={`plan-${plan.id}`}
|
||||||
className={`canvas-page-box ${plan.isCurrent === true ? 'on' : ''}`}
|
className={`canvas-page-box ${plan.isCurrent === true ? 'on' : ''}`}
|
||||||
onClick={() => handleCurrentPlan(plan.id)}
|
onClick={() => (plan.isCurrent ? '' : handleCurrentPlan(plan.id))}
|
||||||
>
|
>
|
||||||
<span>{`Plan ${plan.planNo}`}</span>
|
<span>{`Plan ${plan.planNo}`}</span>
|
||||||
{plans.length > 1 && !pathname.includes('/estimate') && !pathname.includes('/simulator') && (
|
{plans.length > 1 && !pathname.includes('/estimate') && !pathname.includes('/simulator') && (
|
||||||
|
|||||||
@ -180,8 +180,8 @@ const Placement = forwardRef((props, refs) => {
|
|||||||
))}
|
))}
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{selectedModules.itemList &&
|
{selectedModules?.itemList &&
|
||||||
selectedModules.itemList.map((item, index) => (
|
selectedModules?.itemList?.map((item, index) => (
|
||||||
<tr key={index}>
|
<tr key={index}>
|
||||||
<td className="al-c">
|
<td className="al-c">
|
||||||
<div className="d-check-box no-text pop">
|
<div className="d-check-box no-text pop">
|
||||||
@ -329,7 +329,7 @@ const Placement = forwardRef((props, refs) => {
|
|||||||
<tr>
|
<tr>
|
||||||
<th rowSpan={2} style={{ width: '22%' }}></th>
|
<th rowSpan={2} style={{ width: '22%' }}></th>
|
||||||
{selectedModules &&
|
{selectedModules &&
|
||||||
selectedModules.itemList.map((item) => (
|
selectedModules.itemList?.map((item) => (
|
||||||
// <th colSpan={colspan}>
|
// <th colSpan={colspan}>
|
||||||
<th>
|
<th>
|
||||||
<div className="color-wrap">
|
<div className="color-wrap">
|
||||||
@ -341,12 +341,13 @@ const Placement = forwardRef((props, refs) => {
|
|||||||
{colspan > 1 && <th rowSpan={2}>{getMessage('modal.module.basic.setting.module.placement.max.rows.multiple')}</th>}
|
{colspan > 1 && <th rowSpan={2}>{getMessage('modal.module.basic.setting.module.placement.max.rows.multiple')}</th>}
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
{selectedModules.itemList.map((item) => (
|
{selectedModules &&
|
||||||
<>
|
selectedModules.itemList?.map((item) => (
|
||||||
<th>{getMessage('modal.module.basic.setting.module.placement.max.row')}</th>
|
<>
|
||||||
{/* {colspan > 1 && <th>{getMessage('modal.module.basic.setting.module.placement.max.rows.multiple')}</th>} */}
|
<th>{getMessage('modal.module.basic.setting.module.placement.max.row')}</th>
|
||||||
</>
|
{/* {colspan > 1 && <th>{getMessage('modal.module.basic.setting.module.placement.max.rows.multiple')}</th>} */}
|
||||||
))}
|
</>
|
||||||
|
))}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
@ -206,9 +206,17 @@ export function useCanvasEvent() {
|
|||||||
selected.forEach((obj) => {
|
selected.forEach((obj) => {
|
||||||
// if (obj.type === 'QPolygon' && currentMenu !== MENU.MODULE_CIRCUIT_SETTING.BASIC_SETTING) {
|
// if (obj.type === 'QPolygon' && currentMenu !== MENU.MODULE_CIRCUIT_SETTING.BASIC_SETTING) {
|
||||||
if (obj.type === 'QPolygon') {
|
if (obj.type === 'QPolygon') {
|
||||||
|
const originStroke = obj.stroke
|
||||||
obj.set({ stroke: 'red' })
|
obj.set({ stroke: 'red' })
|
||||||
if (obj.name === POLYGON_TYPE.MODULE && currentMenu === MENU.MODULE_CIRCUIT_SETTING.BASIC_SETTING) {
|
|
||||||
obj.set({ strokeWidth: 3 })
|
if (currentMenu === MENU.MODULE_CIRCUIT_SETTING.BASIC_SETTING) {
|
||||||
|
if (obj.name === POLYGON_TYPE.MODULE) {
|
||||||
|
obj.set({ strokeWidth: 3 })
|
||||||
|
}
|
||||||
|
if (obj.name === POLYGON_TYPE.ROOF) {
|
||||||
|
canvas.discardActiveObject()
|
||||||
|
obj.set({ stroke: originStroke })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -407,12 +407,21 @@ export function usePlan(params = {}) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
if (!currentCanvasPlan || currentCanvasPlan.id !== newCurrentId) {
|
swalFire({
|
||||||
await saveCanvas(true)
|
text: getMessage('plan.message.confirm.save'),
|
||||||
clearRecoilState()
|
type: 'confirm',
|
||||||
}
|
confirmFn: async () => {
|
||||||
setCurrentCanvasPlan(plans.find((plan) => plan.id === newCurrentId))
|
//저장 전에 플랜이 이동되어 state가 변경되는 이슈가 있음
|
||||||
setPlans((plans) => plans.map((plan) => ({ ...plan, isCurrent: plan.id === newCurrentId })))
|
await saveCanvas(true)
|
||||||
|
clearRecoilState()
|
||||||
|
setCurrentCanvasPlan(plans.find((plan) => plan.id === newCurrentId))
|
||||||
|
setPlans((plans) => plans.map((plan) => ({ ...plan, isCurrent: plan.id === newCurrentId })))
|
||||||
|
},
|
||||||
|
denyFn: async () => {
|
||||||
|
setCurrentCanvasPlan(plans.find((plan) => plan.id === newCurrentId))
|
||||||
|
setPlans((plans) => plans.map((plan) => ({ ...plan, isCurrent: plan.id === newCurrentId })))
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,9 +456,25 @@ export function usePlan(params = {}) {
|
|||||||
* @param {string} objectNo - 물건번호
|
* @param {string} objectNo - 물건번호
|
||||||
*/
|
*/
|
||||||
const handleAddPlan = async (userId, objectNo) => {
|
const handleAddPlan = async (userId, objectNo) => {
|
||||||
|
let isSelected = false
|
||||||
|
|
||||||
if (currentCanvasPlan?.id) {
|
if (currentCanvasPlan?.id) {
|
||||||
await saveCanvas(false)
|
swalFire({
|
||||||
|
text: getMessage('plan.message.confirm.save'),
|
||||||
|
type: 'confirm',
|
||||||
|
confirmFn: async () => {
|
||||||
|
//저장 전에 플랜이 이동되어 state가 변경되는 이슈가 있음
|
||||||
|
await saveCanvas(true)
|
||||||
|
handleAddPlanCopyConfirm(userId, objectNo)
|
||||||
|
},
|
||||||
|
denyFn: async () => {
|
||||||
|
handleAddPlanCopyConfirm(userId, objectNo)
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleAddPlanCopyConfirm = async (userId, objectNo) => {
|
||||||
if (JSON.parse(currentCanvasData()).objects.length > 0) {
|
if (JSON.parse(currentCanvasData()).objects.length > 0) {
|
||||||
swalFire({
|
swalFire({
|
||||||
text: `Plan ${currentCanvasPlan.planNo} ` + getMessage('plan.message.confirm.copy'),
|
text: `Plan ${currentCanvasPlan.planNo} ` + getMessage('plan.message.confirm.copy'),
|
||||||
@ -471,7 +496,6 @@ export function usePlan(params = {}) {
|
|||||||
setIsGlobalLoading(false)
|
setIsGlobalLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 물건번호(object) plan 삭제 (canvas 삭제 전 planNo 삭제)
|
* 물건번호(object) plan 삭제 (canvas 삭제 전 planNo 삭제)
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user