Files
wace_plm/WebContent/WEB-INF/view/partMng/structurePopupRight.jsp
2025-11-24 15:07:34 +09:00

322 lines
7.6 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>
<link href="/css/tabulator/tabulator.min.css" rel="stylesheet">
<script type="text/javascript" src="/js/tabulator/tabulator.min.js"></script>
<style>
::-webkit-scrollbar {
width: 10px;
}
#structureTableWrap2 .structure_btn {
top: 25px;
}
/* Tabulator 커스텀 스타일 */
.tabulator {
border: 1px solid #ddd;
}
.tabulator .tabulator-header {
background-color: #f0f0f0;
border-bottom: 2px solid #ddd;
}
.tabulator .tabulator-header .tabulator-col {
background-color: #f0f0f0;
border-right: 1px solid #ddd;
}
.tabulator .tabulator-tableHolder .tabulator-table {
background-color: #fff;
}
.tabulator .tabulator-row {
border-bottom: 1px solid #eee;
}
.tabulator .tabulator-row:hover {
background-color: #f5f5f5;
}
.tabulator .tabulator-cell {
padding: 8px;
border-right: 1px solid #eee;
}
</style>
<script>
$(function(){
//저장
$("#btnSave").click(function(){
Swal.fire("save");
});
//end of 저장
//닫기
$("#btnClose").click(function(){
top.opener.window.location.reload();
top.self.close(0);
});
//end of 닫기
//고객사 변경시 차종 조회
$("#search_product_mgmt_objid").change(function(){
fnc_productUPGNEWList(this.value,"","search_product_mgmt_upg", "");
});
//파트넘버 엔터키 event
$("#search_part_no").keyup(function(e){
if(e.keyCode == 13){
$("#btnSearch").trigger("click");
}
});
//end of 파트넘버 엔터키 event
//파트명 엔터키 event
$("#search_part_name").keyup(function(e){
if(e.keyCode == 13){
$("#btnSearch").trigger("click");
}
});
//end of 파트명 엔터키 event
//파트조회
$("#btnSearch").click(function(){
fn_searchPart();
});
//end of 파트조회
//전체선택
$("#allChk").click(function(){
var isChecked = $(this).prop("checked");
if(isChecked){
$(".partChks").prop("checked", true);
}else{
$(".partChks").prop("checked", false);
}
});
fnc_getProductMgmtList("search_product_mgmt_objid","");
fnc_productUPGNEWList("","${resultMap.PRODUCT_MGMT_SPEC}","search_product_mgmt_upg", "");
$('.select2').select2();
// Tabulator 초기화
fn_initRightGrid();
// 초기 로드 제거 - 검색 버튼 클릭 시에만 데이터 로드
// 사용자가 검색 조건 입력 후 조회하도록 유도
});
var _rightGrid;
function fn_initRightGrid(){
var columns = [
{
formatter: "rowSelection",
titleFormatter: "rowSelection",
headerHozAlign: 'center',
hozAlign: 'center',
width: 50,
headerSort: false,
cellClick: function(e, cell){
e.stopPropagation();
}
},
{
headerHozAlign: 'center',
hozAlign: 'left',
width: 150,
title: '품번',
field: 'PART_NO',
formatter: function(cell) {
var rowData = cell.getData();
return '<a href="#" onclick="openPartMngPopup(\'' + rowData.OBJID + '\');">' + rowData.PART_NO + '</a>';
}
},
{
headerHozAlign: 'center',
hozAlign: 'left',
width: 180,
title: '품명',
field: 'PART_NAME'
},
{
headerHozAlign: 'center',
hozAlign: 'left',
width: 200,
title: '규격',
field: 'SPEC'
},
{
headerHozAlign: 'center',
hozAlign: 'left',
width: 120,
title: '메이커',
field: 'MAKER'
}
];
_rightGrid = new Tabulator("#rightPartGrid", {
layout: "fitColumns",
height: "600px",
pagination: false,
columns: columns,
placeholder: "검색 버튼을 클릭하여 품목을 조회하세요",
selectable: true, // 다중 선택 가능
selectableRangeMode: "click" // 클릭으로 선택
});
}
function fn_searchPart(){
// 전체 품목 데이터 조회 (검색 조건 적용)
$.ajax({
url: "/partMng/getPartMngList_ajax.do",
type: "POST",
data: $("#form1").serialize(),
dataType: "json",
beforeSend: function(){
// 로딩 스피너 표시
Swal.fire({
title: '조회 중...',
html: '품목 데이터를 불러오는 중입니다.',
allowOutsideClick: false,
didOpen: () => {
Swal.showLoading();
}
});
if(_rightGrid){
_rightGrid.clearData();
}
},
success: function(response) {
// 로딩 스피너 닫기
Swal.close();
console.log('조회 완료:', response.data ? response.data.length + '건' : '0건');
// Tabulator에 데이터 설정
if(_rightGrid){
_rightGrid.setData(response.data || []);
}
// 결과 메시지
if(!response.data || response.data.length === 0){
Swal.fire({
icon: 'info',
title: '조회 결과 없음',
text: '검색 조건에 맞는 품목이 없습니다.'
});
} else {
// 성공 토스트 메시지
Swal.fire({
toast: true,
position: 'top-end',
icon: 'success',
title: response.data.length + '건 조회 완료',
showConfirmButton: false,
timer: 2000
});
}
},
error: function(jqxhr, status, error){
// 로딩 스피너 닫기
Swal.close();
Swal.fire({
icon: 'error',
title: '조회 실패',
text: '데이터 조회 중 오류가 발생했습니다.'
});
console.error(error);
}
});
}
/**
* 파트 상세 공용(View 전용)
*/
function openPartMngPopup(objId){
var hiddenForm = document.hiddenForm;
var url = "/partMng/partMngDetailPopUp.do";
if("" == objId){
Swal.fire("올바르지 않은 접근입니다.");
}
var target = "partMngPopUp";
window.open(url,target,"width=600, height=730, menubars=no, scrollbars=yes, resizable=yes");
hiddenForm.action = url;
hiddenForm.OBJID.value = objId;
hiddenForm.ACTION_TYPE.value = "view";
hiddenForm.target = target;
hiddenForm.submit();
}
// 선택된 행 데이터 반환 (Center 프레임에서 호출)
function getSelectedRows() {
if(!_rightGrid) return [];
return _rightGrid.getSelectedRows();
}
// 선택 해제 함수
function clearSelection() {
if(_rightGrid) {
_rightGrid.deselectRow();
}
}
</script>
</head>
<body class="backcolor">
<form name="hiddenForm" id="hiddenForm" method="post">
<input type="hidden" name="OBJID" id="OBJID">
<input type="hidden" name="ACTION_TYPE" id="ACTION_TYPE">
</form>
<form name="form1" id="form1" action="" method="post">
<input type="hidden" name="bomReportObjId" id="bomReportObjId" value="${param.objId}">
<input type="hidden" name="is_last" id="is_last" value="1">
<input type="hidden" name="searchTargetStatus" id="searchTargetStatus" value="${info.STATUS}">
<div id="structureName2"></div>
<div id="structureTableWrap2" style="">
<!-- 검색 필터 영역 -->
<div id="plmSearchZon">
<table>
<tr>
<td><label for="search_part_no">품번</label></td>
<td>
<input type="text" name="search_part_no" id="search_part_no" value="">
</td>
<td class="label"><label for="search_part_name">품명</label></td>
<td>
<input type="text" name="search_part_name" id="search_part_name" value="">
</td>
</tr>
<tr>
<td><label for="search_spec">규격</label></td>
<td>
<input type="text" name="search_spec" id="search_spec" value="">
</td>
<td class="label"><label for="search_maker">메이커</label></td>
<td>
<input type="text" name="search_maker" id="search_maker" value="">
</td>
<td>
<input type="button" value="조회" class="plm_btns" id="btnSearch">
</td>
</tr>
</table>
</div>
<div class="plm_table_wrap">
<div id="rightPartGrid"></div>
</div>
</div>
</form>
</body>
</html>