$.ajax({
url:"../../stock",
data: $.toJSON(opts),
type:"post",
dataType:"json",
success:function(data) {
var result = data.result;
var reason = data.reason;
if("OK"==result){
if(data.itemList!=null){
if(data.itemList.length>0){
for(var i=0;i<data.itemList.length;i++){
if(data.page.pos>=20){
value = i+20+1;
}else{
value = i+1;
}
if(i%2 == 0){
tab+="<tr class=\"table1-tr1 \" align=\"center\">";
}else{
tab+="<tr class=\"table1-tr2 \" align=\"center\">";
}
tab+="<td>"+value+"</td>";
tab+="<td>"+data.itemList[i].itemName+"</td>";
tab+="<td>"+data.itemList[i].typeName+"</td>";
tab+="<td>"+data.itemList[i].unitName+"</td>";
tab+="<td class='table1-a' width='300px' style='padding-left:60px;' nowrap=\"nowrap\">";
tab+='<a href=\"#\" onclick=\"openDialog(\'query\', \''+data.itemList[i].itemID+'\');\"><p><img src=\"../../images/ico1-1.png\" width=\"16\" height=\"16\"/></p>查看</a>';
//tab+="<input type=\"button\" value=\"查看\" style=\"margin-right:5px;\" onclick='openDialog(\"query\",\""+data.itemList[i].itemID+"\");' class=\"table_butonstyle\">";
//add by guanhao 增加权限控制
if($('#jurisdiction', parent.parent.document).val() != "CSViewer"){
tab+='<a href=\"#\" onclick=\"openDialog(\'update\', \''+data.itemList[i].itemID+'\');\"><p><img src=\"../../images/ico1-2.png\" width=\"16\" height=\"16\"/></p>修改</a>';
tab+='<a href=\"#\" onclick=\"delItem(\''+data.itemList[i].itemID+'\');\"><p><img src=\"../../images/ico1-3.png\" width=\"16\" height=\"16\"/></p>删除</a>';
// tab+="<input type=\"button\" value=\"修改\" style=\"margin-right:5px;\" onclick='openDialog(\"update\",\""+data.itemList[i].itemID+"\");' class=\"table_butonstyle\">";
// tab+="<input type=\"button\" value=\"删除\" style=\"margin-right:5px;\" onclick='delItem(\""+data.itemList[i].itemID+"\");'>";
}else{
$("#addItem").hide();
}
tab+="</td></tr>";
}
}
}
value = 0;
tab+="</tbody>";
tab+="</table>";
$("#itemtable").html(tab);
if(data.page!=null){
totalCount = data.page.totalCount;
}
$("#totalCount").html("每页显示20条,共有"+totalCount+"条记录");
//生成分页
$(".page").pagination(totalCount, {
num_edge_entries: 1,
num_display_entries: 3,
callback: pageselectCallback,
items_per_page:20,
current_page:parseInt(opts.item.pos/20)
});
$(".page").show();
}else{
alert(reason);;
}
},
error:function(msg){
alert(msg);
}
});
隐藏,前台
最新推荐文章于 2021-05-29 21:48:37 发布