📄 stufflist.aspx
字号:
function UpdateTable(xml,table)
{
var len=table.rows.length;
for(var i=len-1;i>0;i--)
{
table.deleteRow(i);
}
for(var i=0;i<xml.documentElement.childNodes.length;i++)
{
//alert(xml.documentElement.xml);
var node=xml.documentElement.childNodes[i];
var row=table.insertRow();
addTrStyle(row);
addMoveEvent(row);
addOutEvent(row);
addClickEvent(row);
addDblClickEvent(row);
var cell=row.insertCell();
cell.innerText=node.childNodes[0].text+" ";
cell.className="td1";
cell=row.insertCell();
cell.innerText=node.childNodes[1].text+" ";
cell.className="td1";
cell=row.insertCell();
cell.innerText=node.childNodes[2].text+" ";
cell.className="td1";
cell=row.insertCell();
cell.innerText=node.childNodes[3].text+" ";
cell.className="td1";
cell=row.insertCell();
cell.innerText=node.childNodes[4].text+" ";
cell.className="td1";
cell=row.insertCell();
cell.innerText=node.childNodes[5].text+" ";
//cell.style.display="none";
cell.style.width="0";
cell.className="td1";
cell=row.insertCell();
cell.innerText=node.childNodes[6].text+" ";
cell.className="td1";
cell=row.insertCell();
cell.innerText=node.childNodes[7].text+" ";
cell.className="td1";
cell=row.insertCell();
cell.innerText=node.childNodes[8].text+" ";
cell.className="td1";
cell=row.insertCell();
cell.innerText=node.childNodes[9].text+" ";
//cell.style.display="none";
cell.style.width="0";
cell.className="td1";
cell=row.insertCell();
cell.innerText=node.childNodes[10].text+" ";
cell.className="td1";
}
}
function addTrStyle(row)
{
row.style.height="22";
row.style.whiteSpace="nowrap";
row.style.backgroundColor="#ffffff";
}
//联动下拉框
function linkage(obj,objcategory)
{
objcategory.innerHTML="";
if(xmlDom!=null)
{
for(var i=0;i<xmlDom.documentElement.childNodes.length;i++)
{
if(xmlDom.documentElement.childNodes[i].attributes[0].text==obj.value)
{
var op=document.createElement("OPTION");
op.value="";
op.innerText="";
objcategory.appendChild(op);
for(var ii=0;ii<xmlDom.documentElement.childNodes[i].childNodes.length;ii++)
{
var op=document.createElement("OPTION");
op.value=xmlDom.documentElement.childNodes[i].childNodes[ii].attributes[1].text;
op.innerText=xmlDom.documentElement.childNodes[i].childNodes[ii].attributes[0].text;
objcategory.appendChild(op);
}
}
}
}
}
//查询
function query()
{
currentTR=null;
var param="op=byMulit&sort="+document.all("sltSort").value+"&stype="+document.all("sltCategory").value+"&sname="+document.all("txtStuffName").value+"&snamecon="+document.all("sltStuffNameCondition").value+"&sno="+document.all("txtStuffNo").value+"&snocon="+document.all("sltStuffNoCondition").value+"&stock="+document.all("txtStock").value+"&stockcon="+document.all("sltStock").value;
var xmlHttp=new ActiveXObject("microsoft.XMLHTTP");
xmlHttp.open("POST","StuffQuery.aspx",false);
xmlHttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded;");
xmlHttp.send(param);
var xmlDom2=new ActiveXObject("msxml.DOMDocument");
var xml=xmlHttp.responsetext;
if(xml!="false")
{
xmlDom2.loadXML(xml);
UpdateTable(xmlDom2,document.all("tb1"));
}
}
//绑定单位
function BindUnit(objSlt)
{
objSlt.innerHTML="";
var xmlDom2=new ActiveXObject("msxml.DOMDocument");
xmlDom2.async=false;
xmlDom2.load("../XML/unit.xml");
var op=document.createElement("OPTION");
objSlt.appendChild(op);
for(var i=0;i<xmlDom2.documentElement.childNodes.length;i++)
{
var op=document.createElement("OPTION");
op.value=xmlDom2.documentElement.childNodes[i].attributes[0].text;
op.innerText=xmlDom2.documentElement.childNodes[i].attributes[1].text;
objSlt.appendChild(op);
}
}
//默认选定下拉框项目
function selectSltValue(objSlt,text)
{
objSlt.selectedIndex=0;
for(var i=0;i<objSlt.options.length;i++)
{
//alert(document.all("sltNewCategory").options.length);
if(objSlt.options[i].outerText==text)
{
objSlt.selectedIndex=i;
if(objSlt.id=="sltNewSort")
{
linkage(objSlt,document.all("sltNewCategory"));
}
return;
}
}
}
//新增类别
var categoryOpState;
function newCategory(objDiv)
{
categoryOpState="add";
document.all("txtAddCategoryId").value="999";
document.all("txtAddCategory").value="";
document.all("txtAddRemark").value="";
showDiv(objDiv);
}
//修改类别
function modifyCategory()
{
categoryOpState="modify";
if(currentCategory!=null&&categoryId!="undefined")
{
var o=currentCategory.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.rows[0].outerText;
document.all("txtAddCategoryId").value=categoryId;
document.all("txtAddCategory").value=currentCategory.outerText;
selectSltValue(document.all("sltAddCategory"),o);
showDiv(document.all("divCategory"));
}
else
{
alert("请先选中左边要修改的小类!");
}
}
//删除类别
function deleteCategory()
{
categoryOpState="del";
if(currentCategory!=null&&categoryId!="undefined")
{
document.all("txtAddCategory").value=currentCategory.outerText;
document.all("txtAddCategoryId").value=categoryId;
if(confirm("删除该类别同时会删除所属该类的物料资料,确定删除吗?"))
{
saveCategory("","");
}
}
else
{
alert("请先选中左边要修改的小类!");
}
}
//保存类别
function saveCategory(sort,category)
{
var param="op="+categoryOpState+"&id="+document.all("txtAddCategoryId").value+"&sort="+document.all("sltAddCategory").value+"&category="+document.all("txtAddCategory").value+"¬e="+document.all("txtAddRemark").value;
var xmlHttp=new ActiveXObject("microsoft.XMLHTTP");
xmlHttp.open("POST","stuffCategoryHandle.aspx",false);
xmlHttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded;");
xmlHttp.send(param);
retValue=xmlHttp.responsetext;
if(getState(retValue)=="1")
{
document.all("divCategory").style.display="none";
if(categoryOpState=="add")
{
alert("添加成功");
currentCategory=null;
}
else if(categoryOpState=="modify")
{
alert("修改成功");
currentCategory=null;
}
else
{
alert("删除成功");
currentCategory=null;
}
}
else
{
alert(getMsg(retValue));
}
buildTreeView("../XML/StuffCategory.xml");
linkage(document.all("sltSort"),document.all("sltCategory"));
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -