JQuery给指定的表格的输入框或其他组件赋值

参考代码如下:

function modifyApplyMoney()
{
    var applymoney = $("#applymoney").val();//申请金额
    var plandeposit = $("#plandeposit").val();//拟交保证金
    if (plandeposit == "")
    {
        plandeposit = 0;
    }
    if (applymoney == "")
    {
        applymoney = 0;
    }
    if (plandeposit != 0 && applymoney != 0 && (applymoney - (plandeposit*10000)) < 0)
    {
        alert("拟交保证金不能大于拟担保金额!");
        $("#plandeposit").val("");
        return;
    }
    var fee = 0;
    var assureterm = 0;
    var assuretermtype= $("#assuretermtype").val();//担保期限类型
    var table=$("#projfee");
    var trs=table.find("tr");
    var feerate = 0;
    var method="";
    var index=0;
    var feeinfolist="<s:property value='result.dataMap.projectInfo.feeProjInfoList.size'/>";
    if(feeinfolist > 0)
    { 
        index=0;
    }
    var val = $('#busstypeid').val();
    
      
    for(var i=2;i<trs.length;i++)
    {  
        fee=0;
         assureterm= $("#assureterm").val(); //担保期限  
        /*收费方式*/ 
        var method=$("#projfee").find("[name='projectInfo.feeProjInfoList["+index+"].feemethod']:last").val();
        /*费用类型*/
        var feetype=$("#projfee").find("[name='projectInfo.feeProjInfoList["+index+"].feetype']:last").val();
        index++;
        feerate=$(trs[i]).find(".feerate").val();
           if(feetype=="301"){
               fee= applymoney*feerate* 100;
            }else{
            /*年*/
            if(method==3){
                fee = (applymoney * feerate) * 100
            }
            /*月*/
            if(method==2){
           
                 if(assuretermtype==2){
                    fee = (applymoney * feerate*assureterm) * 100
                  }
                  if(assuretermtype==1){
                    fee = (applymoney * feerate*assureterm*12) * 100    
                  }
                  if(assuretermtype==3){
                    fee = (applymoney * feerate*(assureterm/30)) * 100    
                  }
            }
            /*次*/
            if(method==1){
                if(assuretermtype==1){
                    fee = (applymoney * feerate*assureterm) * 100
                  }
                  if(assuretermtype==2){
                    fee = (applymoney * feerate*(assureterm/12)) * 100    
                  }
                  if(assuretermtype==3){
                    fee = (applymoney * feerate*(assureterm/365)) * 100    
                      }
                  //alert("money"+money+"_feerate"+feerate+"_assureterm"+assureterm+"_fee"+fee);
                }
            }
               
       /*担保费,费用精确到百元*/
<%--      if(feetype=='101' || feetype=='104'||feetype=='105'){--%>
<%--          fee=roundFloat((fee/10000),2);--%>
<%--          fee=fee*10000; --%>
<%--          }--%>

            var refyearfee;
            if(method==3){
                if(assuretermtype==1)
                {
                    refyearfee = (applymoney * feerate*assureterm) * 100
                }
                if(assuretermtype==2)
                {
                    refyearfee = (applymoney * feerate*(assureterm/12)) * 100    
                }
                if(assuretermtype==3)
                {
                    refyearfee = (applymoney * feerate*(assureterm/365)) * 100    
                }

                $(trs[i]).find(".refyear").val(roundFloat(fee,2));
                $(trs[i]).find(".feewill").val(roundFloat(refyearfee,2))
                
            }else{
                $(trs[i]).find(".refyear").val("-");
            }
             //$(trs[i]).find(".feewill").val(roundFloat(fee,2))
    }
    calcauteRate();
}

<td style="text-align:center;">
  <input type="text" id="projectInfo.feeProjInfoList[0].feewill" onblur="allFeeSum();"

  name="projectInfo.feeProjInfoList[0].feewill" class="easyui-validatebox feewill"

  data-options="required:true,validType:'number'" disabled="true" style="width:100px;" />
</td>

 class="easyui-validatebox feewill"

$(trs[i]).find(".feewill").val(roundFloat(refyearfee,2));就是赋值;

 

posted @ 2019-05-28 16:36  xh_Blog  阅读(855)  评论(0编辑  收藏  举报