...
|
...
|
@@ -7,21 +7,31 @@ var Handlebars = require('yoho.handlebars') |
|
|
|
|
|
exports.init = function() {
|
|
|
$('.getsize').on('click', function() {
|
|
|
console.log($(this).data('id'));
|
|
|
$.ajax({
|
|
|
url: '/erpproduct/size/getSize',
|
|
|
type: 'POST',
|
|
|
dataType: "json",
|
|
|
data: {
|
|
|
id: 9
|
|
|
id: $(this).data('id')
|
|
|
},
|
|
|
success: function(data) {
|
|
|
console.log(data);
|
|
|
console.log(data.data.data);
|
|
|
var siezNameBox = [];
|
|
|
siezNameBox.push('<input type="hidden" id="id" value="'+data.data.data.id+'" />');
|
|
|
siezNameBox.push('<input class="form-control"id="siezName" type="text" value="'+data.data.data.sizeName+'" />');
|
|
|
$('#siezNameBox').html(siezNameBox);
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
$('#addSize').on('click',function(){
|
|
|
$('#siezNameBox').html('<input id="siezName" class="form-control" type="text" value="" />');
|
|
|
$('#modal-id').modal('show');
|
|
|
})
|
|
|
$('.add').on('click', function() {
|
|
|
var id= $('#id').val();
|
|
|
var siezName= $('#siezName').val();
|
|
|
console.log(siezName);
|
|
|
if(!id){
|
|
|
__ajax({
|
|
|
url:'/erpproduct/size/addSize',
|
...
|
...
|
@@ -58,6 +68,9 @@ function __ajax(options,callback){ |
|
|
callback&&callback();
|
|
|
}
|
|
|
});
|
|
|
setInterval(function(){
|
|
|
history.go(0);
|
|
|
},1000)
|
|
|
} else {
|
|
|
$.gritter.add({
|
|
|
title: '提交失败',
|
...
|
...
|
@@ -65,6 +78,9 @@ function __ajax(options,callback){ |
|
|
sticky: false,
|
|
|
time: '1000'
|
|
|
});
|
|
|
setInterval(function(){
|
|
|
history.go(0);
|
|
|
},1000)
|
|
|
}
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -111,7 +127,7 @@ function __ajax(options,callback){ |
|
|
$.each(all, function(index) {
|
|
|
html.push('<li><a href="/erpproduct/size/index/' + all[index] + '" aria-label="Previous">' + all[index] + '</a></li>');
|
|
|
})
|
|
|
html.push('<li><a href="/erpproduct/size/index/10" aria-label="Previous">»</a></li>')
|
|
|
html.push('<li><a href="/erpproduct/size/index/'+this.totalPages+'" aria-label="Previous">»</a></li>')
|
|
|
return html.join('');
|
|
|
});
|
|
|
var pagecm = Handlebars.compile($("#pagenation-template").html().replace(/\\/g, ''));
|
...
|
...
|
|