标签:har alc 更新 清空 java 模式 role end 表单
常用的js整理 confirm("此次修改操作会清空所有基础数据!!!您确定要修改吗?") <a onclick="delBasisData(‘${data[‘_id‘]!‘‘}‘)">删除</a> 抑制警告 @SuppressWarnings(value={"unchecked","unused"}) @SuppressWarnings("all") 如果为空给一个空的字符串 ${fieldGroup.name?default(‘‘)} 定义一个事件和方法 onkeyup=‘valueRFMNum(this)‘ 判断是否为空 <#if fieldGroup.children??> ${user!‘your name‘} ${user?if_exists} ${user?default(‘your name‘)} 进行转换 <#assign test2 = "2009-01-22 17:23:45"?datetime("yyyy-MM-dd HH:mm:ss") /> <#if child.fieldFloat?default(0)==0> 重定向方法的使用 function toCustomerGroupPage(id){ window.location.href="../customerGroup/toCustomerGroupPage?bhCustomerGroupId="+id; } 排序 <#list list?sort_by("time") as v> </#list> 集合的循环 <#assign score = {"语文":78,"数学":83,"Java":89} > <#list score?key as x> ${x}--->${score[x]}; </#list> 返回的数据使用id 进行一个添加的功能 $("#div_content").append(‘<ul class="labelEditUl">‘ + ‘<input type="hidden" name="_id" value="‘ + _id + ‘">‘ + ‘<input type="hidden" name="customerId" value="‘ + data.customerId + ‘">‘ + ‘<input type="hidden" name="creatorId" value="‘ + data.creatorId + ‘">‘ + ‘<input type="hidden" name="creator" value="‘ + data.creator + ‘">‘ + ‘<input type="hidden" name="createTime" value="‘ + data.createTime + ‘">‘ + ‘<#list 1..30 as i><#if (basisTable[‘field‘+i])??><li>‘ + ‘ <span><#if (basisTable[‘must‘+i]) == ‘1‘><i style="color:red; margin-left: -7px;">* </i></#if>${basisTable[‘field‘+i]!‘‘}:</span>‘ + ‘<input onblur="checkDataModal(this)" maxlength="${maxLen[(basisTable[‘type‘+i])]}" style="width:200px;height:28px" class="modify_input <#if basisTable[‘type‘+i] == ‘date‘>Wdate</#if>" fieldName="${basisTable[‘field‘+i]}" must="${basisTable[‘must‘+i]}" fieldType="${basisTable[‘type‘+i]}" type="text" name="field${i}" value="‘+ (data.field${i} == "undefined" ? "" : data.field${i}) +‘" class="labelInput" <#if basisTable[‘type‘+i] == ‘date‘>onfocus="WdatePicker({dateFmt:\‘yyyy-MM-dd HH:mm:ss\‘})"<#elseif basisTable[‘type‘+i] == ‘integer‘>onKeyUp="disposeUtil.limitnumeral(this);"<#elseif basisTable[‘type‘+i] == ‘double‘>onKeyUp="disposeUtil.limitprice(this);"<#else>onKeyUp="disposeUtil.limitspecialstr1(this);"</#if>>${typeMap[(basisTable[‘type‘+i])]}</li><br><p class="Validform_checktip Validform_wrong" style="margin: -25px 1px 10px 89px;"></p><#else><#break></#if></#list></ul>‘); $("#modifyDataModal").modal(‘show‘); 循环功能 <#list KMFunctionMap?if_exists?keys as key> <option value="${key}" <#if (tag.moduleId)?default(‘402893be5507612a01550763306906f9‘) == "${key}">selected</#if>>${(KMFunctionMap[key])?default(‘‘)}</option> </#list> 动态包含 <#include "./confirmWindow.ftl"/> debugger; <#if totalm gte 10000>${(totalm/10000)?string(‘##.#‘)}万<#else>$ 存量288.7万人 数据库的更新 String orgId = getOrgIdByUserByOrg(); DBCollection collection = MongoDBServer.getInstance().getBaihuiDB().getCollection("goal_count"); DBObject obj = new BasicDBObject(); obj.put("orgId",orgId); obj.put("goalCount",goalCount); collection.update(new BasicDBObject("orgId",orgId),obj,true,false); 获得val值 readonly 只读模式 1. <input type="text" readonly id="goal-input" maxlength="16" name="goal" value="${goalm!‘0‘}"> 2. $("#goal-input").val(‘${goalm!‘0‘}‘); <select class="select" id="findBy" name="findBy"> <option value="">--请选择--</option> <option value="customerId">客户ID</option> <#list 1..30 as i> <#if (basisTable[‘field‘+i])??> <option value="field${i}">${basisTable[‘field‘+i]!‘‘}</option> <#else><#break> </#if> </#list> </select> $("#findBy").val() 按钮的功能 <input type="button" class="btn btn-primary" value="下一步" onclick="nextOperation();"> 弹出新的窗口使用 1. <a id="goalMember" href="javascript:void(0);"> 2.$("#goalMember").click(function () { $("#goalMemberModal").modal("show"); }); 3.<div class="modal fade chartModal" id="goalMemberModal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">修改目标会员总量</h4> </div> <form role="form" id="goalMemberForm" action=‘‘ method="post"> <div style="text-align: center"> <ul class="chartModalUl"> <li> <span><i style="color:red; margin-left: -7px;">* </i>目标会员总量:</span> <input type="text" id="goal-input" maxlength="16" name="goal" value="${goalm!‘0‘}"> </li> </ul> </div> </form> <div class="newly-down-buttn" style="text-align: center"> <button type="button" id="save-btn" class="btn btn-success">保存</button> <button type="button" id="cancel-btn" class="btn btn-outline btn-default" style="margin-left: 20px">取消</button> </div> </div> </div> </div> 非空的校验 var goal = $("#goal-input").val(); if (!goal){ alert("目标会员总量不能为空!"); return; } 编写一个事件 把表单的内容进行一个提交 $("#div_content").append(‘<h3>失败!</h3><span>错误‘+data.error +‘条数据</span><br><a onclick="downErrorList()">下载错误列表</a>‘+ ‘<form id="downError" action="../basis/downErrorList"><input type="hidden" name="filePath" value="‘+ data.filePath+‘"></form>‘); 提示信息 confirm("您确定要删除这个分组吗?") 用来处理字符串 转化为json的格式 JSONArray jsonArray = JSONArray.fromObject(tag.getRuleConditions()); ajax里面嵌套 超链接 $.ajax({ type:"post", url:"../referenceGroup/isLeafNode", data:{ groupId : TgroupId }, success:function(data) { if (data == true){ document.location.href = "../reference/updatePage?opName=create&groupId="+TgroupId+"&groupName="+TgroupName; }else { alert("只有叶子分组才能添加参照表!"); } } }); 加载和调用前一个路径 History back() 方法 ajax里面调方法 function groupExists(groupId) { var flag = false; $.ajax({ type: "post", url:"../referenceGroup/groupExists", data: { groupId:groupId }, async: false, success:function(data){ if(true == data){ flag = true; } }, error:function(){ errorAlert(); } }); return flag; } function errorAlert() { alert("抱歉,分组数据与服务器不同步!"); document.location.href = "../referenceGroup/referenceGroupList"; } $.ajax({ type:"post", url:"../tagGroup/isLeafNode", data:{ groupId : TgroupId,opName:"create" }, success:function(data) { if (data == true){ document.location.href = "../tag/updatePage?groupId="+TgroupId+"&groupName="+TgroupName+"&opName=create"; }else { alert("只有叶子分组才能添加标签!"); } } }); sql 不等于空 AND ARG_F2001 <> ‘‘ 解析为整数 StringUtil.parseInt( 本地文件的路径 String filePath = ApplicationPath.getRootPath() + "uploadFile" + File.separator; 实现文件写入本地的功能 private boolean createCsvDataFile(int size, Map<String, Long> cardsMap_1, Map<String, Long> goodsMap_1, String filePath, String fileName) { String countSql = "SELECT COUNT(ARG_F2001) FROM (SELECT ARG_F2001 FROM bh_custom_module_2 WHERE IS_DELETED = 0 AND ARG_F2001 <> ‘‘ AND ARG_A2001 <> ‘‘) a "; int total = StringUtil.parseInt(bhCustomModule2Dao.findBySql(countSql).get(0)+""); int loop = total% size == 0 ? (total/ size) : (total/ size + 1); 三元表达式 String limitSql; String countSql = "SELECT COUNT(ARG_F2001) FROM (SELECT ARG_F2001 FROM bh_custom_module_2 WHERE IS_DELETED = 0 AND ARG_F2001 <> ‘‘ AND ARG_A2001 <> ‘‘) a "; int loop = total% size == 0 ? (total/ size) : (total/ size + 1); BufferedWriter csvWriter = null; try { File file = new File(filePath); if (!file.exists()) { file.mkdirs(); } csvWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(filePath+fileName)), "UTF-8"), 1024); for (int i = 0,start = 0; i < loop; i++) { limitSql = "SELECT ARG_F2001,ARG_A2001 FROM bh_custom_module_2 WHERE IS_DELETED = 0 AND ARG_F2001 <> ‘‘ AND ARG_A2001 <> ‘‘ limit " + start + "," + size; ArrayList<Object []> limitResult = (ArrayList<Object[]>)bhCustomModule2Dao.findBySql(limitSql); for (Object[] strings : limitResult) { Long cardId = cardsMap_1.get(strings[0].toString()); Long goodsId = goodsMap_1.get(strings[1].toString()); if (cardId == null || goodsId == null)continue; csvWriter.write(cardId+","+goodsId+",1"); csvWriter.newLine(); csvWriter.flush(); } start += size; } return true; } catch (Exception e) { e.printStackTrace(); return false; } finally { try { if (csvWriter != null) csvWriter.close(); } catch (IOException e) { e.printStackTrace(); } } } 清除集合的方法 cardsMap_1.clear() js 标签判断上下页 function gotoPage() { var totalPage = ‘${page.totalPage}‘; var pageNo = $("#commonListTable_input").val(); if (!pageNo || parseInt(pageNo) > parseInt(totalPage) || parseInt(pageNo) < 0)return; queryListDo(pageNo,‘${page.pageSize}‘); } 进行一个赋值的操作 window.tagSearchForm.action="./tagSearchUpdate"; window.tagSearchForm.opName.value="update"; 获得被选中的id 被给一个返回值 function getShareState(){ var shareState = 0; var shareState = $("#shareState_div").find("input[type=‘radio‘][name=‘shareState‘]:checked").val(); if(parseInt(shareState)>2){//分配 shareState = $("#shareState_div").find("select[name=‘shareState‘]").val(); } return shareState; } 首页按钮禁用 <li class="paginate_button first disabled" aria-controls="commonListTable" tabindex="0" id="commonListTable_first"> <a href="#">首页</a> </li> 搜索清除 回显和确认 recommendResult 页面 吧搜索的功能里面的信息 进行一个清除的操作 搜索条件进行一个加密的处理 base64encode(escape(__ret.operaValues)); <script src="../plugins/base64/base64.js" language="javascript" type="text/javascript"></script> json的数据的格式 { "people": [{ "firstName": "Jason", "lastName":"Hunter", "email": "bbbb"},{ "firstName": "Elliotte", "lastName":"Harold", "email": "cccc" }] "annimal":[{ "firstName": "Jason", "lastName":"Hunter", "email": "bbbb"},{ "firstName": "Elliotte", "lastName":"Harold", "email": "cccc" }] } json的转化和解析 var last=JSON.stringify(obj); //将JSON对象转化为JSON字符 var obj = str.parseJSON(); //由JSON字符串转换为JSON对象 var obj = JSON.parse(str); //由JSON字符串转换为JSON对象 用for...in 这种遍历的方式,例如: var arr = new Array("first", "second", "third") for(var item in arr) { document.write(arr[item]+","); } Map 循环的方式 Map<String,String> map=new HashMap<String,String>(); map.put("1","hello"); map.put("2","name"); map.put("3","tom"); for(String key:map.keySet()){ System.out.println("value值为:"+map.get(key)); } 重定向 window.location.href="../customerGroup/customerGroupBaseList?size=${page.size}&number=" + num + "&searchVal=" + encodeURI(encodeURI(searchParams)) + "&pageSign=1&dateStr=" + dateStr + "&orgId=" + orgId; 获得每个某个不认的标签 $("#tbody-search td").each(function(){ var oper = $(this).find("select").val(); var name = $(this).find("input").prop("name"); var val = $(this).find("input").val(); var strs = "NULL,UNNULL,TODAY,YESTERDAY,LASTWEEK,THISWEEK,LASTMONTH,THISMONTH"; if(val!="undefined"&& $.trim(val)!="" || strs.indexOf(oper)!=-1){ searchParams += ",\""+oper+"|"+name+"\":\""+$.trim(val)+"\""; } }); 移除属性disabled $("#valueRNum").removeAttr("disabled"); 正则表达式替换字符 paramsJsonString.replace(new RegExp("‘",‘gm‘), "\"") 获取var 集合中某个值 var paramsJson=\‘‘; paramsJson[‘module‘] 循环集合var的值 for(var i in linkModule) { linkModule[i]; } 遮罩页面实现和结束 Overlayer.show("正在处理数据,这个动作可能要花费一些时间,请耐心等待!"); Overlayer.remove(); 判断去空格是否为空 if (nameId.trim() =="") { Overlayer.remove(); alert(‘文件夹名不能为空格‘); return false; } 三元表达式 totalElements != map ? 1 : 0; 获取当前用户 User user = UserUtil.getUser(); 系统当前时间 long nowMills = System.currentTimeMillis(); 将字符串进行编码 txt = URLDecoder.decode(txt, "UTF-8"); 关闭窗口 window.close()
标签:har alc 更新 清空 java 模式 role end 表单
原文地址:https://www.cnblogs.com/zhanghongjie/p/9504320.html