index.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. /* 饼图 */
  2. (function() {
  3. /* 饼图初始化 */
  4. var myChartPie = echarts.init(document.querySelector(" .chart"));
  5. var placeHolderStyle = {
  6. normal: {
  7. color: '#fff',
  8. opacity: .1
  9. },
  10. emphasis: {
  11. color: '#fff',
  12. opacity: .1
  13. }
  14. }
  15. optionPie = {
  16. grid: {
  17. left: '4%',
  18. top: '4%',
  19. height: "100%",
  20. containLabel: true
  21. },
  22. textStyle: {
  23. fontSize: 16,
  24. color: '#40E7F4 '
  25. },
  26. tooltip: {
  27. trigger: 'item',
  28. formatter: "{a} :<br/>({d}%)"
  29. },
  30. color: ['#3FFFEA', '#FFFF00'],
  31. legend: {
  32. orient: 'horizontal',
  33. bottom: '0',
  34. left: '12%',
  35. data: ['失电', '低压'],
  36. textStyle: {
  37. color: '#40E7F4 ',
  38. fontSize: 12
  39. },
  40. formatter(name) {
  41. return name
  42. },
  43. itemWidth: 20,
  44. itemHeight: 10,
  45. itemGap: 10
  46. },
  47. series: [{
  48. name: '失电',
  49. type: 'pie',
  50. radius: ['70%', '80%'],
  51. center: ["50%", "40%"],
  52. label: false,
  53. startAngle: 90,
  54. clockWise: true, //顺时加载
  55. hoverAnimation: true,
  56. hoverOffset: 3,
  57. data: [{
  58. value: 103,
  59. name: '失电',
  60. },
  61. {
  62. value: 242,
  63. hoverAnimation: false, //鼠标移入变大
  64. itemStyle: placeHolderStyle
  65. }
  66. ]
  67. }, {
  68. name: '低压',
  69. type: 'pie',
  70. radius: ['50%', '60%'],
  71. center: ["50%", "40%"],
  72. label: false,
  73. startAngle: 270,
  74. clockWise: true,
  75. hoverAnimation: true,
  76. hoverOffset: 3,
  77. data: [{
  78. value: 242,
  79. name: '低压',
  80. },
  81. {
  82. value: 103,
  83. hoverAnimation: false,
  84. itemStyle: placeHolderStyle
  85. }
  86. ]
  87. }]
  88. };
  89. myChartPie.setOption(optionPie);
  90. window.addEventListener("resize", function() {
  91. myChartPie.resize();
  92. });
  93. // 数据统计ajax请求数据
  94. function getStatisticData2(queryParam = {}) {
  95. ajaxRequest(STATISTICS, "get", queryParam, function(result) {
  96. var data = result.data[0]
  97. myChartPie.setOption({
  98. series: [{
  99. data: [{
  100. value: data.powerLossAlarmNumber,
  101. name: '失电',
  102. },
  103. {
  104. value: data.lowPressureAlarmNumber,
  105. hoverAnimation: false, //鼠标移入变大
  106. itemStyle: placeHolderStyle
  107. }
  108. ]
  109. }, {
  110. data: [{
  111. value: data.lowPressureAlarmNumber,
  112. name: '低压',
  113. },
  114. {
  115. value: data.powerLossAlarmNumber,
  116. hoverAnimation: false,
  117. itemStyle: placeHolderStyle
  118. }
  119. ]
  120. }]
  121. })
  122. }, function(errorMsg) {
  123. alert("请求数据失败!");
  124. })
  125. }
  126. getStatisticData2()
  127. })();
  128. /* 地图 */
  129. (function() {
  130. var mm1;
  131. var mm2;
  132. var time = new Date();
  133. var y = time.getFullYear();
  134. var m = time.getMonth()+1;
  135. var d = time.getDate();
  136. var h = time.getHours();
  137. var mm = time.getMinutes();
  138. var s = time.getSeconds();
  139. if(mm<30){
  140. mm1=0;
  141. mm2=5;
  142. }else{
  143. mm1=30;
  144. mm2=34;
  145. }
  146. var datatime = y+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm1)+':'+add0(s);
  147. var datatime1 = y+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm2)+':'+add0(s);
  148. var mapStyle = 'amap://styles/659dc6c4753dc6e87c65c8a874c02133';
  149. var map1 = new AMap.Map('map1', {
  150. mapStyle: mapStyle, //样式URL
  151. viewMode: '3D',
  152. turboMode: false,
  153. resizeEnable: true,
  154. zoom: 11,
  155. center: [121.475644, 31.1857],
  156. features: ['bg', 'road', 'building'],
  157. pitch: 45,
  158. forceVector: true
  159. });
  160. function add0(m){return m<10?'0'+m:m }
  161. var StatusStore = [{
  162. "address": "沪太路8786弄155号临附近",
  163. "building_name": "宝辉冶金",
  164. "company_code": "2021-01-04 09:13:13",
  165. "company_name": "宝辉冶金",
  166. "d0": 221.5,
  167. "d0a": 0,
  168. "d0ac": 0,
  169. "d0o": 0,
  170. "d0oc": 0,
  171. "fulladdress": "上海市.上海市.沪太路8786弄155号临附近",
  172. "lat": 31.34759,
  173. "lng": 121.3313,
  174. "phone": "13816977298",
  175. "username": "裘怡",
  176. "xmlx": "商业"
  177. }, {
  178. "address": "嘉定区宝安公路2442号北80米",
  179. "building_name": "永鑫汽车配件",
  180. "company_code": "2021-01-04 10:55:02",
  181. "company_name": "永鑫汽车配件",
  182. "d0": 219.06,
  183. "d0a": 0,
  184. "d0ac": 0,
  185. "d0o": 0,
  186. "d0oc": 0,
  187. "fulladdress": "上海市.上海市.嘉定区.嘉定区宝安公路2442号北80米",
  188. "lat": 31.37482,
  189. "lng": 121.26621,
  190. "phone": "15122423833",
  191. "username": "韩锐",
  192. "xmlx": "商业"
  193. }];
  194. var current_company_code = "";
  195. var clear_detail_info = function() {
  196. var d0 = 0,
  197. d0o = 0,
  198. d0oc = 0,
  199. d0a = 0,
  200. d0ac = 0;
  201. var d1 = 0,
  202. d1o = 0,
  203. d1oc = 0,
  204. d1a = 0,
  205. d1ac = 0;
  206. var d2 = 0,
  207. d2o = 0,
  208. d2oc = 0,
  209. d2a = 0,
  210. d2ac = 0;
  211. var d6 = 0,
  212. d6o = 0,
  213. d6oc = 0,
  214. d6a = 0,
  215. d6ac = 0;
  216. var d7 = 0,
  217. d7o = 0,
  218. d7oc = 0,
  219. d7a = 0,
  220. d7ac = 0;
  221. var detail_info = document.getElementById('detail_info');
  222. var real_time_alarm_div = document.getElementById('real_time_alarm_div');
  223. var parent = document.getElementById('map1');
  224. if (detail_info != undefined) {
  225. parent.removeChild(detail_info);
  226. current_company_code = "";
  227. } else if (real_time_alarm_div != undefined) {
  228. parent.removeChild(real_time_alarm_div);
  229. }
  230. }
  231. // //撒点图表弹窗
  232. var showInfo = function(e) {
  233. var pixel = e.pixel;
  234. var company_code = e.target.getExtData().company_code;
  235. var detail_info;
  236. var parent = document.getElementById('map1')
  237. for (var i = 0; i < StatusStore.length; i++) {
  238. if (StatusStore[i].company_code == company_code) {
  239. if (current_company_code == company_code)
  240. return;
  241. clear_detail_info();
  242. current_company_code = company_code;
  243. var qobj = new Object();
  244. qobj.V_LOGINNAME = $("#V_LOGINNAME").val();
  245. qobj.V_PASSWORD = $("#V_PASSWORD").val();
  246. qobj.V_COMPANYID = company_code;
  247. qobj.I_COMMAND = 4;
  248. var qdata = "queryJson=" + JSON.stringify(qobj);
  249. // var qurl = 'https://iot.usky.cn/YtIoT/cgi-bin/WebAction2.cgi';
  250. var qurl = 'https://fire.usky.cn:8443/YtIoT/cgi-bin/WebAction.cgi';
  251. $.ajax({
  252. type: 'POST',
  253. url: qurl,
  254. data: qdata,
  255. success: function(result) {
  256. var json = eval('(' + result + ')');
  257. if (json.action == 'getAlarmList') {
  258. $(".alarm_tab_area").remove();
  259. if ((json.ALARM == undefined) || (json.ALARM.length == 0))
  260. return;
  261. var parent = document.getElementById('map1');
  262. json.ALARM.sort(alarmSortByTime);
  263. var area = document.createElement('div');
  264. area.id = 'alarm_tab_area';
  265. area.setAttribute('class', 'alarm_tab_area');
  266. parent.appendChild(area);
  267. }
  268. }
  269. });
  270. detail_info = document.createElement('div');
  271. detail_info.id = 'detail_info';
  272. detail_info.style.position = 'absolute';
  273. detail_info.style.top = (pixel.getY() - 210) + 'px';
  274. detail_info.style.left = (pixel.getX() - 113) + 'px';
  275. detail_info.style.width = '227px';
  276. detail_info.style.height = '164px';
  277. detail_info.style.backgroundImage = 'url(images/info_bg_wj.png)';
  278. detail_info.style.zIndex = '500';
  279. parent.appendChild(detail_info);
  280. var info_title = document.createElement('div');
  281. info_title.id = 'info_title';
  282. info_title.setAttribute('class', 'info_title');
  283. info_title.innerHTML = '<div style="display:inline-block;vertical-align:middle;align-self:center;">' + StatusStore[i].company_name + '</div>';
  284. detail_info.appendChild(info_title);
  285. var info_body0 = document.createElement('div');
  286. info_body0.id = 'info_body0';
  287. info_body0.setAttribute('class', 'info_body0');
  288. // info_body0.innerHTML = '地址:' + StatusStore[i].address;
  289. info_body0.innerHTML = '<span class="info-text">地理名称:</span>' + StatusStore[i].building_name;
  290. detail_info.appendChild(info_body0);
  291. var info_body1 = document.createElement('div');
  292. info_body1.id = 'info_body1';
  293. info_body1.setAttribute('class', 'info_body1');
  294. info_body1.innerHTML = '<span class="info-text">所在位置:</span>' + StatusStore[i].address;
  295. // info_body1.innerHTML = '联系人:' + StatusStore[i].username;
  296. detail_info.appendChild(info_body1);
  297. var info_body2 = document.createElement('div');
  298. info_body2.id = 'info_body2';
  299. info_body2.setAttribute('class', 'info_body2');
  300. info_body2.innerHTML = '<span class="info-text">电压值:</span>' + StatusStore[i].d0;
  301. // info_body2.innerHTML = '联系电话:' + StatusStore[i].phone;
  302. detail_info.appendChild(info_body2);
  303. var info_btn = document.createElement('div');
  304. if(StatusStore[i].building_name=="永鑫汽车配件"){
  305. var info_body3 = document.createElement('div');
  306. info_body3.id = 'info_body3';
  307. info_body3.setAttribute('class', 'info_body3');
  308. info_body3.innerHTML = '<span class="info-text">采集时间:</span>' + datatime;
  309. detail_info.appendChild(info_body3);
  310. }else{
  311. var info_body3 = document.createElement('div');
  312. info_body3.id = 'info_body3';
  313. info_body3.setAttribute('class', 'info_body3');
  314. info_body3.innerHTML = '<span class="info-text">采集时间:</span>' + datatime1;
  315. detail_info.appendChild(info_body3);
  316. }
  317. // var info_body3 = document.createElement('div');
  318. // info_body3.id = 'info_body3';
  319. // info_body3.setAttribute('class', 'info_body3');
  320. // info_body3.innerHTML = '<span class="info-text">采集时间:</span>' + StatusStore[i].company_code;
  321. // detail_info.appendChild(info_body3);
  322. var info_btn = document.createElement('div');
  323. // info_btn.id = 'info_btn';
  324. // info_btn.setAttribute('class', 'info_btn');
  325. // info_btn.innerHTML = '查看详情';
  326. // info_btn.company_code = company_code;
  327. // info_btn.onclick = function (e) {
  328. // var event = e;
  329. // location.href = baseUrl + 'view/frontpage/company.jsp?company_code=' + event.currentTarget.company_code;
  330. // }
  331. // detail_info.appendChild(info_btn);
  332. break;
  333. }
  334. }
  335. }
  336. //撒点
  337. var iconWidth = 28;
  338. var iconHeight = 28;
  339. var totalLng = 0;
  340. var totalLat = 0;
  341. var latngCount = 0;
  342. var markers = [];
  343. for (var i = 0; i < StatusStore.length; i++) {
  344. var obj = StatusStore[i];
  345. var iconurl = 'images/building_icon.png';
  346. // var iconurl = baseUrl + 'images/building_icon.png';
  347. if (obj.d0a != obj.d0ac)
  348. iconurl = 'images/building_alarm_icon.png';
  349. //iconurl = baseUrl + 'images/building_alarm_icon.png';
  350. if ((obj.lat > 30) && (obj.lat < 33) && (obj.lng > 120) && (obj.lng < 125)) {
  351. totalLng += obj.lng;
  352. totalLat += obj.lat;
  353. latngCount++;
  354. var marker = new AMap.Marker({
  355. icon: new AMap.Icon({
  356. size: new AMap.Size(iconWidth, iconHeight),
  357. image: iconurl,
  358. imageSize: new AMap.Size(iconWidth, iconHeight)
  359. }),
  360. position: new AMap.LngLat(obj.lng, obj.lat),
  361. extData: {
  362. icontype: 'company',
  363. company_code: obj.company_code
  364. },
  365. offset: new AMap.Pixel(-(iconWidth / 2), -(iconHeight / 2)),
  366. draggable: false,
  367. raiseOnDrag: false,
  368. autoRotation: false,
  369. label: {
  370. offset: new AMap.Pixel(-iconWidth - 5, -(iconHeight / 2) - 10),
  371. content: "<div id='label_" + obj.company_code + "' class='info " + ('shown') + "'>" + obj.company_name + "</div>",
  372. direction: 'right'
  373. }
  374. });
  375. // AMap.event.addListener(marker, 'click', showBuilding, this);
  376. AMap.event.addListener(marker, 'mouseover', showInfo, this);
  377. AMap.event.addListener(marker, 'mouseout', clear_detail_info, this);
  378. marker.setMap(map1);
  379. markers.push(marker);
  380. // if (!MapShow) {
  381. // }
  382. }
  383. }
  384. })();
  385. /* 数据统计 */
  386. (function() {
  387. // 数据统计ajax请求数据
  388. function getStatisticData(queryParam = {}) {
  389. ajaxRequest(STATISTICS, "GET", queryParam, function(result) {
  390. var data = result.data[0]
  391. $('#alarmNumber').html(data.alarmNumber)
  392. $('#processedAlarmNumber').html(data.processedAlarmNumber)
  393. $('#unprocessedAlarmNumber').html(data.unprocessedAlarmNumber)
  394. $('#powerLossAlarmNumber').html(data.powerLossAlarmNumber)
  395. $('#lowPressureAlarmNumber').html(data.lowPressureAlarmNumber)
  396. $('#siteNumber').html(data.siteNumber)
  397. }, function(errorMsg) {
  398. alert("请求数据失败!");
  399. })
  400. }
  401. getStatisticData()
  402. })();
  403. /* 设备列表 */
  404. (function() {
  405. // 设备列表查询ajax请求数据
  406. function getListData(queryParam = {}) {
  407. ajaxRequest(DEVICE_LIST, "POST", queryParam, function(result) {
  408. if (result.code) {
  409. var data = result.data
  410. console.log('data')
  411. console.log(data)
  412. var items = '';
  413. data.forEach(function(item, key) {
  414. var deviceStatusClassName = item.deviceStatus == '在线' ? 'online' : 'offline';
  415. items += ` <tr data-id=${item.deviceCode} class="detail">
  416. <td>${item.deviceName}</td>
  417. <td class="${deviceStatusClassName}">${item.deviceStatus}</td>
  418. <td>${item.deviceAdress}</td>
  419. </tr>`;
  420. })
  421. $('#deviceListBox').html(items)
  422. } else {
  423. alert('errorMSG')
  424. }
  425. }, function(errorMsg) {
  426. alert("请求数据失败!");
  427. }, 2)
  428. }
  429. getListData({ 'deviceCode': '1' })
  430. //按钮搜索
  431. $('#deviceButtonClick').on('click', function() {
  432. getListData(getSearchParamObj());
  433. })
  434. //拼接搜索条件
  435. function getSearchParamObj() {
  436. let queryParam = {};
  437. let deviceStatus = $('#deviceStatus').val();
  438. queryParam.deviceStatus = deviceStatus;
  439. return queryParam;
  440. }
  441. //设备详情弹框
  442. $(document).on('dblclick', 'tr.detail', function() {
  443. let dataId = $('.scroll tbody').find('.selected').data('id');
  444. // console.log('dataId')
  445. // alert(dataId);
  446. ajaxRequest(DEVICE_INFO_LIST, "POST", { "deviceCode": dataId }, function(result) {
  447. if (result.code) {
  448. var data = result.data[0]
  449. console.log('data')
  450. console.log(data)
  451. document.getElementById('dataTime').innerHTML="采集时间:"+data.dataTime;
  452. var items = ` <ul class="leftUl">
  453. <li>${data.Uab}</li>
  454. <li>${data.Ubc}</li>
  455. <li style="margin-bottom:50px">${data.Uca}</li>
  456. <li>${data.F}</li>
  457. </ul>
  458. <ul class="rightUl">
  459. <li>${data.Ia}</li>
  460. <li>${data.Ib}</li>
  461. <li style="margin-bottom:50px">${data.Ic}</li>
  462. <li>${data.P}</li>
  463. <li>${data.Q}</li>
  464. <li>${data.COS}</li>
  465. </ul>`;
  466. $('#txt-box').html(items)
  467. } else {
  468. alert('errorMSG')
  469. }
  470. }, function(errorMsg) {
  471. alert("请求数据失败!");
  472. }, 2)
  473. $('.deviceDetailOut').show()
  474. })
  475. $('.clsBtn,.cancel').click(function() {
  476. $('.deviceDetailOut').hide()
  477. })
  478. })();
  479. /* 告警列表 */
  480. (function() {
  481. // 告警列表查询ajax请求数据
  482. function getListData(queryParam = {}) {
  483. ajaxRequest(ALARM_LIST, "POST", queryParam, function(result) {
  484. // console.log(result)
  485. if (result.code) {
  486. var data = result.RESULT
  487. console.log('告警列表')
  488. console.log(data)
  489. var items = '';
  490. data.forEach(function(item, key) {
  491. var digitalValueClassName = item.digitalValue == '动作' ? 'color-red' : 'color-orange';
  492. var handleStatusClassName = item.handleState == '已处理' ? 'processed' : 'unprocess';
  493. // var timeConsuming = item.timeConsuming == '--' ? '--' : item.timeConsuming.hours;
  494. items += "<tr data-id=" + item.id + " data-alarm='" + JSON.stringify(item) + "'>" +
  495. "<td>" + item.companyName + "</td>" +
  496. "<td>" + item.companyAdress + "</td>" +
  497. "<td class='" + digitalValueClassName + "'>" + item.digitalValue + "</td>" +
  498. "<td>" + item.measDesc + "</td>" +
  499. "<td>" + item.sendingTime + "</td>" +
  500. "<td>" + item.timeConsuming + "</td>" +
  501. "<td class='" + handleStatusClassName + "'>" + item.handleState + "</td>" +
  502. "</tr>"
  503. })
  504. $('#alarmListBox').html(items)
  505. } else {
  506. alert('errorMSG')
  507. }
  508. }, function(errorMsg) {
  509. alert("请求数据失败!");
  510. }, 2)
  511. }
  512. getListData()
  513. //按钮搜索
  514. $('#alarmButtonClick').on('click', function() {
  515. getListData(getAlarmSearchParamObj());
  516. })
  517. //拼接搜索条件
  518. function getAlarmSearchParamObj() {
  519. let queryParam = {};
  520. let digitalValue = $('#digitalValue').val()
  521. let startTime = $('#startTime').val();
  522. let endTime = $('#endTime').val();
  523. queryParam.digitalValue = digitalValue;
  524. queryParam.startTime = startTime;
  525. queryParam.endTime = endTime;
  526. return queryParam;
  527. }
  528. //处置弹框
  529. $(document).on('dblclick', '.alarm-table tbody tr', function() {
  530. let alarmInfo = $('.scroll tbody').find('.selected').data('alarm');
  531. // console.log('alarmInfo')
  532. // console.log(alarmInfo)
  533. $('.alarmHanleOut input[name=companyName]').val(alarmInfo.siteName);
  534. $('.alarmHanleOut input[name=companyAdress]').val(alarmInfo.companyAdress);
  535. $('.alarmHanleOut input[name=lineName]').val(alarmInfo.lineName);
  536. $('.alarmHanleOut input[name=measName]').val(alarmInfo.measName);
  537. $('.alarmHanleOut input[name=digitalValue]').val(alarmInfo.digitalValue);
  538. $('.alarmHanleOut input[name=userName]').val(alarmInfo.userName);
  539. $('.alarmHanleOut input[name=userPhone]').val(alarmInfo.userPhone);
  540. $('.alarmHanleOut input[name=measDesc]').val(alarmInfo.measDesc);
  541. $('.alarmHanleOut input[name=deviceCode]').val(alarmInfo.deviceCode);
  542. $('.alarmHanleOut input[name=handleContent]').val(alarmInfo.handleContent);
  543. // $('.alarmHanleOut input[name=handleMisinformation]').val(alarmInfo.handleMisinformation);
  544. $('.alarmHanleOut input[name=alarmId]').val(alarmInfo.alarmId);
  545. $('.alarmHanleOut input[name=pictureUrl]').val(alarmInfo.pictureUrl);
  546. if(alarmInfo.handleState=="已处理" && alarmInfo.pictureUrl!=null && alarmInfo.pictureUrl!=""){
  547. document.getElementById('drop_area_addimg').setAttribute('src','https://iot.usky.cn/YtIoT'+alarmInfo.pictureUrl);
  548. }
  549. if(alarmInfo.handleState=="已处理"){
  550. $("input[name='handleMisinformation']").each(function() {
  551. if ($(this).val() != alarmInfo.handleMisinformation) {
  552. $(this).removeAttr("checked");
  553. } else {
  554. $(this).prop("checked", "checked");
  555. }
  556. });
  557. // $('.alarmHanleOut input[name=handleMisinformation]').val(alarmInfo.handleMisinformation);
  558. }
  559. layui.use(['form'],function(){
  560. var form = layui.form;
  561. form.render('radio');
  562. })
  563. $('.alarmHanleOut').show()
  564. })
  565. $('.clsBtn,.cancel').click(function() {
  566. $('.alarmHanleOut').hide()
  567. $("tbody tr").removeClass("selected");
  568. })
  569. /* 处理发送请求 */
  570. $('#dataUpdate').click(function() {
  571. //获取表单的值 并转换成对象
  572. let allParam = serializeArrayToObj($("#alarmHandleForm").serializeArray());
  573. //验证数据是否为空
  574. let res = validParamIsEmpty(allParam, {
  575. // "ownerMan": "请填写单位负责人",
  576. });
  577. if (res.code == -1) {
  578. alert(res.msg);
  579. return;
  580. }
  581. //验证图片是否为空
  582. // var uploadImgSrc = $('#drop_area img').attr('src')
  583. // if (uploadImgSrc == 'images/upload.png') {
  584. // alert('请上传图片')
  585. // }
  586. //验证通过 请求ajax
  587. ajaxRequest(ALARM_HANDLE, "POST", allParam, function(result) {
  588. // if (result.code) {
  589. // alert('修改成功')
  590. // } else {
  591. // alert('修改失败')
  592. // }
  593. $('.alarmHanleOut').hide()
  594. getListData();
  595. document.getElementById('drop_area_addimg').setAttribute('src','images/upload.png');
  596. }, function(errorMsg) {
  597. alert("异常错误!");
  598. }, 2)
  599. })
  600. $('#dataCancel').click(function() {
  601. document.getElementById('drop_area_addimg').setAttribute('src','images/upload.png');
  602. })
  603. })()