fix:외사장비현황 -> 업무용휴대전화 작업완료

TaehunPark 2022-10-12 17:43:30 +09:00
parent 79ae27796e
commit 7a5c20c02d
14 changed files with 585 additions and 84 deletions

View File

@ -6,6 +6,7 @@ import com.dbnt.faisp.equip.model.CellPhone;
import com.dbnt.faisp.equip.model.Equip; import com.dbnt.faisp.equip.model.Equip;
import com.dbnt.faisp.equip.model.EquipLog; import com.dbnt.faisp.equip.model.EquipLog;
import com.dbnt.faisp.equip.service.EquipService; import com.dbnt.faisp.equip.service.EquipService;
import com.dbnt.faisp.fipTarget.model.PartInfo;
import com.dbnt.faisp.organMgt.service.OrganConfigService; import com.dbnt.faisp.organMgt.service.OrganConfigService;
import com.dbnt.faisp.userInfo.model.UserInfo; import com.dbnt.faisp.userInfo.model.UserInfo;
import com.dbnt.faisp.userInfo.service.UserInfoService; import com.dbnt.faisp.userInfo.service.UserInfoService;
@ -210,16 +211,31 @@ public class EquipController {
} }
@GetMapping("/cellPhoneList") @GetMapping("/cellPhoneList")
public ModelAndView cellPhoneList(@AuthenticationPrincipal UserInfo loginUser,CellPhone cellPhone) { public ModelAndView cellPhoneList(@AuthenticationPrincipal UserInfo loginUser,CellPhone cellPhone,HttpServletResponse response) {
ModelAndView mav = new ModelAndView("equip/cellPhoneList"); ModelAndView mav = new ModelAndView("equip/cellPhoneList");
cellPhone.setDownOrganCdList(loginUser.getDownOrganCdList());
//엑셀다운
if(cellPhone.getExcel() != null && cellPhone.getExcel().equals("Y")){
String[] headers = { "phone_key", "sosok", "tel_no", "user_nm", "ext_mail", "webex_no", "katalk_id"};
String[] headerNames = { "연번", "소속","전화번호", "사용자(관리자)", "등록 외부메일", "웹엑스 미팅번호", "카카오톡 ID"};
String[] columnType = { "int", "String","String", "String", "String", "String", "String", "Stiring"};
String sheetName = "업무용 휴대전화 현황";
String excelFileName = "업무용 휴대전화 현황";
List<CellPhone> cellPhoneList= equipService.selectCellPhoneList(cellPhone);
try {
Utils.cellPhoneListToExcel(cellPhoneList, response, headers, headerNames, columnType, sheetName, excelFileName);
} catch (IOException e) {
}
return null;
}
//메뉴권한 확인 //메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/cellPhoneList").get(0).getAccessAuth(); String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/cellPhoneList").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth); mav.addObject("accessAuth", accessAuth);
cellPhone.setDownOrganCdList(loginUser.getDownOrganCdList());
cellPhone.setQueryInfo(); cellPhone.setQueryInfo();
mav.addObject("cellPhoneList", equipService.selectCellPhoneList(cellPhone));
cellPhone.setContentCnt(equipService.selectCellPhoneListCnt(cellPhone));
cellPhone.setPaginationInfo(); cellPhone.setPaginationInfo();
mav.addObject("searchParams", cellPhone); mav.addObject("searchParams", cellPhone);
@ -227,25 +243,53 @@ public class EquipController {
} }
@GetMapping("/cellPhoneEditModal") @GetMapping("/cellPhoneEditModal")
public ModelAndView cellPhoneEditModal(@AuthenticationPrincipal UserInfo loginUser,CellPhone cellPhone,String ogCd) { public ModelAndView cellPhoneEditModal(@AuthenticationPrincipal UserInfo loginUser,CellPhone cellPhone) {
ModelAndView mav = new ModelAndView("equip/cellPhoneEditModal"); ModelAndView mav = new ModelAndView("equip/cellPhoneEditModal");
if(cellPhone.getPhoneKey() != null) {
cellPhone = equipService.selectCellPhoneInfo(cellPhone.getPhoneKey());
ParamMap param = new ParamMap();
param.put("downOrganCdList", organConfigService.selectDownOrganListWhereUserOgCd(cellPhone.getMgtOrgan()));
mav.addObject("managerList", userInfoService.selectManagerList(param));
}
if (cellPhone.getPhoneKey() == null) {
cellPhone.setWrtOrgan(loginUser.getOgCd());
cellPhone.setWrtPart(loginUser.getOfcCd());
cellPhone.setWrtUserSeq(loginUser.getUserSeq());
cellPhone.setWrtNm(loginUser.getUserNm());
}
//메뉴권한 확인 //메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/equipStatus").get(0).getAccessAuth(); String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/cellPhoneList").get(0).getAccessAuth();
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList()); mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
mav.addObject("userOrgan", loginUser.getOgCd()); mav.addObject("userOrgan", loginUser.getOgCd());
mav.addObject("accessAuth", accessAuth); mav.addObject("accessAuth", accessAuth);
mav.addObject("info", cellPhone);
return mav;
}
//사용자 리스트 @GetMapping("/cellPhoneSelecBox")
public ModelAndView cellPhoneSelecBox(String ogCd) {
ModelAndView mav = new ModelAndView("equip/cellPhoneSelecBox");
ParamMap param = new ParamMap(); ParamMap param = new ParamMap();
param.put("downOrganCdList", organConfigService.selectDownOrganListWhereUserOgCd(ogCd)); param.put("downOrganCdList", organConfigService.selectDownOrganListWhereUserOgCd(ogCd));
mav.addObject("managerList", userInfoService.selectManagerList(param)); mav.addObject("managerList", userInfoService.selectManagerList(param));
return mav; return mav;
} }
@PostMapping("/saveCellPhone")
public Integer saveCellPhone (@AuthenticationPrincipal UserInfo loginUser,CellPhone cellPhone){
cellPhone.setWrtDt(LocalDateTime.now());
return equipService.saveCellPhone(cellPhone);
}
@PostMapping("/deleteCellPhone")
public void deleteCellPhone(@RequestBody List<CellPhone> cellPhone){
equipService.deleteCellPhone(cellPhone);
}
} }

