/** * Created by vian on 2017/3/27. */ var mainAjax = { getStdBillsLib: function(userId){ $.ajax({ type: "post", url: "/stdBillsEditor/getStdBillsLib", data: {"data": JSON.stringify({"userId": userId})}, dataType: "json", success: function(result){ if(result.data){ for(var i=0; i" + ""+billsLibName+"" + ""+createDateFmt+" " + "" + " " + ""); var newHref = "stdBills?billsLibId="+id; $("#tempId td:first a").attr("href", newHref); $("#tempId").attr("id", id); } } } }); }, createStdBillsLib: function(billsLibName){ $.ajax({ type: "POST", url: "/stdBillsEditor/createStdBillsLib", data: {data: JSON.stringify({name: billsLibName}) }, dataType: "json", success: function(result){ var id = result.data[0].billsLibId; var createDate = result.data[0].createDate; var createDateFmt = new Date(createDate).format("yyyy-MM-dd"); $("#showArea").append( ""+billsLibName+""+createDateFmt+" " + " " + "" ); var newHref = "stdBills?billsLibId="+id; $("#tempId td:first a").attr("href", newHref); $("#tempId").attr("id", id); } }); }, deleteStdBillsLib: function(billsLibId){ $.ajax({ type: "POST", url: "/stdBillsEditor/deleteStdBillsLib", data: {"data": JSON.stringify({"billsLibId": billsLibId})}, dataType: "json", success: function(result){ if(!result.error){ var jqSel = "#"+billsLibId; $(jqSel).remove(); } } }); }, renameStdBillsLib: function(billsLibId, newName){ $.ajax({ type: "post", url: "/stdBillsEditor/renameStdbillsLib", data: {"data": JSON.stringify({"id": billsLibId, "value": newName})}, dataType: "json", success: function(result){ var jqSel = "#" + billsLibId + " td:first" + " a"; $(jqSel).text(newName); } }); } } var billsAjax = { getBills: function(billsLibId){ $.ajax({ type: "post", url: "/stdBillsEditor/getBills", data: {"data": JSON.stringify({"billsLibId": billsLibId})}, dataType: "json", success: function(result){ } }); } }