Easyui基于jSignature弹窗签名

<%@ page language="java" contentType="text/html; charset=utf-8"  pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<%@ include file="/static/common/taglibs.jsp" %>
    <%@ include file="/static/common/meta.jsp" %>
    <%@ include file="/static/common/js-css.jsp" %>
    <!-- <code>作业票编辑数据页面</code> -->
</head>
<body>
<script type="text/javascript" charset="utf-8" src="${ctx}/static/libs/jSignature/flashcanvas.min.js"></script>
<script type="text/javascript" charset="utf-8" src="${ctx}/static/libs/jSignature/jSignature.min.js"></script>

<style type="text/css">

	#signatureparent {
		color:darkblue;
		background-color:darkgrey;
		/*max-width:600px;*/
		padding:10px;
	}

	#signature {
		border: 2px dotted black;
		background-color:lightgrey;
	}

</style>
<script type="text/javascript" charset="utf-8">
Namespace.register("TicketEdit");

$(function() {
	$("#signature").jSignature({height:400,width:900,lineWidth:"2",signatureLine:false});

});


TicketEdit.editTicket = function () {
	var dataimg = $("#signature").jSignature("getData", "image")
	$("#signatureImg").val(dataimg[1]); // append the image (SVG) to DOM.
	if(!$('#TicketEditForm').form('validate')) {return false;}
	loadSubmitOverlay($('#dialogDiv001'));
	$("#TicketEditForm").form("submit", {
		url:'${ctx}/c/ticket/signature',
		type:'post',
		data:$('#TicketEditForm').serialize(),
		dataType:'json',
		success:function(result) {
			removeSubmitOverlay();
			 var data = JSON.parse(result);
			try {
				if (data.success) {
					$('#dialogDiv001').dialog('close');
				}
				$.messager.show({
					title : '提示',
					msg : data.msg,
					showType:'slide',  
					height:'150px',
				});
			} catch (e) {
				$.messager.alert('提示', data);
			}		
		}
	});
}


</script>
<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center'" style="padding:5px;">
	<form id="TicketEditForm" method="post" >
	
		<input type="hidden" id="signatureImg" name="signatureImg"  value="${signatureImg}"/>
		<div id="signatureparent">
			<div>签名处</div>
			<div id="signature"></div>
		</div>
	</form>
	</div>
	<div data-options="region:'north',border:false" style="text-align:right;padding:0px 0px 0px;">
		<table align="center" bgcolor="#90FB90" border="0" width="100%" class="form_table" cellpadding="0" cellspacing="0" style="border: 1px solid #00EE00">
   	 		<tr>
    		<td >
	    		<a class="easyui-linkbutton" data-options="iconCls:'icon-add'"  onclick="$('#signature').jSignature('reset')" style="background:#FFFFFF;width:180px;height:33px">重置</a>
	    		<a class="easyui-linkbutton" data-options="iconCls:'icon-add'"  onclick="TicketEdit.editTicket()" style="background:#FFFFFF;width:120px;height:33px">保存</a>
    		</td>
    		</tr>
       	</table>
	</div>
</div>
</body>
</html>

/**
	 * @Description: 将base64编码字符串转换为图片
	 * @Author:
	 * @CreateTime:
	 * @param imgStr base64编码字符串
	 * @param path 图片路径-具体到文件
	 * @return
	 */
	public static boolean generateImage(String imgStr, String path) throws Exception {
		if (imgStr == null)
			return false;
		BASE64Decoder decoder = new BASE64Decoder();
		byte[] decoderBytes = decoder.decodeBuffer(imgStr);
		FileOutputStream out = new FileOutputStream(new File(path));
		out.write(decoderBytes);
		return true;
	}

/**
	 * 方法/动作描述: {控制返回主页 查询列表页} <br/>
	 * @param req  HttpServletRequest
	 * @return 返回类型: {String}  {返回:控制视图}
	 * @throws Exception  异常说明:  {404 找不到对应的视图}
	 */
	@RequestMapping(value="/signature")
	@ResponseBody
	public HarJson signature(HttpServletRequest req,String signatureImg) throws Exception {
		
		String urlname = TicketUtils.AutographTypeUrl(autographTypeVal);
		if(signatureImg!=null){
			String realpath = AddressUtils.standardRequestPath(req);
			realpath = realpath + "photo/autograph/"+urlname+"/"+ ticketAutographEntity.getAutographId() + ".png";
			TicketUtils.generateImage(signatureImg,realpath );
		}

		return new HarJson(Boolean.TRUE,DwStringConstants.TINVIE_STRING_OPERATION_OK,ticketAutographEntity);
	}

基于Spring+SpringMVC+Mybatis+easyui敏捷开发后台管理系统架构。

开发的一套权限系统,极低门槛,拿来即用。设计之初,就非常注重安全性,为企业系统保驾护航,让一切都变得如此简单。

提供了代码生成器,代码交给系统自动生成,可快速完成开发任务。代码生成也包括页面代码生成,针对单表操作增加、修改、查询、删除、查看、复制、导入、导出、页面打印、页面导出等都有对应生成代码。生成菜单、数据库。生成完后单表操作直接完成,需要针对业务做小量的修改。

支持MySQL、SQL ServerL等主流数据库

提供权限管理,菜单管理,角色管理,用户管理。代码基于模板生成,减少重复工作。针对菜单权限控制,可以控制带单个操作按钮,例如:添加数据可以单独控制按钮。

项目演示

演示地址:http://cbs.tinvie.cn

项目地址 https://gitee.com/tinvie/vssm

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值