CommCodeDescList.jsp 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <%--
  2. - FileName : CommCodeDescList.jsp
  3. - Author : gyeongmo an
  4. - Date : 2014.08.01
  5. - Copyright : Copyright (c) 2014 www.udapsoft.co.kr, Inc.
  6. - All rights reserved.
  7. - Description: 기준코드 등록
  8. --%>
  9. <%@ page contentType="text/html; charset=utf-8" %>
  10. <%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
  11. <%@ page import="com.udapsoft.waf.common.ui.*" %>
  12. <%@ page import="kr.co.udapsoft.common.code.*" %>
  13. <%@ page import="kr.co.hsnc.common.util.*"%>
  14. <%@ page import="kr.co.hsnc.common.sql.*" %>
  15. <%@ include file="/jsp/work/taglib.jsp" %>
  16. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  17. <%
  18. ctx.init(request, response);
  19. HandlerStorage storage = ctx.getHandlerStorage();
  20. ValueObject params = storage.getParams();
  21. ValueObject user = storage.getUser();
  22. String fevent = storage.getEvent();
  23. %>
  24. <SCRIPT language="JavaScript" src="/js/menu.js"></SCRIPT>
  25. <SCRIPT language="JavaScript">
  26. /*예약함수*/
  27. var sheet1;
  28. var sheet1Row;
  29. var sheet1PageNo = 1;
  30. var pageLastRowIndex = 1;
  31. var validationResult = false;
  32. var filterShow = false;
  33. function _onReady(){
  34. gridInit(sheet1);
  35. jQuery("#btnSave").click(function() {
  36. if(confirm("저장하시겠습니까?")) {
  37. for(var i=sheet1.LastRow(); i>=1; i--) {
  38. if(sheet1.GetCellValue(i, "STATUS2") == "D") {
  39. sheet1.SetCellValue(i, "STATUS", "D");
  40. }
  41. }
  42. jQuery("#fevent").val("SAVE_DESC");
  43. var url = Modular.model.PageContext.CONTEXT_ROOT + "/sycs/code/CommCodeDescList_sheet.screen";
  44. var result = Modular.view.IBSheet7.doSave(sheet1, url, jQuery("#form1"), false);
  45. }
  46. });
  47. jQuery("#btnClose").click(function() {
  48. setTimeout(function(){
  49. parent.searchCommCodeDescList();
  50. },100);
  51. });
  52. doSearch();
  53. }
  54. function searchCommCodeDescList(){
  55. fLayerPopClose('_searchCommCodeDescList');
  56. }
  57. function gridInit(sheetName){
  58. var init_sheet = {};
  59. init_sheet.Cfg = {SearchMode:2, Page:10};
  60. init_sheet.Cols = [
  61. {Header:'삭제', Type:"CheckBox", SaveName:"DEL_CHECK", Width:45, Align:"Center"},
  62. {Header:'순번', Type:"Seq", SaveName:"NO", Width:25, Align:"Center"},
  63. {Header:'상태', Type:"Status", SaveName:"STATUS", Width:0, Align:"Center", Hidden:"True"},
  64. {Header:'상태2', Type:"Text", SaveName:"STATUS2", Width:0, Align:"Center", Hidden:"True"},
  65. {Header:'테이블명', Type:"Text", SaveName:"TABLE_NM", Width:150, Align:"Left", Hidden:"True", EditLen:50},
  66. {Header:'기준코드', Type:"Text", SaveName:"BASE_CD", Width:150, Align:"Left", Hidden:"True", EditLen:50},
  67. {Header:'컬럼영문명', Type:"Text", SaveName:"COL_ENG", Width:100, Align:"Center", EditLen:50, Edit:"false"},
  68. {Header:'컬럼설명', Type:"Text", SaveName:"COL_KOR", Width:100, Align:"Center", EditLen:100},
  69. {Header:'', Type:"Text", SaveName:"CODE_ID", Width:80, Align:"Left", Hidden:"True"},
  70. {Header:'', Type:"Text", SaveName:"CRE_DATE", Width:80, Align:"Left", Hidden:"True"},
  71. {Header:'ID', Type:"Text", SaveName:"CRE_BY", Width:80, Align:"Left", Hidden:"True"},
  72. {Header:'참조', Type:"Text", SaveName:"COL_DESC", Width:300, Align:"Left", EditLen:2000}
  73. ];
  74. init_sheet.HeaderMode = {Sort:1};
  75. IBS_InitSheet(sheetName, init_sheet);
  76. sheetName.SetDataAutoTrim(0);
  77. //sheetName.SetEditable(false);
  78. setGridSize();
  79. }
  80. function sheet1_OnSearchEnd(code, message) {
  81. if(code == 0) {
  82. var rownum = sheet1.GetTotalRows();
  83. var col_temp = "DETAILCD|DETAILNM|DETAILSORTNM|CHG_CODE01|CHG_CODE02|CHG_CODE03|CHG_CODE04|CHG_CODE05|"+
  84. "CHG_CODE06|CHG_CODE07|CHG_CODE08|CHG_CODE09|CHG_CODE10|CHG_CODE11|CHG_CODE12|CHG_CODE13|CHG_CODE14|CHG_CODE15|CHG_CODE16|CHG_CODE17|"+
  85. "CHG_CODE18|CHG_CODE19|CHG_CODE20|REMARK";
  86. var col_text_temp = "내역코드|내역코드명|약어명|변환코드01|변환코드02|변환코드03|변환코드04|변환코드05|변환코드06|변환코드07"+
  87. "|변환코드08|변환코드09|변환코드10|변환코드11|변환코드12|변환코드13|변환코드14|변환코드15|변환코드16|변환코드17|변환코드18|변환코드19|변환코드20"+
  88. "|REMARK|기준코드";
  89. var colNames = col_temp.split("|");
  90. var colTexts = col_text_temp.split("|");
  91. var isExist = false;
  92. var sheetNameValue = new Array(rownum);
  93. var sheetTextValue = new Array(rownum);
  94. var sheetCodeIdValue = new Array(rownum);
  95. var sheetDescValue = new Array(rownum);
  96. var j=0;
  97. for(var k = sheet1.HeaderRows(); k < sheet1.GetTotalRows()+sheet1.HeaderRows(); k++ ){
  98. sheetNameValue[sheet1.GetCellValue(k, "COL_ENG")] = sheet1.GetCellValue(k, "COL_ENG");
  99. sheetTextValue[sheet1.GetCellValue(k, "COL_ENG")] = sheet1.GetCellValue(k, "COL_KOR");
  100. sheetCodeIdValue[sheet1.GetCellValue(k, "COL_ENG")] = sheet1.GetCellValue(k, "CODE_ID");
  101. sheetDescValue[sheet1.GetCellValue(k, "COL_ENG")] = sheet1.GetCellValue(k, "COL_DESC");
  102. }
  103. sheet1.RemoveAll(); // DB의 데이터순이아닌 파라미터로 넘어오는 col 순서로 재조정
  104. for (var i=0; i<colNames.length; i++){
  105. var Row = sheet1.DataInsert(-1);
  106. sheet1.SetCellValue(Row, "TABLE_NM", "<%= params.get("p_table_nm") %>");
  107. sheet1.SetCellValue(Row, "BASE_CD", "<%= params.get("p_base_cd") %>");
  108. if( sheetNameValue[colNames[i]] !="" && sheetNameValue[colNames[i]] !=undefined){
  109. sheet1.SetCellValue(Row, "COL_ENG", sheetNameValue[colNames[i]]);
  110. sheet1.SetRowBackColor(Row, "#eeecff");
  111. }else{
  112. sheet1.SetCellValue(Row, "COL_ENG", colNames[i]);
  113. }
  114. if(sheetTextValue[colNames[i]] !="" && sheetTextValue[colNames[i]] !=undefined){
  115. sheet1.SetCellValue(Row, "COL_KOR", sheetTextValue[colNames[i]]);
  116. }else{
  117. sheet1.SetCellValue(Row, "COL_KOR", colTexts[i]);
  118. }
  119. if(sheetCodeIdValue[colNames[i]] !="" && sheetCodeIdValue[colNames[i]] !=undefined ){
  120. sheet1.SetCellValue(Row, "CODE_ID", sheetCodeIdValue[colNames[i]]);
  121. }
  122. if(sheetDescValue[colNames[i]] !="" && sheetDescValue[colNames[i]] !=undefined ){
  123. sheet1.SetCellValue(Row, "COL_DESC", sheetDescValue[colNames[i]]);
  124. }
  125. sheet1.SetCellValue(Row, "STATUS", "");
  126. }
  127. setGridSize();
  128. } else {
  129. //조회 에러 수행
  130. //alert(message);
  131. alert("조회 실패");
  132. }
  133. }
  134. function sheet1_OnSaveEnd(code, msg) {
  135. if(code >= 0) {
  136. alert("저장하였습니다.");
  137. doSearch();
  138. } else {
  139. alert("저장실패");
  140. }
  141. }
  142. function sheet1_OnClick(Row, Col, Value, CellX, CellY, CellW, CellH) {
  143. if(sheet1.ColSaveName(0, Col) == "DEL_CHECK") {
  144. if(sheet1.GetCellValue(Row, "DEL_CHECK") == 0) {
  145. sheet1.SetCellValue(Row, "STATUS2", "");
  146. sheet1.SetCellEditable(Row, "COL_ENG", true);
  147. sheet1.SetCellEditable(Row, "COL_KOR", true);
  148. sheet1.SetCellEditable(Row, "COL_DESC", true);
  149. } else if(sheet1.GetCellValue(Row, "DEL_CHECK") == 1) {
  150. sheet1.SetCellValue(Row, "STATUS2", "D");
  151. sheet1.SetCellEditable(Row, "COL_ENG", false);
  152. sheet1.SetCellEditable(Row, "COL_KOR", false);
  153. sheet1.SetCellEditable(Row, "COL_DESC", false);
  154. }
  155. }
  156. }
  157. function sheet1_OnCheckAllEnd(Col, Value) {
  158. var deleteYn = "";
  159. var editYn = "";
  160. if(Value == 1) {
  161. deleteYn = "D";
  162. editYn = false;
  163. } else {
  164. deleteYn = "";
  165. editYn = true;
  166. }
  167. for(var i=sheet1.LastRow(); i>=1; i--) {
  168. sheet1.SetCellValue(i, "STATUS2", deleteYn);
  169. sheet1.SetCellEditable(i, "COL_ENG", editYn);
  170. sheet1.SetCellEditable(i, "COL_KOR", editYn);
  171. sheet1.SetCellEditable(i, "COL_DESC", editYn);
  172. }
  173. }
  174. /**
  175. * IBSheet size setting
  176. */
  177. function setGridSize() {
  178. sheet1.FitColWidth();
  179. }
  180. // 검색
  181. function doSearch(sheetObj) {
  182. jQuery("#fevent").val("GET_DESC");
  183. var url = Modular.model.PageContext.CONTEXT_ROOT + "/sycs/code/CommCodeDescList_sheet.screen";
  184. Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 10, "");
  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. <!-- 검색조건 시작 -->
  193. <table id="search-table" class="search-form-table">
  194. <colgroup>
  195. <col width="100" />
  196. <col width="200" />
  197. <col width="100" />
  198. <col width="*" />
  199. <col width="200" />
  200. </colgroup>
  201. <tr>
  202. <th>테이블명</th>
  203. <td>
  204. <INPUT type="text" name='p_table_nm' class="input" READONLY value="<%= params.get("p_table_nm") %>" style="width:90%">
  205. </td>
  206. <th>기준코드</th>
  207. <td>
  208. <INPUT type="text" name='p_base_cd' class="input" READONLY value="<%= params.get("p_base_cd") %>" style="width:90%">
  209. </td>
  210. <td class="button">
  211. <span class="btnSearch center"><a href="javascript:void(0);" id="btnSave">저장</a></span>
  212. <span class="btnSearch center"><a href="javascript:void(0);" id="btnClose">닫기</a></span>
  213. </td>
  214. </tr>
  215. </table>
  216. <!-- 검색조건 종료 -->
  217. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 330px; overflow: auto;">
  218. <script>createIBSheet('sheet1','100%', '330px');</script>
  219. </div>
  220. <table width="100%">
  221. <tr>
  222. <TD height="5">※ 설정이 된 항목은 <font color="red">열의 바탕색이 있습니다. </font> </TD>
  223. </tr>
  224. </table>
  225. </FORM>