解决单位被删后导致商品选择的bug

This commit is contained in:
季圣华
2020-04-22 23:58:46 +08:00
parent 19a90d578a
commit 4d05d5ee2f
2 changed files with 46 additions and 36 deletions

View File

@@ -330,44 +330,53 @@
oldUnit = ""; oldUnit = "";
unitID = 0; unitID = 0;
url = '/unit/add'; url = '/unit/add';
//单位名称事件
$("#basicName").textbox('textbox').bind("keyup", function () {
$("#unitName").text($(this).val());
});
} }
//保存信息 //保存信息
$("#saveUnit").off("click").on("click", function () { $("#saveUnit").off("click").on("click", function () {
if (checkUnitName()) { if(!$('#unitFM').form('validate')){
return; return;
} }
var basicName = $.trim($("#basicName").val()); else {
var otherName = $.trim($("#otherName").val()); if (checkUnitName()) {
var otherNum = $.trim($("#otherNum").val());
var name = basicName + "," + otherName + "(1:" + otherNum + ")";
$.ajax({
url: url,
type: "post",
dataType: "json",
data: ({
info: JSON.stringify({
uname: name,
basicUnit: basicName,
otherUnit: otherName,
ratio: otherNum
})
}),
success: function(res) {
if(res && res.code === 200) {
$('#unitDlg').dialog('close');
//加载完以后重新初始化
var opts = $("#tableData").datagrid('options');
showUnitDetails(opts.pageNumber, opts.pageSize);
}
},
//此处添加错误处理
error: function () {
$.messager.alert('提示', '保存计量单位异常,请稍后再试!', 'error');
return; return;
} }
}); var basicName = $.trim($("#basicName").val());
var otherName = $.trim($("#otherName").val());
var otherNum = $.trim($("#otherNum").val());
var name = basicName + "," + otherName + "(1:" + otherNum + ")";
$.ajax({
url: url,
type: "post",
dataType: "json",
data: ({
info: JSON.stringify({
uname: name,
basicUnit: basicName,
otherUnit: otherName,
ratio: otherNum
})
}),
success: function (res) {
if (res && res.code === 200) {
$('#unitDlg').dialog('close');
//加载完以后重新初始化
var opts = $("#tableData").datagrid('options');
showUnitDetails(opts.pageNumber, opts.pageSize);
}
},
//此处添加错误处理
error: function () {
$.messager.alert('提示', '保存计量单位异常,请稍后再试!', 'error');
return;
}
});
}
}); });
//编辑信息 //编辑信息
@@ -382,6 +391,10 @@
$("#otherNum").textbox("setValue", rowsdata.ratio); $("#otherNum").textbox("setValue", rowsdata.ratio);
$("#unitName").text(rowsdata.basicUnit); $("#unitName").text(rowsdata.basicUnit);
url = '/unit/update?id=' + rowsdata.id; url = '/unit/update?id=' + rowsdata.id;
//单位名称事件
$("#basicName").textbox('textbox').bind("keyup", function () {
$("#unitName").text($(this).val());
});
} }
//检查名称是否存在 ++ 重名无法提示问题需要跟进 //检查名称是否存在 ++ 重名无法提示问题需要跟进
@@ -472,11 +485,6 @@
$("#searchBtn").click(); $("#searchBtn").click();
} }
}); });
//单位名称事件
$("#basicName").off("keyup").on("keyup", function () {
$("#unitName").text($(this).val());
});
</script> </script>
</body> </body>
</html> </html>

View File

@@ -157,7 +157,9 @@ public class MaterialController {
ratio = ""; ratio = "";
} else { } else {
ratio = material.getUnitName(); ratio = material.getUnitName();
ratio = ratio.substring(ratio.indexOf("(")); if(ratio!=null) {
ratio = ratio.substring(ratio.indexOf("("));
}
} }
//品名/型号/扩展信息/包装 //品名/型号/扩展信息/包装
String MaterialName = ""; String MaterialName = "";