赞
踩
$("#savaUserSet").click(function(){
- var JSONArr=[];
- $("i[name='eventName']").each(function() {//获取所有name属性为eventName的i标签,并遍历
- if(!($(this).hasClass("active"))){
- var eventCode=$(this).attr("id");
- var eventName=$(this).html();
- var activityTypeCode=$(this).parent().prev().children("span").eq(0).attr("value");
- var JSONObject= {
- "userid":userid,
- "activityCode":activityTypeCode,
- "eventCode":eventCode
- };
- JSONArr.push(JSONObject);
- }
- });
- var JSONArrStr=JSON.stringify(JSONArr);//js数组转json字符串
- $.ajax({//ajax其实可以不用管了
- method : "POST",
- url : "../../privacyProtect/savaUserGenPrivacySet.do",
- dataType : "json",
- data:{
- "JSONArrStr":JSONArrStr,
- "userid":userid
- },
- beforeSend: function () {
- // 禁用按钮防止重复提交,发送前响应
- waitingDialog.show("正在提交数据,请稍候",{dialogSize: 'sm'});
- $("#savaUserSet").attr({ disabled: "disabled" });
-
- },
- complete: function () {//完成响应
- $("#savaUserSet").removeAttr("disabled");
- },
- success : function(data) {
- waitingDialog.hide();
- var msg=data.result;
- bootbox.alert(msg, function () {});
- },
- error : function(data) {
- bootbox.alert("服务器发生错误,加载数据发生异常!", function () {});
- }
- });
- });
- @RequestMapping ("/savaUserGenPrivacySet")
- @ResponseBody
- public String savaUserGenPrivacySet (HttpServletResponse response, HttpServletRequest request)
- {
- try
- {
- request.setCharacterEncoding ("utf-8");
- response.setCharacterEncoding ("utf-8");
- }
- catch (UnsupportedEncodingException e)
- {
- _logger.error (e.getMessage ());
- }
- // 返回数据的容器
- Map <String, Object> resultMap = new HashMap <String, Object> ();
- Long userid = Long.parseLong (request.getParameter ("userid"));
- UserGenPrivacy userGenPrivacy = new UserGenPrivacy ();
- userGenPrivacy.setUserid (userid);
- String jsonArrStr = request.getParameter ("JSONArrStr");//接收到数据字符串
- JSONArray arr = JSONArray.fromObject (jsonArrStr);//将其解析为JSON数组
//将json数组转为list集合,注意这里的对象属性要和你前台建的对象属性一致
List <UserGenPrivacy> userGenPrivacys = JSONArray.toList (arr, new UserGenPrivacy (), new JsonConfig ());
boolean isOk = _privacyProtectService.savaUserGenPrivacySet (userGenPrivacy, userGenPrivacys);
String msg = "";
if (isOk)
{
msg = "设置保存成功!";
}
else
{
msg = "设置保存失败!";
}
resultMap.put ("result", msg);
JsonConfig config = new JsonConfig ();
config.registerJsonValueProcessor (Date.class, new JsonDateValueProcessor ("yyyy-MM-dd"));
return JSONObject.fromObject (resultMap, config).toString ();
}
- <li>
- <h2 class="set_title">
- <span class="picon_yes" name="activityTypeCode" value="1"></span>
- 允许查看门诊过程的相关内容:
- <span class="set_icon"></span>
- <span id="mz_flag" class="opcl_icon zhankai"></span>
- </h2>
- <div class="jmcheckBox" id="mz">
- <i class="active" name="eventName" id="D008" value="D008">门诊病历</i>
- <i class="active" name="eventName" id="H152" value="H152">门诊处方</i>
- </div>
- </li>
-
-
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。