fragmentarea.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  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/frangmentArea/getByPage',
  40. editurl:"${ctx}/myconsole/frangmentArea/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 : 'areaid',
  54. editable: false,
  55. width : 80
  56. }, {
  57. label : '区域名称',
  58. name : 'areaname',
  59. editable: true,
  60. width : 80
  61. }, {
  62. label : '区域描述',
  63. name : 'areadesc',
  64. editable: true,
  65. width : 80,
  66. edittype : "textarea",
  67. editoptions: {
  68. size:50,
  69. maxlength: 500,
  70. rows:"5",
  71. cols:"40"
  72. }
  73. }, {
  74. label : '模板文件',
  75. name : 'templatefile',
  76. editable: false,
  77. width : 80
  78. }],
  79. rownumbers : true,//添加左侧行号
  80. viewrecords : true,//是否在浏览导航栏显示记录总数
  81. rowNum : 10,//每页显示记录数
  82. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  83. autowidth : true,
  84. height : 'auto',
  85. onSelectRow : function( rowid ) {
  86. if(rowid.length>10){
  87. var row = $(this).getRowData(rowid);
  88. $("#jqGridBind").setColProp('areakeyid',{editoptions:{value:rowid+":a"}});
  89. $("#jqGridBind").setColProp('areaid',{editoptions:{value:row.areaid+":a"}});
  90. $("#jqGridBind").setCaption("片段绑定--"+row.areaid);
  91. $("#jqGridBind").jqGrid('setGridParam',{url: "${ctx}/myconsole/fragmentBind/getByPage?areaKeyID="+rowid});
  92. $("#jqGridBind").trigger("reloadGrid");
  93. }
  94. },
  95. pager : "#jqGridPager"
  96. });
  97. $('#jqGrid').navGrid('#jqGridPager',
  98. // the buttons to appear on the toolbar of the grid
  99. {
  100. edit : true,
  101. add : false,
  102. del : false,
  103. search : true,
  104. refresh : true,
  105. view : true,
  106. position : "left",
  107. cloneToTop : true
  108. },
  109. // options for the Edit Dialog
  110. {
  111. recreateForm : true,
  112. checkOnUpdate : true,
  113. checkOnSubmit : true,
  114. closeAfterEdit : true,
  115. onInitializeForm:function(formid) {
  116. },
  117. serializeEditData: function(postdata) {
  118. //myconsole.log(postdata);
  119. $.each(postdata,function (index, value) {
  120. //myconsole.log(index);
  121. if(index!="jqGrid_id" && index!="oper" && index!="keyid"){
  122. modifyJosnKey(postdata,index,"fragmentArea."+index);
  123. }
  124. if(index=="keyid"){
  125. postdata["fragmentArea."+index]=value
  126. }
  127. })
  128. //myconsole.log(postdata);
  129. return postdata;
  130. },
  131. afterSubmit: function (response, postdata) {
  132. // console.log(response);
  133. var res=eval('(' + response.responseText + ')');
  134. layer.msg(res.msg);
  135. return [res.state,res.msg,''];
  136. },
  137. errorTextFormat : function(data) {
  138. return 'Error: ' + data.responseText
  139. }
  140. },
  141. // options for the Add Dialog
  142. {
  143. closeAfterAdd : true,
  144. recreateForm : true,
  145. beforeSubmit: function(postdata, formid){
  146. $.each(postdata,function (index, value) {
  147. if(index!="jqGrid_id" && index!="oper"){
  148. modifyJosnKey(postdata,index,"fragmentArea."+index);
  149. }
  150. })
  151. return[true,''];
  152. },
  153. afterSubmit: function (response, postdata) {
  154. // console.log(response);
  155. var res=eval('(' + response.responseText + ')');
  156. layer.msg(res.msg);
  157. return [res.state,res.msg,''];
  158. },
  159. errorTextFormat : function(data) {
  160. return 'Error: ' + data.responseText
  161. }
  162. },
  163. // options for the Delete Dailog
  164. {
  165. errorTextFormat : function(data) {
  166. return 'Error: ' + data.responseText
  167. }
  168. },{
  169. // search options 这里支持多条件查询
  170. multipleSearch: true,
  171. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  172. afterSubmit: function(r, data) {
  173. var messageString = r.responseText;
  174. var mesObj = eval('(' + messageString + ')');
  175. return [mesObj.state, mesObj.message];
  176. }
  177. }
  178. );
  179. //区域绑定片段
  180. $("#jqGridBind").jqGrid({
  181. url : '${ctx}/myconsole/fragmentBind/getByPage',
  182. editurl:"${ctx}/myconsole/fragmentBind/saveOrUpdate2",
  183. mtype : "POST",
  184. datatype : "json",
  185. prmNames:{id:"keyid"},
  186. caption:'绑定片段',
  187. sortname: 'sortid',
  188. sortorder: "asc",
  189. colModel : [ {
  190. label : '任务编号',
  191. name : 'keyid',
  192. hidden : true,
  193. key : true,
  194. width : 50,
  195. }, {
  196. label : '区域主键编号',
  197. name : 'areakeyid',
  198. hidden : true,
  199. editable : true,
  200. edittype :"select",
  201. editoptions:{value:"a:a"}
  202. }, {
  203. label : '区域编号',
  204. name : 'areaid',
  205. hidden : true,
  206. editable : true,
  207. edittype :"select",
  208. editoptions:{value:"a:a"}
  209. },{
  210. label : '绑定片段实例',
  211. name : 'bindfragment',
  212. editable: true,
  213. formatter:"select",
  214. edittype: "select",
  215. editoptions: {
  216. value: "${fragmentInstances}"
  217. },
  218. stype:"select",
  219. searchoptions:{
  220. value: "${fragmentInstances}"
  221. },
  222. formoptions:{
  223. elmsuffix:'*'
  224. },
  225. editrules:{required:true},
  226. width : 80
  227. }, {
  228. label : '排序值',
  229. name : 'sortid',
  230. editable: true,
  231. formoptions:{
  232. elmsuffix:'*(整数)'
  233. },
  234. editoptions: {
  235. maxlength: 15
  236. },
  237. editrules:{required:true,integer:true},
  238. width : 80
  239. }],
  240. rownumbers : true,//添加左侧行号
  241. viewrecords : true,//是否在浏览导航栏显示记录总数
  242. rowNum : 10,//每页显示记录数
  243. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  244. autowidth : true,
  245. height : 'auto',
  246. pager : "#jqGridPagerBind"
  247. });
  248. $('#jqGridBind').navGrid('#jqGridPagerBind',
  249. //the buttons to appear on the toolbar of the grid
  250. {
  251. edit : true,
  252. add : true,
  253. del : true,
  254. search : true,
  255. refresh : true,
  256. view : true,
  257. position : "left",
  258. cloneToTop : true
  259. },
  260. //options for the Edit Dialog
  261. {
  262. recreateForm : true,
  263. checkOnUpdate : true,
  264. checkOnSubmit : true,
  265. closeAfterEdit : true,
  266. onInitializeForm:function(formid) {
  267. },
  268. serializeEditData: function(postdata) {
  269. //myconsole.log(postdata);
  270. $.each(postdata,function (index, value) {
  271. //myconsole.log(index);
  272. if(index!="jqGrid_id" && index!="oper" && index!="keyid"){
  273. modifyJosnKey(postdata,index,"fragmentBind."+index);
  274. }
  275. if(index=="keyid"){
  276. postdata["fragmentBind."+index]=value
  277. }
  278. })
  279. //myconsole.log(postdata);
  280. return postdata;
  281. },
  282. afterSubmit: function (response, postdata) {
  283. // console.log(response);
  284. var res=eval('(' + response.responseText + ')');
  285. layer.msg(res.msg);
  286. return [res.state,res.msg,''];
  287. },
  288. errorTextFormat : function(data) {
  289. return 'Error: ' + data.responseText
  290. }
  291. },
  292. //options for the Add Dialog
  293. {
  294. closeAfterAdd : true,
  295. recreateForm : true,
  296. beforeSubmit: function(postdata, formid){
  297. $.each(postdata,function (index, value) {
  298. if(index!="jqGrid_id" && index!="oper"){
  299. modifyJosnKey(postdata,index,"fragmentBind."+index);
  300. }
  301. })
  302. return[true,''];
  303. },
  304. afterSubmit: function (response, postdata) {
  305. var res=eval('(' + response.responseText + ')');
  306. layer.msg(res.msg);
  307. //console.log(res);
  308. return [res.state,res.msg,''];
  309. },
  310. errorTextFormat : function(data) {
  311. return 'Error: ' + data.responseText
  312. }
  313. },
  314. //options for the Delete Dailog
  315. {
  316. errorTextFormat : function(data) {
  317. return 'Error: ' + data.responseText
  318. }
  319. },{
  320. // search options 这里支持多条件查询
  321. multipleSearch: true,
  322. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  323. afterSubmit: function(r, data) {
  324. var messageString = r.responseText;
  325. var mesObj = eval('(' + messageString + ')');
  326. return [mesObj.state, mesObj.message];
  327. }
  328. }
  329. );
  330. $("#initArea").click(function(){
  331. $.post("${ctx}/myconsole/frangmentArea/initArea",{},function(data){
  332. layer.msg("完成读取模板区域");
  333. $("#jqGrid").trigger("reloadGrid");
  334. })
  335. })
  336. })
  337. </script>
  338. <title>我的桌面</title>
  339. </head>
  340. <body>
  341. <div class="page-container">
  342. <div style="text-align:right">
  343. <button id="initArea" class="btn btn-primary radius" type="button"><i class="Hui-iconfont">&#xe632;</i>读取模板区域信息</button>
  344. </div>
  345. <table id="jqGrid"></table>
  346. <div id="jqGridPager"></div>
  347. <div>&nbsp;</div>
  348. <table id="jqGridBind"></table>
  349. <div id="jqGridPagerBind"></div>
  350. </div>
  351. <footer class="footer mt-20">
  352. <div class="container">
  353. <p></p>
  354. </div>
  355. </footer>
  356. </body>
  357. </html>