ERP-node/WebContent/WEB-INF/view/project/partMaster/addPartSearchPopUpLeft.jsp

160 lines
5.2 KiB
Plaintext

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.pms.common.utils.*"%>
<%@ page import="java.util.*" %>
<%@include file= "/init.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
</head>
<script>
$(document).ready(function(){
fn_getConnectedPartList();
$("#allChk").click(function(){
if($(this).prop("checked")){
$("input[name=connectedPartCheckBox]").prop("checked", true);
}else{
$("input[name=connectedPartCheckBox]").prop("checked", false);
}
});
});
</script>
<script>
//Part Master에 연결된 Part 목록을 가져온다.
function fn_getConnectedPartList(){
$.ajax({
url:"/project/partMaster/getPartMasterConnectedPartList.do",
type:"POST",
data:{"objId":$("#objId").val()},
dataType:"json",
async:false,
success:function(data){
$("#connectedPartList").empty();
if(0 < data.length){
for(var i=0;i<data.length;i++){
var attachText = "<tr>";
attachText+= " <td><input type='checkbox' value='"+data[i].PART_NO+"' name='connectedPartCheckBox' class='chk'></td>";
attachText+= " <td>"+data[i].RNUM+"</td>";
attachText+= " <td title='"+data[i].PART_NO+"'><a href='#' onclick=\"fnc_openPartDetailPopup('${connectUserId}','"+data[i].PART_NO+"');\">"+data[i].PART_NO+"</a></td>";
attachText+= " <td title='"+data[i].CONNECT_PART_NAME+"'><a href='#' onclick=\"fnc_openPartDetailPopup('${connectUserId}','"+data[i].PART_NO+"');\">"+data[i].CONNECT_PART_NAME+"</a></td>";
attachText+= " <td><input type='text' name='connectedPartSeq_"+data[i].PART_NO+"' value='"+fnc_checkNull(data[i].SEQ)+"' style='width:100%' required reqTitle='Seq'></td>";
attachText+= " <input type='hidden' name='connectedPartPartNo' value='"+data[i].PART_NO+"'>";
attachText+= "</tr>";
$("#connectedPartList").append(attachText);
}
}else{
var attachText = "<tr style='text-align:center;'>";
attachText+= " <td align='center' colspan='5'>연결된 데이터가 없습니다.</td>";
attachText+= "<tr>";
$("#connectedPartList").append(attachText);
}
},
error: function(jqxhr, status, error){
}
});
}
//선택된 Part를 Part Master와 연결한다.
function fn_disConnectPart(){
var checkBoxLength = $("input:checkbox[name='connectedPartCheckBox']:checked").length;
if(0 == checkBoxLength){
Swal.fire("선택된 Part가 없습니다.");
return false;
}else{
var partForm = $("#form1").serialize();
$.ajax({
url:"/project/partMaster/partMasterDisConnectPart.do",
type:"POST",
data:partForm,
dataType:"json",
async:false,
success:function(data){
if(!data.result){
Swal.fire("오류가 발생하였습니다.");
}else{
Swal.fire("삭제되었습니다.");
fn_getConnectedPartList();
$("#allChk").prop("checked", false);
}
},
error: function(jqxhr, status, error){
}
});
}
}
//연결된 Part의 seq를 저장한다.
function fn_saveConnectedPartInfo(){
var partForm = $("#form1").serialize();
if(fnc_valitate("form1")){
if(confirm("저장하시겠습니까?")){
$.ajax({
url:"/project/partMaster/saveConnectPartInfo.do",
type:"POST",
data:partForm,
dataType:"json",
async:false,
success:function(data){
if(!data.result){
Swal.fire("오류가 발생하였습니다.");
}else{
Swal.fire("저장되었습니다.");
fn_getConnectedPartList();
top.close();
}
},
error: function(jqxhr, status, error){
}
});
}
}
}
</script>
<body>
<form name="form1" id="form1" action="" method="post">
<input type="hidden" name="objId" id="objId" value="${param.objId}">
<div class="plm_table_wrap" style="width:94%; margin: 0 auto;">
<div id="" style="padding-top:92px; font-size:13px;">${partMasterMap.OEM_NAME}-${partMasterMap.CAR_NAME}-${partMasterMap.PRODUCT_GROUP_NAME}-${partMasterMap.PRODUCT_NAME} </div>
<div id="" style=".font-size:13px;"></div>
<div style="overflow-y:scroll;">
<table class="plm_table">
<colgroup>
<col width="5%" />
<col width="5%" />
<col width="18%" />
<col width="*" />
<col width="10%" />
</colgroup>
<thead>
<tr class="plm_thead">
<td><input type="checkbox" name="allChk" id="allChk"></td>
<td>No</td>
<td>Part No.</td>
<td>Part Name</td>
<td>SEQ</td>
</tr>
</thead>
</table>
</div>
<div class="plm_scroll_table" style="width:100%; height:555px;">
<table class="plm_table">
<colgroup>
<col width="5%"/>
<col width="5%"/>
<col width="18%"/>
<col width="*"/>
<col width="10%"/>
</colgroup>
<tbody id="connectedPartList"></tbody>
</table>
</div>
</div>
</form>
</body>
</html>