addReportPush.jsp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <%@ page language="java" contentType="text/html;charset=GBK" pageEncoding="GBK"%>
  2. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html;charset=GBK">
  7. <title>新增/编辑报表推送页面</title>
  8. <link href="${pageContext.request.contextPath }/main.css" rel="stylesheet" type="text/css" />
  9. <link href="${pageContext.request.contextPath }/liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  10. <script src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
  11. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
  12. <script src="${pageContext.request.contextPath}/liger/lib/json2.js" type="text/javascript"></script>
  13. <script type="text/javascript" src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/ligerui.all.js"></script>
  14. <script type="text/javascript" src="/shares/datePicker/WdatePicker.js"></script>
  15. <script type="text/javascript" src="/shares/js/constant.js"></script>
  16. <script type="text/javascript" src="/shares/js/common.js"></script>
  17. <script type="text/javascript">
  18. var isTreeLoad = false;
  19. $(document).ready(function(){
  20. // $("#assetBean\\.asset_number").val(1);
  21. // $("#assetBean\\.asset_unit_price").val(0);
  22. typeTree1 = $("#report_name").ligerComboBox({
  23. width : 180,
  24. selectBoxWidth: 220,
  25. selectBoxHeight: 230,
  26. valueField: 'text',
  27. treeLeafOnly: false,
  28. tree: { url: 'jReprotTypeAction.do?method=selectJReportType&time='+new Date().getTime(),
  29. checkbox : true,
  30. folderCheckbox : false,
  31. single : true,
  32. childIcon : '',
  33. parentIcon : '',
  34. idFieldName : 'universalid',
  35. parentIDFieldName : 'parent_id',
  36. onClick : function(node) {
  37. if(isTreeLoad){
  38. // var id = node.data.universalid;
  39. var ids = node.data.universalid;
  40. var report_name=node.data.text;
  41. var type=node.data.ty;
  42. // var asset_expected_life = node.data.asset_dep_year;
  43. // var asset_salvage_rate = node.data.asset_salvage_rate;
  44. if(type!='3'){
  45. }else{
  46. $("#report_id").val(ids);
  47. $("#report_name").val(report_name);
  48. getReportParam(ids);
  49. }
  50. // $("#assetBean\\.asset_dep_year").val(asset_expected_life);
  51. // $("#assetBean\\.asset_salvage_rate").val(asset_salvage_rate);
  52. }
  53. },
  54. onSuccess : function() {
  55. this.expandAll();
  56. isTreeLoad = true;
  57. }
  58. }
  59. });
  60. });
  61. var grid = null;
  62. var reportParam = null;
  63. var paramValueData = [ {
  64. param_value : 'currYear',
  65. param_text : '当前年(yyyy)'
  66. }, {
  67. param_value : 'currYearMonth',
  68. param_text : '当前年月(yyyy-MM)'
  69. }, {
  70. param_value : 'currYearMonthDay',
  71. param_text : '当前年月日(yyyy-MM-dd)'
  72. } ];
  73. $(function() {
  74. var report_push_id = "${reportPush.universalid }";
  75. if (report_push_id && report_push_id != "") {
  76. initgrid();
  77. }
  78. });
  79. function initgrid() {
  80. grid = $("#maingrid")
  81. .ligerGrid(
  82. {
  83. columns : [
  84. {
  85. display : "参数名称",
  86. name : "param_name",
  87. align : 'center',
  88. editor : {
  89. type : 'select',
  90. data : reportParam,
  91. valueField : 'key',
  92. textField : 'title'
  93. },
  94. render : function(item, rowindex, value) {
  95. if (reportParam) {
  96. for (var i = 0; i < reportParam.length; i++) {
  97. if (reportParam[i]['key'] == item.param_name) {
  98. return reportParam[i]['title'];
  99. }
  100. }
  101. }
  102. return item.param_text;
  103. }
  104. },
  105. {
  106. display : '值',
  107. name : 'param_value',
  108. align : 'center',
  109. width : 200,
  110. editor : {
  111. type : 'select',
  112. data : paramValueData,
  113. valueField : 'param_value',
  114. textField : 'param_text',
  115. width : 200
  116. },
  117. render : function(item, rowindex, value) {
  118. for (var i = 0; i < paramValueData.length; i++) {
  119. if (paramValueData[i]['param_value'] == item.param_value) {
  120. return paramValueData[i]['param_text'];
  121. }
  122. }
  123. return item.param_value;
  124. }
  125. },
  126. {
  127. display : '操作',
  128. isSort : false,
  129. render : function(rowdata, rowindex,
  130. value) {
  131. var h = "";
  132. if (!rowdata.universalid) {
  133. h += "<a href='javascript:beginEdit("
  134. + rowindex
  135. + ")'>修改</a> ";
  136. h += "<a href='javascript:cancelEdit("
  137. + rowindex
  138. + ",1)'>删除</a> ";
  139. } else if (!rowdata._editing) {
  140. h += "<a href='javascript:beginEdit("
  141. + rowindex
  142. + ")'>修改</a> ";
  143. h += "<a href='javascript:cancelEdit("
  144. + rowindex
  145. + ","
  146. + rowdata.universalid
  147. + ")'>删除</a> ";
  148. } else {
  149. h += "<a href='javascript:cancelEdit("
  150. + rowindex
  151. + ")'>取消</a> ";
  152. }
  153. return h;
  154. }
  155. } ],
  156. data : {
  157. Rows : []
  158. },
  159. width : '99%',
  160. // height : '99%',
  161. rowDraggable : true,
  162. usePager : false,
  163. enabledEdit : true,
  164. clickToEdit : false,
  165. rownumbers : true
  166. });
  167. }
  168. function addPushParamtRow() {
  169. var report_id = $("#report_id").val();
  170. // alert(report_id);
  171. if (report_id == "") {
  172. $.ligerDialog.alert('请先选择报表!', '提示', "warn");
  173. return;
  174. }
  175. grid.addEditRow();
  176. }
  177. function beginEdit(rowid) {
  178. grid.beginEdit(rowid);
  179. }
  180. function cancelEdit(rowid, isDelete) {
  181. grid.cancelEdit(rowid);
  182. if (isDelete) {
  183. grid.deleteRow(rowid);
  184. }
  185. }
  186. function endEdit() {
  187. if (grid) {
  188. grid.endEdit();
  189. var paramsData = JSON.stringify(grid.getData());
  190. // alert(paramsData);
  191. var msg = "";
  192. var arrays = [];
  193. $.each(grid.getData(), function(index, obj) {
  194. var param_name = obj.param_name;
  195. var param_value = obj.param_value;
  196. var html = "第" + (parseInt(index) + 1) + "行:";
  197. var content = "";
  198. arrays.push(param_name);
  199. if (param_name == null || param_name == "") {
  200. content += "参数名称不能为空;";
  201. }
  202. if (param_value == null || param_value == "") {
  203. content += "值不能为空;";
  204. }
  205. if (content != "") {
  206. html += content;
  207. msg += html + "<br/>";
  208. }
  209. });
  210. if (msg != "") {
  211. $.ligerDialog.error(msg);
  212. return;
  213. } else {
  214. arrays.sort();
  215. var content = "";
  216. for (var i = 1; i < arrays.length; i++) {
  217. if (arrays[i - 1] == arrays[i]) {
  218. content += arrays[i - 1] + ";";
  219. }
  220. }
  221. if (content != "") {
  222. $.ligerDialog.error("参数名称存在重复值,如下:<br/>" + content);
  223. return;
  224. }
  225. }
  226. $("#params_data").val(paramsData);
  227. }
  228. // $("#addproject").submit();
  229. saveReportPush();
  230. }
  231. function getReportParam(report_id) {
  232. // alert("report_id:"+report_id)
  233. if (report_id && report_id != "") {
  234. $.ajax({
  235. type : "POST",
  236. dataType : "json",
  237. timeout : 10000,
  238. cache : false,
  239. url : "reportPushAction.do?method=getReprotParam&report_id="
  240. + report_id + "&time=" + new Date().getTime(),
  241. success : function(data) {
  242. if (data) {
  243. reportParam = data;
  244. initgrid();
  245. }
  246. },
  247. error : showAjaxError
  248. });
  249. }
  250. }
  251. function checkForm() {
  252. var rs = $.validate({
  253. name : "report_id",
  254. model : [ {
  255. type : "require",
  256. msg : "报表不能为空!"
  257. } ]
  258. });
  259. rs = $.validate({
  260. name : "start_date",
  261. model : [ {
  262. type : "require",
  263. msg : "开始时间不能为空!"
  264. } ]
  265. }) && rs;
  266. if (rs) {
  267. return true;
  268. }
  269. return false;
  270. }
  271. //保存
  272. function saveReportPush() {
  273. //表单提交
  274. if (checkForm()) {
  275. $("#btnSave").attr({
  276. "disabled" : "disabled"
  277. });
  278. $("#reportPushForm").submit();
  279. }
  280. }
  281. // $(function() {
  282. // $("#report_id").ligerComboBox();
  283. // $("#execute_week_day").ligerComboBox();
  284. // $("#execute_state").ligerComboBox();
  285. // });
  286. </script>
  287. <style type="text/css">
  288. .file-style {
  289. width: 550px;
  290. }
  291. .file-style input[type='file'] {
  292. width: 300px;
  293. height: 24px;
  294. line-height: 22px;
  295. vertical-align: bottom;
  296. background-color: #fff;
  297. border: 1px solid #cccccc;
  298. margin-top: 2px;
  299. margin-bottom: 2px;
  300. }
  301. </style>
  302. </head>
  303. <body>
  304. <form id="reportPushForm" action="reportPushAction.do?method=doEditReportPush" method="post">
  305. <div id="title" class="form-button">
  306. <input id="btnSave" type="button" class="l-button" value="保存" onclick="endEdit()" />
  307. <input type="button" value="关闭" class="l-button" onclick="closeWindow();" />
  308. </div>
  309. <div class="container-layout">
  310. <div class="forum-container">
  311. <center>
  312. <table class="l-table-edit line">
  313. <tr>
  314. <td class="l-table-edit-text">报表<FONT COLOR="red">*</FONT>:
  315. </td>
  316. <td class="l-table-edit-td">
  317. <input type="hidden" id="report_id" name="reportPush.report_id" value="" />
  318. <input id="report_name" name="reportPush.report_name" value="" />
  319. </td>
  320. <!-- <td class="l-table-edit-td"><select id="report_id" name="reportPush.report_id" onchange="getReportParam(this.value)"> -->
  321. <!-- <option value="">请选择</option> -->
  322. <%-- <c:forEach items="${jlist }" var="jreport"> --%>
  323. <%-- <option value="${jreport.universalid }">${jreport.report_name }</option> --%>
  324. <%-- </c:forEach> --%>
  325. <!-- </select></td> -->
  326. </tr>
  327. <tr>
  328. <td class="l-table-edit-text" valign="top">参数设置:</td>
  329. <td class="l-table-edit-td">
  330. <div style="padding-top: 5px;">
  331. <input type="button" onClick="addPushParamtRow();" value="新增" />
  332. </div>
  333. <div class="l-clear"></div>
  334. <div id="maingrid" class="l-panel" style="margin-top: 5px"></div>
  335. <div style="height: 10px;"></div>
  336. </td>
  337. </tr>
  338. <tr>
  339. <td class="l-table-edit-text">开始时间<FONT COLOR="red">*</FONT>:
  340. </td>
  341. <td class="l-table-edit-td"><input type="text" class="Wdate" name="reportPush.start_date" id="start_date" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'%y-%M-%d'})"
  342. value="${reportPush.start_date }"></td>
  343. <tr>
  344. <td class="l-table-edit-text">执行日<FONT COLOR="red">*</FONT>:
  345. </td>
  346. <td class="l-table-edit-td"><input type="radio" name="reportPush.execute_day_type" id="execute_day" value="1" checked="checked" />每天 <br /> <input type="radio"
  347. name="reportPush.execute_day_type" value="2" />每周 <select id="execute_week_day" name="reportPush.execute_week_day" style="width: 128px;">
  348. <option value="1">一</option>
  349. <option value="2">二</option>
  350. <option value="3">三</option>
  351. <option value="4">四</option>
  352. <option value="5">五</option>
  353. <option value="6">六</option>
  354. <option value="7">七</option>
  355. </select> <br /> <input type="radio" name="reportPush.execute_day_type" value="3" />每月 <input type="text" class="Wdate" name="reportPush.execute_month_day" id="execute_month_day"
  356. onclick="WdatePicker({dateFmt:'dd'})" value="01" /></td>
  357. </tr>
  358. <tr>
  359. <td class="l-table-edit-text">执行状态<FONT COLOR="red">*</FONT>:
  360. </td>
  361. <td class="l-table-edit-td"><select id="execute_state" name="reportPush.execute_state" style="width: 128px;">
  362. <option value="1">运行</option>
  363. <option value="0">停止</option>
  364. </select></td>
  365. </tr>
  366. </table>
  367. <input type="hidden" id="params_data" name="params_data" value="" />
  368. <input type="hidden" id="universalid" name="universalid" value="${reportPush.universalid }" />
  369. <input type="hidden" id="tabid" name="tabid" value="${param.tabid }" />
  370. </center>
  371. </div>
  372. </div>
  373. </form>
  374. </body>
  375. </html>