GoodsVideoForm.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <!DOCTYPE html>
  2. <html lang="ko"
  3. xmlns:th="http://www.thymeleaf.org">
  4. <!--
  5. *******************************************************************************
  6. * @source : GoodsVideoForm.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 2020.11.16 eskim 최초 작성
  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. <div class="panelStyle">
  27. <!-- TITLE -->
  28. <div class="panelTitle">
  29. <h3><i class="fa fa-info-circle"></i>아래 검색조건 중 하나를 꼭 입력해 주세요.</h3>
  30. </div>
  31. <!-- //TITLE -->
  32. <div class="panelContent">
  33. <form id="searchForm" name="searchForm" action="#" th:action="@{'/goods/video/list'}">
  34. <table class="frmStyle">
  35. <colgroup>
  36. <col style="width:10%;"/>
  37. <col style="width:40%;"/>
  38. <col style="width:10%;"/>
  39. <col/>
  40. </colgroup>
  41. <tr>
  42. <th>키워드</th>
  43. <td>
  44. <select name="keyWord">
  45. <option value="goodsCd">상품코드</option>
  46. <option value="goodsNm">상품명</option>
  47. <option value="goodsNum">품번</option>
  48. <option value="supplyGoodsCd">업체상품코드</option>
  49. </select>
  50. <input type="text" class="w100" maxlength="20" name="searchTxt" placeholder=""/>
  51. <input type="text" class="off" name="goodsCd" id="goodsCd"/>
  52. <input type="text" class="off" name="goodsNm" id="goodsNm"/>
  53. <input type="text" class="off" name="goodsNum" id="goodsNum"/>
  54. <input type="text" class="off" name="supplyGoodsCd" id="supplyGoodsCd"/>
  55. </td>
  56. <th>브랜드명</th>
  57. <td>
  58. <input type="text" class="w200" name="brandEnm" placeholder="" maxlength="50"/>
  59. </td>
  60. </tr>
  61. <tr>
  62. <th>등록일</th>
  63. <td colspan="3" id="sellTerms">
  64. </td>
  65. </tr>
  66. </table>
  67. <ul class="panelBar">
  68. <li class="center">
  69. <button type="button" class="btn btn-default btn-lg" id="btnInit">초기화</button>
  70. <button type="button" class="btn btn-success btn-lg" id="btnSearch">조회</button>
  71. </li>
  72. </ul>
  73. </form>
  74. </div>
  75. </div>
  76. <!-- //검색조건 영역 -->
  77. <!-- 리스트 영역 -->
  78. <div class="panelStyle">
  79. <ul class="panelBar">
  80. <li class="left">
  81. <button type="button" class="btn btn-danger btn-lg" id="btnNotUse">노출안함</button>
  82. </li>
  83. <li class="right">
  84. <button type="button" class="btn btn-default btn-lg" onclick="cfnDownloadSampleFile('SF002');">상품동영상등록 양식다운로드</button>
  85. <button type="button" class="btn btn-info btn-lg" id="btnExcReg">엑셀등록</button>
  86. </li>
  87. </ul>
  88. <div id="gridList" style="width: 100%; height: 450px;" class="ag-theme-balham"></div>
  89. </div>
  90. <!-- //리스트 영역 -->
  91. <!-- 등록/수정 -->
  92. <div class="panelStyle">
  93. <form id="detailForm" name="detailForm" action="#" >
  94. <table class="frmStyle">
  95. <colgroup>
  96. <col style="width:10%;"/>
  97. <col style="width:20%;"/>
  98. <col style="width:10%;"/>
  99. <col style="width:20%;"/>
  100. <col style="width:10%;"/>
  101. <col/>
  102. </colgroup>
  103. <tr>
  104. <td colspan='6'>동영상등록(상세)</td>
  105. </tr>
  106. <tr>
  107. <th>상품코드<em class="required" title="필수"></em></th>
  108. <td>
  109. <input name="videoSq" data-valid-name="상품동영상일련번호" type="hidden"/>
  110. <input type="text" class="w150" name="goodsCd" maxlength="20" required="required" data-valid-name="상품코드"/>
  111. </td>
  112. <th>동영상구분<em class="required" title="필수"></em></th>
  113. <td>
  114. <select name="videoGb" id="videoGb" required="required" data-valid-name="동영상구분" onchange="fnVideoGb();">
  115. <!-- <option value="">[선택]</option> -->
  116. <option value="Y" selected="selected">[Y] 유투브</option>
  117. <option value="M">[M] MP4</option>
  118. </select>
  119. </td>
  120. <th>노출여부<em class="required" title="필수"></em></th>
  121. <td>
  122. <label class="rdoBtn"><input type="radio" name="dispYn" id="dispYn" value="Y" checked="checked">Y</label>
  123. <label class="rdoBtn"><input type="radio" name="dispYn" id="dispYn" value="N">N</label>
  124. </td>
  125. </tr>
  126. <tr id="youtubeArea">
  127. <th>동영상URL<em class="required" title="필수"></em></th>
  128. <td class="infoTxt" colspan="5">
  129. <em><i class="fa fa-info-circle"></i>유투브의 경우 빨간색 표시로 되어있는 값만 넣으세요.</em><br/>
  130. 예시 : https://www.youtube.com/embed/<em><strong>5YqYG71bQ3s</strong></em>?showinfo=0&amp;rel=0&amp;vp=hd1080&amp;fs=0&amp;wmode=opaque&amp;enablejsapi=1
  131. <br/>
  132. <input type="text" class="w400" id="kmcKey" name="kmcKey" maxlength="100" >
  133. <button type="button" class="btn btn-dark btn-lg" onclick="cfnOpenGoodsVideoPopup('filmVideoView','kmcKey', '#detailForm', $('#videoGb').val());">미리보기</button>
  134. </td>
  135. </tr>
  136. <tr id="fileArea" style="display:none;">
  137. <th>파일첨부<em class="required" title="필수"></em></th>
  138. <td class="infoTxt" colspan="5">
  139. <div class="uFile w300">
  140. <input id="file" name="file" type="file" class="uFileInput w300"/>
  141. <label for="file" class="uFileLabel">파일선택</label>
  142. <input type="hidden" name="kufKey"/>
  143. <input type="hidden" name="kmcKey"/>
  144. </div>
  145. <div id="keyArea">미디어키 : <input type="text" class="w200" name="hkmcKey" disabled> upload키 : <input type="text" class="w200" name="hkufKey" disabled></div>
  146. <button type="button" class="btn btn-dark btn-lg" onclick="cfnOpenGoodsVideoPopup('filmVideoView','kmcKey', '#detailForm', $('#videoGb').val());">미리보기</button>
  147. </td>
  148. </tr>
  149. </table>
  150. <ul class="panelBar">
  151. <li class="center">
  152. <button type="button" class="btn btn-info btn-lg" id="btnNew">신규</button>
  153. <button type="button" class="btn btn-success btn-lg" id="btnSave">저장</button>
  154. </li>
  155. </ul>
  156. </form>
  157. </div>
  158. </div>
  159. <script type="text/javascript" src="/ux/plugins/gaga/gaga.kollus.js"></script>
  160. <script th:inline="javascript">
  161. /*<![CDATA[*/
  162. var videoGbList = {'Y':'유투브', 'M':'MP4'};
  163. // specify the columns
  164. var columnDefs = [
  165. {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
  166. {headerName: 'No', width: 60, cellClass: 'text-center', valueGetter: function(params) { return params.node.rowIndex + 1 }},
  167. {headerName: "브랜드명", field: "brandEnm", width: 120, cellClass: 'text-center'},
  168. {headerName: "상품동영상일련번호", field: "goodsVideoSq", width: 120, cellClass: 'text-center', hide: true},
  169. {headerName: "상품코드", field: "goodsCd", width: 120, cellClass: 'text-center',
  170. cellRenderer: function(params) {
  171. return '<a href="javascript:void(0);">' + params.value + '</a>';
  172. }
  173. },
  174. {headerName: "동영상구분", field: "videoGb", width: 100, cellClass: 'text-center',
  175. cellRenderer: function (params) { return !gagajf.isNull(params.value) ? "["+params.value+"] "+gagaAgGrid.lookupValue(videoGbList, params.value) : '';}
  176. },
  177. {headerName: "동영상정보", field: "kmcKey", width: 300, cellClass: 'text-center'},
  178. {headerName: "노출여부", field: "dispYn", width: 80, cellClass: 'text-center'},
  179. {headerName: "등록일자", field: "regDt", width: 150, cellClass: 'text-center',
  180. cellRenderer: function(params) {
  181. return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
  182. }
  183. },
  184. {headerName: "등록자", field: "regNm", width: 150, cellClass: 'text-center'},
  185. {headerName: "수정일자", field: "updDt", width: 150, cellClass: 'text-center',
  186. cellRenderer: function(params) {
  187. return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
  188. }
  189. },
  190. {headerName: "수정자", field: "updNm", width: 150, cellClass: 'text-center'},
  191. ];
  192. // Get GridOptions
  193. var gridOptions = gagaAgGrid.getGridOptions(columnDefs);
  194. gridOptions.rowSelection = 'multiple';
  195. gridOptions.suppressRowClickSelection = true;
  196. // 상품코드 셀 클릭
  197. gridOptions.onCellClicked = function(event) {
  198. if (event.colDef.field == "goodsCd"){
  199. var formId = '#detailForm';
  200. $(formId + " input[name=videoSq]").val(event.data.videoSq);
  201. $(formId + " input[name=goodsCd]").val(event.data.goodsCd);
  202. $(formId + " select[name=videoGb]").val(event.data.videoGb);
  203. $(formId + " input[name=kmcKey]").val(event.data.kmcKey);
  204. $(formId + " input[name=kufKey]").val(event.data.kufKey);
  205. $(formId + " input[name=hkmcKey]").val(event.data.kmcKey);
  206. $(formId + " input[name=hkufKey]").val(event.data.kufKey);
  207. $(formId + " input:radio[name=dispYn]:input[value="+event.data.dispYn+"]").click();
  208. $(formId + " input[name=goodsCd]").prop("disabled", true);
  209. $(formId + " select[name=videoGb]").prop("disabled", true);
  210. $(formId).closest("div").show();
  211. if ("Y" == event.data.videoGb){
  212. $('#youtubeArea').show();
  213. $('#fileArea').hide();
  214. }else{
  215. $('#youtubeArea').hide();
  216. $('#fileArea').show();
  217. $('.uFile').hide();
  218. $('#keyArea').show();
  219. }
  220. }
  221. }
  222. // 신규 버튼 클릭
  223. $("#btnNew").on('click', function() {
  224. $("#detailForm")[0].reset();
  225. $("#detailForm input[name=videoSq]").val('');
  226. $("#detailForm input[name=goodsCd]").prop("disabled", false);
  227. $("#detailForm select[name=videoGb]").prop("disabled", false);
  228. $('#youtubeArea').show();
  229. $('#fileArea').hide();
  230. });
  231. // 엑셀등록
  232. $("#btnExcReg").on('click', function() {
  233. cfnExcelUploadPopup('','fnExcelUpoadCallback');
  234. });
  235. var fnExcelUpoadCallback = function(data){
  236. var jsonData = JSON.stringify(data);
  237. gagajf.ajaxJsonSubmit('/goods/video/excel/save', jsonData, fnSaveCallback);
  238. }
  239. // 동영상구분 변경시
  240. var fnVideoGb = function(){
  241. if ("Y" == $("#detailForm select[name=videoGb]").val()){
  242. $('#youtubeArea').show();
  243. $('#fileArea').hide();
  244. $('.uFile').hide();
  245. $('#keyArea').hide();
  246. }else{
  247. $('#youtubeArea').hide();
  248. $('#fileArea').show();
  249. $('.uFile').show();
  250. $('#keyArea').hide();
  251. }
  252. }
  253. // 조회
  254. $('#btnSearch').on('click', function() {
  255. $("#goodsCd").val('');
  256. $("#goodsNm").val('');
  257. $("#goodsNum").val('');
  258. $("#supplyGoodsCd").val('');
  259. $("#"+$("#searchForm select[name=keyWord]").val()).val($("#searchForm input[name=searchTxt]").val());
  260. if(!fnConditionCheck()) return;
  261. // Fetch data
  262. gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm');
  263. $("#btnNew").click();
  264. });
  265. //검색 조건 확인
  266. var fnConditionCheck = function(){
  267. var form = document.searchForm;
  268. var searchFlag = false;
  269. var cnt = 0;
  270. for (i = 0; i < form.elements.length; i++ ) {
  271. var el = form.elements[i];
  272. if ($(el).prop("type") == "text" || ($(el).prop("type") == "select-one" && el.name != "search" && el.name != "pageSize" && el.name != "keyWord")) {
  273. if (!(el.value == null || el.value == "")) {
  274. cnt++;
  275. }
  276. }
  277. }
  278. if(cnt > 0) searchFlag = true;
  279. if(searchFlag == false){
  280. mcxDialog.alert("검색조건을 입력하세요.");
  281. return false;
  282. }
  283. // 기간 값 체크
  284. if (!fnCalendarDateValidation('#sellTerms', 'stDate', 'edDate')){
  285. return false;
  286. }
  287. return true;
  288. }
  289. // 검색조건 초기화
  290. $('#btnInit').on('click', function() {
  291. $("#searchForm")[0].reset();
  292. });
  293. // 선택상품 사용안함
  294. $("#btnNotUse").on('click', function() {
  295. var selectRowData = gagaAgGrid.selectedRowData(gridOptions);
  296. if(selectRowData.length>0){
  297. mcxDialog.confirm('선택한 상품동영상을 미노출처리 하시겠습니까?', {
  298. cancelBtnText: "취소",
  299. sureBtnText: "확인",
  300. sureBtnClick: function(){
  301. var jsonData = JSON.stringify(selectRowData);
  302. gagajf.ajaxJsonSubmit('/goods/video/update/notUse', jsonData, fnSaveCallback);
  303. }
  304. })
  305. }else{
  306. mcxDialog.alert("선택된 상품동영상이 없습니다.");
  307. }
  308. });
  309. // 동영상 저장
  310. $("#btnSave").on('click', function() {
  311. var formId = '#detailForm';
  312. var videoSq = $(formId + " input[name=videoSq]").val();
  313. var goodsCd = $(formId + " input[name=goodsCd]").val();
  314. var videoGb = $(formId + " select[name=videoGb]").val();
  315. var kmcKey = $(formId + " input[name=kmcKey]").val();
  316. var kufKey = $(formId + " input[name=kufKey]").val();
  317. var dispYn = $(formId + " input:radio[name=dispYn]:checked").val();
  318. if(goodsCd==''){
  319. gagajf.alertMessage(formId + " input[name=goodsCd]", 'input');
  320. return;
  321. }
  322. if(videoGb==''){
  323. gagajf.alertMessage(formId + " select[name=videoGb]", 'select');
  324. return;
  325. }
  326. /* if(kmcKey==''){
  327. gagajf.alertMessage(formId + " input[name=kmcKey]", 'input');
  328. return;
  329. } */
  330. if(kmcKey.indexOf("http")>-1){
  331. mcxDialog.alert('동영상 정보를 확인해 주세요.');
  332. return;
  333. }
  334. mcxDialog.confirm('저장 하시겠습니까?', {
  335. cancelBtnText: "취소",
  336. sureBtnText: "확인",
  337. sureBtnClick: function(){
  338. var data = {videoSq : videoSq
  339. ,goodsCd : goodsCd
  340. ,videoGb : videoGb
  341. ,kmcKey : kmcKey
  342. ,kufKey : kufKey
  343. ,dispYn : dispYn
  344. };
  345. var jsonData = JSON.stringify(data);
  346. gagajf.ajaxJsonSubmit('/goods/video/save', jsonData, fnSaveCallback);
  347. }
  348. })
  349. });
  350. var fnSaveCallback = function() {
  351. $('#btnSearch').click();
  352. }
  353. // 동영상파일 선택 시
  354. $('#detailForm input[name=file]').on('change', function() {
  355. var file = this.files[0];
  356. gagaKollus.upload('Goods', file, $('input[name=kufKey]'));
  357. });
  358. $(document).ready(function() {
  359. cfnCreateCalendar('#sellTerms', 'stDate', 'edDate', true, '등록일', true);
  360. // Create a agGrid
  361. gagaAgGrid.createGrid('gridList', gridOptions);
  362. //$('#btnSearch').click();
  363. });
  364. /*]]>*/
  365. </script>
  366. </html>