SupplyVendorForm.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <!DOCTYPE html>
  2. <html lang="ko"
  3. xmlns:th="http://www.thymeleaf.org">
  4. <!--
  5. *******************************************************************************
  6. * @source : SupplyVendorForm.html
  7. * @desc : 공급벤더관리 Page
  8. *============================================================================
  9. * STYLE24
  10. * Copyright(C) 2020 TSIT, All rights reserved.
  11. *============================================================================
  12. * VER DATE AUTHOR DESCRIPTION
  13. * === =========== ========== =============================================
  14. * 1.0 2021.01.18 gagamel 최초 작성
  15. *******************************************************************************
  16. -->
  17. <div id="main">
  18. <!-- 메인타이틀 영역 -->
  19. <div class="main-title">
  20. </div>
  21. <!-- //메인타이틀 영역 -->
  22. <!-- 메뉴 설명 -->
  23. <div class="infoBox menu-desc">
  24. </div>
  25. <!-- //메뉴 설명 -->
  26. <!-- 검색조건 영역 -->
  27. <div class="panelStyle">
  28. <form id="searchForm" name="searchForm" action="#" th:action="@{'/business/supply/vendor/list'}" onsubmit="$('#btnSearch').trigger('click'); return false;">
  29. <table class="frmStyle" aria-describedby="검색조건">
  30. <colgroup>
  31. <col style="width:10%;"/>
  32. <col/>
  33. </colgroup>
  34. <tr>
  35. <th>검색어</th>
  36. <td>
  37. <select name="searchGb">
  38. <option value="NAME">벤더명</option>
  39. <option value="OWNER">대표자명</option>
  40. </select>
  41. <input type="text" name="searchTxt" class="w300" maxlength="20"/>
  42. </td>
  43. </tr>
  44. </table>
  45. <ul class="panelBar">
  46. <li class="center">
  47. <button type="button" class="btn btn-base btn-lg" id="btnSearch">조회</button>
  48. <button type="button" class="btn btn-gray btn-lg" onclick="$('#searchForm')[0].reset();">초기화</button>
  49. </li>
  50. </ul>
  51. </form>
  52. </div>
  53. <!-- 검색조건 영역 -->
  54. <!-- 리스트 영역 -->
  55. <div class="panelStyle">
  56. <!-- 버튼 배치 영역 -->
  57. <ul class="panelBar">
  58. <li class="right">
  59. <button type="button" class="btn btn-default btn-lg" id="btnExcel">엑셀다운로드</button>
  60. </li>
  61. </ul>
  62. <!-- //버튼 배치 영역 -->
  63. <div id="gridList" style="width: 100%; height: 470px" class="ag-theme-balham"></div>
  64. </div>
  65. <!-- //리스트 영역 -->
  66. <!-- 등록/수정 -->
  67. <div class="panelStyle">
  68. <form id="detailForm" name="detailForm" action="#" th:action="@{'/business/supply/vendor/save'}">
  69. <table class="frmStyle" aria-describedby="등록/수정 폼">
  70. <colgroup>
  71. <col style="width:10%;"/>
  72. <col style="width:15%;"/>
  73. <col style="width:10%;"/>
  74. <col style="width:15%;"/>
  75. <col style="width:10%;"/>
  76. <col style="width:15%;"/>
  77. <col style="width:10%;"/>
  78. <col style="width:15%;"/>
  79. </colgroup>
  80. <tr>
  81. <th>벤더코드</th>
  82. <td>
  83. <input type="text" class="w150" name="supplyVendorCd" placeholder="자동생성" maxlength="6" data-valid-name="벤더코드" readonly="readonly"/>
  84. </td>
  85. <th>벤더명<i class="required" title="필수"></i></th>
  86. <td>
  87. <input type="text" name="supplyVendorNm" maxlength="100" required="required" data-valid-name="벤더명"/>
  88. </td>
  89. <th>사업자구분<i class="required" title="필수"></i></th>
  90. <td>
  91. <label class="rdoBtn"><input type="radio" name="bizGb" value="C" checked="checked"/>법인<span></span></label>
  92. <label class="rdoBtn"><input type="radio" name="bizGb" value="P"/>개인<span></span></label>
  93. </td>
  94. <th>사업자등록번호<i class="required" title="필수"></i></th>
  95. <td>
  96. <input type="text" class="w150" name="bizNo" maxlength="20" required="required" data-valid-name="사업자등록번호"/>
  97. <button type="button" class="btn btn-info btn-sm" onclick="fnCertifyBizNo();">인증</button>
  98. </td>
  99. </tr>
  100. <tr>
  101. <th>업종<i class="required" title="필수"></i></th>
  102. <td>
  103. <input type="text" name="bizKind" maxlength="100" required="required" data-valid-name="업종"/>
  104. </td>
  105. <th>업태<i class="required" title="필수"></i></th>
  106. <td>
  107. <input type="text" name="bizType" maxlength="100" required="required" data-valid-name="업태"/>
  108. </td>
  109. <th>대표자명<i class="required" title="필수"></i></th>
  110. <td>
  111. <input type="text" name="ownerNm" maxlength="50" required="required" data-valid-name="대표자명"/>
  112. </td>
  113. <th>대표전화<i class="required" title="필수"></i></th>
  114. <td>
  115. <input type="text" name="mainTelno" placeholder="02-0000-0000" maxlength="20" required="required" data-valid-name="대표전화"/>
  116. </td>
  117. </tr>
  118. <tr>
  119. <th>대표팩스번호</th>
  120. <td>
  121. <input type="text" name="mainFaxno" placeholder="02-0000-0000" maxlength="20" data-valid-name="대표팩스번호"/>
  122. </td>
  123. <th>사업장주소<i class="required" title="필수"></i></th>
  124. <td colspan="5">
  125. <input type="text" name="bizZipcode" class="w100" data-valid-name="우편번호" readonly="readonly"/>
  126. <button type="button" class="btn btn-info btn-sm" onclick="fnOpenDaumAddr();">우편번호찾기</button>
  127. <input type="text" name="bizBaseAddr" class="w300" maxlength="200" required="required" data-valid-name="사업장주소" readonly="readonly"/>
  128. <input type="text" name="bizDtlAddr" class="w300" maxlength="200"/>
  129. </td>
  130. </tr>
  131. <tr>
  132. <th>홈페이지URL</th>
  133. <td colspan="5">
  134. <input type="text" class="w300" name="homepageUrl" data-valid-name="홈페이지URL"/>
  135. </td>
  136. <th>사용여부<i class="required" title="필수"></i></th>
  137. <td>
  138. <label class="rdoBtn"><input type="radio" name="useYn" value="Y" checked="checked"/>Yes<span></span></label>
  139. <label class="rdoBtn"><input type="radio" name="useYn" value="N"/>No<span></span></label>
  140. </td>
  141. </tr>
  142. </table>
  143. </form>
  144. <!-- 버튼 배치 영역 -->
  145. <ul class="panelBar">
  146. <li class="right">
  147. <button type="button" class="btn btn-info btn-lg" id="btnNew">신규</button>
  148. <button type="button" class="btn btn-success btn-lg" id="btnSave">저장</button>
  149. </li>
  150. </ul>
  151. <!-- //버튼 배치 영역 -->
  152. </div>
  153. <!-- 등록/수정 -->
  154. </div>
  155. <script th:inline="javascript">
  156. /*<![CDATA[*/
  157. let columnDefs = [
  158. { headerName: "벤더코드", field: "supplyVendorCd", width: 100, cellClass: 'text-center' },
  159. {
  160. headerName: "벤더명", field: "supplyVendorNm", width: 150, cellClass: 'text-center',
  161. cellRenderer: function(params) {
  162. return '<a href="javascript:void(0);">' + params.value + '</a>';
  163. }
  164. },
  165. {
  166. headerName: "사업자구분", field: "bizGb", width: 100, cellClass: 'text-center',
  167. valueGetter: function (params) { return params.data.bizGb == 'C' ? '법인' : '개인'; }
  168. },
  169. { headerName: "사업자등록번호", field: "bizNo", width: 120, cellClass: 'text-center' },
  170. { headerName: "업종", field: "bizKind", width: 150, cellClass: 'text-center' },
  171. { headerName: "업태", field: "bizType", width: 150, cellClass: 'text-center' },
  172. { headerName: "대표자명", field: "ownerNm", width: 100, cellClass: 'text-center' },
  173. { headerName: "대표전화번호", field: "mainTelno", width: 120, cellClass: 'text-center' },
  174. { headerName: "대표팩스번호", field: "mainFaxno", width: 120, cellClass: 'text-center' },
  175. { headerName: "우편번호", field: "bizZipcode", width: 80, cellClass: 'text-center' },
  176. { headerName: "기본주소", field: "bizBaseAddr", width: 250 },
  177. { headerName: "상세주소", field: "bizDtlAddr", width: 150 },
  178. { headerName: "홈페이지URL", field: "homepageUrl", width: 200 }
  179. ];
  180. let gridOptions = gagaAgGrid.getGridOptions(columnDefs);
  181. // Cell click
  182. gridOptions.onCellClicked = function(event) {
  183. if (event.colDef.field != 'supplyVendorNm')
  184. return;
  185. $('#detailForm input[name=supplyVendorCd]').val(event.data.supplyVendorCd);
  186. $('#detailForm input[name=supplyVendorNm]').val(event.data.supplyVendorNm);
  187. if (event.data.bizGb == 'C') {
  188. $('#detailForm input:radio[name=bizGb]').eq(0).trigger('click');
  189. } else {
  190. $('#detailForm input:radio[name=bizGb]').eq(1).trigger('click');
  191. }
  192. $('#detailForm input[name=bizNo] ').val(event.data.bizNo);
  193. $('#detailForm input[name=bizKind]').val(event.data.bizKind);
  194. $('#detailForm input[name=bizType]').val(event.data.bizType);
  195. $('#detailForm input[name=ownerNm]').val(event.data.ownerNm);
  196. $('#detailForm input[name=mainTelno]').val(event.data.mainTelno);
  197. $('#detailForm input[name=mainFaxno]').val(event.data.mainFaxno);
  198. $('#detailForm input[name=bizZipcode]').val(event.data.bizZipcode);
  199. $('#detailForm input[name=bizBaseAddr]').val(event.data.bizBaseAddr);
  200. $('#detailForm input[name=bizDtlAddr]').val(event.data.bizDtlAddr);
  201. $('#detailForm input[name=homepageUrl]').val(event.data.homepageUrl);
  202. if (event.data.useYn == 'Y') {
  203. $('#detailForm input:radio[name=useYn]').eq(0).trigger('click');
  204. } else {
  205. $('#detailForm input:radio[name=useYn]').eq(1).trigger('click');
  206. }
  207. fnUnEscapeHtml(); //XSS변환
  208. }
  209. // 검색
  210. $('#btnSearch').on('click', function() {
  211. gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm',fnChangeGrid);
  212. });
  213. // 신규버튼
  214. $('#btnNew').on('click', function() {
  215. $("#detailForm")[0].reset();
  216. });
  217. // 저장
  218. $("#btnSave").on("click", function() {
  219. // 필수값 체크
  220. if (!gagajf.validation('#detailForm'))
  221. return false;
  222. mcxDialog.confirm("저장하시겠습니까?", {
  223. cancelBtnText: "취소",
  224. sureBtnText: "확인",
  225. sureBtnClick: function() {
  226. gagajf.ajaxFormSubmit($('#detailForm').prop('action'), '#detailForm', function() {
  227. $('#btnNew').trigger('click');
  228. $('#btnSearch').trigger('click');
  229. });
  230. }
  231. });
  232. });
  233. // 엑셀다운로드
  234. $('#btnExcel').on('click', function() {
  235. gagaAgGrid.exportToExcel('공급벤더 목록', gridOptions);
  236. });
  237. /**
  238. * DAUM을 이용한 우편번호 팝업 레이어
  239. */
  240. var fnOpenDaumAddr = function() {
  241. let daumZip = new daum.Postcode({
  242. oncomplete: function(data) {
  243. // 우편번호와 주소 정보를 해당 필드에 넣는다.
  244. $('#detailForm input[name=bizZipcode]').val(data.zonecode);
  245. $('#detailForm input[name=bizBaseAddr]').val(cfnGetDaumRoadAddr(data));
  246. $('#detailForm input[name=bizDtlAddr]').focus();
  247. cfnCloseDaumAddr();
  248. },
  249. width: '100%'
  250. });
  251. cfnOpenDaumAddr(daumZip);
  252. }
  253. var fnUnEscapeHtml = function(){ //XSS 변환
  254. $('#detailForm input[name=supplyVendorNm]').val($('#detailForm input[name=supplyVendorNm]').val().replaceXSS());
  255. $('#detailForm input[name=bizNo]').val($('#detailForm input[name=bizNo]').val().replaceXSS());
  256. $('#detailForm input[name=bizKind]').val($('#detailForm input[name=bizKind]').val().replaceXSS());
  257. $('#detailForm input[name=bizType]').val($('#detailForm input[name=bizType]').val().replaceXSS());
  258. $('#detailForm input[name=ownerNm]').val($('#detailForm input[name=ownerNm]').val().replaceXSS());
  259. $('#detailForm input[name=mainTelno]').val($('#detailForm input[name=mainTelno]').val().replaceXSS());
  260. $('#detailForm input[name=mainFaxno]').val($('#detailForm input[name=mainFaxno]').val().replaceXSS());
  261. $('#detailForm input[name=bizDtlAddr]').val($('#detailForm input[name=bizDtlAddr]').val().replaceXSS());
  262. $('#detailForm input[name=homepageUrl]').val($('#detailForm input[name=homepageUrl]').val().replaceXSS());
  263. };
  264. var fnChangeGrid = function(){ //XSS 그리드 내 변환
  265. var data = gagaAgGrid.getAllRowData(gridOptions);
  266. let modifyList = [];
  267. $.each(data, function(idx, item) {
  268. if(item.bizDtlAddr != null && item.bizDtlAddr != '' && item.bizDtlAddr != 'undefined'){
  269. let bizDtlAddr = item.bizDtlAddr;
  270. item.bizDtlAddr = bizDtlAddr.replaceXSS();
  271. }
  272. let bizNo = item.bizNo;
  273. let bizKind = item.bizKind;
  274. let bizType = item.bizType;
  275. let ownerNm = item.ownerNm;
  276. let mainTelno = item.mainTelno;
  277. let mainFaxno = item.mainFaxno;
  278. let homepageUrl = item.homepageUrl;
  279. item.bizNo = bizNo.replaceXSS();
  280. item.bizKind = bizKind.replaceXSS();
  281. item.bizType = bizType.replaceXSS();
  282. item.ownerNm = ownerNm.replaceXSS();
  283. item.mainTelno = mainTelno.replaceXSS();
  284. item.mainFaxno = mainFaxno.replaceXSS();
  285. item.homepageUrl = homepageUrl.replaceXSS();
  286. modifyList.push(item);
  287. });
  288. gridOptions.api.setRowData(modifyList);
  289. };
  290. $(document).ready(function() {
  291. // Create a agGrid
  292. gagaAgGrid.createGrid('gridList', gridOptions);
  293. });
  294. /*]]>*/
  295. </script>
  296. </html>