html页面代码:
//新增页面
function addInfo() {
lodeHtmlData("新增", {}, false, "add");
}
//查看页面
function viewInfo(id) {
lodeHtmlData("三联单信息-查看", {
id : id
}, true, "look");
}
//修改页面
function editInfo(id) {
lodeHtmlData("三联单信息-修改", {
id : id
}, false, "update");
}
function lodeHtmlData(title, data, readOnly, style) {
AW.post({
url : pluginPath + "/c/loadPageInfo.html",
data : data,
bizName : title,
success : function(data) {
AW.refreshForm($("#basic_form"), eval("(" + data + ")"));
}
});
AW.setDisabled($("#basic_form").find("input,span,textarea,select"),
readOnly);
if(style=="update"){
$("#agsx9400").attr("disabled", "true");
$("#agsx9401").attr("disabled", "true");
$("#agsx9402").attr("disabled", "true");
}
if (readOnly) {
$("#save_button").hide();
} else {
$("#save_button").show();
}
}
"#basic_form":form表单id
js封装:
this.setDisabled = function(nodes, disabled) {
nodes.each(function(i, n) {
var n = $(n);
n.attr("disabled", disabled);
if (n.hasClass("chosen-select")) {
if (disabled) {
n.parent().find(">.chosen-container").addClass("chosen-disabled");
} else {
n.parent().find(">.chosen-container").removeClass("chosen-disabled");
}
} else {
if (n.parent().find(">.iCheck-helper").length > 0) {
if (disabled) {
n.parent().addClass("disabled");
} else {
n.parent().removeClass("disabled");
}
}
}
});
};