View File

@ -1,5 +1,6 @@
package com.dbnt.faisp.equip.mapper; package com.dbnt.faisp.equip.mapper;
import com.dbnt.faisp.equip.model.CellPhone;
import com.dbnt.faisp.equip.model.Equip; import com.dbnt.faisp.equip.model.Equip;
import com.dbnt.faisp.equip.model.EquipLog; import com.dbnt.faisp.equip.model.EquipLog;
import com.dbnt.faisp.util.ParamMap; import com.dbnt.faisp.util.ParamMap;
@ -29,6 +30,10 @@ public interface EquipMapper {
String selectEquipFirstId(Equip equip); String selectEquipFirstId(Equip equip);
List<CellPhone> selectCellPhoneList(CellPhone cellPhone);
Integer selectCellPhoneListCnt(CellPhone cellPhone);
} }

View File

@ -37,20 +37,39 @@ public class CellPhone extends BaseModel{
private Integer pUserSeq; private Integer pUserSeq;
@Column(name = "ext_mail") @Column(name = "ext_mail")
private String extMail; private String extMail;
@Column(name = "katalk_id")
private String katalkId;
@Column(name = "webex_no") @Column(name = "webex_no")
private Integer webexNo; private String webexNo;
@Column(name = "description")
private String description;
@Column(name = "wrt_organ") @Column(name = "wrt_organ")
private String wrtOrgan; private String wrtOrgan;
@Column(name = "wrt_part") @Column(name = "wrt_part")
private String wrtPart; private String wrtPart;
@Column(name = "wrt_user_seq") @Column(name = "wrt_user_seq")
private String wrtUserSeq; private Integer wrtUserSeq;
@Column(name = "wrt_nm") @Column(name = "wrt_nm")
private String wrtNm; private String wrtNm;
@Column(name = "wrt_dt") @Column(name = "wrt_dt")
private LocalDateTime wrtDt; private LocalDateTime wrtDt;
@Transient
private String userNm;
@Transient
private String sosok;
@Transient
private String excel;
@Override
public String toString() {
return "CellPhone [phoneKey=" + phoneKey + ", mgtOrgan=" + mgtOrgan + ", telNo=" + telNo + ", pUserSeq=" + pUserSeq
+ ", extMail=" + extMail + ", katalkId=" + katalkId + ", webexNo=" + webexNo + ", description="
+ description + ", wrtOrgan=" + wrtOrgan + ", wrtPart=" + wrtPart + ", wrtUserSeq=" + wrtUserSeq
+ ", wrtNm=" + wrtNm + ", wrtDt=" + wrtDt + ", userNm=" + userNm + ", sosok=" + sosok + "]";
}

View File

@ -0,0 +1,14 @@
package com.dbnt.faisp.equip.repository;
import com.dbnt.faisp.equip.model.CellPhone;
import org.springframework.data.jpa.repository.JpaRepository;
public interface CellPhoneRepository extends JpaRepository<CellPhone, Integer> {
}

View File

@ -2,11 +2,13 @@ package com.dbnt.faisp.equip.service;
import com.dbnt.faisp.equip.mapper.EquipMapper; import com.dbnt.faisp.equip.mapper.EquipMapper;
import com.dbnt.faisp.equip.model.CellPhone;
import com.dbnt.faisp.equip.model.Equip; import com.dbnt.faisp.equip.model.Equip;
import com.dbnt.faisp.equip.model.Equip.EquipId; import com.dbnt.faisp.equip.model.Equip.EquipId;
import com.dbnt.faisp.equip.model.EquipFile; import com.dbnt.faisp.equip.model.EquipFile;
import com.dbnt.faisp.equip.model.EquipFile.EquipFileId; import com.dbnt.faisp.equip.model.EquipFile.EquipFileId;
import com.dbnt.faisp.equip.model.EquipLog; import com.dbnt.faisp.equip.model.EquipLog;
import com.dbnt.faisp.equip.repository.CellPhoneRepository;
import com.dbnt.faisp.equip.repository.EquipFileRepository; import com.dbnt.faisp.equip.repository.EquipFileRepository;
import com.dbnt.faisp.equip.repository.EquipLogRepository; import com.dbnt.faisp.equip.repository.EquipLogRepository;
import com.dbnt.faisp.equip.repository.EquipRepository; import com.dbnt.faisp.equip.repository.EquipRepository;
@ -36,6 +38,7 @@ public class EquipService {
private final EquipRepository equipRepository; private final EquipRepository equipRepository;
private final EquipFileRepository equipFileRepository; private final EquipFileRepository equipFileRepository;
private final EquipLogRepository equipLogRepository; private final EquipLogRepository equipLogRepository;
private final CellPhoneRepository cellPhoneRepository;
private final EquipMapper equipMapper; private final EquipMapper equipMapper;
@ -293,6 +296,28 @@ public class EquipService {
return equipMapper.selectEquipFirstId(equip); return equipMapper.selectEquipFirstId(equip);
} }
@Transactional
public Integer saveCellPhone(CellPhone cellPhone) {
return cellPhoneRepository.save(cellPhone).getPhoneKey();
}
public List<CellPhone> selectCellPhoneList(CellPhone cellPhone) {
return equipMapper.selectCellPhoneList(cellPhone);
}
public Integer selectCellPhoneListCnt(CellPhone cellPhone) {
return equipMapper.selectCellPhoneListCnt(cellPhone);
}
public CellPhone selectCellPhoneInfo(Integer phoneKey) {
return cellPhoneRepository.findById(phoneKey).orElse(null);
}
@Transactional
public void deleteCellPhone(List<CellPhone> cellPhone) {
cellPhoneRepository.deleteAll(cellPhone);
}
} }

