Merge Q-CAST-III-MR-680: #716, #717

This commit is contained in:
상연 정 2025-02-13 02:30:16 +00:00 committed by Space Cloud
commit 4a8ebe19af
No known key found for this signature in database
GPG Key ID: 2F4D45726235F749
5 changed files with 131 additions and 133 deletions

View File

@ -344,10 +344,6 @@ export default function StuffDetail() {
if (objectNo) {
setManagementState({})
setEditMode('EDIT')
if (objectNo.substring(0, 1) !== 'T') {
// ..
setIsFormValid(true)
}
promiseGet({ url: `/api/object/${objectNo}/detail` }).then((res) => {
if (res.status === 200) {
if (res?.data?.createSaleStoreId === 'T01') {
@ -1022,8 +1018,6 @@ export default function StuffDetail() {
const _receiveUser = watch('receiveUser')
//objectName: '', //
const _objectName = watch('objectName')
// objectNameOmit: '', //
const _objectNameOmit = watch('objectNameOmit')
// saleStoreId: '', //1 ID
const _saleStoreId = watch('saleStoreId')
// 2
@ -1051,12 +1045,11 @@ export default function StuffDetail() {
if (!formData.receiveUser || formData.receiveUser.trim().length === 0) {
errors.receiveUser = true
}
if (!formData.objectName || formData.objectName.trim().length === 0) {
errors.objectName = true
}
if (!formData.objectNameOmit) {
errors.objectNameOmit = true
}
if (!formData.saleStoreId) {
errors.saleStoreId = true
}
@ -1102,9 +1095,7 @@ export default function StuffDetail() {
if (!formData.objectName || formData.objectName.trim().length === 0) {
errors.objectName = true
}
if (!formData.objectNameOmit) {
errors.objectNameOmit = true
}
if (!formData.saleStoreId) {
errors.saleStoreId = true
}
@ -1144,7 +1135,6 @@ export default function StuffDetail() {
}, [
_receiveUser,
_objectName,
_objectNameOmit,
_saleStoreId,
_otherSaleStoreId,
_zipNo,
@ -1165,7 +1155,7 @@ export default function StuffDetail() {
const onSearchDesignRequestPopOpen = () => {
const saleStoreId = form.watch('saleStoreId')
if (saleStoreId === '') {
swalFire({ text: getMessage('stuff.planReqPopup.error.message2'), type: 'alert' })
swalFire({ text: getMessage('stuff.planReqPopup.error.message2'), type: 'alert', icon: 'warning' })
} else {
setShowDesignRequestButtonValid(true)
}
@ -1175,7 +1165,7 @@ export default function StuffDetail() {
const onSearchWindSpeedPopOpen = () => {
const prefName = form.watch('prefName')
if (prefName === '') {
swalFire({ text: getMessage('stuff.windSelectPopup.error.message1'), type: 'alert' })
swalFire({ text: getMessage('stuff.windSelectPopup.error.message1'), type: 'alert', icon: 'warning' })
} else {
setShowWindSpeedButtonValid(true)
}
@ -1203,54 +1193,10 @@ export default function StuffDetail() {
const formData = form.getValues()
let errors = {}
let fieldNm
//
if (!formData.receiveUser || formData.receiveUser.trim().length === 0) {
fieldNm = getMessage('stuff.detail.receiveUser')
errors = fieldNm
}
//
if (!formData.objectName || formData.objectName.trim().length === 0) {
fieldNm = getMessage('stuff.detail.objectStatusId')
errors = fieldNm
}
//
if (!formData.objectNameOmit) {
fieldNm = getMessage('stuff.detail.objectNameOmit')
errors = fieldNm
}
//1
if (!formData.saleStoreId) {
fieldNm = getMessage('stuff.detail.saleStoreId')
errors = fieldNm
}
//
if (!formData.zipNo) {
fieldNm = getMessage('stuff.detail.zipNo')
errors = fieldNm
}
//
if (!formData.address) {
fieldNm = getMessage('stuff.detail.address')
errors = fieldNm
}
//
if (!formData.prefId || formData.prefId === '0') {
fieldNm = getMessage('stuff.detail.prefId')
errors = fieldNm
}
//
if (!formData.areaId) {
fieldNm = getMessage('stuff.detail.areaId')
errors = fieldNm
}
//
if (!formData.standardWindSpeedId) {
fieldNm = getMessage('stuff.detail.standardWindSpeedId')
errors = fieldNm
}
//
if (!formData.verticalSnowCover) {
fieldNm = getMessage('stuff.detail.verticalSnowCover')
//
if (!formData.installHeight) {
fieldNm = getMessage('stuff.detail.installHeight')
errors = fieldNm
}
@ -1259,14 +1205,63 @@ export default function StuffDetail() {
fieldNm = getMessage('stuff.detail.surfaceType')
errors = fieldNm
}
//
if (!formData.installHeight) {
fieldNm = getMessage('stuff.detail.installHeight')
//
if (!formData.verticalSnowCover) {
fieldNm = getMessage('stuff.detail.verticalSnowCover')
errors = fieldNm
}
//
if (!formData.standardWindSpeedId) {
fieldNm = getMessage('stuff.detail.standardWindSpeedId')
errors = fieldNm
}
//
if (!formData.areaId) {
fieldNm = getMessage('stuff.detail.areaId')
errors = fieldNm
}
//
if (!formData.address) {
fieldNm = getMessage('stuff.detail.address')
errors = fieldNm
}
//
if (!formData.prefId || formData.prefId === '0') {
fieldNm = getMessage('stuff.detail.prefId')
errors = fieldNm
}
//
if (!formData.zipNo) {
fieldNm = getMessage('stuff.detail.zipNo')
errors = fieldNm
}
//1
if (!formData.saleStoreId) {
fieldNm = getMessage('stuff.detail.saleStoreId')
errors = fieldNm
}
//
if (!formData.objectName || formData.objectName.trim().length === 0) {
fieldNm = getMessage('stuff.detail.objectStatusId')
errors = fieldNm
}
//
if (!formData.receiveUser || formData.receiveUser.trim().length === 0) {
fieldNm = getMessage('stuff.detail.receiveUser')
errors = fieldNm
}
if (Object.keys(errors).length > 0) {
return swalFire({ text: getMessage('stuff.detail.save.valierror3', [errors]), type: 'alert' })
return swalFire({ text: getMessage('stuff.detail.save.valierror3', [errors]), type: 'alert', icon: 'warning' })
}
const apiUrl = '/api/object/save-object'
@ -1306,10 +1301,10 @@ export default function StuffDetail() {
let height = params.installHeight
if (snow === '0') {
return swalFire({ text: getMessage('stuff.detail.save.valierror1'), type: 'alert' })
return swalFire({ text: getMessage('stuff.detail.save.valierror1'), type: 'alert', icon: 'warning' })
}
if (height === '0') {
return swalFire({ text: getMessage('stuff.detail.save.valierror2'), type: 'alert' })
return swalFire({ text: getMessage('stuff.detail.save.valierror2'), type: 'alert', icon: 'warning' })
}
if (managementState) {
@ -1363,29 +1358,29 @@ export default function StuffDetail() {
delete params_sort.workName
if (Object.entries(detail_sort).toString() === Object.entries(params_sort).toString()) {
return swalFire({ text: getMessage('stuff.detail.noChgData'), type: 'alert' })
return swalFire({ text: getMessage('stuff.detail.noChgData'), type: 'alert', icon: 'warning' })
}
}
if (params?.receiveUser !== '') {
if (params?.receiveUser.trim().length > 10) {
return swalFire({ text: getMessage('stuff.detail.tempSave.message2'), type: 'alert' })
return swalFire({ text: getMessage('stuff.detail.tempSave.message2'), type: 'alert', icon: 'warning' })
}
}
// 2 otherSaleStoreId
if (session.storeLvl !== '1') {
if (params.saleStoreLevel === '1') {
return swalFire({ text: getMessage('stuff.detail.tempSave.message3'), type: 'alert' })
return swalFire({ text: getMessage('stuff.detail.tempSave.message3'), type: 'alert', icon: 'warning' })
}
}
if (editMode === 'NEW') {
setIsGlobalLoading(true)
await promisePost({ url: apiUrl, data: params })
.then((res) => {
setIsGlobalLoading(true)
//
setIsGlobalLoading(false)
if (res.status === 201) {
setIsGlobalLoading(false)
setFloorPlanObjectNo({ floorPlanObjectNo: res?.data?.objectNo })
swalFire({
text: getMessage('stuff.detail.save'),
@ -1397,17 +1392,16 @@ export default function StuffDetail() {
}
})
.catch((error) => {
console.log('error::::::', error)
setIsGlobalLoading(false)
console.log('error::::::', error)
})
} else {
// PUT
setIsGlobalLoading(true)
await promisePut({ url: apiUrl, data: params })
.then((res) => {
setIsGlobalLoading(true)
setIsGlobalLoading(false)
if (res.status === 201) {
setIsGlobalLoading(false)
setFloorPlanObjectNo({ floorPlanObjectNo: res.data.objectNo })
swalFire({
text: getMessage('stuff.detail.save'),
@ -1426,8 +1420,8 @@ export default function StuffDetail() {
}
})
.catch((error) => {
console.log('error::::::', error)
setIsGlobalLoading(false)
console.log('error::::::', error)
})
}
}
@ -1474,24 +1468,24 @@ export default function StuffDetail() {
if (session.storeLvl !== '1') {
// 1 2 saleStoreLevel = 1
if (params.saleStoreLevel === '1') {
return swalFire({ text: getMessage('stuff.detail.tempSave.message3'), type: 'alert' })
return swalFire({ text: getMessage('stuff.detail.tempSave.message3'), type: 'alert', icon: 'warning' })
}
}
//
if (params?.receiveUser !== '') {
if (params?.receiveUser.trim().length > 10) {
return swalFire({ text: getMessage('stuff.detail.tempSave.message2'), type: 'alert' })
return swalFire({ text: getMessage('stuff.detail.tempSave.message2'), type: 'alert', icon: 'warning' })
}
}
const apiUrl = '/api/object/save-object'
if (objectNo) {
setIsGlobalLoading(true)
await promisePut({ url: apiUrl, data: params })
.then((res) => {
setIsGlobalLoading(true)
setIsGlobalLoading(false)
if (res.status === 201) {
setIsGlobalLoading(false)
swalFire({
text: getMessage('stuff.detail.tempSave.message1'),
type: 'alert',
@ -1506,11 +1500,11 @@ export default function StuffDetail() {
console.log('error::::::', error)
})
} else {
setIsGlobalLoading(true)
await promisePost({ url: apiUrl, data: params })
.then((res) => {
setIsGlobalLoading(true)
setIsGlobalLoading(false)
if (res.status === 201) {
setIsGlobalLoading(false)
swalFire({
text: getMessage('stuff.detail.tempSave.message1'),
type: 'alert',
@ -1521,8 +1515,8 @@ export default function StuffDetail() {
}
})
.catch((error) => {
console.log('error::::::', error)
setIsGlobalLoading(false)
console.log('error::::::', error)
})
}
}
@ -1676,15 +1670,15 @@ export default function StuffDetail() {
{getMessage('stuff.detail.required')}
</div>
<div className="left-unit-box">
{!isFormValid ? (
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')}
</Button>
) : (
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')}
</Button>
)}
{/* {!isFormValid ? ( */}
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')}
</Button>
{/* ) : ( */}
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')}
</Button>
{/* )} */}
<button
type="button"
className="btn-origin grey"
@ -2184,15 +2178,15 @@ export default function StuffDetail() {
</table>
</div>
<div className="sub-right-footer">
{!isFormValid ? (
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')}
</Button>
) : (
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')}
</Button>
)}
{/* {!isFormValid ? ( */}
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')}
</Button>
{/* ) : ( */}
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')}
</Button>
{/* )} */}
<button
type="button"
className="btn-origin grey"
@ -2238,15 +2232,15 @@ export default function StuffDetail() {
) : (
<>
<div className="left-unit-box">
{!isFormValid ? (
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')}
</Button>
) : (
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')}
</Button>
)}
{/* {!isFormValid ? ( */}
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')}
</Button>
{/* ) : ( */}
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')}
</Button>
{/* )} */}
<button
type="button"
className="btn-origin grey"
@ -2833,15 +2827,15 @@ export default function StuffDetail() {
) : (
<>
<div className="sub-right-footer">
{!isFormValid ? (
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')}
</Button>
) : (
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')}
</Button>
)}
{/* {!isFormValid ? ( */}
<Button className="btn-origin grey mr5" onPress={onTempSave} style={{ display: showButton }}>
{getMessage('stuff.detail.btn.tempSave')}
</Button>
{/* ) : ( */}
<Button type="submit" className="btn-origin navy mr5" style={{ display: showButton }}>
{getMessage('stuff.detail.btn.save')}
</Button>
{/* )} */}
<button
type="button"
className="btn-origin grey"

View File

@ -7,6 +7,7 @@ import { useRecoilValue } from 'recoil'
import FindAddressPopQGrid from './FindAddressPopQGrid'
import { useMessage } from '@/hooks/useMessage'
import { isNotEmptyArray } from '@/util/common-utils'
import { useSwal } from '@/hooks/useSwal'
export default function FindAddressPop(props) {
const globalLocaleState = useRecoilValue(globalLocaleStore)
@ -19,7 +20,7 @@ export default function FindAddressPop(props) {
const [address1, setAddress1] = useState(null)
const [address2, setAddress2] = useState(null)
const [address3, setAddress3] = useState(null)
const { swalFire } = useSwal()
const [gridProps, setGridProps] = useState({
gridData: [],
isPageable: false,
@ -65,11 +66,11 @@ export default function FindAddressPop(props) {
if (isNotEmptyArray(res.results)) {
setGridProps({ ...gridProps, gridData: res.results })
} else {
alert(getMessage('stuff.addressPopup.error.message1'))
swalFire({ text: getMessage('stuff.addressPopup.error.message1'), type: 'alert', icon: 'warning' })
setGridProps({ ...gridProps, gridData: [] })
}
} else {
alert(getMessage('stuff.addressPopup.error.message1'))
swalFire({ text: getMessage('stuff.addressPopup.error.message1'), type: 'alert', icon: 'warning' })
setGridProps({ ...gridProps, gridData: [] })
}
})
@ -77,7 +78,7 @@ export default function FindAddressPop(props) {
//
const applyAddress = () => {
if (prefId == null) {
alert(getMessage('stuff.addressPopup.error.message2'))
swalFire({ text: getMessage('stuff.addressPopup.error.message2'), type: 'alert', icon: 'warning' })
} else {
props.zipInfo({
zipNo: zipNo,
@ -128,7 +129,7 @@ export default function FindAddressPop(props) {
setZipNo(event.data.zipcode)
if (event.data.prefcode == null) {
return alert(getMessage('stuff.addressPopup.error.message2'))
return swalFire({ text: getMessage('stuff.addressPopup.error.message2'), type: 'alert', icon: 'warning' })
} else {
props.zipInfo({
zipNo: event.data.zipcode,

View File

@ -9,11 +9,12 @@ import dayjs from 'dayjs'
import PlanRequestPopQGrid from './PlanRequestPopQGrid'
import { isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils'
import QPagination from '@/components/common/pagination/QPagination'
import { useSwal } from '@/hooks/useSwal'
export default function PlanRequestPop(props) {
const [pageNo, setPageNo] = useState(1) //
const [pageSize, setPageSize] = useState(20) //
const [totalCount, setTotalCount] = useState(0) //
const { swalFire } = useSwal()
const globalLocaleState = useRecoilValue(globalLocaleStore)
const [planReqObject, setPlanReqObject] = useState({})
@ -214,7 +215,7 @@ export default function PlanRequestPop(props) {
//
props.setShowDesignRequestButtonValid(false)
} else {
alert(getMessage('stuff.planReqPopup.error.message1'))
swalFire({ text: getMessage('stuff.planReqPopup.error.message1'), type: 'alert', icon: 'warning' })
}
}

View File

@ -3,14 +3,16 @@ import { useMessage } from '@/hooks/useMessage'
import { useAxios } from '@/hooks/useAxios'
import { globalLocaleStore } from '@/store/localeAtom'
import { useRecoilValue } from 'recoil'
import { isEmptyArray, isNotEmptyArray } from '@/util/common-utils'
import { isEmptyArray } from '@/util/common-utils'
import { useSwal } from '@/hooks/useSwal'
export default function WindSelectPop(props) {
const globalLocaleState = useRecoilValue(globalLocaleStore)
const { promiseGet } = useAxios(globalLocaleState)
const [windSpeedList, setWindSpeedList] = useState([])
const [windSpeed, setWindSpeed] = useState(null)
const { getMessage } = useMessage()
const { swalFire } = useSwal()
//
const handleChangeRadio = (e) => {
setWindSpeed(e.target.value)
@ -19,7 +21,7 @@ export default function WindSelectPop(props) {
//
const applyWindSpeed = () => {
if (windSpeed == null) {
alert(getMessage('stuff.windSelectPopup.error.message2'))
swalFire({ text: getMessage('stuff.windSelectPopup.error.message2'), type: 'alert', icon: 'warning' })
} else {
props.windSpeedInfo({ windSpeed: windSpeed })

View File

@ -647,7 +647,7 @@
"stuff.gridData.tempObjectNo": "임시저장물건",
"stuff.message.periodError": "최대1년 조회 가능합니다.",
"stuff.addressPopup.title": "우편번호",
"stuff.addressPopup.placeholder": "우편번호 7자리를 입력하세요.",
"stuff.addressPopup.placeholder": "우편번호 7자리를 입력하세요.",
"stuff.addressPopup.error.message1": "등록된 우편번호에서 주소를 찾을 수 없습니다. 다시 입력해주세요.",
"stuff.addressPopup.error.message2": "주소를 선택해주세요.",
"stuff.addressPopup.gridHeader.address1": "도도부현",