GoodsVideoForm.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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="youtobeArea">
  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. <button type="button" class="btn btn-dark btn-lg" onclick="cfnOpenGoodsVideoPopup('filmVideoView','kmcKey', '#detailForm', $('#videoGb').val());">미리보기</button>
  146. </td>
  147. </tr>
  148. </table>
  149. <ul class="panelBar">
  150. <li class="center">
  151. <button type="button" class="btn btn-info btn-lg" id="btnNew">신규</button>
  152. <button type="button" class="btn btn-success btn-lg" id="btnSave">저장</button>
  153. </li>
  154. </ul>
  155. </form>
  156. </div>
  157. </div>
  158. <script type="text/javascript" src="/ux/plugins/gaga/gaga.kollus.js"></script>
  159. <script th:inline="javascript">
  160. /*<![CDATA[*/
  161. var videoGbList = {'Y':'유투브', 'M':'MP4'};
  162. // specify the columns
  163. var columnDefs = [
  164. {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
  165. {headerName: 'No', width: 60, cellClass: 'text-center', valueGetter: function(params) { return params.node.rowIndex + 1 }},
  166. {headerName: "브랜드명", field: "brandEnm", width: 120, cellClass: 'text-center'},
  167. {headerName: "상품동영상일련번호", field: "goodsVideoSq", width: 120, cellClass: 'text-center', hide: true},
  168. {headerName: "상품코드", field: "goodsCd", width: 120, cellClass: 'text-center',
  169. cellRenderer: function(params) {
  170. return '<a href="javascript:void(0);">' + params.value + '</a>';
  171. }
  172. },
  173. {headerName: "동영상구분", field: "videoGb", width: 100, cellClass: 'text-center',
  174. cellRenderer: function (params) { return !gagajf.isNull(params.value) ? "["+params.value+"] "+gagaAgGrid.lookupValue(videoGbList, params.value) : '';}
  175. },
  176. {headerName: "동영상정보", field: "kmcKey", width: 300, cellClass: 'text-center'},
  177. {headerName: "노출여부", field: "dispYn", width: 80, cellClass: 'text-center'},
  178. {headerName: "등록일자", field: "regDt", width: 150, cellClass: 'text-center',
  179. cellRenderer: function(params) {
  180. return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
  181. }
  182. },
  183. {headerName: "등록자", field: "regNo", width: 150, cellClass: 'text-center'},
  184. {headerName: "수정일자", field: "updDt", width: 150, cellClass: 'text-center',
  185. cellRenderer: function(params) {
  186. return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
  187. }
  188. },
  189. {headerName: "수정자", field: "updNo", width: 150, cellClass: 'text-center'},
  190. ];
  191. // Get GridOptions
  192. var gridOptions = gagaAgGrid.getGridOptions(columnDefs);
  193. gridOptions.rowSelection = 'multiple';
  194. gridOptions.suppressRowClickSelection = true;
  195. // 상품코드 셀 클릭
  196. gridOptions.onCellClicked = function(event) {
  197. if (event.colDef.field == "goodsCd"){
  198. var formId = '#detailForm';
  199. $(formId + " input[name=videoSq]").val(event.data.videoSq);
  200. $(formId + " input[name=goodsCd]").val(event.data.goodsCd);
  201. $(formId + " select[name=videoGb]").val(event.data.videoGb);
  202. $(formId + " input[name=kmcKey]").val(event.data.kmcKey);
  203. $(formId + " input:radio[name=dispYn]:input[value="+event.data.dispYn+"]").click();
  204. $(formId + " input[name=goodsCd]").prop("disabled", true);
  205. $(formId).closest("div").show();
  206. }
  207. }
  208. // 신규 버튼 클릭
  209. $("#btnNew").on('click', function() {
  210. $("#detailForm")[0].reset();
  211. $("#detailForm input[name=videoSq]").val('');
  212. $("#detailForm input[name=goodsCd]").prop("disabled", false);
  213. $('#youtobeArea').show();
  214. $('#fileArea').hide();
  215. });
  216. // 엑셀등록
  217. $("#btnExcReg").on('click', function() {
  218. cfnExcelUploadPopup('','fnExcelUpoadCallback');
  219. });
  220. var fnExcelUpoadCallback = function(data){
  221. var jsonData = JSON.stringify(data);
  222. gagajf.ajaxJsonSubmit('/goods/video/excel/save', jsonData, fnSaveCallback);
  223. }
  224. // 동영상구분 변경시
  225. var fnVideoGb = function(){debugger;
  226. if ("Y" == $("#detailForm select[name=videoGb]").val()){
  227. $('#youtobeArea').show();
  228. $('#fileArea').hide();
  229. }else{
  230. $('#youtobeArea').hide();
  231. $('#fileArea').show();
  232. }
  233. }
  234. // 조회
  235. $('#btnSearch').on('click', function() {
  236. $("#goodsCd").val('');
  237. $("#goodsNm").val('');
  238. $("#goodsNum").val('');
  239. $("#supplyGoodsCd").val('');
  240. $("#"+$("#searchForm select[name=keyWord]").val()).val($("#searchForm input[name=searchTxt]").val());
  241. // 기간 값 체크
  242. if (!fnCalendarDateValidation('#sellTerms', 'stDate', 'edDate')){
  243. return false;
  244. }
  245. // Fetch data
  246. gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm');
  247. $("#btnNew").click();
  248. });
  249. // 검색조건 초기화
  250. $('#btnInit').on('click', function() {
  251. $("#searchForm")[0].reset();
  252. });
  253. // 선택상품 사용안함
  254. $("#btnNotUse").on('click', function() {
  255. var selectRowData = gagaAgGrid.selectedRowData(gridOptions);
  256. if(selectRowData.length>0){
  257. mcxDialog.confirm('선택한 상품동영상을 미노출처리 하시겠습니까?', {
  258. cancelBtnText: "취소",
  259. sureBtnText: "확인",
  260. sureBtnClick: function(){
  261. var jsonData = JSON.stringify(selectRowData);
  262. gagajf.ajaxJsonSubmit('/goods/video/update/notUse', jsonData, fnSaveCallback);
  263. }
  264. })
  265. }else{
  266. mcxDialog.alert("선택된 상품동영상이 없습니다.");
  267. }
  268. });
  269. // 동영상 저장
  270. $("#btnSave").on('click', function() {
  271. var formId = '#detailForm';
  272. var videoSq = $(formId + " input[name=videoSq]").val();
  273. var goodsCd = $(formId + " input[name=goodsCd]").val();
  274. var videoGb = $(formId + " select[name=videoGb]").val();
  275. var kmcKey = $(formId + " input[name=kmcKey]").val();
  276. var dispYn = $(formId + " input:radio[name=dispYn]:checked").val();
  277. var kufKey = $(formId + " input[name=kufKey]").val();
  278. if(goodsCd==''){
  279. gagajf.alertMessage(formId + " input[name=goodsCd]", 'input');
  280. return;
  281. }
  282. if(videoGb==''){
  283. gagajf.alertMessage(formId + " select[name=videoGb]", 'select');
  284. return;
  285. }
  286. if(kmcKey==''){
  287. gagajf.alertMessage(formId + " input[name=kmcKey]", 'input');
  288. return;
  289. }
  290. if(kmcKey.indexOf("http")>-1){
  291. mcxDialog.alert('동영상 정보를 확인해 주세요.');
  292. return;
  293. }
  294. mcxDialog.confirm('저장 하시겠습니까?', {
  295. cancelBtnText: "취소",
  296. sureBtnText: "확인",
  297. sureBtnClick: function(){
  298. var data = {videoSq : videoSq
  299. ,goodsCd : goodsCd
  300. ,videoGb : videoGb
  301. ,kmcKey : kmcKey
  302. ,kufKey : kufKey
  303. ,dispYn : dispYn
  304. };
  305. var jsonData = JSON.stringify(data);
  306. gagajf.ajaxJsonSubmit('/goods/video/save', jsonData, fnSaveCallback);
  307. }
  308. })
  309. });
  310. var fnSaveCallback = function() {
  311. $('#btnSearch').click();
  312. }
  313. // 동영상파일 선택 시
  314. $('#detailForm input[name=file]').on('change', function() {
  315. var file = this.files[0];
  316. gagaKollus.upload('Goods', file, $('input[name=kufKey]'));
  317. });
  318. $(document).ready(function() {
  319. cfnCreateCalendar('#sellTerms', 'stDate', 'edDate', true, '등록일', true);
  320. // Create a agGrid
  321. gagaAgGrid.createGrid('gridList', gridOptions);
  322. //$('#btnSearch').click();
  323. });
  324. /*]]>*/
  325. </script>
  326. </html>