layuiアップロードファイル(class='layui-btn layui-btn-sm uploadBtn file 2_"+i+")


================================================================================================
エコーデータ:
for(var k = 0;k < bonusList.length; k++) {
    var bonus  = bonusList[k];
    i += 1;
    var tablestr = "";
    tablestr += "";
    tablestr += "";
    tablestr += "";
    tablestr += "";
    tablestr += "   ";
    tablestr += "     
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += ""; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += ""; tablestr += ""; tablestr += " "; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += " "; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += ""; tablestr += ""; tablestr += ""; if(bonus.agreementName == undefined){ tablestr += ""; tablestr += "" tablestr += ""; }else{ tablestr += ""+bonus.agreementName+""; } if(bonus.annexName == undefined){ tablestr += ""; tablestr += ""; tablestr += ""; }else{ tablestr += ""+bonus.annexName+""; } tablestr += ""; tablestr += ""; tablesstr+=" "; tablestr += ""; $("#fenHBody1").append(tablestr); $("#bonusYears"+i).val(bonus.bonus_years); $("#bonusPrec"+i).val(bonus.bonus_prec); $("#bonusUnitType"+i).val(bonus.bonus_unit_type); $("#investUnit"+i).val(bonus.bonus_unit_id); $("#investment"+i).val(bonus.investment); var bonusUnitTypeid = "bonusUnitType"+i ; var bonus_unit_id = bonus.bonus_unit_id ; var investUnitDiv = "#investUnit"+i ; var selectId = bonusUnitTypeid.substring(13, bonusUnitTypeid.length); var unit_class = $("#" + bonusUnitTypeid).val(); $.ajax({// url: "../project/investUnit", type: "POST", data: {"unit_class": unit_class}, dataType: "json", async: false, success: function (data) { $("#investUnit" + selectId).empty(); var tablestr = ""; for (var j = 0; j < data.investUnitList.length; j++) { var investUnit = data.investUnitList[j]; tablestr += ""; } $("#investUnit" + selectId).append(tablestr) $(investUnitDiv).val(bonus_unit_id); form.render(); } }); upload.render({ elem: '.file_'+i ,url: '../file/fileUpload' ,method: 'post' ,done: function(res){ // if(res.msg=='1'){ layer.msg(" "); console.log(res.file_name) addUpoloadTr(res.file_name,res.file_url,1); }else{ layer.msg(" "); } } ,accept: 'file' // }) upload.render({ elem: '.file2_'+i ,url: '../file/fileUpload' ,method: 'post' ,done: function(res){ // if(res.msg=='1'){ layer.msg(" "); console.log(res.file_name) addUpoloadTr(res.file_name,res.file_url,2); }else{ layer.msg(" "); } } ,accept: 'file' // }) }

 
==================================================================================== 
1行のアクションを追加するには、次の手順に従います.
function fenHong(){
    i += 1;
    var tablestr = "";
    tablestr += "";
    tablestr += "";
    tablestr += "";
    tablestr += "";
    tablestr += "   ";
    tablestr += "     
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += " "; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += ""; tablestr += ""; tablestr += " "; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += " "; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += "
"; tablestr += ""; tablestr += ""; tablestr += ""; tablestr += ""; tablestr += "" tablestr += ""; tablestr += ""; tablestr += ""; tablestr += ""; tablestr += ""; tablestr += ""; tablesstr+=" "; tablestr += ""; $("#fenHBody1").append(tablestr); upload.render({ elem: '.file_'+i ,url: '../file/fileUpload' ,method: 'post' ,done: function(res){ // if(res.msg=='1'){ layer.msg(" "); console.log(res.file_name) addUpoloadTr(res.file_name,res.file_url,1); }else{ layer.msg(" "); } } ,accept: 'file' // }) upload.render({ elem: '.file2_'+i ,url: '../file/fileUpload' ,method: 'post' ,done: function(res){ // if(res.msg=='1'){ layer.msg(" "); console.log(res.file_name) addUpoloadTr(res.file_name,res.file_url,2); }else{ layer.msg(" "); } } ,accept: 'file' // }) }

 
var uploadList = [];
function addUpoloadTr(file_name,file_url,type) {
    var uploadObject = new Object();
    uploadObject['parentId'] = parentId;
    uploadObject['annexName'] = file_name;
    uploadObject['fileUrl'] = file_url;
    //1  2 
    uploadObject['type'] = type;
    if(type ==1 ){
        $("#fileDiv"+parentId).empty();
        var tablestr = "";
        tablestr += "";
        $("#fileDiv"+parentId).append(tablestr);
    }
    if(type ==2 ){
        $("#fileDiv2"+parentId).empty();
        var tablestr = "";
        tablestr += "";
        $("#fileDiv2"+parentId).append(tablestr);
    }
    uploadList.push(uploadObject);
}
var parentId ;
function fileupload(v){
    parentId = v
}