diff --git a/src/apis/OpstBizService.js b/src/apis/OpstBizService.js deleted file mode 100644 index 9163159..0000000 --- a/src/apis/OpstBizService.js +++ /dev/null @@ -1,137 +0,0 @@ -import { - GET_BOARD_LIST, - // GET_PUBLIC_BOARD_LIST, - GET_PARKING_SIMSA_DETAILS_LIST, - GET_PARKING_SIMSA_LIST, - GET_PARKING_SIMSA_TARGET_LIST, - SAVE_PARKING_SIMSA_TARGET - // GET_CMM_CODE_LIST, - // SAVE_PUBLIC_BOARD, - // DELETE_PUBLIC_BOARD, - // GET_FILE_DOWNLOAD, - // SAVE_PUBLIC_BOARD_HIT_CNT -} from 'commons/ApiUrl'; -import axios from 'utils/axios'; -// import FileSaver from 'file-saver'; - -class OpstBizService { - //---------------------------------------------------------------------------- - // Common : 공통 - //---------------------------------------------------------------------------- - // eslint-disable-next-line no-return-await - // getComboCodeList = (params) => async () => await axios.get(GET_CMM_CODE_LIST, { params }); - - // TODO: 헤더에서 파일 정보 읽을 수 있도록 변경 필요 - // fileDownload = async (id, filename, alert) => { - // await axios - // .get(GET_FILE_DOWNLOAD + id, { - // responseType: 'blob' // 'arrayBuffer', - // // withCredentials: process.env.NODE_ENV === 'development' - // // headers: { Authorization: window.localStorage.getItem(ACCESS_TOKEN_NAME) } - // }) - // // eslint-disable-next-line consistent-return - // .then((res) => { - // if (res.isAxiosError) { - // alert.show('파일을 다운로드 할 수 없습니다[파일정보 오류]'); - // return false; - // } - // FileSaver.saveAs(res, filename); - // }); - // }; - - setRowId = (params, idx) => { - if (params && params.page && params.size) return params.page * params.size + idx + 1; - return idx + 1; - }; - - //---------------------------------------------------------------------------- - // PublicBoard : 공지사항 관리 - //---------------------------------------------------------------------------- - // eslint-disable-next-line no-return-await - // getPublicBoardList = async (params) => { - // const res = await axios.get(GET_PUBLIC_BOARD_LIST, { params }); - // if (res.success) { - // res.data = res.data.map((d, idx) => ({ ...d, rowId: this.setRowId(params, idx) })); - // return res; - // } - // return res; - // }; - // - // savePublicBoard = async (formData) => { - // const config = { - // method: 'post', - // data: formData, - // headers: { 'Content-Type': 'multipart/form-data' } // , Authorization: localStorage.getItem('access_token') } - // }; - // // eslint-disable-next-line no-return-await - // return await axios(SAVE_PUBLIC_BOARD, config); - // }; - // - // // eslint-disable-next-line no-return-await - // deletePublicBoard = (inCode) => async () => await axios.post(DELETE_PUBLIC_BOARD + inCode); - // - // // getPublicBoard = async (inCode) => { - // // await axios.get(GET_PUBLIC_BOARD + inCode); - // // }; - // - // modifyPublicBoardHitCount = async (inCode) => { - // const res = await axios.put(SAVE_PUBLIC_BOARD_HIT_CNT + inCode); - // if (res.success) { - // return res; - // } - // return res; - // }; - - //---------------------------------------------------------------------------- - // Parking : 주정차 의견 진술 - //---------------------------------------------------------------------------- - // eslint-disable-next-line no-return-await - getSimsa680GroupList = async (params) => { - const res = await axios.get(GET_PARKING_SIMSA_LIST, { params }); - if (res.success) { - res.data = res.data.map((d, idx) => ({ ...d, rowId: this.setRowId(params, idx) })); - return res; - } - return res; - }; - - getSimsa680DetailList = async (params) => { - const res = await axios.get(GET_PARKING_SIMSA_DETAILS_LIST, { params }); - if (res.success) { - res.data = res.data.map((d, idx) => ({ ...d, rowId: this.setRowId(params, idx) })); - return res; - } - return res; - }; - - getSimsaTargetList = async (params) => { - const res = await axios.get(GET_PARKING_SIMSA_TARGET_LIST, { params }); - if (res.success) { - res.data = res.data.map((d, idx) => ({ ...d, rowId: this.setRowId(params, idx) })); - return res; - } - return res; - }; - - saveSimsaTargetList = async (params) => { - const res = await axios.post(SAVE_PARKING_SIMSA_TARGET, params); - if (res.success) { - res.data = res.data.map((d, idx) => ({ ...d, rowId: this.setRowId(params, idx) })); - return res; - } - return res; - }; - - //---------------------------------------------------------------------------- - // Board : 게시판 관리 - //---------------------------------------------------------------------------- - getBoardList = async (params) => { - const res = await axios.get(GET_BOARD_LIST, { params }); - if (res.success) { - res.data = res.data.map((d, idx) => ({ ...d, rowId: this.setRowId(params, idx) })); - return res; - } - return res; - }; -} -export default new OpstBizService(); diff --git a/src/apis/board.js b/src/apis/board.js new file mode 100644 index 0000000..e006e25 --- /dev/null +++ b/src/apis/board.js @@ -0,0 +1,17 @@ +//---------------------------------------------------------------------------- +// Board : 게시판 관리 +//---------------------------------------------------------------------------- + +import axios from 'utils/axios'; +import { GET_BOARD_LIST } from 'commons/ApiUrl'; +import { setRowId } from './common'; + +// eslint-disable-next-line import/prefer-default-export +export async function getBoardList(params) { + const res = await axios.get(GET_BOARD_LIST, { params }); + if (res.success) { + res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); + return res; + } + return res; +} diff --git a/src/apis/common.js b/src/apis/common.js index 35571e7..b56808c 100644 --- a/src/apis/common.js +++ b/src/apis/common.js @@ -1,6 +1,6 @@ -import axios from '../utils/axios'; +import axios from 'utils/axios'; import FileSaver from 'file-saver'; -import { GET_CMM_CODE_LIST, GET_FILE_DOWNLOAD } from '../commons/ApiUrl'; +import { GET_CMM_CODE_LIST, GET_FILE_DOWNLOAD } from 'commons/ApiUrl'; //---------------------------------------------------------------------------- // Common : 공통 diff --git a/src/apis/parking.js b/src/apis/parking.js new file mode 100644 index 0000000..b1d0bf2 --- /dev/null +++ b/src/apis/parking.js @@ -0,0 +1,49 @@ +//---------------------------------------------------------------------------- +// Parking : 주정차의견진술관리 +//---------------------------------------------------------------------------- + +import axios from 'utils/axios'; +import { + GET_PARKING_SIMSA_DETAILS_LIST, + GET_PARKING_SIMSA_LIST, + GET_PARKING_SIMSA_TARGET_LIST, + SAVE_PARKING_SIMSA_TARGET +} from 'commons/ApiUrl'; +import { setRowId } from './common'; + +// eslint-disable-next-line no-return-await +export async function getSimsa680GroupList(params) { + const res = await axios.get(GET_PARKING_SIMSA_LIST, { params }); + if (res.success) { + res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); + return res; + } + return res; +} + +export async function getSimsa680DetailList(params) { + const res = await axios.get(GET_PARKING_SIMSA_DETAILS_LIST, { params }); + if (res.success) { + res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); + return res; + } + return res; +} + +export async function getSimsaTargetList(params) { + const res = await axios.get(GET_PARKING_SIMSA_TARGET_LIST, { params }); + if (res.success) { + res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); + return res; + } + return res; +} + +export async function saveSimsaTargetList(params) { + const res = await axios.post(SAVE_PARKING_SIMSA_TARGET, params); + if (res.success) { + res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); + return res; + } + return res; +} diff --git a/src/apis/public.js b/src/apis/public.js index b73bc94..f310456 100644 --- a/src/apis/public.js +++ b/src/apis/public.js @@ -2,8 +2,8 @@ // PublicBoard : 공지사항 관리 //---------------------------------------------------------------------------- -import axios from '../utils/axios'; -import { DELETE_PUBLIC_BOARD, GET_PUBLIC_BOARD_LIST, SAVE_PUBLIC_BOARD, SAVE_PUBLIC_BOARD_HIT_CNT } from '../commons/ApiUrl'; +import axios from 'utils/axios'; +import { DELETE_PUBLIC_BOARD, GET_PUBLIC_BOARD_LIST, SAVE_PUBLIC_BOARD, SAVE_PUBLIC_BOARD_HIT_CNT } from 'commons/ApiUrl'; import { setRowId } from './common'; export async function getPublicBoardList(params) { diff --git a/src/apis/resident.js b/src/apis/resident.js new file mode 100644 index 0000000..bd08bd9 --- /dev/null +++ b/src/apis/resident.js @@ -0,0 +1,25 @@ +//---------------------------------------------------------------------------- +// Parking : 주정차의견진술관리 +//---------------------------------------------------------------------------- + +import axios from 'utils/axios'; +import { GET_RESIDENT, GET_RESIDENT_DATA_LIST } from 'commons/ApiUrl'; +import { setRowId } from './common'; + +// eslint-disable-next-line no-return-await +export async function getResidents(params) { + const res = await axios.get(GET_RESIDENT_DATA_LIST, { params }); + if (res.success) { + res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); + return res; + } + return res; +} + +export async function getResident(scCode) { + const res = await axios.get(GET_RESIDENT + scCode); + if (res.success) { + return res; + } + return res; +} diff --git a/src/commons/ApiUrl.js b/src/commons/ApiUrl.js index 34e19e7..37e95f9 100644 --- a/src/commons/ApiUrl.js +++ b/src/commons/ApiUrl.js @@ -19,3 +19,7 @@ export const GET_PARKING_SIMSA_LIST = '/api/v1/ctgy/parking'; export const GET_PARKING_SIMSA_DETAILS_LIST = '/api/v1/ctgy/parking/details'; export const GET_PARKING_SIMSA_TARGET_LIST = '/api/v1/ctgy/parking/target'; export const SAVE_PARKING_SIMSA_TARGET = '/api/v1/ctgy/parking/target'; + +// 거주자 의견 진술 +export const GET_RESIDENT_DATA_LIST = '/api/v1/ctgy/resident/data'; +export const GET_RESIDENT = '/api/v1/ctgy/resident/'; diff --git a/src/commons/XitCmm.js b/src/commons/XitCmm.js index cce4ff9..d715da5 100644 --- a/src/commons/XitCmm.js +++ b/src/commons/XitCmm.js @@ -1,74 +1,8 @@ import Swal from 'sweetalert2'; import { useCallback, useState } from 'react'; +import format from 'date-fns/format'; const XitCmm = { - // const request: (options: object) => { - // const headers = new Headers({ - // 'Content-Type': 'application/json', - // }) - // - // if(localStorage.getItem(ACCESS_TOKEN)) { - // headers.append('Authorization', 'Bearer ' + localStorage.getItem(ACCESS_TOKEN)) - // } - // - // const defaults = {headers: headers}; - // options = Object.assign({}, defaults, options); - // - // return fetch(options.url, options) - // .then(response => - // response.json().then(json => { - // if(!response.ok) { - // return Promise.reject(json); - // } - // return json; - // }) - // ); - // }, - - // requestApi: async ( - // methodType: string, - // url: string, - // params: any, - // headers: any - // ): Promise> => { - // console.log(`process.env.NODE_ENV`, process.env.NODE_ENV); - // console.table(params); - // - // headers = Object.assign({'Content-Type': 'application/json;charset=UTF-8'}, headers); //, "Authorization": session.get('token')}; - // let options: any = { - // url: process.env.NODE_ENV === 'development' ? url : process.env.REACT_APP_API + url, - // method: methodType, - // headers: headers - // }; - // // get 요청은 body 없이 call - // if (methodType.toLocaleLowerCase() === 'get') options = {...options, params}; - // else options = {...options, data: params}; - // - // // 요청 처리 - // let res: IApiResponse; - // try { - // res = await axios(options); //{...config, ...options});//.then(res => { - // } catch (e) { - // console.log(`@@@@@@@@@@@ requestApi EXCEPTION @@@@@@@@@@@@@`); - // Alert.error(`

${e}

`); - // } finally { - // } - // if (res !== undefined && res.success && res.data.success) { - // console.log(JSON.stringify(res.data)); - // Alert.success(`처리되었습니다`); - // } else { - // console.log(`@@@@@@@@@@@ requestApi ERROR @@@@@@@@@@@@@`); - // let code = res.data.code != null ? `[${res.data.code}]` : ''; - // await SweetAlert.fire({ - // title: `Inpix Administrator`, - // html: `

${res.data.message} ${code}

`, - // //footer: 'Copyright 2018', - // timer: 3000 - // }); - // } - // return res.data; - // }, - /** * validation check error message * @param message @@ -120,46 +54,10 @@ const XitCmm = { return [value, setValue, changer]; }, - // ag-grid 페이지 변경 - onPageSizeChanged() { - /* - Page Size: -