$(function() { getbaseList(1); }); function getbaseList(init) { if (init == 1) $(".pageNum").val(1); JY.Model.loading(); JY.Ajax.doRequest("baseForm",bonuspath + '/backstage/machineType/findWarnModel',null, function(data) { $("#baseTable tbody").empty(); var obj = data.obj; var list = obj.list; var results = list.results; var permitBtn = obj.permitBtn; var pageNum = list.pageNum, pageSize = list.pageSize, totalRecord = list.totalRecord; var html = ""; if (results != null && results.length > 0) { var leng = (pageNum - 1) * pageSize; for (var i = 0; i < results.length; i++) { var l = results[i]; html += ""; html += "" + (i + leng + 1) + ""; html += "" + JY.Object.notEmpty(l.firstName) + ""; html += "" + JY.Object.notEmpty(l.secondName) + ""; html += "" + JY.Object.notEmpty(l.parentName) + ""; html += "" + JY.Object.notEmpty(l.name) + ""; html += "" + JY.Object.notEmpty(l.nums) + ""; html += "" + JY.Object.notEmpty(l.allNums) + ""; html += "" + JY.Object.notEmpty(l.keeper) + ""; // html += rowFunction(l.id); html += ""; } $("#baseTable tbody").append(html); JY.Page.setPage("baseForm", "pageing", pageSize,pageNum, totalRecord, "getbaseList"); } else { html += "没有相关数据"; $("#baseTable tbody").append(html); $("#pageing ul").empty();// 清空分页 } JY.Model.loadingClose(); } ); } function rowFunction(id) { var h = ""; h += ""; h += ""; h += ""; h += ""; return h; } function check(id) { cleanForm(); JY.Ajax.doRequest(null, bonuspath + '/backstage/machineType/findModel', { id : id }, function(data) { setForm(data); JY.Model.check("auDiv"); }); } function setForm(data) { var l = data.obj; $("#auForm input[name$='id']").val(l.id); $("#auForm input[id$='pName']").val(JY.Object.notEmpty(l.parentName)); $("#auForm input[id$='name']").val(JY.Object.notEmpty(l.name)); $("#auForm input[id$='sampingRatio']").val(JY.Object.notEmpty(l.sampingRatio)); $("#auForm input[id$='weight']").val(JY.Object.notEmpty(l.weight)); $("#auForm input[id$='unit']").val(JY.Object.notEmpty(l.unit)); $("#auForm input[id$='ratedLoad']").val(JY.Object.notEmpty(l.ratedLoad)); $("#auForm input[id$='testLoad']").val(JY.Object.notEmpty(l.testLoad)); $("#auForm input[id$='holdingTime']").val(JY.Object.notEmpty(l.holdingTime)); $("#auForm input[id$='leasePrice']").val(JY.Object.notEmpty(l.leasePrice)); $("#auForm input[id$='payPrice']").val(JY.Object.notEmpty(l.payPrice)); $("#auForm input[id$='buyPrice']").val(JY.Object.notEmpty(l.buyPrice)); if(l.isTest == "1") { $('#isTest1').prop('checked',true); } if(l.isTest == "0") { $('#isTest0').prop('checked',true); } if(l.isCount == "1") { $('#isCount1').prop('checked',true); } if(l.isTest == "0") { $('#isCount0').prop('checked',true); } $("#auForm input[id$='keeper']").val(JY.Object.notEmpty(l.keeper)); $("#auForm input[id$='warnNum']").val(JY.Object.notEmpty(l.warnNum)); } function cleanForm() { $("#auForm input[name$='id']").val(""); $("#auForm input[id$='pName']").val(""); $("#auForm input[id$='name']").val(""); $("#auForm input[id$='sampingRatio']").val("100"); $("#auForm input[id$='weight']").val(""); $("#auForm input[id$='unit']").val(""); $("#auForm input[id$='ratedLoad']").val(""); $("#auForm input[id$='testLoad']").val(""); $("#auForm input[id$='holdingTime']").val(""); $("#auForm input[id$='leasePrice']").val(""); $("#auForm input[id$='payPrice']").val(""); $("#auForm input[id$='buyPrice']").val(""); $('#isTest1').prop('checked',true); $('#isCount0').prop('checked',true); $("#auForm input[id$='keepper']").val(""); $("#auForm input[id$='warnNum']").val(""); } function edit(id) { cleanForm(); JY.Ajax.doRequest(null, bonuspath + '/backstage/machineType/findModel', { id : id }, function(data) { setForm(data); JY.Model.edit("auDiv", "修改", function() { var sampingRatio = $("#sampingRatio").val(); if(sampingRatio >= 0 && sampingRatio <= 100){ if (JY.Validate.form("auForm")) { var that = $(this); JY.Ajax.doRequest("auForm", bonuspath + '/backstage/machineType/updateModel', null, function(data) { that.dialog("close"); JY.Model.info(data.resMsg, function() { getbaseList(1); }); }); } }else{ JY.Model.info("请正确填写抽检比例!(0~100)"); } }); }); } function del(id) { JY.Model.confirm("请联系相关人员", function(){ JY.Model.confirm("确认删除吗?", function() { JY.Ajax.doRequest(null, bonuspath + '/backstage/machineType/delete', { id : id, level : 4 }, function(data) { JY.Model.info(data.resMsg, function() { getbaseList(1); }); }); }); }); }