展开全部
问题具体一点,代码肯定是没有的,e68a843231313335323631343130323136353331333365663438只会给你思路
是前端不会还是后端不会?
评论里面写了。下面是前端类似代码。前端传递一个集合到后端,后端批量update。第一种是ajax修改一条,行失去焦点触发。var flag =$("#addStructureForm").form('validate');
if (flag){
var attributeListStr = "";
var attributeList = new Array();
var trs = $("#addStructureForm table tbody tr");
if(trs.size() == 0 || trs == "undefined"){
$.messager.alert('提示', "结构至少需要包含一条配置字段", 'error');
return false;
}
var sameAttr = false;
trs.each(function(){
var attribute = {};
attribute["attributeName"]=$(this).find("[name=attributeName]").val();
attribute["attributeField"]=$(this).find("[name=attributeField]").val();
attribute["attributeDesc"]=$(this).find("[name=attributeDesc]").val();
var isRequired = "" + $(this).find("[name=isRequired]").is(':checked');
attribute["attributeValidate"]=isRequired + "|" + $(this).find("[name=length]").val();
for(var i=0; i
if (attributeList[i].attributeField == attribute.attributeField){
$.messager.alert('提示', "结构属性字段不能重复:" + attribute.attributeField, 'error');
sameAttr = true;
return false;
}
}
attributeList.push(attribute);
});
if (sameAttr){
return false;
}
attributeListStr = JSON.stringify(attributeList);
$('#addStructureForm').form('submit',{
url: basePath + "/commonContentManage/structure/addStructure",
onSubmit:function(param){
param.attributeListStr=attributeListStr;
},
success:function(data){
var datas = JSON.parse(data);
if (datas.success == "true"){
$.messager.alert('操作结果', datas.message, 'info');
$("#addStructure").dialog('close');
} else{
$.messager.alert('操作结果', datas.message, 'error');
}
}
});