View File

@ -25,6 +25,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFDataFormat; import org.apache.poi.xssf.usermodel.XSSFDataFormat;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import com.dbnt.faisp.equip.model.CellPhone;
import com.dbnt.faisp.fipTarget.model.PartInfo; import com.dbnt.faisp.fipTarget.model.PartInfo;
import com.dbnt.faisp.fipTarget.model.PartWork; import com.dbnt.faisp.fipTarget.model.PartWork;
@ -646,6 +647,109 @@ public class Utils {
} }
public static void cellPhoneListToExcel(List<CellPhone> cellPhoneList, HttpServletResponse response,
String[] headers, String[] headerNames, String[] columnType, String sheetName, String excelFileName) throws IOException {
if(Utils.isNotEmpty(cellPhoneList)) {
// 메모리에 100개의 행을 유지합니다. 행의 수가 넘으면 디스크에 적습니다.
XSSFWorkbook wb = new XSSFWorkbook();
Sheet sheet = wb.createSheet(sheetName);
Row headerRow = sheet.createRow(0);
CellStyle cellStyle1 = wb.createCellStyle(); //쉼표들어간 숫자 양식
CellStyle cellStyle2 = wb.createCellStyle(); //숫자양식
CellStyle headerStyle = wb.createCellStyle(); //숫자양식
CellStyle headerStyle2 = wb.createCellStyle();
CellStyle headerStyle3 = wb.createCellStyle();
XSSFDataFormat format = wb.createDataFormat();
cellStyle1.setAlignment(HorizontalAlignment.CENTER);
cellStyle2.setDataFormat(format.getFormat("#,##0"));
cellStyle2.setAlignment(HorizontalAlignment.CENTER);
headerStyle2.setBorderTop(BorderStyle.THIN);
headerStyle2.setBorderBottom(BorderStyle.THIN);
headerStyle2.setBorderLeft(BorderStyle.THIN);
headerStyle2.setBorderRight(BorderStyle.THIN);
headerStyle2.setAlignment(HorizontalAlignment.CENTER);
headerStyle2.setFillPattern(FillPatternType.SOLID_FOREGROUND);
headerStyle2.setFillForegroundColor((short)3);
headerStyle2.setFillForegroundColor(IndexedColors.LIME.getIndex());
headerStyle.setAlignment(HorizontalAlignment.CENTER);
headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
headerStyle.setFillForegroundColor((short)3);
headerStyle.setFillForegroundColor(IndexedColors.LIME.getIndex());
headerStyle3.setBorderTop(BorderStyle.THIN);
headerStyle3.setBorderBottom(BorderStyle.THIN);
headerStyle3.setBorderLeft(BorderStyle.THIN);
headerStyle3.setBorderRight(BorderStyle.THIN);
headerStyle3.setAlignment(HorizontalAlignment.CENTER);
headerStyle3.setFillPattern(FillPatternType.SOLID_FOREGROUND);
headerStyle3.setFillForegroundColor((short)3);
headerStyle3.setFillForegroundColor(IndexedColors.LIME.getIndex());
//로우그리기
for(int i=0; i<cellPhoneList.size(); i++) {
ParamMap rowData = new ParamMap();
Row row = sheet.createRow(i+1);
rowData.set("phone_key", cellPhoneList.get(i).getPhoneKey());
rowData.set("sosok", cellPhoneList.get(i).getSosok());
rowData.set("tel_no", cellPhoneList.get(i).getTelNo());
rowData.set("user_nm", cellPhoneList.get(i).getUserNm());
rowData.set("ext_mail", cellPhoneList.get(i).getExtMail());
rowData.set("webex_no", cellPhoneList.get(i).getWebexNo());
rowData.set("katalk_id", cellPhoneList.get(i).getKatalkId());
for(int j=0; j<headers.length; j++) {
Cell cell = row.createCell(j);
if(columnType[j].equalsIgnoreCase("Int")) {
cell.setCellValue(rowData.getInt(headers[j]));
cell.setCellStyle(cellStyle2);
} else if(columnType[j].equalsIgnoreCase("String")) {
cell.setCellValue(rowData.getString(headers[j]));
cell.setCellStyle(cellStyle1);
} else {
cell.setCellValue(rowData.getString(headers[j]));
cell.setCellStyle(cellStyle1);
}
}
}
//헤더
for(int j=0; j<headerNames.length; j++) {
Cell cell = headerRow.createCell(j);
cell.setCellValue(headerNames[j]);
cell.setCellStyle(headerStyle3);
sheet.autoSizeColumn(j);
sheet.setColumnWidth(j, (sheet.getColumnWidth(j)) + 1024);
}
//엑셀이름 한글깨짐방지
String outputFileName = new String(excelFileName.getBytes("KSC5601"), "8859_1");
response.setHeader("Set-Cookie", "fileDownload=true; path=/");
response.setHeader("Content-Disposition", String.format("attachment; filename=\""+outputFileName+"_"+Utils.getTimeStampString("yyyyMMdd_HHmm")+".xlsx\""));
wb.write(response.getOutputStream());
wb.close();
} else {
response.setHeader("Content-Type", "text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
out.write("<html lang=\"ko\">");
out.write("<head>");
out.write("<script type=\"text/javascript\">");
out.write("alert('데이터가 없습니다.');");
out.write("history.back(-1);");
out.write("</script>");
out.write("</head>");
out.write("</html>");
out.flush();
out.close();
}
}

View File

@ -393,5 +393,56 @@
limit 1 limit 1
</select> </select>
<select id="selectCellPhoneList" resultType="CellPhone" parameterType="CellPhone">
select phone_key,
case
when oc.organ_type = 'OGC001' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
when oc.organ_type = 'OGC002' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else concat((select item_value from code_mgt cm where cm.item_cd = oc.parent_organ ),'-', (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd ))
end as sosok,
tel_no,
p_user_seq,
(select user_nm from user_info ui where ui.user_seq = cm.p_user_seq) as user_nm,
ext_mail,
webex_no,
katalk_id
from cellphone_mgt cm,
organ_config oc
where cm.mgt_organ = oc.organ_cd
and cm.mgt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
order by cm.wrt_dt desc
limit #{rowCnt} offset #{firstIndex}
</select>
<select id="selectCellPhoneListCnt" resultType="int" parameterType="CellPhone">
select count(*)
from(
select phone_key,
case
when oc.organ_type = 'OGC001' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
when oc.organ_type = 'OGC002' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else concat((select item_value from code_mgt cm where cm.item_cd = oc.parent_organ ),'-', (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd ))
end as sosok,
tel_no,
p_user_seq,
(select user_nm from user_info ui where ui.user_seq = cm.p_user_seq) as user_nm,
ext_mail,
webex_no,
katalk_id
from cellphone_mgt cm,
organ_config oc
where cm.mgt_organ = oc.organ_cd
and cm.mgt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
order by cm.wrt_dt desc
) a
</select>
</mapper> </mapper>

View File

@ -1,16 +1,5 @@
$(document).on('click', '#addEquip', function (){ $(document).on('click', '#addCellPhone', function (){
$.ajax({ showModal(null);
url: '/equip/cellPhoneEditModal',
type: 'GET',
dataType:"html",
success: function(html){
$("#cellPhoneEditModalContent").empty().append(html);
$("#cellPhoneEditModal").modal('show');
},
error:function(){
}
});
}) })
$(document).on('change', '#mgtOrgan', function (){ $(document).on('change', '#mgtOrgan', function (){
@ -41,6 +30,184 @@ function changeManager(ogCd){
}); });
} }
$(document).on('click', '#saveCellPhone', function (){
if(Validation()){
if(confirm("저장하시겠습니까?")){
document.getElementById("mgtOrgan").disabled = false;
contentFade("in");
const formData = new FormData($("#cellPhoneEditFm")[0]);
$.ajax({
type : 'POST',
data : formData,
url : "/equip/saveCellPhone",
processData: false,
contentType: false,
success : function(result) {
alert("저장되었습니다.");
contentFade("out");
location.reload();
},
error : function(xhr, status) {
alert("저장에 실패하였습니다.")
contentFade("out");
}
})
}
}
})
$(document).on('click', '.cellPhoneTr', function (event){
const target = event.target;
if(!(target.className === "cpChk" ||$(target).parents("td").length>0)){
const phoneKey = (Number($(this).find(".phoneKey").val()));
showModal(phoneKey);
}
});
$(document).on('click', '.affairTr', function (event){
const target = event.target;
if(!(target.className === "apprvTd" || $(target).parents(".apprvTd").length>0)){
$(".trChkBox").prop("checked", false);
$(this).find(".trChkBox").prop("checked", true);
getAffairViewModal(Number($(this).find(".affairKey").val()));
}
})
function showModal(phoneKey){
$.ajax({
url: '/equip/cellPhoneEditModal',
data: {phoneKey: phoneKey},
type: 'GET',
dataType:"html",
success: function(html){
$("#cellPhoneEditModalContent").empty().append(html);
$("#cellPhoneEditModal").modal('show');
if(phoneKey == null){
changeManager($("#mgtOrgan").val());
}
},
error:function(){
}
});
}
$(document).on('click', '#updateCellPhone', function (){
if(Validation()){
if(confirm("수정하시겠습니까?")){
document.getElementById("mgtOrgan").disabled = false;
contentFade("in");
const formData = new FormData($("#cellPhoneEditFm")[0]);
$.ajax({
type : 'POST',
data : formData,
url : "/equip/saveCellPhone",
processData: false,
contentType: false,
success : function(result) {
alert("수정되었습니다.");
contentFade("out");
showModal(result);
},
error : function(xhr, status) {
alert("수정에 실패하였습니다.")
contentFade("out");
}
})
}
}
})
$(document).ready( function() {
$('#chk-all').click( function() {
$('.cellPhoneCheckBox').prop('checked',this.checked);
});
});
$(document).on('click', '#deleteCellPhone', function (){
if(confirm("선택한 대상을 삭제처리 하시겠습니까?")){
const checkArr = [];
$('input:checkbox[name=cpChk]:checked').each(function (idx, el){
checkArr.push({});
const target = $(el);
checkArr[idx].phoneKey = Number(target.parents('tr').find('.phoneKey').val());
})
deleteCellPhone(checkArr);
}
})
$(document).on('click', '#deleteCellPhoneM', function (){
if(confirm("선택한 대상을 삭제처리 하시겠습니까?")){
const checkArr = [];
checkArr.push({});
checkArr[0].phoneKey = Number( $('input[name=phoneKey]').val());
deleteCellPhone(checkArr);
}
})
function deleteCellPhone(checkArr){
$.ajax({
type : 'POST',
url : "/equip/deleteCellPhone",
data : JSON.stringify(checkArr),
contentType: 'application/json',
beforeSend: function (xhr){
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
},
success : function() {
alert("삭제처리 되었습니다.");
location.reload();
},
error : function(xhr, status) {
alert("삭제처리에 실패하였습니다");
}
})
}
$(document).on('click', '#goExcel', function (){
if(confirm("엑셀로 다운로드 하시겠습니까?")){
$('input[name=excel]').val('Y');
$('#searchFm').submit();
$('input[name=excel]').val('');
}else{
false;
}
})
function Validation(){
let flag = true;
const emailRule = /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.[a-zA-Z]{2,3}$/i;
const regExp = /^\d{2,3}-\d{3,4}-\d{4}$/;
if($('#mgtOrgan').val() == ""){
alert("관리처를 선택해주세요.");
$('#mgtOrgan').focus();
flag = false;
}
if($('#pUserSeq').val() == ""){
alert("사용자를 선택해주세요.");
$('#pUserSeq').focus();
flag = false;
}
if($('#telNo').val() != ""){
if(!regExp.test($("input[id='telNo']").val())) {
alert("전화번호 형식이 맞지않습니다.");
$('#telNo').focus();
flag = false;
}
}
if($('#extMail').val() != ""){
if(!emailRule.test($("input[id='extMail']").val())) {
alert("이메일 형식이 맞지않습니다.");
$('#extMail').focus();
flag = false;
}
}
return flag;
}
$(document).on('click', '#btn-close', function (){
location.reload();
})

