fragment.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="renderer" content="webkit|ie-comp|ie-stand">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="Cache-Control" content="no-siteapp" />
  9. <!--[if lt IE 9]>
  10. <script type="text/javascript" src="${ctx}/assets/lib/html5.js"></script>
  11. <script type="text/javascript" src="${ctx}/assets/lib/respond.min.js"></script>
  12. <script type="text/javascript" src="${ctx}/assets/lib/PIE_IE678.js"></script>
  13. <![endif]-->
  14. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui/css/H-ui.min.css" />
  15. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/H-ui.admin.css" />
  16. <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/Hui-iconfont/1.0.7/iconfont.css" />
  17. <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/icheck/icheck.css" />
  18. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/skin/default/skin.css" id="skin" />
  19. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/style.css" />
  20. <script type="text/ecmascript" src="${ctx}/assets/lib/jquery/1.9.1/jquery.js"></script>
  21. <script type="text/javascript" src="${ctx}/assets/static/h-ui/js/H-ui.js"></script>
  22. <script type="text/javascript" src="${ctx}/assets/lib/layer/3.0.3/layer.js"></script>
  23. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqueryui/jquery-ui.css" />
  24. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqgrid/css/ui.jqgrid.css" />
  25. <script type="text/ecmascript" src="${ctx}/assets/lib/jqueryui/jquery-ui.js"></script>
  26. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/i18n/grid.locale-cn.js"></script>
  27. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/jquery.jqGrid.min.js"></script>
  28. <script type="text/javascript" src="${ctx}/assets/js/base.js"></script>
  29. <!--[if IE 6]>
  30. <script type="text/javascript" src="${ctx}/assets/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
  31. <script>DD_belatedPNG.fix('*');</script>
  32. <![endif]-->
  33. <script type="text/javascript">
  34. $(function() {
  35. $(window).resize(function(){
  36. $("#jqGrid").setGridWidth($(window).width()-40); 
  37. });
  38. $("#jqGrid").jqGrid({
  39. url : '${ctx}/myconsole/fragment/getByPage',
  40. editurl:"${ctx}/myconsole/fragment/saveOrUpdate2",
  41. mtype : "POST",
  42. datatype : "json",
  43. prmNames:{id:"keyid"},
  44. caption:'片段管理',
  45. colModel : [ {
  46. label : '任务编号',
  47. name : 'keyid',
  48. hidden : true,
  49. key : true,
  50. width : 50,
  51. }, {
  52. label : '片段编号',
  53. name : 'fragmentid',
  54. editable: false,
  55. width : 80
  56. }, {
  57. label : '站点编号',
  58. name : 'siteid',
  59. hidden : true,
  60. editable : true,
  61. edittype :"select",
  62. editoptions:{value:"${site.siteid}:a"}
  63. },{
  64. label : '片段名称 ',
  65. name : 'fragmentname',
  66. editable: true,
  67. edittype: "text",
  68. width : 80
  69. }, {
  70. label : '片段描述',
  71. name : 'fragmentdesc',
  72. editable: true,
  73. width : 80,
  74. edittype : "textarea",
  75. editoptions: {
  76. size:50,
  77. maxlength: 500,
  78. rows:5,
  79. cols:40
  80. }
  81. }, {
  82. label : '更新时间',
  83. name : 'updatetime',
  84. editable: false,
  85. width : 80
  86. }],
  87. rownumbers : true,//添加左侧行号
  88. viewrecords : true,//是否在浏览导航栏显示记录总数
  89. rowNum : 10,//每页显示记录数
  90. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  91. autowidth : true,
  92. height : 'auto',
  93. onSelectRow : function( rowid ) {
  94. if(rowid.length>10){
  95. var row = $(this).getRowData(rowid);
  96. $("#jqGridParam").setColProp('fragmentkeyid',{editoptions:{value:rowid+":a"}});
  97. $("#jqGridParam").setColProp('fragmentid',{editoptions:{value:row.fragmentid+":a"}});
  98. $("#jqGridParam").setColProp('siteid',{editoptions:{value:row.siteid+":a"}});
  99. $("#jqGridParam").setCaption("片段参数--"+row.fragmentid);
  100. $("#jqGridParam").jqGrid('setGridParam',{url: "${ctx}/myconsole/fragmentParam/getByPage?fragmentKeyID="+rowid});
  101. $("#jqGridParam").trigger("reloadGrid");
  102. }
  103. },
  104. pager : "#jqGridPager"
  105. });
  106. $('#jqGrid').navGrid('#jqGridPager',
  107. // the buttons to appear on the toolbar of the grid
  108. {
  109. edit : true,
  110. add : false,
  111. del : true,
  112. search : true,
  113. refresh : true,
  114. view : true,
  115. position : "left",
  116. cloneToTop : true
  117. },
  118. // options for the Edit Dialog
  119. {
  120. recreateForm : true,
  121. checkOnUpdate : true,
  122. checkOnSubmit : true,
  123. closeAfterEdit : true,
  124. onInitializeForm:function(formid) {
  125. },
  126. serializeEditData: function(postdata) {
  127. //myconsole.log(postdata);
  128. $.each(postdata,function (index, value) {
  129. //myconsole.log(index);
  130. if(index!="jqGrid_id" && index!="oper" && index!="keyid"){
  131. modifyJosnKey(postdata,index,"fragment."+index);
  132. }
  133. if(index=="keyid"){
  134. postdata["fragment."+index]=value
  135. }
  136. })
  137. //myconsole.log(postdata);
  138. return postdata;
  139. },
  140. afterSubmit: function (response, postdata) {
  141. // console.log(response);
  142. var res=eval('(' + response.responseText + ')');
  143. layer.msg(res.msg);
  144. return [res.state,res.msg,''];
  145. },
  146. errorTextFormat : function(data) {
  147. return 'Error: ' + data.responseText
  148. }
  149. },
  150. // options for the Add Dialog
  151. {
  152. closeAfterAdd : true,
  153. recreateForm : true,
  154. beforeSubmit: function(postdata, formid){
  155. $.each(postdata,function (index, value) {
  156. if(index!="jqGrid_id" && index!="oper"){
  157. modifyJosnKey(postdata,index,"fragment."+index);
  158. }
  159. })
  160. return[true,''];
  161. },
  162. afterSubmit: function (response, postdata) {
  163. // console.log(response);
  164. var res=eval('(' + response.responseText + ')');
  165. layer.msg(res.msg);
  166. return [res.state,res.msg,''];
  167. },
  168. errorTextFormat : function(data) {
  169. return 'Error: ' + data.responseText
  170. }
  171. },
  172. // options for the Delete Dailog
  173. {
  174. errorTextFormat : function(data) {
  175. return 'Error: ' + data.responseText
  176. }
  177. },{
  178. // search options 这里支持多条件查询
  179. multipleSearch: true,
  180. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  181. afterSubmit: function(r, data) {
  182. var messageString = r.responseText;
  183. var mesObj = eval('(' + messageString + ')');
  184. return [mesObj.state, mesObj.message];
  185. }
  186. }
  187. );
  188. //片段实例
  189. //区域绑定片段
  190. $("#jqGridParam").jqGrid({
  191. url : '${ctx}/myconsole/fragmentParam/getByPage',
  192. editurl:"${ctx}/myconsole/fragmentParam/saveOrUpdate2",
  193. mtype : "POST",
  194. datatype : "json",
  195. prmNames:{id:"keyid"},
  196. caption:'片段参数',
  197. colModel : [ {
  198. label : '任务编号',
  199. name : 'keyid',
  200. hidden : true,
  201. key : true,
  202. width : 50,
  203. }, {
  204. label : '模板组编号',
  205. name : 'fragmentkeyid',
  206. hidden : true,
  207. editable : true,
  208. edittype :"select",
  209. editoptions:{value:"a:a"}
  210. }, {
  211. label : '模板组编号',
  212. name : 'fragmentid',
  213. hidden : true,
  214. editable : true,
  215. edittype :"select",
  216. editoptions:{value:"a:a"}
  217. }, {
  218. label : '站点编号',
  219. name : 'siteid',
  220. hidden : true,
  221. editable : true,
  222. edittype :"select",
  223. editoptions:{value:"a:a"}
  224. }, {
  225. label : '参数类型',
  226. name : 'paramtype',
  227. editable : true,
  228. formatter:"select",
  229. edittype: "select",
  230. editoptions: {
  231. value: "${paramtype}"
  232. },
  233. stype:"select",
  234. searchoptions:{
  235. value: "${paramtype}"
  236. }
  237. }, {
  238. label : '参数名称',
  239. name : 'paramname',
  240. editable: true,
  241. formoptions:{
  242. elmsuffix:'*(英文)'
  243. },
  244. editoptions: {
  245. maxlength: 15
  246. },
  247. editrules:{required:true},
  248. width : 80
  249. }, {
  250. label : '参数描述',
  251. name : 'paramdesc',
  252. editable: true,
  253. width : 80,
  254. edittype : "textarea",
  255. formoptions:{
  256. elmsuffix:'*(中文)'
  257. },
  258. editoptions: {
  259. maxlength: 15
  260. },
  261. editrules:{required:true},
  262. editoptions: {
  263. size:50,
  264. maxlength: 500,
  265. rows:5,
  266. cols:40
  267. }
  268. }, {
  269. label : '更新时间',
  270. name : 'updatetime',
  271. editable: false,
  272. width : 80
  273. }],
  274. rownumbers : true,//添加左侧行号
  275. viewrecords : true,//是否在浏览导航栏显示记录总数
  276. rowNum : 10,//每页显示记录数
  277. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  278. autowidth : true,
  279. height : 'auto',
  280. pager : "#jqGridPagerParam"
  281. });
  282. $('#jqGridParam').navGrid('#jqGridPagerParam',
  283. //the buttons to appear on the toolbar of the grid
  284. {
  285. edit : true,
  286. add : true,
  287. del : true,
  288. search : true,
  289. refresh : true,
  290. view : true,
  291. position : "left",
  292. cloneToTop : true
  293. },
  294. //options for the Edit Dialog
  295. {
  296. recreateForm : true,
  297. checkOnUpdate : true,
  298. checkOnSubmit : true,
  299. closeAfterEdit : true,
  300. onInitializeForm:function(formid) {
  301. },
  302. serializeEditData: function(postdata) {
  303. //myconsole.log(postdata);
  304. $.each(postdata,function (index, value) {
  305. //myconsole.log(index);
  306. if(index!="jqGrid_id" && index!="oper" && index!="keyid"){
  307. modifyJosnKey(postdata,index,"fragmentParam."+index);
  308. }
  309. if(index=="keyid"){
  310. postdata["fragmentParam."+index]=value
  311. }
  312. })
  313. //myconsole.log(postdata);
  314. return postdata;
  315. },
  316. afterSubmit: function (response, postdata) {
  317. // console.log(response);
  318. var res=eval('(' + response.responseText + ')');
  319. layer.msg(res.msg);
  320. return [res.state,res.msg,''];
  321. },
  322. errorTextFormat : function(data) {
  323. return 'Error: ' + data.responseText
  324. }
  325. },
  326. //options for the Add Dialog
  327. {
  328. closeAfterAdd : true,
  329. recreateForm : true,
  330. beforeSubmit: function(postdata, formid){
  331. $.each(postdata,function (index, value) {
  332. if(index!="jqGrid_id" && index!="oper"){
  333. modifyJosnKey(postdata,index,"fragmentParam."+index);
  334. }
  335. })
  336. return[true,''];
  337. },
  338. afterSubmit: function (response, postdata) {
  339. // console.log(response);
  340. var res=eval('(' + response.responseText + ')');
  341. layer.msg(res.msg);
  342. return [res.state,res.msg,''];
  343. },
  344. errorTextFormat : function(data) {
  345. return 'Error: ' + data.responseText
  346. }
  347. },
  348. //options for the Delete Dailog
  349. {
  350. errorTextFormat : function(data) {
  351. return 'Error: ' + data.responseText
  352. }
  353. },{
  354. // search options 这里支持多条件查询
  355. multipleSearch: true,
  356. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  357. afterSubmit: function(r, data) {
  358. var messageString = r.responseText;
  359. var mesObj = eval('(' + messageString + ')');
  360. return [mesObj.state, mesObj.message];
  361. }
  362. }
  363. );
  364. $("#initFragment").click(function(){
  365. $.post("${ctx}/myconsole/fragment/initFragment",{},function(data){
  366. layer.msg("完成读取模板片段");
  367. $("#jqGrid").trigger("reloadGrid");
  368. })
  369. })
  370. })
  371. </script>
  372. <title>我的桌面</title>
  373. </head>
  374. <body>
  375. <div class="page-container">
  376. <div style="text-align:right">
  377. <button id="initFragment" class="btn btn-primary radius" type="button"><i class="Hui-iconfont">&#xe632;</i>读取模板片段信息</button>
  378. </div>
  379. <table id="jqGrid"></table>
  380. <div id="jqGridPager"></div>
  381. <div>&nbsp;</div>
  382. <table id="jqGridParam"></table>
  383. <div id="jqGridPagerParam"></div>
  384. </div>
  385. <footer class="footer mt-20">
  386. <div class="container">
  387. <p></p>
  388. </div>
  389. </footer>
  390. </body>
  391. </html>