368 lines
11 KiB
Plaintext
368 lines
11 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_jqGrid.jsp"%>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<title><%=Constants.SYSTEM_NAME%></title>
|
|
<script>
|
|
$(document).ready(function(){
|
|
$("#templateDownload").click(function(){
|
|
location.href="/template/WBS_EXCEL_IMPORT_TEMPLATE.xlsx";
|
|
});
|
|
|
|
$("#product1").prop("disabled","disabled");
|
|
|
|
fnc_datepick();
|
|
|
|
fnc_setFileDropZone(
|
|
"excelImportDropZone",
|
|
"${OBJID}",
|
|
"WBS_EXCEL_IMPORT",
|
|
"WBS Excel Import Template",
|
|
"setExcelFileArea",
|
|
true,
|
|
"fileUploadPreProc",
|
|
"/project/excelImportFileProc.do",
|
|
null
|
|
);
|
|
|
|
//fnc_getOEMList("OEM_OBJID","");
|
|
|
|
//Excel File Upload된 파일 목록 부분을 초기화 한다.
|
|
$("#excelImportList").hide();
|
|
});
|
|
|
|
//Excel 파일 업로드 후 처리함수
|
|
function setExcelFileArea(){
|
|
setUploadTemplateFile();
|
|
}
|
|
|
|
//템플릿 업로드 후 처리
|
|
function setUploadTemplateFile(){
|
|
var docType = "WBS_EXCEL_IMPORT";
|
|
var deleteCallBackFN = "excelFileDelete";
|
|
|
|
$.ajax({
|
|
url:"/common/getFileList.do",
|
|
type:"POST",
|
|
data:{"targetObjId":"${OBJID}", "docType":docType},
|
|
dataType:"json",
|
|
async:false,
|
|
success:function(data){
|
|
|
|
$.each(data, function(i){
|
|
var s = "<tr>";
|
|
s += "<td><a href='javascript:fnc_downloadFile(\""+data[i].OBJID+"\")'>"+data[i].REAL_FILE_NAME+"</a></td>";
|
|
s += "<td>"+data[i].FILE_SIZE+"</td>";
|
|
s += "<td><div class='delete_btn' onclick='javascript:fnc_deleteFile(\""+data[i].OBJID+"\", \""+deleteCallBackFN+"\")'></div></td>";
|
|
s += "</tr>";
|
|
$("#excelImportArea").append(s);
|
|
});
|
|
//$("#excelImportList").show();
|
|
|
|
parsingExcelFile();
|
|
},
|
|
error: function(jqxhr, status, error){
|
|
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
|
|
Swal.fire(jqxhr.status);
|
|
Swal.fire(jqxhr.responseText);
|
|
}
|
|
});
|
|
}
|
|
|
|
function excelFileDelete(){
|
|
$("#excelImportArea").empty();
|
|
$("#excelImportList").hide();
|
|
$("#wbsTaskList").empty();
|
|
}
|
|
|
|
function parsingExcelFile(){
|
|
$("#wbsTaskList").empty();
|
|
|
|
var appendText = "";
|
|
$.ajax({
|
|
url:"/project/parsingExcelFile.do",
|
|
type:"POST",
|
|
data:{"targetObjId":"${OBJID}", "docType":"WBS_EXCEL_IMPORT"},
|
|
dataType:"json",
|
|
async:false,
|
|
success:function(data){
|
|
if(0 < data.length){
|
|
var resultList = data;
|
|
if(0 < resultList.length){
|
|
for (var i = 0; i < resultList.length; i++) {
|
|
|
|
var WBS_OBJID = resultList[i].WBS_OBJID;
|
|
/* var STEP = resultList[i].STEP;
|
|
var TASK1 = resultList[i].TASK1; */
|
|
var TASK_NAME = resultList[i].TASK_NAME;
|
|
//var USER_ID = resultList[i].USER_ID;
|
|
var UNIT_NO = resultList[i].UNIT_NO;
|
|
|
|
appendText += " <tr>";
|
|
appendText += " <input type='hidden' name='WBS_TASK_OBJID' value='"+WBS_OBJID+"'>";
|
|
//appendText += " <input type='hidden' name='TASK_CHARGER_ID_CODE_"+WBS_OBJID+"' id='TASK_CHARGER_ID_CODE_"+WBS_OBJID+"' value='"+USER_ID+"'>";
|
|
/* appendText += " <td>";
|
|
appendText += " <input type='text' name='STEP_"+WBS_OBJID+"' id='STEP_"+WBS_OBJID+"' value='"+STEP+"'>";
|
|
appendText += " </td>";
|
|
appendText += " <td>";
|
|
appendText += " <input type='text' name='TASK1_NAME_"+WBS_OBJID+"' id='TASK1_NAME_"+WBS_OBJID+"' value='"+TASK1+"'>";
|
|
appendText += " </td>"; */
|
|
appendText += " <td>";
|
|
appendText += " <input type='text' name='TASK_NAME_"+WBS_OBJID+"' id='TASK_NAME_"+WBS_OBJID+"' value='"+TASK_NAME+"'>";
|
|
appendText += " </td>";
|
|
appendText += " <td>";
|
|
appendText += " <input type='text' name='UNIT_NO_"+WBS_OBJID+"' id='UNIT_NO_"+WBS_OBJID+"' value='"+UNIT_NO+"'>";
|
|
/* appendText += " <select name='TASK_CHARGER_ID_"+WBS_OBJID+"' id='TASK_CHARGER_ID_"+WBS_OBJID+"'></select>"; */
|
|
appendText += " </td>";
|
|
appendText += " </tr>";
|
|
}
|
|
}else{
|
|
appendText += " <tr>";
|
|
appendText += " <td colspan='4'>조회된 내용이 없습니다.</td>";
|
|
appendText += " </tr>";
|
|
}
|
|
}
|
|
},
|
|
error: function(jqxhr, status, error){
|
|
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
|
|
Swal.fire(jqxhr.status);
|
|
Swal.fire(jqxhr.responseText);
|
|
}
|
|
});
|
|
|
|
$("#wbsTaskList").append(appendText);
|
|
|
|
fn_setSelectData();
|
|
|
|
}
|
|
|
|
/*
|
|
저장 전 개정중인 정보의 존재여부를 확인한다.
|
|
*/
|
|
function fn_checkWBSTemplateRevision(){
|
|
var resultFlag = true;
|
|
|
|
$.ajax({
|
|
type:"POST",
|
|
url : "/project/checkWBSTemplateProduct.do",
|
|
data : {"PRODUCT":fnc_checkNull($("#product").val()),"TITLE":fnc_checkNull($("#title").val())},
|
|
dataType:"json",
|
|
async:false,
|
|
error: function(jqxhr, status, error){
|
|
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
|
|
Swal.fire(jqxhr.status);
|
|
Swal.fire(jqxhr.responseText);
|
|
},
|
|
success:function(data){
|
|
if(0 < data.length){
|
|
resultFlag = false;
|
|
}
|
|
}
|
|
});
|
|
|
|
return resultFlag;
|
|
}
|
|
|
|
function saveWBS(){
|
|
var formData = $("#form1").serialize();
|
|
if( $("#title").val()==""){
|
|
Swal.fire('기계형식을 입력해 주세요');
|
|
return;
|
|
}
|
|
if( $("#customer_product").val()==""){
|
|
Swal.fire('고객사_장비목적 입력해 주세요');
|
|
return;
|
|
}
|
|
|
|
if(fn_checkWBSTemplateRevision()){
|
|
if(0 < $("input[name='WBS_TASK_OBJID']").length){
|
|
if(confirm("해당 WBS 정보를 저장하시겠습니까?")){
|
|
$.ajax({
|
|
type:"POST",
|
|
url : "/project/saveExcelUploadWBS.do",
|
|
data : $("#form1").serialize(),
|
|
dataType:"json",
|
|
async:false,
|
|
error: function(jqxhr, status, error){
|
|
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
|
|
Swal.fire(jqxhr.status);
|
|
Swal.fire(jqxhr.responseText);
|
|
},
|
|
success: function(result){
|
|
if(null != result){
|
|
Swal.fire(result.message);
|
|
opener.fn_search();
|
|
self.close();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}else{
|
|
Swal.fire("저장할 정보가 없습니다.");
|
|
}
|
|
}else{
|
|
Swal.fire("이미 해당 기계형식으로 등록된 정보가 존재합니다.");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
//파일을 삭제한다.
|
|
//Excel 파일 삭제 시 파트 첨부파일도 모두 삭제한다.
|
|
function fileUploadPreProc(){
|
|
var templateTitle = fnc_checkNull($("#title").val());
|
|
preFileDelete();
|
|
}
|
|
|
|
//파일을 삭제한다.
|
|
//Excel 파일 삭제 시 파트 첨부파일도 모두 삭제한다.
|
|
function preFileDelete(){
|
|
if(confirm("파일을 업로드하시겠습니까?\n기존에 업로드된 파일은 삭제됩니다.")){
|
|
$.ajax({
|
|
url:"/common/deleteFileInfo.do",
|
|
type:"POST",
|
|
data:{"targetObjId":"${OBJID}"},
|
|
dataType:"json",
|
|
async:true,
|
|
success:function(data){
|
|
excelFileDelete();
|
|
},
|
|
error: function(jqxhr, status, error){
|
|
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
|
|
Swal.fire(jqxhr.status);
|
|
Swal.fire(jqxhr.responseText);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
//파일을 삭제한다.
|
|
//Excel 파일 삭제 시 파트 첨부파일도 모두 삭제한다.
|
|
function fileDelete(){
|
|
if(confirm("Excel 파일을 변경하시겠습니까?.")){
|
|
$.ajax({
|
|
url:"/common/deleteFileInfo.do",
|
|
type:"POST",
|
|
data:{"targetObjId":"${OBJID}"},
|
|
dataType:"json",
|
|
async:true,
|
|
success:function(data){
|
|
excelFileDelete();
|
|
},
|
|
error: function(jqxhr, status, error){
|
|
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
|
|
Swal.fire(jqxhr.status);
|
|
Swal.fire(jqxhr.responseText);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function fn_setSelectData(){
|
|
$("input[name='WBS_TASK_OBJID']").each(function(i){
|
|
var targetVal = $(this).val();
|
|
var userSelectId = "TASK_CHARGER_ID_"+targetVal;
|
|
var userSelectedVal = $("#TASK_CHARGER_ID_CODE_"+targetVal).val();
|
|
fnc_getUserList2(userSelectId, userSelectedVal);
|
|
});
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<form name="form1" id="form1" action="" method="post">
|
|
<input type="hidden" name="importPopObjid" id="importPopObjid" value="${OBJID}">
|
|
<input type="hidden" name="product" id="product" value="${param.product}">
|
|
|
|
|
|
|
|
<div class="content-box">
|
|
<div class="content-box-s">
|
|
<div class="plm_menu_name">
|
|
<h2>
|
|
<span>WBS Excel Upload</span>
|
|
</h2>
|
|
</div>
|
|
<div id="plmSearchZon" style="width:auto;">
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<td class="align_r">
|
|
<label for="" class="">제품구분</label>
|
|
</td>
|
|
<td>
|
|
<select name="product1" id="product1" style="" class="select2" autocomplete="off">
|
|
<option value="">선택</option>
|
|
${code_map.product_cd}
|
|
</select>
|
|
</td>
|
|
<td class="align_r">
|
|
<label for="title" class="">기계형식</label>
|
|
</td>
|
|
<td>
|
|
<input id="title" name="title" type="text" value="">
|
|
</td>
|
|
|
|
<td class="align_r">
|
|
<label for="customer_product" class="">고객사_장비목적</label>
|
|
</td>
|
|
<td>
|
|
<input id="customer_product" name="customer_product" type="text" value="">
|
|
</td>
|
|
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<section class="contents_page_basic_margin">
|
|
<div class="btn_wrap">
|
|
<div class="plm_btn_wrap">
|
|
<input type="button" value="Template Download" id="templateDownload" class="plm_btns">
|
|
<input type="button" value="저장" class="plm_btns" onclick="saveWBS();">
|
|
<input type="button" value="닫기" id="btn_close" class="plm_btns" onclick="javascript:self.close();">
|
|
</div>
|
|
</div>
|
|
<div id="excelImportDropZone" class="dropzone" style="height:50px;">Drag & Drop 엑셀 템플릿</div>
|
|
<div id="excelImportList">
|
|
<table id="excelImportTable" class="excelUploadPopupForm">
|
|
<thead>
|
|
<tr><td colspan="3">Excel 첨부파일</td></tr>
|
|
</thead>
|
|
<tbody id="excelImportArea">
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="in_table_scroll_wrap _table1" style="height:26px;width:99.2%;">
|
|
<table class="plm_table">
|
|
<colgroup>
|
|
<col width="70%" /><!-- 단계 -->
|
|
<col width="30%" /><!-- TASK명 -->
|
|
</colgroup>
|
|
<thead>
|
|
<tr class="plm_thead">
|
|
<td>UNIT Name</td>
|
|
<td>UNIT No</td>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="in_table_scroll_wrap _table2" style="height:560px;width:100%;">
|
|
<table class="pmsPopupForm" style="margin:0px;">
|
|
<colgroup>
|
|
<col width="70%" /><!-- 단계 -->
|
|
<col width="30%" /><!-- TASK명 -->
|
|
</colgroup>
|
|
<tbody id="wbsTaskList"></tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</body>
|
|
</html> |