WaterAnalysis.cshtml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_LayoutIndex.cshtml";
  4. }
  5. <script src="~/Content/scripts/utils/learun-ui.js"></script>
  6. <script>
  7. var checkedIds = [];
  8. $(function () {
  9. InitialPage();
  10. GetTree();
  11. GetMonthGrid();
  12. GetYearGrid();
  13. //deviceDay.init();
  14. //deviceYear.init();
  15. });
  16. //初始化页面
  17. function InitialPage() {
  18. //layout布局
  19. $('#layout').layout({
  20. applyDemoStyles: true,
  21. onresize: function () {
  22. $(window).resize();
  23. }
  24. });
  25. //resize重设(表格、树形)宽高
  26. $(window).resize(function (e) {
  27. window.setTimeout(function () {
  28. $("#itemTree").setTreeHeight($(window).height() - 52);
  29. $('#yearGridTable').setGridWidth(($('.gridPanel').width()));
  30. }, 200);
  31. e.stopPropagation();
  32. });
  33. $("#tabs").tabs({
  34. });
  35. }
  36. function getSelectedTabIndex() {
  37. return $("#tabs").tabs('option', 'active');
  38. }
  39. //被选中元素的ID,TEXT 数组维护
  40. function GetAllCheckNodes(id, status, text) {
  41. //数据加入数组
  42. if (status == 1) {
  43. if (!checkedIds.contain(id)) {
  44. checkedIds.push(id);
  45. }
  46. }
  47. if (status == 0) {
  48. if (checkedIds.contain(id)) {
  49. checkedIds.splice(checkedIds.indexOf(id), 1);
  50. }
  51. }
  52. }
  53. function GetTree() {
  54. var item = {
  55. height: $(window).height() - 52,
  56. url: "/PipeNetworkManage/Meter/GetMeterTreeJson?showCheck=true",
  57. oncheckboxclick: function (item, status) {
  58. GetAllCheckNodes(item.id, status, item.text);//维护 选中元素id的数组
  59. }
  60. };
  61. //初始化
  62. $("#itemTree").treeview(item);
  63. }
  64. //AutoComplete
  65. var deviceDay = {
  66. init: function () {
  67. $('#deviceDay').autocomplete({
  68. source: function (request, response) {
  69. $.ajax({
  70. url: "/IPm/DeviceInfo/GetDeviceBySearch",
  71. type: "GET",
  72. data: { q: $('#deviceDay').val() },
  73. dataType: "json",
  74. success: function (data) {
  75. response($.map(data, function (item) {
  76. console.log(item);
  77. return {
  78. label: item.label,
  79. value: "dev" + item.value
  80. }
  81. }));
  82. }
  83. });
  84. },
  85. select: function (event, ui) {
  86. DepartmentId = "";
  87. TypeID = "";
  88. DeviceID = "";
  89. $("#deviceDay").val(ui.item.label);
  90. DeviceID = ui.item.value.substring(3);
  91. PointTreeCode = ui.item.value;
  92. return false;
  93. }
  94. });
  95. }
  96. };
  97. var deviceYear = {
  98. init: function () {
  99. $('#deviceYear').autocomplete({
  100. source: function (request, response) {
  101. $.ajax({
  102. url: "/IPm/DeviceInfo/GetDeviceBySearch",
  103. type: "GET",
  104. data: { q: $('#deviceYear').val() },
  105. dataType: "json",
  106. success: function (data) {
  107. response($.map(data, function (item) {
  108. console.log(item);
  109. return {
  110. label: item.label,
  111. value: "dev" + item.value
  112. }
  113. }));
  114. }
  115. });
  116. },
  117. select: function (event, ui) {
  118. DepartmentId = "";
  119. TypeID = "";
  120. DeviceID = "";
  121. $("#deviceYear").val(ui.item.label);
  122. DeviceID = ui.item.value.substring(3);
  123. PointTreeCode = ui.item.value;
  124. return false;
  125. }
  126. });
  127. }
  128. };
  129. function GetMonthGrid() {
  130. var $gridTable = $('#monthGridTable');
  131. $gridTable.jqGrid({
  132. url: "/PipeNetworkManage/Statistical/GetMonthReport",
  133. datatype: "json",
  134. height: $(window).height() - 200,
  135. rownumbers: true,
  136. colModel: [
  137. { name: "DevName", label: "测点名称", width: 160, align: "center" },
  138. { name: "Day1", label: "1日", align: "right", width: 80 },
  139. { name: "Day2", label: "2日", align: "right", width: 80 },
  140. { name: "Day3", label: "3日", align: "right", width: 80 },
  141. { name: "Day4", label: "4日", align: "right", width: 80 },
  142. { name: "Day5", label: "5日", align: "right", width: 80 },
  143. { name: "Day6", label: "6日", align: "right", width: 80 },
  144. { name: "Day7", label: "7日", align: "right", width: 80 },
  145. { name: "Day8", label: "8日", align: "right", width: 80 },
  146. { name: "Day9", label: "9日", align: "right", width: 80 },
  147. { name: "Day10", label: "10日", align: "right", width: 80 },
  148. { name: "Day11", label: "11日", align: "right", width: 80 },
  149. { name: "Day12", label: "12日", align: "right", width: 80 },
  150. { name: "Day13", label: "13日", align: "right", width: 80 },
  151. { name: "Day14", label: "14日", align: "right", width: 80 },
  152. { name: "Day15", label: "15日", align: "right", width: 80 },
  153. { name: "Day16", label: "16日", align: "right", width: 80 },
  154. { name: "Day17", label: "17日", align: "right", width: 80 },
  155. { name: "Day18", label: "18日", align: "right", width: 80 },
  156. { name: "Day19", label: "19日", align: "right", width: 80 },
  157. { name: "Day20", label: "20日", align: "right", width: 80 },
  158. { name: "Day21", label: "21日", align: "right", width: 80 },
  159. { name: "Day22", label: "22日", align: "right", width: 80 },
  160. { name: "Day23", label: "23日", align: "right", width: 80 },
  161. { name: "Day24", label: "24日", align: "right", width: 80 },
  162. { name: "Day25", label: "25日", align: "right", width: 80 },
  163. { name: "Day26", label: "26日", align: "right", width: 80 },
  164. { name: "Day27", label: "27日", align: "right", width: 80 },
  165. { name: "Day28", label: "28日", align: "right", width: 80 },
  166. { name: "Day29", label: "29日", align: "right", width: 80 },
  167. { name: "Day30", label: "30日", align: "right", width: 80 },
  168. { name: "Day31", label: "31日", align: "right", width: 80 }
  169. ],
  170. viewrecords: true,
  171. rowNum: 30,
  172. rowList: [30, 50, 100],
  173. pager: "#monthGridPager",
  174. gridview: true,
  175. gridComplete: function () {
  176. }
  177. });
  178. //查询事件
  179. $("#btn_month_Search").click(function () {
  180. var monthSelect = $("#monthSelect").val();
  181. if (checkedIds.length == 0) {
  182. dialogMsg('请选择测点!', 0);
  183. return;
  184. }
  185. if (monthSelect.length <= 0) {
  186. dialogMsg('请选择时间!', 0);
  187. return;
  188. }
  189. $gridTable.jqGrid('setGridParam', {
  190. postData: { DeviceID: checkedIds.toString(), time: monthSelect },
  191. page: 1
  192. }).trigger('reloadGrid');
  193. });
  194. }
  195. function GetYearGrid() {
  196. var $gridTable = $('#yearGridTable');
  197. //$gridTable.width = $(".gridPanel").width();
  198. $gridTable.jqGrid({
  199. url: "/PipeNetworkManage/Statistical/GetYearReport",
  200. datatype: "json",
  201. width: $(".gridPanel").width(),
  202. autowidth: true,
  203. height: $(window).height() - 200,
  204. rownumbers: true,
  205. colModel: [
  206. { name: "DevName", label: "测点名称", align: "center", frozen: true },
  207. { name: "Month1", label: "1月", align: "center", width: 120 },
  208. { name: "Month2", label: "2月", align: "center", width: 120 },
  209. { name: "Month3", label: "3月", align: "center", width: 120 },
  210. { name: "Month4", label: "4月", align: "center", width: 120 },
  211. { name: "Month5", label: "5月", align: "center", width: 120 },
  212. { name: "Month6", label: "6月", align: "center", width: 120 },
  213. { name: "Month7", label: "7月", align: "center", width: 120 },
  214. { name: "Month8", label: "8月", align: "center", width: 120 },
  215. { name: "Month9", label: "9月", align: "center", width: 120 },
  216. { name: "Month10", label: "10月", align: "center", width: 120 },
  217. { name: "Month11", label: "11月", align: "center", width: 120 },
  218. { name: "Month12", label: "12月", align: "center", width: 120 }
  219. ],
  220. viewrecords: true,
  221. rowNum: 30,
  222. rowList: [30, 50, 100],
  223. pager: "#yearGridPager",
  224. gridview: true,
  225. gridComplete: function () {
  226. }
  227. });
  228. //查询事件
  229. $("#btn_year_Search").click(function () {
  230. var yearSelect = $("#yearSelect").val();
  231. if (checkedIds.length == 0) {
  232. dialogMsg('请选择测点!', 0);
  233. return;
  234. }
  235. if (yearSelect.length <= 0) {
  236. dialogMsg('请选择时间!', 0);
  237. return;
  238. }
  239. $gridTable.jqGrid('setGridParam', {
  240. postData: { DeviceID: checkedIds.toString(), time: yearSelect },
  241. page: 1
  242. }).trigger('reloadGrid');
  243. });
  244. }
  245. //导出-月分析
  246. function btn_month_export() {
  247. dialogOpen({
  248. id: "ExcelIExportDialog",
  249. title: '导出月分析',
  250. url: '/Utility/ExcelExportForm?gridId=monthGridTable&filename=用水分析日报表',
  251. width: "500px",
  252. height: "380px",
  253. callBack: function (iframeId) {
  254. top.frames[iframeId].AcceptClick();
  255. }, btn: ['导出Excel', '关闭']
  256. });
  257. }
  258. //导出-年分析
  259. function btn_year_export() {
  260. dialogOpen({
  261. id: "ExcelIExportDialog",
  262. title: '导出年分析',
  263. url: '/Utility/ExcelExportForm?gridId=yearGridTable&filename=用水分析月报表',
  264. width: "500px",
  265. height: "380px",
  266. callBack: function (iframeId) {
  267. top.frames[iframeId].AcceptClick();
  268. }, btn: ['导出Excel', '关闭']
  269. });
  270. }
  271. </script>
  272. <div class="ui-layout" id="layout" style="height: 100%; width: 100%;">
  273. <div class="ui-layout-west">
  274. <div class="west-Panel">
  275. <div class="panel-Title">测点列表</div>
  276. <div id="itemTree"></div>
  277. </div>
  278. </div>
  279. <div class="ui-layout-center">
  280. <div class="center-Panel">
  281. <div id="tabs">
  282. <ul>
  283. <li><a href="#tabs-1">日报统计</a></li>
  284. <li><a href="#tabs-2">月报统计</a></li>
  285. </ul>
  286. <div id="tabs-1">
  287. <div class="titlePanel">
  288. <div class="title-search">
  289. <table>
  290. <tr>
  291. @*<td style="padding-left: 10px;">测点名称:
  292. </td>
  293. <td style="padding-left: 10px;">
  294. <input type="text" id="deviceDay" class="form-control easyui-combobox" />
  295. </td>*@
  296. <td style="padding-left: 10px;">统计月份:
  297. </td>
  298. <td style="padding-left: 10px;">
  299. <input id="monthSelect" readonly type="text" value="@LeaRun.Util.Time.Now.Year-@LeaRun.Util.Time.Now.Month" class="form-control input-wdatepicker" onfocus="WdatePicker({maxDate:'%y-%M-%d',dateFmt:'yyyy-MM'})" style="width: 155px">
  300. </td>
  301. <td style="padding-left: 10px;">
  302. <a id="btn_month_Search" class="btn btn-primary">&nbsp;查&nbsp;&nbsp;询</a>
  303. </td>
  304. </tr>
  305. </table>
  306. </div>
  307. <div class="toolbar">
  308. <div class="btn-group">
  309. <a id="lr-replace" class="btn btn-default" onclick="reload();"><i class="fa fa-refresh"></i>&nbsp;刷新</a>
  310. <a id="lr-export" class="btn btn-default" onclick="btn_month_export()"><i class="fa fa-sign-out"></i>&nbsp;导出</a>
  311. </div>
  312. </div>
  313. </div>
  314. <div class="gridPanel">
  315. <table id="monthGridTable"></table>
  316. <div id="monthGridPager"></div>
  317. </div>
  318. </div>
  319. <div id="tabs-2">
  320. <div class="titlePanel">
  321. <div class="title-search">
  322. <table>
  323. <tr>
  324. @*<td style="padding-left: 10px;">测点名称:
  325. </td>
  326. <td style="padding-left: 10px;">
  327. <input type="text" id="deviceYear" class="form-control easyui-combobox" />
  328. </td>*@
  329. <td style="padding-left: 10px;">统计月份:
  330. </td>
  331. <td style="padding-left: 10px;">
  332. <input id="yearSelect" readonly type="text" value="@LeaRun.Util.Time.Now.Year" class="form-control input-wdatepicker" onfocus="WdatePicker({maxDate:'%y-%M-%d',dateFmt:'yyyy'})" style="width: 155px">
  333. </td>
  334. <td style="padding-left: 10px;">
  335. <a id="btn_year_Search" class="btn btn-primary">&nbsp;查&nbsp;&nbsp;询</a>
  336. </td>
  337. </tr>
  338. </table>
  339. </div>
  340. <div class="toolbar">
  341. <div class="btn-group">
  342. <a class="btn btn-default" onclick="reload();"><i class="fa fa-refresh"></i>&nbsp;刷新</a>
  343. <a class="btn btn-default" onclick="btn_year_export()"><i class="fa fa-sign-out"></i>&nbsp;导出</a>
  344. </div>
  345. </div>
  346. </div>
  347. <div class="gridPanel">
  348. <table id="yearGridTable"></table>
  349. <div id="yearGridPager"></div>
  350. </div>
  351. </div>
  352. </div>
  353. </div>
  354. </div>
  355. </div>