ERP-node/WebContent/WEB-INF/view/productmgmt/productmgmtUpgList.jsp

415 lines
12 KiB
Plaintext

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.pms.common.utils.*"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page import="java.util.*" %>
<%@include file= "/init.jsp" %>
<%
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
String connector = person.getUserId();
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
<!-- //JSTL 페이징 변수선언 -->
<c:set var="totalCount" value="${empty TOTAL_COUNT?0:TOTAL_COUNT}" />
<c:set var="maxPage" value="${empty MAX_PAGE_SIZE?1:MAX_PAGE_SIZE}" />
<c:set var="nPage" value="${empty param.page?1:param.page}" />
<c:set var="pageIndex" value="${(nPage-1)/10}" />
<c:set var="nextPage" value="${empty NEXT_PAGE?1:NEXT_PAGE}" />
<c:set var="prevPage" value="${empty PREV_PAGE?1:PREV_PAGE}" />
<c:set var="now" value="<%=new java.util.Date() %>"/>
<c:set var="sysYear"><fmt:formatDate value="${now}" pattern="yyyy" /></c:set>
<c:set var="connector" value="<%=connector %>" />
<style>
a:link {
color : white;
text-decoration: none;
}
a:visited {
color : black;
text-decoration: none;
}
a:hover {
color : red;
text-decoration: underline;
}
a:active {
color : green;
text-decoration: none;
}
</style>
<script type="text/javascript">
$(function(){
$(document).ready(function(){
$('.select2').select2();
fnc_datepick();
$("input[type=text]").keyup(function(e){
if(e.keyCode == 13) search();
});
$("#btnSearch").click(function(){
$("#page").val("1");
fn_search();
});
//등록팝업
$("#btnReg").click(function(){
if($("#product_code").val()==""){
Swal.fire('양산제품코드를 선택해 주세요');
$("#product_code").focus();
}else{
window.open("/productmgmt/productMgmtUpgInsertFormPopup.do?product_code="+$("#product_code").val(), "", "width=900, height=600","menubars=no, scrollbars=yes, resizable=yes");
}
});
//삭제
$("#btnDelete").click(function(){
fn_delete();
});
});
});
//검색
function fn_search(){
document.form1.action = "/productmgmt/getProductMgntUpgList.do";
document.form1.submit();
}
function fnc_goEdit(master_objid){
window.open("/productmgmt/productMgmtUpgUpdateFormPopup.do?product_code="+master_objid, "", "width=900, height=665","menubars=no, scrollbars=yes, resizable=yes");
}
function fn_delete(){
var masterLength = $("input[name=master_objid]:checked").length;
var detailLength = $("input[name=detail_objid]:checked").length;
//초기화
$("#master_objid").val("");
$("#detail_objid").val("");
if(0 < masterLength || 0 < detailLength){
var checkArr = new Array();
var checkArr1 = new Array();
$("input[name=master_objid]:checked").each(function(){
var objId = fnc_checkNull($(this).attr("data-objId").replace(" ",""));
checkArr.push(objId);
});
$("input[name=detail_objid]:checked").each(function(){
var objId = fnc_checkNull($(this).attr("data-objId").replace(" ",""));
checkArr1.push(objId);
});
$("#master_objid").val(checkArr);
$("#detail_objid").val(checkArr1);
/* Swal.fire(checkArr);
Swal.fire(checkArr1);
Swal.fire($("#rootObjid").val());
return; */
if(confirm("기등록된 BOM&PART도 함께 삭제 됩니다. 삭제 하시겠습니까?")){
var param = $("#hiddenForm").serialize();
$.ajax({
type : "POST",
url : "/productmgmt/productUpgListDelete.do",
data: param,
dataType:"json",
success:function(data){
if(data =="SUCCESS"){
Swal.fire("삭제되었습니다.");
fn_search();
};
}
,error: function(jqxhr, status, error){
}
});
}
}else{
Swal.fire("선택한 항목이 없습니다.");
}
}
</script>
</head>
<body class="backcolor">
<form name="hiddenForm" id="hiddenForm" method="post">
<input type="hidden" name="actionType" id="actionType">
<input type="hidden" name="master_objid" id="master_objid">
<input type="hidden" name="detail_objid" id="detail_objid">
<input type="hidden" name="rootObjid" id="rootObjid" value="${param.product_code}">
</form>
<form name="form1" id="form1" method="post">
<input type="hidden" name="actionType">
<div class="content-box">
<div class="content-box-s">
<div class="plm_menu_name">
<h2>
<span>제품사양관리</span>
</h2>
</div>
<div id="plmSearchZon">
<table>
<tbody>
<tr>
<td class="align_r"><label for="" class="">년도</label></td>
<td>
<select name="Year" id="Year" style="width:80px;" class="select2" autocomplete="off">
<option value="">선택</option>
<c:forEach begin="${sysYear-4}" end="${sysYear}" var="req_year">
<option value="${req_year}"${param.Year eq req_year ? 'selected':'' }>${req_year}</option>
</c:forEach>
</select>
</td>
<td class="align_r"><label for="" class="">양산제품코드</label></td>
<td>
<select name="product_code" id="product_code" style="width: 150px;" class="select2" autocomplete="off">
<option value="">전체</option>
${code_map.product_code}
</select>
</td>
</tr>
</tbody>
</table>
</div>
<section class="contents_page_basic_margin">
<div class="btn_wrap">
<div class="plm_btn_wrap">
<input type="button" value="등록" class="plm_btns" id="btnReg">
<input type="button" value="삭제" class="plm_btns" id="btnDelete">
<input type="button" value="조회" class="plm_btns" id="btnSearch">
</div>
</div>
<div class="plm_table_wrap">
<div>
<table class="plm_table">
<colgroup>
<col width="10%" />
<col width="10%" />
<c:choose>
<c:when test="${empty productList}">
</c:when>
<c:otherwise>
<c:forEach var="item" items="${productList}" varStatus="varStatus">
<col width="100px" />
</c:forEach>
</c:otherwise>
</c:choose>
</colgroup>
<thead>
<tr class="plm_thead">
<td colspan="2">UPG</td>
<td colspan="${productListCnt}">사양명</td>
<!-- <td rowspan="2">
비고
</td> -->
</tr>
<tr class="plm_thead">
<td>NAME</td>
<td>CODE</td>
<c:choose>
<c:when test="${empty productList}">
<td>데이터가 없습니다.</td>
</c:when>
<c:otherwise>
<c:forEach var="item" items="${productList}" varStatus="varStatus">
<td><input type="checkbox" name="master_objid" data-objId="${item.MASTER_OBJID}">&nbsp;&nbsp;<a href="javascript:fnc_goEdit('${item.MASTER_OBJID}');">${item.SPEC_NAME}</a></td>
</c:forEach>
</c:otherwise>
</c:choose>
</tr>
</thead>
<c:choose>
<c:when test="${empty LIST}">
<%-- <tr style="text-align:center;">
<td align="center" colspan="${productListCnt}">조회된 데이터가 없습니다.</td>
</tr> --%>
</c:when>
<c:otherwise>
<c:set var="upgSize" value="${fn:length(LIST)/productListCnt}" />
<c:set var="Cnt" value="1" />
<c:forEach var="item" items="${LIST}" varStatus="varStatus">
<tr>
<td style="text-align:left;"><input type="checkbox" name="detail_objid" data-objId="${item.CODE_ID}"> &nbsp; ${item.UPG_NAME}</td>
<td>${item.UPG_CODE}</td>
<c:if test="${productListCnt == 1}">
<td>${item.UPG_NO0}</td>
</c:if>
<c:if test="${productListCnt == 2}">
<td>${item.UPG_NO0}</td>
<td>${item.UPG_NO1}</td>
</c:if>
<c:if test="${productListCnt == 3}">
<td>${item.UPG_NO0}</td>
<td>${item.UPG_NO1}</td>
<td>${item.UPG_NO2}</td>
</c:if>
<c:if test="${productListCnt == 4}">
<td>${item.UPG_NO0}</td>
<td>${item.UPG_NO1}</td>
<td>${item.UPG_NO2}</td>
<td>${item.UPG_NO3}</td>
</c:if>
<c:if test="${productListCnt == 5}">
<td>${item.UPG_NO0}</td>
<td>${item.UPG_NO1}</td>
<td>${item.UPG_NO2}</td>
<td>${item.UPG_NO3}</td>
<td>${item.UPG_NO4}</td>
</c:if>
<c:if test="${productListCnt == 6}">
<td>${item.UPG_NO0}</td>
<td>${item.UPG_NO1}</td>
<td>${item.UPG_NO2}</td>
<td>${item.UPG_NO3}</td>
<td>${item.UPG_NO4}</td>
<td>${item.UPG_NO5}</td>
</c:if>
<c:if test="${productListCnt == 7}">
<td>${item.UPG_NO0}</td>
<td>${item.UPG_NO1}</td>
<td>${item.UPG_NO2}</td>
<td>${item.UPG_NO3}</td>
<td>${item.UPG_NO4}</td>
<td>${item.UPG_NO5}</td>
<td>${item.UPG_NO6}</td>
</c:if>
<c:if test="${productListCnt == 8}">
<td>${item.UPG_NO0}</td>
<td>${item.UPG_NO1}</td>
<td>${item.UPG_NO2}</td>
<td>${item.UPG_NO3}</td>
<td>${item.UPG_NO4}</td>
<td>${item.UPG_NO5}</td>
<td>${item.UPG_NO6}</td>
<td>${item.UPG_NO7}</td>
</c:if>
<c:if test="${productListCnt == 9}">
<td>${item.UPG_NO0}</td>
<td>${item.UPG_NO1}</td>
<td>${item.UPG_NO2}</td>
<td>${item.UPG_NO3}</td>
<td>${item.UPG_NO4}</td>
<td>${item.UPG_NO5}</td>
<td>${item.UPG_NO6}</td>
<td>${item.UPG_NO7}</td>
<td>${item.UPG_NO8}</td>
</c:if>
<c:if test="${productListCnt == 10}">
<td>${item.UPG_NO0}</td>
<td>${item.UPG_NO1}</td>
<td>${item.UPG_NO2}</td>
<td>${item.UPG_NO3}</td>
<td>${item.UPG_NO4}</td>
<td>${item.UPG_NO5}</td>
<td>${item.UPG_NO6}</td>
<td>${item.UPG_NO7}</td>
<td>${item.UPG_NO8}</td>
<td>${item.UPG_NO9}</td>
</c:if>
<%-- <c:forEach var="item1" items="${productList}" varStatus="varStatus">
<c:set var="UPG_NO" value="UPG_NO${varStatus.count}" />
<td>${requestScope[UPG_NO]}</td>
</c:forEach> --%>
</tr>
</c:forEach>
</c:otherwise>
</c:choose>
</table>
</div>
</div>
<%-- <div class="pdm_page">
<input type="hidden" name="page" id="page" value="${nPage}">
<c:if test="${!empty LIST}">
<div class="page_pro">
<table align="center">
<tr>
<c:choose>
<c:when test="${nPage > 1}">
<td><a href="javascript:fnc_goPrev('${prevPage}');">prev</a></td>
<td>&nbsp;&nbsp;&nbsp;</td>
</c:when>
<c:otherwise>
<td class="no_more_page">prev</td>
<td>&nbsp;&nbsp;&nbsp;</td>
</c:otherwise>
</c:choose>
<c:forEach var="v" begin="${nPage>5?nPage-5:1}" end="${nPage>5?nPage+4:10}" step="1" varStatus="status">
<c:if test="${status.index -1 < maxPage}">
<c:choose>
<c:when test="${status.index eq nPage}">
<td><a href="#" class="now_page">${nPage}</a></td>
<td>&nbsp;&nbsp;&nbsp;</td>
</c:when>
<c:otherwise>
<td><a href="javascript:fnc_goPage('${status.index}');">${status.index}</a></td>
<td>&nbsp;&nbsp;&nbsp;</td>
</c:otherwise>
</c:choose>
</c:if>
</c:forEach>
<c:choose>
<c:when test="${nPage < maxPage}">
<td><a href="javascript:fnc_goNext('${nextPage}');">next</a></td>
</c:when>
<c:otherwise>
<td class="no_more_page">next</td>
</c:otherwise>
</c:choose>
</tr>
</table>
<c:if test="${!empty LIST}">
<p id="adminPageCount">총 ${totalCount}건</p>
</c:if>
</div>
</c:if>
</div> --%>
</section>
</div>
</div>
</form>
</body>
</html>