• 日常工作记录


     

    1.日期控件时间为1899年(原因:传过来的日期类型不符合控件时间类型)  

    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    <fmt:formatDate value="${info.startDate}" pattern="yyyy-MM-dd"/>

    2.拼接select
    for (var i = 0; i < data.length; i++) {
    $('#supplierId').append('<option value=' + data[i].id + '>' + data[i].name + '</option>');
    }
    3.选中select的text值
    $("#supplierId").find("option:selected").text()
    4.根据value值选中select
    $("#businessIdSelect option").each(function(){
    if($(this).val() == businessIdSelect){
    $(this).attr("selected",true);
    }
    });

     5.根据value值选中的radio

    $(":radio[name='blackType'][value='" + blackType + "']").prop("checked", "checked");

    6.model层日期格式化
    @JSONField(format = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    7.bootstrap 日期校验
    callback: {
    message: '结束日期不能小于等于开始日期',
    callback:function(value, validator,$field,options){
    var start = $('#blackListInfo').find("input[name='startDate']").val();
    if(start != '' ){
    return value>=start;
    }else{
    return true;
    }

    }
    }

    8.combotree
    <dt>服务城市: </dt>
        <dd>
            <div>
                <input class="easyui-combotree gdClassify" style="100%"  id="city">
                <input id="cityId" name="city" class="hidden">
            </div>
           </dd>
    
    $('#city').combotree({
        url: contextPath + '/product/info/cityAllManageTree.do',
        method : 'get',
        labelPosition : 'top',
        //标记被选元素
        onSelect:function(node) {
            $("#cityId").val(node.id);
        }
    })    
    
    public List<CategoryView> listCity() {
            List<CodeManage> cityList = productService.getCityAllManage();
            if (null != cityList && !cityList.isEmpty()) {
                Map<String, CategoryView> allMap = new HashMap<>();
                List<CategoryView> result = new ArrayList<>();
                List<CategoryView> children;
                CategoryView parent;
                for (CodeManage codeManage : cityList) {
                    CategoryView categoryView = new CategoryView(codeManage.getCode());
                    categoryView.setCategoryName(codeManage.getName());
                    categoryView.setCode(codeManage.getCode());
                    if(codeManage.getParentCode() != null){
                        categoryView.setParentCode(codeManage.getParentCode());
                    }
                    if (allMap.containsKey(codeManage.getParentCode())) {
                        parent = allMap.get(codeManage.getParentCode());
                        children = parent.getChildren();
                        if (children == null) {
                            children = new ArrayList<>();
                            parent.setChildren(children);
                        }
                        children.add(categoryView);
                    } else {
                        result.add(categoryView);
                    }
                    allMap.put(codeManage.getCode(), categoryView);
                }
                return result;
            }
            return null;
        }

     清除combotree数据:

    $('.easyui-combotree').combotree("clear");

    9.spring 前台需要传页面上的数据和一个其他对象数据(将其他对象分装到数据对象里,通过一个对象传到后台)
    var requestDeptId = $("#requestDeptId").val().trim();
    var requestUserId = $("#requestUserId").val().trim();
    var reason = $("#reason").val().trim();
    var sendDate= $("#sendDate").val().trim();
    var parms={
          "deptId": requestDeptId,
           "userId": requestUserId,
           "remark": reason,
            "sendDt": sendDate,
            "list": infoList,
    }
    $.ajax({
                url:contextPath+"/yhTicket/apply/applyMany.do",
                type: "POST",
                headers: {
                    'Accept': 'application/json',
                    'Content-Type': 'application/json'
                },
                data: JSON.stringify(parms),
                success: function (data) {
                    if(data.flag !="success"){
                        textModal("保存数据失败,请重试");
                    }else{
                        textModal("保存成功");
                        //刷新表格
                        $("#grid-data").bootgrid("reload");
                        approval(data.id,reason);
                        $("#uploadMany").modal("hide");
                    }
    
                }
            })
    public Map<String, String> applyMany(@RequestBody YhTicketApply parms )
    { }

     10.初始化日期格式

    $("#monthDateStart").val((new Date('${honors.awardDate}')).format("yyyy-MM-dd"));

          
  • 相关阅读:
    Python接口自动化之request请求封装
    AI缘起——达特茅斯会议
    AirtestProject测试框架
    强化学习落地:竞态场景下基于锁机制的闲置端口查用
    多智能体强化学习入门Qmix
    代码回滚----git reset 和 git revert 使用
    requestAnimationFrame
    深度剖析-事件循环event
    Ubuntu18.04安装ES也就是ELK
    Ubuntu18.04+kafka
  • 原文地址:https://www.cnblogs.com/zhuwenxia/p/9994591.html
Copyright © 2020-2023  润新知