fail-hs-pop-up.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. let selectBox = null;
  2. let searchButton = null;
  3. let textBox = null;
  4. let failHsPopupTb = null;
  5. let btnArr = [];
  6. let strtDt = null;
  7. let endDt = null;
  8. let endTime = null;
  9. let strtTime = null;
  10. btnArr = [
  11. strtDt ={
  12. box : null,
  13. value : new Date().setDate(new Date().getDate()-1),
  14. type : 'date',
  15. format : 'yyyy-MM-dd',
  16. class : 'strt-dt'
  17. },
  18. endDt ={
  19. box : null,
  20. value : new Date().setDate(new Date().getDate()-1),
  21. type : 'date',
  22. format : 'yyyy-MM-dd',
  23. class : 'end-dt'
  24. },
  25. endTime ={
  26. box : null,
  27. value : endSettingTime,
  28. type : 'time',
  29. interval : '10',
  30. format : 'HH시 mm분',
  31. class : 'end-time'
  32. },
  33. strtTime={
  34. box : null,
  35. value : firstSettingTime,
  36. type : 'time',
  37. interval : '10',
  38. format : 'HH시 mm분',
  39. class : 'strt-time'
  40. },
  41. ]
  42. const selectDataSource = [
  43. {
  44. name : '전체',
  45. uri : null,
  46. },
  47. {
  48. name : 'CCTV',
  49. uri : '/api/cctv/history/stts-hs/fail',
  50. },
  51. {
  52. name : 'VMS',
  53. uri : '/api/vms/history/stts/fail'
  54. },
  55. {
  56. name : 'VDS',
  57. uri : '/api/vds/history/stts/fail'
  58. },
  59. ];
  60. $(()=>{
  61. //시설물 구분 코드
  62. //시설물 구분에 따른 데이터 조회
  63. selectBox = $(".select-box").dxSelectBox({
  64. dataSource : null,
  65. value : null,
  66. width : 150,
  67. height : 30,
  68. displayExpr : 'fclt_nm',
  69. valueExpr : 'fclt_cd',
  70. stylingMode : 'outlined',
  71. }).dxSelectBox("instance");
  72. btnArr.map((item)=>{
  73. item.box = $('.' + item.class).dxDateBox({
  74. value : item.value,
  75. type : item.type,
  76. displayFormat : item.format,
  77. width : 100,
  78. height : 30,
  79. stylingMode : 'outlined',
  80. }).dxDateBox('instance');
  81. if(item.interval){
  82. item.box.option('interval', item.interval);
  83. }
  84. })
  85. textBox = $(".text-box").dxTextBox({
  86. width : 220,
  87. height : 30,
  88. stylingMode : 'outlined'
  89. }).dxTextBox("instance");
  90. searchButton = $(".search-btn").dxButton({
  91. width : 80,
  92. height : 31,
  93. stylingMode : 'outlined',
  94. icon : 'refresh',
  95. text : '조회',
  96. onClick(){
  97. fetchlistData();
  98. }
  99. }).dxButton("instance");
  100. failHsPopupTb = $(".FrmGisSearch").width('100%').height("100%").dxDataGrid({
  101. dataSource : null,
  102. allowColumnReordering : true,
  103. allowColumnResizing : true,
  104. showBorders : true,
  105. showColumnLines : true,
  106. rowAlternationEnabled : true,
  107. columnAutoWidth : true,
  108. focusedRowEnabled : true,
  109. keyExpr : ['fclt_type', 'fclt_id', 'crtn_dt'],
  110. noDataText : '표출할 정보가 없습니다.',
  111. filterRow : {
  112. visible: true,
  113. applyFilter: "auto",
  114. showOperationChooser:false,
  115. },
  116. scrolling : {
  117. mode : 'standard',
  118. },
  119. paging : {
  120. pageSize : 1000,
  121. },
  122. headerFilter : {
  123. visible: true,
  124. },
  125. columns : [
  126. {
  127. dataField : 'fclt_type',
  128. alignment : 'center',
  129. caption : '구분',
  130. groupIndex : 0,
  131. },
  132. {
  133. dataField : 'fclt_id',
  134. alignment : 'center',
  135. width : 120,
  136. caption : '시설물 ID',
  137. },
  138. {
  139. dataField : 'fclt_nm',
  140. alignment : 'center',
  141. caption : '시설물 명칭',
  142. cellTemplate(c,e){
  143. c.css('text-align','left');
  144. c.text(e.displayValue);
  145. }
  146. },
  147. {
  148. dataField : 'crtn_dt',
  149. alignment : 'center',
  150. caption : '발생시각',
  151. dataType : 'datetime',
  152. format : 'yyyy-MM-dd HH:mm:ss',
  153. },
  154. {
  155. dataField : 'comm_stts_desc',
  156. alignment : 'center',
  157. caption : '통신',
  158. width : 120,
  159. cellTemplate(c,e){
  160. c.css('height','1px');
  161. c.css('padding','1px');
  162. const div = $("<div>");
  163. div.addClass(e.data.comm_stts_cd);
  164. div.text(e.displayValue);
  165. c.append(div);
  166. }
  167. },
  168. {
  169. dataField : 'door_stts_desc',
  170. alignment : 'center',
  171. caption : '함체문',
  172. width : 120,
  173. cellTemplate(c,e){
  174. c.css('height','1px');
  175. c.css('padding','1px');
  176. const div = $("<div>");
  177. div.addClass(e.data.door_stts_cd);
  178. div.text(e.displayValue);
  179. c.append(div);
  180. }
  181. },
  182. {
  183. dataField : 'cbox_tmpr',
  184. alignment : 'center',
  185. caption : '함체온도',
  186. width : 120,
  187. cellTemplate(c,e){
  188. c.css('height','1px');
  189. c.css('padding','1px');
  190. const div = $("<div>");
  191. if (e.displayValue === 255 || e.displayValue === null) {
  192. div.addClass('gray');
  193. div.text('-');
  194. }
  195. else {
  196. div.text(e.displayValue);
  197. }
  198. div.addClass(e.data.comm_stts_cd);
  199. c.append(div);
  200. }
  201. },
  202. ],
  203. }).dxDataGrid('instance');
  204. fetchSelectData();
  205. })
  206. function fetchSelectData(){
  207. data = [];
  208. getData('/api/facility/stts-error/fclt-type', data);
  209. if ( data[0].length > 0) {
  210. selectBox.option('dataSource', data[0]);
  211. setValue(selectBox, data[0][0].fclt_cd);
  212. }
  213. }
  214. function fetchlistData(){
  215. const type = getValue(selectBox);
  216. console.log(type);
  217. if (type) {
  218. const result = validationCheck(strtDt.box, endDt.box, strtTime.box, endTime.box);
  219. if (!result) return false;
  220. const strtDtVal = getValue(strtDt.box);
  221. const endDtVal = getValue(endDt.box);
  222. const strtTimeVal = getValue(strtTime.box);
  223. const endTimeVal = getValue(endTime.box);
  224. const fromDt = getDate(strtDtVal, strtTimeVal);
  225. const toDt = getDate(endDtVal, endTimeVal);
  226. let data = [];
  227. getData('/api/facility/stts-error/list/' + type + '/' + fromDt + '/' + toDt, data);
  228. if ( data[0] ) {
  229. data[0].map((obj) => {
  230. if (obj.crtn_dt) obj.crtn_dt = new Date(getParseDateTime(obj.crtn_dt));
  231. });
  232. failHsPopupTb.option('dataSource', data[0]);
  233. console.log(data[0]);
  234. }
  235. alertConfirm('데이터 조회가 완료되었습니다. [' + data[0].length + '건]');
  236. }
  237. }