watermark.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" >
  21. <script type="text/ecmascript" src="${ctx}/assets/lib/jquery/1.9.1/jquery.js"></script>
  22. <script type="text/javascript" src="${ctx}/assets/static/h-ui/js/H-ui.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. <script type="text/javascript" src="${ctx}/assets/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
  30. <!--[if IE 6]>
  31. <script type="text/javascript" src="${ctx}/assets/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
  32. <script>DD_belatedPNG.fix('*');</script>
  33. <![endif]-->
  34. <script type="text/javascript">
  35. function watermark(keyid){
  36. $.get("${ctx}/myconsole/watermark/run",{"keyid":keyid},function(data){
  37. alert(data);
  38. })
  39. }
  40. $(function() {
  41. $(window).resize(function(){
  42. $("#jqGrid").setGridWidth($(window).width()-40); 
  43. });
  44. $("#jqGrid").jqGrid({
  45. url : '${ctx}/myconsole/watermark/getByPage',
  46. editurl:"${ctx}/myconsole/watermark/saveOrUpdate",
  47. mtype : "POST",
  48. datatype : "json",
  49. caption:'水印管理',
  50. prmNames : { //定义表单的主键 // Default valuesprmNames: {page:“page”,rows:“rows”, sort: “sidx”,order: “sord”, search:“_search”, nd:“nd”, npage:null} 当参数为null时不会被发到服务器端
  51. id: "keyid", 
  52. oper:"oper",    
  53. addoper:"add",
  54. editoper:"edit",
  55. deloper:"del" 
  56. },
  57. colModel : [ {
  58. label : '水印编号',
  59. name : 'keyid',
  60. hidden : true,
  61. key : true,
  62. width : 50
  63. }, {
  64. label : '水印名称',
  65. name : 'watermarkname',
  66. edittype: "text",
  67. editable: true,
  68. formoptions:{
  69. elmsuffix:'*'
  70. },
  71. editrules:{required:true},
  72. width : 80
  73. },{
  74. label : '水印描述',
  75. name : 'watermarkdesc',
  76. editable: true,
  77. edittype: "text",
  78. width : 80
  79. },{
  80. label : '水印类型',
  81. name : 'watermarktype',
  82. editable: true,
  83. edittype: "select",
  84. formatter:"select",
  85. width : 50,
  86. editoptions: {
  87. value : "text:文字;pic:图片"
  88. }
  89. },{
  90. label : '水印文字',
  91. name : 'watermarktext',
  92. editable: true,
  93. edittype: "text",
  94. width : 80
  95. },{
  96. label : '文字字号',
  97. name : 'fontsize',
  98. editable: true,
  99. edittype: "select",
  100. formatter:"select",
  101. width : 50,
  102. editoptions: {
  103. value : "15:15;18:18;20:20;24:24"
  104. }
  105. } , {
  106. label : '水印图片',
  107. name : 'watermarkpic',
  108. editable: true,
  109. hidden : true,
  110. edittype: "text",
  111. editoptions:{readonly: true}
  112. } ,{
  113. label : '水印图片',
  114. name : 'watermarkpic1',
  115. editable: true,
  116. hidden : true,
  117. edittype: "file",
  118. width : 100,
  119. editrules:{
  120. edithidden : true
  121. },
  122. editoptions: {
  123. enctype: "multipart/form-data",
  124. }
  125. },{
  126. label : '水印位置',
  127. name : 'position',
  128. editable: true,
  129. edittype: "select",
  130. formatter:"select",
  131. width : 50,
  132. editoptions: {
  133. value : "TOP_LEFT:上左;TOP_CENTER:上中;TOP_RIGHT:上右;CENTER_LEFT:中左;CENTER:中心;CENTER_RIGHT:中右;BOTTOM_LEFT:下左;BOTTOM_CENTER:下中;BOTTOM_RIGHT:下右"
  134. }
  135. }],
  136. rownumbers : true,//添加左侧行号
  137. viewrecords : true,//是否在浏览导航栏显示记录总数
  138. rowNum : 10,//每页显示记录数
  139. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  140. autowidth : true,
  141. height : 'auto',
  142. pager : "#jqGridPager"
  143. });
  144. $('#jqGrid').navGrid('#jqGridPager',
  145. // the buttons to appear on the toolbar of the grid
  146. {
  147. edit : true,
  148. add : true,
  149. del : true,
  150. search : true,
  151. refresh : true,
  152. view : true,
  153. position : "left",
  154. cloneToTop : true
  155. },
  156. // options for the Edit Dialog
  157. {
  158. recreateForm : true,
  159. checkOnUpdate : true,
  160. checkOnSubmit : true,
  161. closeAfterEdit : true,
  162. onInitializeForm: function(formid) {
  163. $("#watermarkpic1").change(function(){
  164. var v = $(this).val();
  165. var reader = new FileReader();
  166. reader.readAsDataURL(this.files[0]);
  167. reader.onload = function(e){
  168. $('#watermarkpic').val(e.target.result);
  169. };
  170. });
  171. },
  172. beforeShowForm:function(formid){
  173. show("orgid");
  174. },
  175. afterShowForm: function (formid){
  176. },
  177. serializeEditData: function(postdata) {
  178. //myconsole.log(postdata);
  179. $.each(postdata,function (index, value) {
  180. //myconsole.log(index);
  181. if(index!="jqGrid_id" && index!="oper" && index!="id"){
  182. modifyJosnKey(postdata,index,"watermark."+index);
  183. }
  184. if(index=="id"){
  185. postdata["watermark."+index]=value
  186. }
  187. })
  188. //myconsole.log(postdata);
  189. return postdata;
  190. },
  191. errorTextFormat : function(data) {
  192. return 'Error: ' + data.responseText
  193. }
  194. },
  195. // options for the Add Dialog
  196. {
  197. closeAfterAdd : true,
  198. recreateForm : true,
  199. onInitializeForm:function(formid) {
  200. $("#watermarkpic1").change(function(){
  201. var v = $(this).val();
  202. var reader = new FileReader();
  203. reader.readAsDataURL(this.files[0]);
  204. reader.onload = function(e){
  205. $('#watermarkpic').val(e.target.result);
  206. };
  207. });
  208. },
  209. beforeSubmit: function(postdata, formid){
  210. $.each(postdata,function (index, value) {
  211. if(index!="jqGrid_id" && index!="oper"){
  212. modifyJosnKey(postdata,index,"watermark."+index);
  213. }
  214. })
  215. return[true,''];
  216. },
  217. errorTextFormat : function(data) {
  218. return 'Error: ' + data.responseText
  219. }
  220. },
  221. // options for the Delete Dailog
  222. {
  223. errorTextFormat : function(data) {
  224. return 'Error: ' + data.responseText
  225. }
  226. },{
  227. // search options 这里支持多条件查询
  228. multipleSearch: true,
  229. closeAfterSearch: true,
  230. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  231. afterSubmit: function(r, data) {
  232. var messageString = r.responseText;
  233. var mesObj = eval('(' + messageString + ')');
  234. return [mesObj.state, mesObj.message];
  235. }
  236. }
  237. );
  238. })
  239. </script>
  240. <title>水印</title>
  241. <style type="text/css" >
  242. ul.ztree {
  243. background: #f0f6e4 none repeat scroll 0 0;
  244. border: 1px solid #617775;
  245. height: 360px;
  246. margin-top: 10px;
  247. overflow-x: auto;
  248. overflow-y: scroll;
  249. width: 220px;
  250. }
  251. </style>
  252. </head>
  253. <body>
  254. <div class="page-container">
  255. <table id="jqGrid"></table>
  256. <div id="jqGridPager"></div>
  257. </div>
  258. <footer class="footer mt-20">
  259. <div class="container">
  260. <p></p>
  261. </div>
  262. </footer>
  263. </body>
  264. </html>