editReportPush.jsp 14 KB

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