Authored by 王钱钧

修改bug

... ... @@ -23,7 +23,7 @@ var common={
data:options.data||{},
success: function(res) {
res=res.data;
if (res.code === "200") {
if (("" + res.code) === "200") {
common.util.__tip(res.message,"success",callback.bind(this,res));
} else {
common.util.__tip(res.message,"danger");
... ...
... ... @@ -26,16 +26,20 @@ exports.init = function () {
$('#size-property').on('click', '.add2', function () {
var item = g.rows[$(this).data("index")];
common.dialog.confirm("修改尺码属性",
common.util.__template($("#template").html(), {id: item.id, input: item.attributeName})
, function () {
common.util.__ajax({
url: '/erpproduct/sizeattribute/propertyModify',
data: {
id: item.id,
attributeName: $("#input").val()
}
data: (function(){
var input = $('#input').val();
if (input === '' || $.trim(input) === '') return "尺码名不能为空";
return {
id: item.id,
attributeName: $("#input").val()
};
})()
}, function () {
g.reload();
});
... ... @@ -50,9 +54,13 @@ exports.init = function () {
, function () {
common.util.__ajax({
url: '/erpproduct/sizeattribute/propertyAdd',
data: {
attributeName: $("#input").val()
}
data: (function(){
var input = $('#input').val();
if (input === '' || $.trim(input) === '') return "尺码名不能为空";
return {
attributeName: input
};
})()
}, function () {
g.reload();
});
... ...
... ... @@ -24,43 +24,42 @@ exports.init = function() {
var item = g.rows[$(this).data("index")];
console.log(item);
// 修改尺码
common.dialog.confirm("修改尺码属性",
common.dialog.confirm("修改尺码",
common.util.__template($("#template").html(), {id: item.id, input: item.sizeName})
, function () {
common.util.__ajax({
url: '/erpproduct/size/updateSize',
data: function () {
if($("#input").val()==""){
return "尺码名不能为空";
}
data: (function () {
var input = $('#input').val();
if (input === '' || $.trim(input) === '') return "尺码名不能为空";
return {
id: item.id,
sizeName: $("#input").val()
}
}
sizeName: input
};
})()
}, function () {
g.reload();
});
});
});
// 添加尺码
$('#add').on('click', function () {
common.dialog.confirm("添加尺码属性",
common.dialog.confirm("添加尺码",
common.util.__template($("#template").html(), {id: "", input: ""})
, function () {
common.util.__ajax({
url: '/erpproduct/size/addSize',
data: {
sizeName: $("#input").val()
}
data: (function () {
var input = $('#input').val();
if (input === '' || $.trim(input) === '') return "尺码名不能为空";
return {
sizeName: input
};
})()
}, function () {
g.reload();
});
... ...
... ... @@ -36,7 +36,7 @@
<script type="text/template" id="template">
<div class="form-group">
<label for="input" class="col-sm-2 control-label">尺码属性:</label>
<label for="input" class="col-sm-2 control-label">尺码属性:</label>
<div class="col-sm-10">
<input type="hidden" name="" value="{id}" id="id" class="form-control" value="" required="required" pattern="" title="">
<input type="text" name="" value="{input}" id="input" class="form-control" value="" required="required" pattern="" title="">
... ...