Compare commits
3 Commits
3ba58816e8
...
c0504044ad
| Author | SHA1 | Date |
|---|---|---|
|
|
c0504044ad | |
|
|
d98798e7b5 | |
|
|
29215ccaae |
|
|
@ -15,6 +15,9 @@ import AddIcon from '@mui/icons-material/Add';
|
||||||
|
|
||||||
import styledComponent from "styled-components";
|
import styledComponent from "styled-components";
|
||||||
|
|
||||||
|
import * as EgovNet from 'api/egovFetch';
|
||||||
|
|
||||||
|
|
||||||
const StyledDiv = styledComponent.div`
|
const StyledDiv = styledComponent.div`
|
||||||
.text-item.active {
|
.text-item.active {
|
||||||
background-color: #676767;
|
background-color: #676767;
|
||||||
|
|
@ -27,10 +30,14 @@ function generate(items, element, onClickListner,nameKey,
|
||||||
let returnValue = [];
|
let returnValue = [];
|
||||||
let nIndex = 0;
|
let nIndex = 0;
|
||||||
Object.keys(items).forEach(function(key) {
|
Object.keys(items).forEach(function(key) {
|
||||||
|
|
||||||
|
|
||||||
returnValue = [
|
returnValue = [
|
||||||
...returnValue,
|
...returnValue,
|
||||||
React.cloneElement(element, {
|
React.cloneElement(element, {
|
||||||
key,
|
key,
|
||||||
|
'data-key' : key,
|
||||||
|
'data-index' : nIndex,
|
||||||
},
|
},
|
||||||
<Card className="text-item" sx={{ '&': { boxShadow: 'none' } }} key={key} data-index={nIndex} onClick={(e) => {onClickListner(e, key);}}>
|
<Card className="text-item" sx={{ '&': { boxShadow: 'none' } }} key={key} data-index={nIndex} onClick={(e) => {onClickListner(e, key);}}>
|
||||||
<CardActionArea sx={{ px: 1 }}>
|
<CardActionArea sx={{ px: 1 }}>
|
||||||
|
|
@ -114,10 +121,19 @@ function ListCreateUpdateDelete(props) {
|
||||||
<ListItem
|
<ListItem
|
||||||
secondaryAction={
|
secondaryAction={
|
||||||
<div>
|
<div>
|
||||||
<IconButton sx={{ mx: 0 }} edge="start" aria-label="edit">
|
<IconButton sx={{ mx: 0 }} edge="start" aria-label="edit" onClick={(e)=> {alert('수정 클릭')}}>
|
||||||
<EditIcon />
|
<EditIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton edge="end" aria-label="delete">
|
<IconButton edge="end" aria-label="delete" onClick={(e)=> {
|
||||||
|
const dataKey = Number(e.currentTarget.parentNode.parentNode.parentNode.getAttribute('data-key'));
|
||||||
|
|
||||||
|
let paramCodeGroup = null;
|
||||||
|
if( props.depthSelectedArrayIndex > 0 ) {
|
||||||
|
paramCodeGroup = props.itemIndex[props.depthSelectedArrayIndex-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
props.onClickDeleteItem(e, paramCodeGroup, props.paramCodeLevel, props.depthSelectedArrayIndex, props.items[dataKey]);
|
||||||
|
}}>
|
||||||
<DeleteIcon />
|
<DeleteIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,10 @@ import Box from '@mui/material/Box';
|
||||||
|
|
||||||
import * as EgovNet from 'api/egovFetch';
|
import * as EgovNet from 'api/egovFetch';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import CommitteeCodeRegistrationPopup from './CommitteeCodeMgt/CommitteeCodeRegistrationPopup';
|
import CommitteeCodeRegistrationPopup from './CommitteeCodeMgt/CommitteeCodeRegistrationPopup';
|
||||||
|
|
||||||
import ListCreateUpdateDelete from '../../../components/list/ListCreateUpdateDelete'
|
import ListCreateUpdateDelete from '../../../components/list/ListCreateUpdateDelete'
|
||||||
import ListLabelInputs from '../../../components/list/ListLabelInputs'
|
import ListLabelInputs from '../../../components/list/ListLabelInputs'
|
||||||
|
|
||||||
|
|
||||||
import URL from 'constants/url';
|
import URL from 'constants/url';
|
||||||
|
|
||||||
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
||||||
|
|
@ -37,7 +32,7 @@ function CommitteeCodeMgt(props) {
|
||||||
|
|
||||||
// '중앙건설기술심의'에서 특정 item선택 시, 하위 '총괄위원회'목록을 불러온다.
|
// '중앙건설기술심의'에서 특정 item선택 시, 하위 '총괄위원회'목록을 불러온다.
|
||||||
useEffect(function () {
|
useEffect(function () {
|
||||||
if( typeof depthSelectedIndex[0] !== "undefined" && depth01List[depthSelectedIndex[0]].orgId !== undefined) {
|
if( typeof depthSelectedIndex[0] !== "undefined" && depth01List[depthSelectedIndex[0]] && depth01List[depthSelectedIndex[0]].orgId !== undefined) {
|
||||||
setSearchCondition({ paramCodeGroup: depth01List[depthSelectedIndex[0]].orgId, paramCodeLevel: 'LV_02' });
|
setSearchCondition({ paramCodeGroup: depth01List[depthSelectedIndex[0]].orgId, paramCodeLevel: 'LV_02' });
|
||||||
setDepth02List({});
|
setDepth02List({});
|
||||||
setDepth03List({});
|
setDepth03List({});
|
||||||
|
|
@ -153,6 +148,66 @@ function CommitteeCodeMgt(props) {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
const onClickDeleteItem = (e, paramCodeGroup, paramCodeLevel, depthSelectedArrayIndex, deleteItem) => {
|
||||||
|
|
||||||
|
if( deleteItem.orgId === undefined ) {
|
||||||
|
alert('삭제 대상이 존재하지 않습니다.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const requestOptions = {
|
||||||
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
'Content-type': 'application/json',
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EgovNet.requestFetch(`/admin/config/committee-code-management/${deleteItem.orgId}`,
|
||||||
|
requestOptions,
|
||||||
|
function (resp) {
|
||||||
|
//방금 삭제한 것만 새로 읽어 드린다.
|
||||||
|
let forChangeObject = {...searchCondition, paramCodeGroup, paramCodeLevel};
|
||||||
|
setSearchCondition(forChangeObject);
|
||||||
|
|
||||||
|
//현재 선택된 아이템을 삭제한 경우 그 하위 목록을 모두 비운다.
|
||||||
|
|
||||||
|
//현재 선택된 아이템을 삭제 했는지 체크한다
|
||||||
|
// 여기에 현재 선택된 아이템을 삭제 했는지 체크하는 로직을 추가해주세요.
|
||||||
|
if( Number(depthSelectedIndex[depthSelectedArrayIndex]) === Number(deleteItem.orgId) ) {
|
||||||
|
// 맞다면
|
||||||
|
//그 하위 목록을 비운다.
|
||||||
|
|
||||||
|
for( let i = depthSelectedArrayIndex + 1; i<4; i++ ) {
|
||||||
|
//setSearchCondition({...searchCondition, paramCodeLevel : createCondition.paramCodeLevel});
|
||||||
|
depthSelectedIndex[i] = undefined;
|
||||||
|
}
|
||||||
|
let forChangeObject = [...depthSelectedIndex];
|
||||||
|
setDepthSelectedIndex(forChangeObject);
|
||||||
|
|
||||||
|
// eslint-disable-next-line default-case
|
||||||
|
switch(depthSelectedArrayIndex) {
|
||||||
|
case 0:
|
||||||
|
setDepth02List({});
|
||||||
|
// eslint-disable-next-line no-fallthrough
|
||||||
|
case 1:
|
||||||
|
setDepth03List({});
|
||||||
|
// eslint-disable-next-line no-fallthrough
|
||||||
|
case 2:
|
||||||
|
setDepth04List({});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
alert('삭제 되었습니다.');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const Location = React.memo(function Location() {
|
const Location = React.memo(function Location() {
|
||||||
return (
|
return (
|
||||||
<div className="location">
|
<div className="location">
|
||||||
|
|
@ -211,6 +266,7 @@ function CommitteeCodeMgt(props) {
|
||||||
idKey="orgId"
|
idKey="orgId"
|
||||||
isPopupOpen = {isCommitteeCodeRegistrationPopupOpen}
|
isPopupOpen = {isCommitteeCodeRegistrationPopupOpen}
|
||||||
setIsPopupOpen = {setIsCommitteeCodeRegistrationPopupOpen}
|
setIsPopupOpen = {setIsCommitteeCodeRegistrationPopupOpen}
|
||||||
|
onClickDeleteItem={onClickDeleteItem}
|
||||||
/>
|
/>
|
||||||
<ListCreateUpdateDelete
|
<ListCreateUpdateDelete
|
||||||
title="총괄위원회"
|
title="총괄위원회"
|
||||||
|
|
@ -220,11 +276,14 @@ function CommitteeCodeMgt(props) {
|
||||||
depthSelectedArrayIndex={1}
|
depthSelectedArrayIndex={1}
|
||||||
createCondition={createCondition}
|
createCondition={createCondition}
|
||||||
setCreateCondition={setCreateCondition}
|
setCreateCondition={setCreateCondition}
|
||||||
|
searchCondition={searchCondition}
|
||||||
|
setSearchCondition={setSearchCondition}
|
||||||
paramCodeLevel="LV_02"
|
paramCodeLevel="LV_02"
|
||||||
nameKey="orgNm"
|
nameKey="orgNm"
|
||||||
idKey="orgId"
|
idKey="orgId"
|
||||||
isPopupOpen = {isCommitteeCodeRegistrationPopupOpen}
|
isPopupOpen = {isCommitteeCodeRegistrationPopupOpen}
|
||||||
setIsPopupOpen = {setIsCommitteeCodeRegistrationPopupOpen}
|
setIsPopupOpen = {setIsCommitteeCodeRegistrationPopupOpen}
|
||||||
|
onClickDeleteItem={onClickDeleteItem}
|
||||||
/>
|
/>
|
||||||
<ListCreateUpdateDelete
|
<ListCreateUpdateDelete
|
||||||
title="건설기준위원회"
|
title="건설기준위원회"
|
||||||
|
|
@ -234,11 +293,14 @@ function CommitteeCodeMgt(props) {
|
||||||
depthSelectedArrayIndex={2}
|
depthSelectedArrayIndex={2}
|
||||||
createCondition={createCondition}
|
createCondition={createCondition}
|
||||||
setCreateCondition={setCreateCondition}
|
setCreateCondition={setCreateCondition}
|
||||||
|
searchCondition={searchCondition}
|
||||||
|
setSearchCondition={setSearchCondition}
|
||||||
paramCodeLevel="LV_03"
|
paramCodeLevel="LV_03"
|
||||||
nameKey="orgNm"
|
nameKey="orgNm"
|
||||||
idKey="orgId"
|
idKey="orgId"
|
||||||
isPopupOpen = {isCommitteeCodeRegistrationPopupOpen}
|
isPopupOpen = {isCommitteeCodeRegistrationPopupOpen}
|
||||||
setIsPopupOpen = {setIsCommitteeCodeRegistrationPopupOpen}
|
setIsPopupOpen = {setIsCommitteeCodeRegistrationPopupOpen}
|
||||||
|
onClickDeleteItem={onClickDeleteItem}
|
||||||
/>
|
/>
|
||||||
<ListCreateUpdateDelete
|
<ListCreateUpdateDelete
|
||||||
title="실무위원회"
|
title="실무위원회"
|
||||||
|
|
@ -248,11 +310,14 @@ function CommitteeCodeMgt(props) {
|
||||||
depthSelectedArrayIndex={3}
|
depthSelectedArrayIndex={3}
|
||||||
createCondition={createCondition}
|
createCondition={createCondition}
|
||||||
setCreateCondition={setCreateCondition}
|
setCreateCondition={setCreateCondition}
|
||||||
|
searchCondition={searchCondition}
|
||||||
|
setSearchCondition={setSearchCondition}
|
||||||
paramCodeLevel="LV_04"
|
paramCodeLevel="LV_04"
|
||||||
nameKey="orgNm"
|
nameKey="orgNm"
|
||||||
idKey="orgId"
|
idKey="orgId"
|
||||||
isPopupOpen = {isCommitteeCodeRegistrationPopupOpen}
|
isPopupOpen = {isCommitteeCodeRegistrationPopupOpen}
|
||||||
setIsPopupOpen = {setIsCommitteeCodeRegistrationPopupOpen}
|
setIsPopupOpen = {setIsCommitteeCodeRegistrationPopupOpen}
|
||||||
|
onClickDeleteItem={onClickDeleteItem}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ function CommitteeCodeRegistrationPopup(props) {
|
||||||
EgovNet.requestFetch(`/admin/config/committee-code-management`,
|
EgovNet.requestFetch(`/admin/config/committee-code-management`,
|
||||||
requestOptions,
|
requestOptions,
|
||||||
function (resp) {
|
function (resp) {
|
||||||
//window.location.reload();
|
|
||||||
//방금 추가한 것만 새로 읽어 드린다.
|
//방금 추가한 것만 새로 읽어 드린다.
|
||||||
props.setSearchCondition({...props.searchCondition, paramCodeLevel : props.createCondition.paramCodeLevel});
|
props.setSearchCondition({...props.searchCondition, paramCodeLevel : props.createCondition.paramCodeLevel});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -447,6 +447,47 @@ public class AdminConfigController extends BaseController {
|
||||||
return resultVO;
|
return resultVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "'위원회 코드 관리' 페이지에서 위원회 코드 삭제하는 API",
|
||||||
|
description = "관리자 단에서 '환경설정' > '위원회코드 관리' 페이지에서 휴지통 모양 삭제 버튼으로 항목 삭제하는 API",
|
||||||
|
tags = {"AdminConfigController"}
|
||||||
|
)
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "등록 성공"),
|
||||||
|
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
|
})
|
||||||
|
@DeleteMapping(value = "/committee-code-management/{orgId}")
|
||||||
|
public ResultVO deleteSchedule
|
||||||
|
(
|
||||||
|
@AuthenticationPrincipal LoginVO user,
|
||||||
|
HttpServletRequest request,
|
||||||
|
@PathVariable("orgId") String strOrgId
|
||||||
|
) throws Exception {
|
||||||
|
|
||||||
|
ResultVO resultVO = new ResultVO();
|
||||||
|
Long orgId = Long.valueOf(strOrgId);
|
||||||
|
try {
|
||||||
|
resultVO = adminCommitteeCodeManagementService.deleteCommitteeCodeManagement(resultVO, request, user, orgId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||||
|
resultVO.setResultMessage(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println(
|
||||||
|
"\n--------------------------------------------------------------\n" +
|
||||||
|
request.getRequestURI() + " OUT:" +
|
||||||
|
"\n--------------------------------------------------------------\n" +
|
||||||
|
"resultVO.toString():" + "\n" +
|
||||||
|
resultVO.toString() + "\n" +
|
||||||
|
"\n--------------------------------------------------------------\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
return resultVO;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ---- 관련사이트 관리 ----- */
|
/* ---- 관련사이트 관리 ----- */
|
||||||
@Operation(
|
@Operation(
|
||||||
summary = "관련사이트 목록 조회",
|
summary = "관련사이트 목록 조회",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.dbnt.kcscbackend.admin.config.service.AdminCommitteeCodeManagementSer
|
||||||
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
||||||
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
||||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||||
|
import com.dbnt.kcscbackend.commonCode.entity.TnCmtOrg;
|
||||||
import com.dbnt.kcscbackend.commonCode.repository.TnCmtOrgRepository;
|
import com.dbnt.kcscbackend.commonCode.repository.TnCmtOrgRepository;
|
||||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||||
|
|
@ -110,7 +111,56 @@ public class AdminCommitteeCodeManagementServiceImpl extends EgovAbstractService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultVO deleteCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception {
|
public ResultVO deleteCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long cmtSeq) throws Exception {
|
||||||
return null;
|
System.out.println(
|
||||||
|
"\n--------------------------------------------------------------\n" +
|
||||||
|
request.getRequestURI() + " IN:" +
|
||||||
|
"\n--------------------------------------------------------------\n" +
|
||||||
|
"cmtSeq:" + "\n" +
|
||||||
|
cmtSeq + "\n" +
|
||||||
|
"\n--------------------------------------------------------------\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> response = tnCmtOrgRepository.spDeleteTnCmtOrg(
|
||||||
|
cmtSeq.intValue(),
|
||||||
|
user.getId(),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
// 자식 코드들을 모두 제거한다.
|
||||||
|
getChildrenOrg(user, cmtSeq);
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> dto = new HashMap<String, Object>();
|
||||||
|
dto.put("errorMessage", response.get("_error_message") );
|
||||||
|
dto.put("orgId", cmtSeq );
|
||||||
|
|
||||||
|
resultVO.setResult(dto);
|
||||||
|
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||||
|
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||||
|
|
||||||
|
return resultVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getChildrenOrg(LoginVO user, Long upCmtSeq) {
|
||||||
|
List<Map<String, Object>> list = tnCmtOrgRepository.findByUpCmtSeq(upCmtSeq).stream()
|
||||||
|
.map(item -> {
|
||||||
|
Map<String, Object> returnMap = new HashMap<>();
|
||||||
|
returnMap.put("cmtSeq", item.getCmtSeq());
|
||||||
|
getChildrenOrg( user, item.getCmtSeq() );
|
||||||
|
Map<String, Object> response = tnCmtOrgRepository.spDeleteTnCmtOrg(
|
||||||
|
item.getCmtSeq().intValue(),
|
||||||
|
user.getId(),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
return returnMap;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
System.out.println("for Debugging");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.dbnt.kcscbackend.commonCode.repository;
|
||||||
import com.dbnt.kcscbackend.commonCode.entity.TnCmtOrg;
|
import com.dbnt.kcscbackend.commonCode.entity.TnCmtOrg;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.jpa.repository.query.Procedure;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -40,4 +41,28 @@ public interface TnCmtOrgRepository extends JpaRepository<TnCmtOrg, TnCmtOrg.TnC
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Query(value = "CALL sp_delete_tn_cmt_org (" +
|
||||||
|
":_cmt_seq, " +
|
||||||
|
":_modi_id, " +
|
||||||
|
":_result_count, " +
|
||||||
|
":_result_code, " +
|
||||||
|
":_error_message)",
|
||||||
|
nativeQuery = true)
|
||||||
|
Map<String, Object> spDeleteTnCmtOrg(
|
||||||
|
@Param("_cmt_seq") Integer cmtSeq,
|
||||||
|
@Param("_modi_id") String modiId,
|
||||||
|
@Param("_result_count") Integer resultCount,
|
||||||
|
@Param("_result_code") String resultCode,
|
||||||
|
@Param("_error_message") String errorMessage
|
||||||
|
);
|
||||||
|
|
||||||
|
@Procedure("sp_is_valid_tn_cmt_org_id")
|
||||||
|
int spIsValidTnCmtOrgId( Integer cmtSeq );
|
||||||
|
|
||||||
|
TnCmtOrg findByCmtSeq(Long cmtSeq);
|
||||||
|
List<TnCmtOrg> findByUpCmtSeq(Long upCmtSeq);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue