refactor: 모듈 타입별 아이템 목록 조회 api 조회 방식을 query string 방식으로 변경, validation 추가
This commit is contained in:
parent
fca9ce557f
commit
e296c17994
@ -1,4 +1,7 @@
|
|||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
|
import { getQueryString } from '@/util/common-utils'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -7,6 +10,8 @@ import axios from 'axios'
|
|||||||
*/
|
*/
|
||||||
export function useMasterController() {
|
export function useMasterController() {
|
||||||
const { get } = useAxios()
|
const { get } = useAxios()
|
||||||
|
const { getMessage } = useMessage()
|
||||||
|
const { swalFire } = useSwal()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 지붕재 목록 조회
|
* 지붕재 목록 조회
|
||||||
@ -21,11 +26,17 @@ export function useMasterController() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 모듈 타입별 아이템 목록 조회
|
* 모듈 타입별 아이템 목록 조회
|
||||||
* @param {지붕재 코드} roofMaterialCd
|
* @param {지붕재 코드} roofMatlCd
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
const getModuleTypeItemList = async (roofMaterialCd) => {
|
const getModuleTypeItemList = async (roofMatlCd) => {
|
||||||
return await get({ url: `/api/v1/master/getModuleTypeItemList/${roofMaterialCd}` }).then((res) => {
|
if (!roofMatlCd || roofMatlCd.trim() === '') {
|
||||||
|
swalFire({ text: getMessage('master.moduletypeitem.message.error'), type: 'alert', icon: 'error' })
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
const param = { roofMatlCd: roofMatlCd }
|
||||||
|
const paramString = getQueryString(param)
|
||||||
|
return await get({ url: `/api/v1/master/getModuleTypeItemList${paramString}` }).then((res) => {
|
||||||
console.log('🚀🚀 ~ getModuleTypeItemList ~ res:', res)
|
console.log('🚀🚀 ~ getModuleTypeItemList ~ res:', res)
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
|
|||||||
@ -932,5 +932,6 @@
|
|||||||
"simulator.table.sub8": "台",
|
"simulator.table.sub8": "台",
|
||||||
"simulator.table.sub9": "予測発電量 (kWh)",
|
"simulator.table.sub9": "予測発電量 (kWh)",
|
||||||
"simulator.notice.sub1": "Hanwha Japan 年間発電量",
|
"simulator.notice.sub1": "Hanwha Japan 年間発電量",
|
||||||
"simulator.notice.sub2": "シミュレーション案内事項"
|
"simulator.notice.sub2": "シミュレーション案内事項",
|
||||||
|
"master.moduletypeitem.message.error": "지붕재 코드를 입력하세요."
|
||||||
}
|
}
|
||||||
|
|||||||
@ -942,5 +942,6 @@
|
|||||||
"simulator.table.sub8": "대",
|
"simulator.table.sub8": "대",
|
||||||
"simulator.table.sub9": "예측발전량 (kWh)",
|
"simulator.table.sub9": "예측발전량 (kWh)",
|
||||||
"simulator.notice.sub1": "Hanwha Japan 연간 발전량",
|
"simulator.notice.sub1": "Hanwha Japan 연간 발전량",
|
||||||
"simulator.notice.sub2": "시뮬레이션 안내사항"
|
"simulator.notice.sub2": "시뮬레이션 안내사항",
|
||||||
|
"master.moduletypeitem.message.error": "지붕재 코드를 입력하세요."
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user