newCarInfo.js代码如下:
$(function() {
// 获取燃油种类
url = "basicFuelType_queryAll.action";
$.post(url,params,function(data) {
$.each(data.rows,function(index,item) {
$("#fuelType").append("<option value='" + item.fuelTypeName + "'>" + item.fuelTypeName + "</option>");
});
},"json");
// 如果是修改车辆档案,那么赋值
var _addOrEdit = $("#_addOrEdit").val();
if ("add" == _addOrEdit) {
$("#_submit_fk").css("visibility","visible");
$("#_submit_edit").css("visibility","hidden");
} else {
$("#_submit_fk").css("visibility","hidden");
$("#_submit_edit").css("visibility","visible");
var row = $("#dataList").datagrid("getSelected");
if (row) {
$("#thisid").val(row.id);
$("#_licenseNo").val(row.licenseNo);
$("#_licenseType option[value='" + row.licenseType + "']").attr("selected","selected");
$("#_licenseColor option[value='" + row.licenseColor + "']").attr("selected","selected");
$("#engineNo").val(row.engineNo);
$("#fuelType option[value='" + row.fuelType + "']").attr("selected","selected");
}
}
})