metatable.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  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. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqueryui/jquery-ui.css" />
  23. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqgrid/css/ui.jqgrid.css" />
  24. <script type="text/ecmascript" src="${ctx}/assets/lib/jqueryui/jquery-ui.js"></script>
  25. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/i18n/grid.locale-cn.js"></script>
  26. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/jquery.jqGrid.min.js"></script>
  27. <script type="text/javascript" src="${ctx}/assets/js/base.js"></script>
  28. <!--[if IE 6]>
  29. <script type="text/javascript" src="${ctx}/assets/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
  30. <script>DD_belatedPNG.fix('*');</script>
  31. <![endif]-->
  32. <script type="text/javascript">
  33. $(function() {
  34. $(window).resize(function(){
  35. $("#jqGrid").setGridWidth($(window).width()-40); 
  36. });
  37. $("#jqGrid").jqGrid({
  38. url : '${ctx}/myconsole/metatable/getByPage',
  39. editurl:"${ctx}/myconsole/metatable/saveOrUpdate",
  40. mtype : "POST",
  41. datatype : "json",
  42. multiselect: true,
  43. caption:'元数据对象(栏目类型)',
  44. prmNames : {
  45. id: "keyid", 
  46. oper:"oper",    
  47. addoper:"add",
  48. editoper:"edit",
  49. deloper:"del" 
  50. },
  51. colModel : [ {
  52. label : '元数据编号',
  53. name : 'keyid',
  54. hidden : true,
  55. key : true,
  56. width : 50
  57. }, {
  58. label : '包名称',
  59. name : 'packagename',
  60. editable: true,
  61. formoptions:{
  62. elmsuffix:'小写'
  63. },
  64. editoptions:{
  65. defaultValue:'com.fsm.app'
  66. },
  67. editrules:{required:true},
  68. width : 80
  69. }, {
  70. label : '类名',
  71. name : 'modelname',
  72. editable: true,
  73. formoptions:{
  74. elmsuffix:'英文,首字母大写'
  75. },
  76. editrules:{required:true},
  77. width : 80
  78. },{
  79. label : '类描述',
  80. name : 'modeldesc',
  81. formoptions:{
  82. elmsuffix:'中文描述'
  83. },
  84. editrules:{required:true},
  85. editable: true,
  86. width : 80
  87. },{
  88. label : 'Excel工作表',
  89. name : 'excelsheet',
  90. formoptions:{
  91. elmsuffix:'工作表名称'
  92. },
  93. editoptions:{
  94. defaultValue:'Sheet1'
  95. },
  96. editable: true,
  97. width : 80
  98. },{
  99. label : 'Excel标题行',
  100. name : 'exceltitle',
  101. editoptions:{
  102. defaultValue:'1'
  103. },
  104. editrules:{integer:true,minValue:0},
  105. editable: true,
  106. width : 80
  107. }, {
  108. label : '更新时间',
  109. name : 'updatetime',
  110. editable: false,
  111. width : 80
  112. }],
  113. rownumbers : true,//添加左侧行号
  114. viewrecords : true,//是否在浏览导航栏显示记录总数
  115. rowNum : 10,//每页显示记录数
  116. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  117. autowidth : true,
  118. height : 'auto',
  119. onSelectRow : function( rowid ) {
  120. if(rowid.length>10){
  121. $("#jqGrid1").setColProp('tableid',{editoptions:{value:rowid+":a"}});
  122. var row = $(this).getRowData(rowid);
  123. $("#jqGrid1").setCaption("元数据属性--"+row.modeldesc);
  124. $("#jqGrid1").jqGrid('setGridParam',{url: "${ctx}/myconsole/metafield/getByPage?tableid="+rowid});
  125. $("#jqGrid1").trigger("reloadGrid");
  126. }
  127. },
  128. pager : "#jqGridPager"
  129. });
  130. $('#jqGrid').navGrid('#jqGridPager',
  131. // the buttons to appear on the toolbar of the grid
  132. {
  133. edit : true,
  134. add : true,
  135. del : true,
  136. search : true,
  137. refresh : true,
  138. view : true,
  139. position : "left",
  140. cloneToTop : true
  141. },
  142. // options for the Edit Dialog
  143. {
  144. recreateForm : true,
  145. checkOnUpdate : true,
  146. checkOnSubmit : true,
  147. closeAfterEdit : true,
  148. onInitializeForm:function(formid) {
  149. },
  150. serializeEditData: function(postdata) {
  151. //myconsole.log(postdata);
  152. $.each(postdata,function (index, value) {
  153. //myconsole.log(index);
  154. if(index!="jqGrid_id" && index!="oper" && index!="keyid"){
  155. modifyJosnKey(postdata,index,"metaTable."+index);
  156. }
  157. if(index=="keyid"){
  158. postdata["metaTable."+index]=value
  159. }
  160. })
  161. //myconsole.log(postdata);
  162. return postdata;
  163. },
  164. errorTextFormat : function(data) {
  165. return 'Error: ' + data.responseText
  166. }
  167. },
  168. // options for the Add Dialog
  169. {
  170. closeAfterAdd : true,
  171. recreateForm : true,
  172. beforeSubmit: function(postdata, formid){
  173. $.each(postdata,function (index, value) {
  174. if(index!="jqGrid_id" && index!="oper"){
  175. modifyJosnKey(postdata,index,"metaTable."+index);
  176. }
  177. })
  178. return[true,''];
  179. },
  180. errorTextFormat : function(data) {
  181. return 'Error: ' + data.responseText
  182. }
  183. },
  184. // options for the Delete Dailog
  185. {
  186. errorTextFormat : function(data) {
  187. return 'Error: ' + data.responseText
  188. }
  189. },{
  190. // search options 这里支持多条件查询
  191. multipleSearch: true,
  192. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  193. afterSubmit: function(r, data) {
  194. var messageString = r.responseText;
  195. var mesObj = eval('(' + messageString + ')');
  196. return [mesObj.state, mesObj.message];
  197. }
  198. }
  199. );
  200. /////////////////////////////////////////////////////////////////////////////////////////////////
  201. $(window).resize(function(){
  202. $("#jqGrid1").setGridWidth($(window).width()-40); 
  203. });
  204. $("#jqGrid1").jqGrid({
  205. url : '${ctx}/myconsole/metafield/getByPage',
  206. editurl:"${ctx}/myconsole/metafield/saveOrUpdate",
  207. mtype : "POST",
  208. datatype : "json",
  209. caption:'元数据属性',
  210. prmNames : {
  211. id: "keyid", 
  212. oper:"oper",    
  213. addoper:"add",
  214. editoper:"edit",
  215. deloper:"del" 
  216. },
  217. colModel : [ {
  218. label : '属性编号',
  219. name : 'keyid',
  220. hidden : true,
  221. key : true,
  222. width : 50
  223. }, {
  224. label : '元数据 编号',
  225. name : 'tableid',
  226. hidden : true,
  227. editable : true,
  228. edittype :"select",
  229. editoptions:{value:"a:a"}
  230. },{
  231. label : '属性名称',
  232. name : 'fieldname',
  233. editable: true,
  234. width : 80
  235. }, {
  236. label : '属性类型',
  237. name : 'fieldtype',
  238. editable: true,
  239. formatter:"select",
  240. edittype: "select",
  241. editoptions: {
  242. value: "${fieldType}"
  243. },
  244. stype:"select",
  245. searchoptions:{
  246. value: "${fieldType}"
  247. },
  248. width : 80
  249. }, {
  250. label : '属性长度',
  251. name : 'fieldlength',
  252. editable: true,
  253. width : 80
  254. }, {
  255. label : '属性描述',
  256. name : 'fielddesc',
  257. editable: true,
  258. width : 80
  259. }, {
  260. label : '表单类型',
  261. name : 'formtype',
  262. editable: true,
  263. formatter:"select",
  264. edittype: "select",
  265. editoptions: {
  266. value: "${formType}"
  267. },
  268. stype:"select",
  269. searchoptions:{
  270. value: "${formType}"
  271. },
  272. width : 80
  273. }, {
  274. label : '字典选项',
  275. name : 'formoption',
  276. editable: true,
  277. formatter:"select",
  278. edittype: "select",
  279. editoptions: {
  280. value: "${dataDic}"
  281. },
  282. stype:"select",
  283. searchoptions:{
  284. value: "${dataDic}"
  285. },
  286. width : 80
  287. }, {
  288. label : '表单验证',
  289. name : 'formvalidate',
  290. editable: true,
  291. formatter:"select",
  292. edittype: "select",
  293. editoptions: {
  294. value: "${formVerification}"
  295. },
  296. stype:"select",
  297. searchoptions:{
  298. value: "${formVerification}"
  299. },
  300. width : 80
  301. }, {
  302. label : '列表显示',
  303. name : 'listshow',
  304. editable: true,
  305. formatter:"select",
  306. edittype: "select",
  307. editoptions: {
  308. value: "${listshow}"
  309. },
  310. stype:"select",
  311. searchoptions:{
  312. value: "${listshow}"
  313. },
  314. width : 80
  315. }, {
  316. label : '表单提示',
  317. name : 'formsuffix',
  318. editable: true,
  319. width : 80
  320. }],
  321. rownumbers : true,//添加左侧行号
  322. viewrecords : true,//是否在浏览导航栏显示记录总数
  323. rowNum : 10,//每页显示记录数
  324. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  325. autowidth : true,
  326. height : 'auto',
  327. pager : "#jqGridPager1"
  328. });
  329. $('#jqGrid1').navGrid('#jqGridPager1',
  330. // the buttons to appear on the toolbar of the grid
  331. {
  332. edit : true,
  333. add : true,
  334. del : true,
  335. search : true,
  336. refresh : true,
  337. view : true,
  338. position : "left",
  339. cloneToTop : true
  340. },
  341. // options for the Edit Dialog
  342. {
  343. recreateForm : true,
  344. checkOnUpdate : true,
  345. checkOnSubmit : true,
  346. closeAfterEdit : true,
  347. onInitializeForm:function(formid) {
  348. },
  349. serializeEditData: function(postdata) {
  350. //myconsole.log(postdata);
  351. $.each(postdata,function (index, value) {
  352. //myconsole.log(index);
  353. if(index!="jqGrid_id" && index!="oper" && index!="keyid"){
  354. modifyJosnKey(postdata,index,"metaField."+index);
  355. }
  356. if(index=="keyid"){
  357. postdata["metaField."+index]=value
  358. }
  359. })
  360. //myconsole.log(postdata);
  361. return postdata;
  362. },
  363. errorTextFormat : function(data) {
  364. return 'Error: ' + data.responseText
  365. }
  366. },
  367. // options for the Add Dialog
  368. {
  369. closeAfterAdd : true,
  370. recreateForm : true,
  371. beforeSubmit: function(postdata, formid){
  372. $.each(postdata,function (index, value) {
  373. if(index!="jqGrid_id" && index!="oper"){
  374. modifyJosnKey(postdata,index,"metaField."+index);
  375. }
  376. })
  377. return[true,''];
  378. },
  379. errorTextFormat : function(data) {
  380. return 'Error: ' + data.responseText
  381. }
  382. },
  383. // options for the Delete Dailog
  384. {
  385. errorTextFormat : function(data) {
  386. return 'Error: ' + data.responseText
  387. }
  388. },{
  389. // search options 这里支持多条件查询
  390. multipleSearch: true,
  391. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  392. afterSubmit: function(r, data) {
  393. var messageString = r.responseText;
  394. var mesObj = eval('(' + messageString + ')');
  395. return [mesObj.state, mesObj.message];
  396. }
  397. }
  398. );
  399. $("#make").click(function(){
  400. var mataTableIDs = $('#jqGrid').jqGrid('getGridParam','selarrrow');
  401. $.get("${ctx}/myconsole/metatable/make",{"mataTableIDs":mataTableIDs},function(data){
  402. alert(data);
  403. })
  404. })
  405. })
  406. </script>
  407. <title>我的桌面</title>
  408. </head>
  409. <body>
  410. <div class="page-container">
  411. <div style="text-align:right">
  412. <button id="make" class="btn btn-primary radius" type="button"><i class="Hui-iconfont">&#xe632;</i> 生成程序和库表</button>
  413. </div>
  414. <table id="jqGrid"></table>
  415. <div id="jqGridPager"></div>
  416. <div>&nbsp;</div>
  417. <table id="jqGrid1"></table>
  418. <div id="jqGridPager1"></div>
  419. </div>
  420. <footer class="footer mt-20">
  421. <div class="container">
  422. <p></p>
  423. </div>
  424. </footer>
  425. </body>
  426. </html>