You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.3 KiB
72 lines
2.3 KiB
/**
|
|
*
|
|
*/
|
|
function selectBypname() {
|
|
$("#table tr:not(:first)").empty("");
|
|
var goods_name = $("#goods_name").val();
|
|
$.ajax({
|
|
type : "post",
|
|
dataType : "json",
|
|
url : basepath+'/Goods/selectBygoodsname',
|
|
data : {
|
|
goods_name : goods_name
|
|
},
|
|
success : function(data) {
|
|
/*console.log(data);*/
|
|
var itemtotal = "";
|
|
$.each(data, function(i, item) {
|
|
/* console.log(item); */
|
|
var id = item.id;
|
|
var goods_name = item.goods_name;
|
|
var price = item.price;
|
|
var category_name = item.gc.category_name;
|
|
item1 = "<tr><td>" +"<input type='checkbox' id='' >"+"</td><td>"+ id + "</td><td>" + goods_name
|
|
+ "</td><td>" + price + "</td><td>" + category_name
|
|
+ "</td><td>"+"<input type='button' value='详情' onclick='check()'> " +
|
|
/*"<a href=' ' onclick = 'javascript:if(confirm('确定删除吗?'))>删除</a>"+ "</td></tr>"; */
|
|
/*"<input type='button' value='删除' onclick='del("id+")'>"+ "</td></tr>";*/
|
|
"<input type='button' value='删除' onclick='del()'>"+ "</td></tr>";
|
|
itemtotal = itemtotal + item1;
|
|
});
|
|
$("#table").append(itemtotal);
|
|
/* alert(data.goods_name);这是错的data是数组不是item不能点出goods_name */
|
|
/* alert("查询成功"); */
|
|
},
|
|
error : function(e) {
|
|
alert("查询失败");
|
|
}
|
|
});
|
|
}
|
|
|
|
function getselectAll() {
|
|
$("#table tr:not(:first)").empty("");
|
|
$.ajax({
|
|
type : "post",
|
|
dataType : "json",
|
|
url : basepath+'/Goods/selectAll',
|
|
data : {},
|
|
success : function(data) {
|
|
alert(data);
|
|
var itemtotal = "";
|
|
$.each(data, function(i, item) {
|
|
var id = item.id;
|
|
var goods_name = item.goods_name;
|
|
var price = item.price;
|
|
var category_name = item.gc.category_name;
|
|
var btn1="<input class='btn btn-primary btn-sm Edit_btn' type='button' id='Edit_btn' value='编辑' />";
|
|
var btn2="<input type='button' value='删除' class='btn btn-danger btn-sm dele_btn' onclick='del()' />";
|
|
item1 = "<tr><td>" +"<input type='checkbox' class='check_item' />"+ "</td><td>"+ id + "</td><td>" + goods_name
|
|
+ "</td><td>" + price + "</td><td>" + category_name
|
|
+ "</td><td>"+btn1 +' '+' '+btn2+ "</td></tr>";
|
|
itemtotal = itemtotal + item1;
|
|
});
|
|
$("#table").append(itemtotal);
|
|
alert("查询成功");
|
|
},
|
|
error : function(e) {
|
|
alert("查询失败");
|
|
}
|
|
});
|
|
}
|
|
|
|
|