View File

@ -248,7 +248,21 @@ $(document).on('click', '#equDeleteBtn', function (){
const target = $(el); const target = $(el);
checkArr[idx].equKey = Number(target.parents('tr').find('.equKey').val()); checkArr[idx].equKey = Number(target.parents('tr').find('.equKey').val());
}) })
deleteEquip(checkArr);
}
})
$(document).on('click', '#deleteEquip', function (){
if(confirm("선택한 대상을 삭제처리 하시겠습니까?")){
const checkArr = [];
checkArr.push({});
checkArr[0].equKey = Number($('#mEquKey').val());
deleteEquip(checkArr);
}
})
function deleteEquip(checkArr){
$.ajax({ $.ajax({
type : 'POST', type : 'POST',
url : "/equip/epuipDelete", url : "/equip/epuipDelete",
@ -265,9 +279,7 @@ $(document).on('click', '#equDeleteBtn', function (){
alert("삭제처리에 실패하였습니다"); alert("삭제처리에 실패하였습니다");
} }
}) })
}
}
})
$(document).ready( function() { $(document).ready( function() {
$('#chk-all').click( function() { $('#chk-all').click( function() {

View File

@ -2,13 +2,23 @@
<html lang="ko" xmlns:th="http://www.thymeleaf.org"> <html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="menuEditModalLabel">등록</h5> <h5 class="modal-title" id="menuEditModalLabel" th:text="${info.phoneKey eq null?'업무용 휴대전화 등록':'업무용 휴대전화 수정'}"></h5>
<th:block th:if="${info.phoneKey eq null}">
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</th:block>
<th:block th:unless="${info.phoneKey eq null}">
<button type="button" class="btn-close" id="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</th:block>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form id="equipEditForm" th:action="@{/equip/saveEquip}" method="post" enctype="multipart/form-data"> <form id="cellPhoneEditFm" method="post">
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/> <input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/> <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<input type="hidden" name="phoneKey" th:value="${info.phoneKey}">
<input type="hidden" name="wrtOrgan" th:value="${info.wrtOrgan}">
<input type="hidden" name="wrtPart" th:value="${info.wrtPart}">
<input type="hidden" name="wrtUserSeq" th:value="${info.wrtUserSeq}">
<input type="hidden" name="wrtNm" th:value="${info.wrtNm}">
<div class="row mb-3"> <div class="row mb-3">
<label for="cat1Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">관리처</label> <label for="cat1Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">관리처</label>
<div class="col-sm-6"> <div class="col-sm-6">
@ -16,66 +26,78 @@
<option value="">선택</option> <option value="">선택</option>
<th:block th:each="commonCode:${session.commonCode.get('OG')}"> <th:block th:each="commonCode:${session.commonCode.get('OG')}">
<th:block th:if="${#lists.contains(mgtOrganList, commonCode.itemCd)}"> <th:block th:if="${#lists.contains(mgtOrganList, commonCode.itemCd)}">
<th:block th:if="${info.phoneKey eq null}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq userOrgan}"></option> <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq userOrgan}"></option>
</th:block> </th:block>
<th:block th:unless="${info.phoneKey eq null}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq info.mgtOrgan}"></option>
</th:block>
</th:block>
</th:block> </th:block>
</select> </select>
</div> </div>
</div> </div>
<div class="mb-2 row"> <div class="mb-3 row">
<label for="ogCd" class="col-sm-2 col-form-label text-center">담당</label> <label for="ogCd" class="col-sm-4 col-form-label text-center">사용</label>
<div class="col-sm-3"> <div class="col-sm-3">
<select class="form-select form-select-sm" id="pUserSeq" name="pUserSeq" disabled> <select class="form-select form-select-sm" id="pUserSeq" name="pUserSeq">
<option value="">선택</option> <option value="">선택</option>
</select> <th:block th:unless="${info.phoneKey eq null}">
</div> <th:block th:each="uInfo:${managerList}">
</div> <option th:value="${uInfo.user_seq}" th:text="${uInfo.user_name}" th:selected="${uInfo.user_seq eq info.pUserSeq}"></option>
<div class="row mb-3"> </th:block>
<label for="cat1Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">분류</label>
<div class="col-sm-6">
<select class="form-select form-select-sm" id="equType" name="equType">
<option value="">-분류 선택-</option>
<th:block th:each="commonCode:${session.commonCode.get('IT')}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
</th:block> </th:block>
</select> </select>
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<label for="cat3Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">취득연도</label> <label for="cat1Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">전화번호</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" class="form-control storedYear" name="storedYear"> <input type="text" class="form-control" id="telNo" name="telNo" th:value="${info.telNo}" placeholder="EX: 010-0000-0000">
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<label for="cat3Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">보유량</label> <label for="cat3Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">등록외부메일</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="number" class="form-control" id="itemQty" name="itemQty" placeholder="수량 직접입력"> <input type="text" class="form-control" id="extMail" name="extMail" th:value="${info.extMail}" placeholder="EX: test@test.com">
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<label for="cat2Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">상태</label> <label for="cat3Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">웹엑스<br>미팅번호</label>
<div class="col-sm-6"> <div class="col-sm-6">
<select class="form-select form-select-sm" name="itemCondition"> <input type="text" class="form-control" id="webexNo" name="webexNo" th:value="${info.webexNo}">
<option value="">상태 선택</option> </div>
<th:block th:each="commonCode:${session.commonCode.get('ITCON')}"> </div>
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option> <div class="row mb-3">
</th:block> <label for="cat2Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">카카오톡 ID</label>
</select> <div class="col-sm-6">
<input type="text" class="form-control" id="katalkId" name="katalkId" th:value="${info.katalkId}">
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<label for="cat3Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">비고</label> <label for="cat3Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">비고</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" class="form-control" name="note"> <input type="text" class="form-control" id="description" name="description" th:value="${info.description}">
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<div class="modal-footer justify-content-between"> <div class="modal-footer justify-content-between">
<div class="col-auto"> <div class="col-auto">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button> <th:block th:if="${info.phoneKey eq null}">
<button type="button" class="btn btn-primary" id="saveEquip">저장</button> <button type="button" class="btn btn-secondary"
data-bs-dismiss="modal">닫기</button>
</th:block>
<th:block th:unless="${info.phoneKey eq null}">
<button type="button" class="btn btn-secondary" id="btn-close"
data-bs-dismiss="modal">닫기</button>
</th:block>
<button type="button" class="btn btn-primary" id="saveCellPhone"
th:if="${info.phoneKey eq null}">저장</button>
<button type="button" class="btn btn-primary" id="updateCellPhone"
th:unless="${info.phoneKey eq null}">수정</button>
<button type="button" class="btn btn-danger" id="deleteCellPhoneM"
th:if="${info.phoneKey != null} and ${accessAuth eq 'ACC003'}">삭제</button>
</div> </div>
</div> </div>
</html> </html>

View File

@ -13,7 +13,8 @@
<div class="row mx-0"> <div class="row mx-0">
<div class="col-12 card text-center"> <div class="col-12 card text-center">
<div class="card-body"> <div class="card-body">
<form method="get" th:action="@{/equip/List}"> <form id="searchFm" method="get" th:action="@{/equip/cellPhoneList}">
<input type="hidden" name="excel">
<input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}"> <input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}">
<div class="row justify-content-between pe-3 py-1"> <div class="row justify-content-between pe-3 py-1">
<div class="col-auto"> <div class="col-auto">
@ -33,6 +34,8 @@
</div> </div>
</div> </div>
</form> </form>
<button data-bs-toggle="modal" data-bs-target="#webexModal" >웹엑스 접속방법</button>
<button id="goExcel">엑셀다운</button>
<div class="row justify-content-start"> <div class="row justify-content-start">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
@ -52,17 +55,21 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr class="cellPhoneTr" th:each="cp:${cellPhoneList}">
<td> <td class="cpChk">
<input type="checkbox" name="equChk" class="equInfoCheckBox"> <input type="checkbox" name="cpChk" class="cellPhoneCheckBox">
<input type="hidden" class="phoneKey" th:value="${cp.phoneKey}">
</td> </td>
<td th:text="${cp.phoneKey}"></td>
<td th:text="${cp.sosok}"></td>
<td th:text="${cp.telNo}"></td>
<td th:text="${cp.userNm}"></td>
<td th:text="${cp.extMail}"></td>
<td th:text="${cp.webexNo}"></td>
<td th:text="${cp.katalkId}"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
<div class="col-auto">
<button type="button" class="btn btn-success"id="addEquip" th:unless="${accessAuth eq 'ACC001'}">등록</button>
</div> </div>
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-auto"> <div class="col-auto">
@ -91,6 +98,10 @@
</nav> </nav>
</div> </div>
</div> </div>
<div class="col-auto">
<button type="button" class="btn btn-danger"id="deleteCellPhone" th:if="${accessAuth eq 'ACC003'}">삭제</button>
<button type="button" class="btn btn-success"id="addCellPhone" th:unless="${accessAuth eq 'ACC001'}">등록</button>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -113,5 +124,24 @@
</div> </div>
</div> </div>
<div class="modal fade" id="webexModal" data-bs-backdrop="static"
data-bs-keyboard="false" tabindex="-1"
aria-labelledby="userInsertModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content ">
<div class="modal-header">
<h5 class="modal-title" id="translatorInsertModalLabel">웹엑스 접속방법</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div class="col-auto">
<div class="text-center">
<h6>Cisco WebEx Meeting 설치 > 회원가입 > 미팅에 참여 클릭 > 미팅번호 입력</h6>
</div>
</div>
</div>
</div>
</div>
</div> </div>
</html> </html>

View File

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<option value="">-선택-</option>
<th:block th:each="info:${managerList}">
<option th:value="${info.user_seq}" th:text="${info.user_name}"></option>
</th:block>
</html>

View File

@ -72,11 +72,6 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
<div class="col-auto">
<input type="button" class="btn btn-success" value="삭제" id="equDeleteBtn" th:unless="${accessAuth eq 'ACC001'}">
<input type="button" class="btn btn-success" value="수정" id="equUpdateBtn" th:unless="${accessAuth eq 'ACC001'}">
<input type="button" class="btn btn-success" value="수정이력" id="historyBtn" th:unless="${accessAuth eq 'ACC001'}">
</div> </div>
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-auto"> <div class="col-auto">
@ -105,6 +100,11 @@
</nav> </nav>
</div> </div>
</div> </div>
<div class="col-auto">
<input type="button" class="btn btn-danger" value="삭제" id="equDeleteBtn" th:if="${accessAuth eq 'ACC003'}">
<input type="button" class="btn btn-success" value="수정" id="equUpdateBtn" th:unless="${accessAuth eq 'ACC001'}">
<input type="button" class="btn btn-success" value="수정이력" id="historyBtn" th:unless="${accessAuth eq 'ACC001'}">
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -9,7 +9,7 @@
<form id="equipModifyForm" th:action="@{/equip/updateEquip}" method="post" enctype="multipart/form-data"> <form id="equipModifyForm" th:action="@{/equip/updateEquip}" method="post" enctype="multipart/form-data">
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/> <input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/> <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<input type="hidden" name="equKey" th:value="${equInfo.equKey}"> <input type="hidden" id="mEquKey" name="equKey" th:value="${equInfo.equKey}">
<input type="hidden" name="versionNo" th:value="${equInfo.versionNo}"> <input type="hidden" name="versionNo" th:value="${equInfo.versionNo}">
<div class="row mb-3"> <div class="row mb-3">
<label for="cat1Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">관리처</label> <label for="cat1Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">관리처</label>
@ -93,6 +93,7 @@
<div class="col-auto"> <div class="col-auto">
<button type="button" class="btn btn-secondary" id="closeModal" data-bs-dismiss="modal">닫기</button> <button type="button" class="btn btn-secondary" id="closeModal" data-bs-dismiss="modal">닫기</button>
<button type="button" class="btn btn-primary" id="updateEquip" th:if="${accessAuth eq 'ACC003'} or ${wrtId eq userId}">수정</button> <button type="button" class="btn btn-primary" id="updateEquip" th:if="${accessAuth eq 'ACC003'} or ${wrtId eq userId}">수정</button>
<button type="button" class="btn btn-danger" id="deleteEquip" th:if="${accessAuth eq 'ACC003'} or ${wrtId eq userId}">삭제</button>
</div> </div>
</div> </div>
</html> </html>