CommGongCodeList.jsp 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <%@ page contentType="text/html; charset=utf-8" %>
  2. <%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
  3. <%@ page import="com.udapsoft.waf.common.ui.*" %>
  4. <%@ page import="kr.co.hsnc.common.util.*"%>
  5. <%@ page import="kr.co.hsnc.common.sql.*" %>
  6. <%@ include file="/jsp/work/taglib.jsp" %>
  7. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  8. <%
  9. ctx.init(request, response);
  10. ValueObject user = ctx.getUser();
  11. String USER_ID = user.get("USER_ID");
  12. HandlerStorage storage = ctx.getHandlerStorage();
  13. ValueObject params = storage.getParams();
  14. String systemSelectTag = (String) storage.getObject("SystemSelectTag");
  15. String depth = (String) params.get("depth");
  16. String item_cd = (String) params.get("item_cd");
  17. String item_name = (String) storage.getObject("ITEM_NAME");
  18. %>
  19. <script type="text/javascript">
  20. /*예약함수*/
  21. var sheet1 = new ibsheetObject();
  22. var sheet1Row;
  23. var sheet1PageNo = 1;
  24. var pageLastRowIndex = 1;
  25. var validationResult = false;
  26. var filterShow = false;
  27. $(function(){
  28. $.gridInit = function(sheetName)
  29. {
  30. var init_sheet = {};
  31. init_sheet.Cfg = {SearchMode:2, Page:30, MergeSheet:msHeaderOnly};
  32. init_sheet.Cols = [
  33. {Header:"Status", Type:"Status", SaveName:"STATUS", Width:0, Align:"Center", Hidden:"True"},
  34. {Header:"삭제", Type:"DelCheck", SaveName:"DEL_CHECK", Width:30, Align:"Center", Hidden:"True"},
  35. {Header:"No.", Type:"Seq", SaveName:"NO", Width:20, Align:"Center"},
  36. {Header:"공종코드", Type:"Text", SaveName:"ITEM_CD", Width:40, Align:"Center", Edit:"false"},
  37. {Header:"공종명", Type:"Text", SaveName:"ITEM_NAME", Width:140, Align:"Left"},
  38. {Header:"대분류", Type:"Text", SaveName:"KIND_BIG", Width:140, Align:"Left", Hidden:"True"},
  39. {Header:"중분류", Type:"Text", SaveName:"KIND_MID", Width:140, Align:"Left", Hidden:"True"},
  40. {Header:"DEPTH", Type:"Text", SaveName:"DEPTH", Width:140, Align:"Left", Hidden:"True"},
  41. {Header:"PARENT_LEVEL", Type:"Text", SaveName:"PARENT_LEVEL", Width:140, Align:"Left", Hidden:"True"},
  42. ];
  43. init_sheet.HeaderMode = {Sort:1};
  44. IBS_InitSheet(sheetName, init_sheet);
  45. sheetName.SetDataAutoTrim(0);
  46. sheetName.SetEditable(true);
  47. sheetName.FitColWidth();
  48. }
  49. $(document).on("keyup", "input:text", function(e) {
  50. if (e.keyCode == 13)
  51. {
  52. $.searchList();
  53. }
  54. });
  55. $.searchList = function()
  56. {
  57. $("#fevent").val("GET_CODE_LIST");
  58. var url = Modular.model.PageContext.CONTEXT_ROOT + "/common/CommGongCodeList_sheet.screen";
  59. Modular.view.IBSheet7.doSearch(sheet1, url, $("#form1"), 30, "");
  60. }
  61. $("#btn_search").click(function(){
  62. $.searchList();
  63. });
  64. $("#btn_add").click(function(){
  65. var depth = "<%=depth%>";
  66. var item_cd = "";
  67. var item_cd1 = "";
  68. var seq = "";
  69. if(depth == "2")
  70. {
  71. if (sheet1.SearchRows() == 0 && (sheet1.RowCount("I") == 0))
  72. {
  73. sheet1.SetDataAutoTrim(0);
  74. var rowIndex = sheet1.DataInsert(-1);
  75. item_cd = "<%=item_cd%>";
  76. sheet1.SetCellValue(rowIndex, "ITEM_CD", item_cd + leadingZeros("01",2));
  77. sheet1.SetCellValue(rowIndex, "KIND_BIG", item_cd.substring(0,2));
  78. sheet1.SetCellValue(rowIndex, "KIND_MID", item_cd.substring(0,4));
  79. sheet1.SetCellValue(rowIndex, "DEPTH", '3');
  80. sheet1.SetCellValue(rowIndex, "PARENT_LEVEL", item_cd.substring(0,4));
  81. }
  82. else
  83. {
  84. sheet1.SetDataAutoTrim(0);
  85. var rowIndex = sheet1.DataInsert(-1);
  86. item_cd = sheet1.GetCellValue(rowIndex -1, "ITEM_CD");
  87. item_cd1 = item_cd.substring(0, item_cd.length -2);
  88. seq = Number(item_cd.substring(item_cd.length -2, item_cd.length)) + 1;
  89. sheet1.SetCellValue(rowIndex, "ITEM_CD", item_cd1 + leadingZeros(seq,2));
  90. sheet1.SetCellValue(rowIndex, "KIND_BIG", item_cd.substring(0,2));
  91. sheet1.SetCellValue(rowIndex, "KIND_MID", item_cd.substring(0,4));
  92. sheet1.SetCellValue(rowIndex, "DEPTH", '3');
  93. sheet1.SetCellValue(rowIndex, "PARENT_LEVEL", item_cd.substring(0,4));
  94. }
  95. }else{
  96. alert("소분류를 선택하세요.");
  97. }
  98. });
  99. $("#btn_save").click(function(){
  100. $("#fevent").val("SAVE_CODE_LIST");
  101. var url = Modular.model.PageContext.CONTEXT_ROOT + "/common/CommGongCodeList_sheet.screen";
  102. var result = Modular.view.IBSheet7.doSave(sheet1, url, $("#form1"), false);
  103. });
  104. $("#btn_category_reg").click(function(){
  105. var depth = "<%=depth%>";
  106. var item_cd = "<%=item_cd%>";
  107. var item_name = "<%=item_name%>";
  108. if (depth == "1") //1, 01
  109. {
  110. var win_id = "_categoryReg";
  111. var url = "/common/GongCategoryAddPopup.screen?depth=2"+"&item_cd=" + item_cd+"&pop_win_id="+win_id;
  112. }
  113. else if (depth == "2")
  114. {
  115. alert("상위구분을 선택하고 분류코드를 등록하십시요.");
  116. return ;
  117. }
  118. else{
  119. var win_id = "_categoryReg";
  120. var url = "/common/GongCategoryAddPopup.screen?depth=1"+"&item_cd=" + "&pop_win_id="+win_id;
  121. }
  122. fLayerPop(win_id, url, 550, 120, '', '', 'NO');
  123. });
  124. $("#btn_excel").click(function(){
  125. if(sheet1.RowCount() == 0) {
  126. alert("내역이 없습니다.");
  127. return;
  128. }
  129. var params = { FileName : "CommGongCodeList.xls", SheetName : "CommGongCodeList", SheetDesign:0, Merge:1, DownCols:"2|3|4|5", TitleText:"외주공종코드", UserMerge:"0,0,1,3", AutoSizeColumn:1 };
  130. sheet1.Down2Excel(params);
  131. });
  132. });
  133. function doResult(resultObj) {
  134. try {
  135. }
  136. catch(errorObject) {
  137. showErrorDlg("doResult()", errorObject);
  138. }
  139. }
  140. $(document).ready(function(){
  141. $.gridInit(sheet1);
  142. $.searchList();
  143. autoResize();
  144. });
  145. function autoResize(){
  146. var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title").scrollHeight + 24;
  147. var iframeHeight= document.body.scrollHeight - t1_height;
  148. var iframeWidth= document.body.scrollWidth;
  149. sheet1.SetSheetHeight(iframeHeight);
  150. }
  151. function leadingZeros(n, digits) {
  152. var zero = '';
  153. n = n.toString();
  154. if (n.length < digits) {
  155. for (var i = 0; i < digits - n.length; i++)
  156. zero += '0';
  157. }
  158. return zero + n;
  159. }
  160. function sheet1_OnSearchEnd(code, message)
  161. {
  162. sheet1.FitColWidth();
  163. }
  164. function sheet1_OnSaveEnd(code, msg)
  165. {
  166. var event = $("#fevent").val();
  167. var f = document.form1;
  168. document.form1.isSubmit = false;
  169. try {
  170. if(event == "SAVE_CODE_LIST")
  171. {
  172. if(code >= "0")
  173. {
  174. alert("저장되었습니다.");
  175. }
  176. else
  177. {
  178. alert(msg);
  179. }
  180. }
  181. }
  182. catch(errorObject) {
  183. showErrorDlg("doResult()", errorObject);
  184. }
  185. }
  186. </script>
  187. <modular:search id="form1">
  188. <modular:key id="fevent" />
  189. </modular:search>
  190. <form id="form1" name="form1" method="post" modular:type="search">
  191. <input type="hidden" name="fevent" id="fevent" value="">
  192. <input type="hidden" name="USER_ID" value="<%=USER_ID%>"/>
  193. <input type="hidden" name="depth" value = "<%=depth %>" />
  194. <input type="hidden" name="item_cd" value = "<%=item_cd %>" />
  195. <input type="hidden" name="item_name" value = "<%=item_name %>" />
  196. <div align="left" id="title">
  197. <ul>
  198. <li>외주공종코드</li>
  199. </ul>
  200. </div>
  201. <table border="0" cellspacing="0" cellpadding="0" width="98%" id="search-table">
  202. <!-- 검색조건 영역 : 시작 -->
  203. <tr>
  204. <td height="1">
  205. <table cellspacing="1" cellpadding="0" class="search-form-table">
  206. <col width="10%">
  207. <col width="30%">
  208. <col width="60%">
  209. <tr height="25">
  210. <!-- 검색조건 타이틀 1 -->
  211. <th>
  212. 공종코드/명
  213. </th>
  214. <td>
  215. <input type='text' name="pgm_name2" class="input" style="width:90%" />
  216. </td>
  217. <td rowspan="2" class="search_button" align="right">
  218. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_search">검색</a></span>
  219. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_add">추가</a></span>
  220. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_save">저장</a></span>
  221. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_category_reg">분류코드</a></span>
  222. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_excel">엑셀다운</a></span>
  223. </td>
  224. </tr>
  225. </table>
  226. </td>
  227. </tr>
  228. <!-- 검색조건 영역 : 종료 -->
  229. <!-- 검색조건 영역, 테이터 영역 구분 여백 : 시작 -->
  230. <tr>
  231. <td height="1">
  232. </td>
  233. </tr>
  234. <!-- 검색조건 영역, 테이터 영역 구분 여백 : 종료 -->
  235. </table>
  236. <div id="sheet1_div" style="padding-top:5px; width:98%; height: 500px">
  237. <script>createIBSheet("sheet1","100%", "100%");</script>
  238. </div>
  239. </form>