📄 spreadsheet.js
字号:
dataElement.appendChild(newDataNode);
newDataNode = dataXMLDOC.createElement("field");
i = activecell.row;
j = activecell.column;
newDataNode.setAttribute("row",i);
newDataNode.setAttribute("col",j+tt);
newDataNode.setAttribute("condition","");
//newDataNode.setAttribute("actcount","0");
newDataNode.setAttribute("name",optionsValues[2]);
newDataNode.setAttribute("showname",optionsValues[4]);
newDataNode.setAttribute("type",optionsValues[3]);
if(optionsValues[3]=="3")
{
newDataNode.setAttribute("format","yy-MM-dd");
}
if(optionsValues[5]!=""&&optionsValues[5]!=null)
{
newDataNode.setAttribute("code",optionsValues[5]);
}
if(optionsValues[6]!=""&&optionsValues[6]!=null)
{
newDataNode.setAttribute("consql",optionsValues[6]);
}
//newDataNode.setAttribute("rep","1");
chfieldname = optionsValues[4];
rowrow=i;
colcol=j+tt;
}
for(x=0;x<dataXMLDOC.documentElement.childNodes.length;x++)
{
datanode = dataXMLDOC.documentElement.childNodes.item(x);
for(i=0;i<datanode.childNodes.length;i++)
{
fieldnode = datanode.childNodes.item(i);
xxx = fieldnode.getAttribute("row");
yyy = fieldnode.getAttribute("col");
xxxx = activecell.row ;
yyyy = activecell.column+tt ;
//alert("xxx:"+xxx+";yyy:"+yyy+";xxxx:"+xxxx+";yyyy:"+yyyy+";");
if(xxx==xxxx&&yyy==yyyy)
{
//alert("removeChild:");
deleteXmlNode(document.forms(0),Spreadsheet.Cells(xxxx,yyyy));
//alert("enddeleteXmlNode(");
//datanode.removeChild(fieldnode); //该格式中如果定义过则删除结点
break ;
}
}
}
for(x=0;x<dataXMLDOC.documentElement.childNodes.length;x++)
{
datanode = dataXMLDOC.documentElement.childNodes.item(x);
datanode.appendChild(newDataNode);
}
if(chfieldname.indexOf(".")!=-1)
{
activecell.value="["+chfieldname.substring(chfieldname.indexOf(".")+1)+"]";
}
else
{
//activecell.value = "["+chfieldname+"]";
Spreadsheet.Cells(rowrow,colcol).value="["+chfieldname+"]";
}
//optionsFlags[selectIndex] = true ;//标记选择过
}
else //该字段已经定义过
{
kkkk = -1;
for(x=0;x<dataXMLDOC.documentElement.childNodes.length;x++)
{
datanode = dataXMLDOC.documentElement.childNodes.item(x);
for(i=0;i<datanode.childNodes.length;i++)
{
fieldnode = datanode.childNodes.item(i);
xxx = fieldnode.getAttribute("row");
yyy = fieldnode.getAttribute("col");
xxxx = activecell.row ;
yyyy = activecell.column ;
if(xxx==xxxx&&yyy==yyyy)
{
for(k=0;k<form.queryfield.options.length;k++)
{
datad = form.queryfield.options[k].value;
//divideOptionValue(datad);
optionsValues=datad.split("$");
fieldname1 = optionsValues[1];
if(fieldname1==fieldnode.nodeName) //找到对应的选择过的字段在select中的编号
{
kkkk = k ;
if(k!=selectIndex)
{
optionsFlags[k] = false ;//修改记录该字段是否被选择过的值
}
break ;
}
}
datad = form.queryfield.options[k].value;
//divideOptionValue(datad);
optionsValues=datad.split("$");
if(kkkk!=selectIndex)datanode.removeChild(fieldnode); //该格式中如果定义过则删除结点
break ;
}
}
}
data = form.queryfield.options[selectIndex].value;
//data = "epmsTirpTbl|vcCommon001ID|1|1|序列号|610001|0";
//表名|字段名|type|id|memo|extendtype|baseinfo
//divideOptionValue(data); //分隔
optionsValues=data.split("$");
fieldname = optionsValues[1];
for(x=0;x<dataXMLDOC.documentElement.childNodes.length;x++)
{
datanode = dataXMLDOC.documentElement.childNodes.item(x);
for(i=0;i<datanode.childNodes.length;i++)
{
fieldnode = datanode.childNodes.item(i);
if(fieldnode.nodeName==fieldname)
{
row = fieldnode.getAttribute("row");
col = fieldnode.getAttribute("col");
Spreadsheet.Activesheet.Cells(row,col).value = "";
row = activecell.row;col=activecell.column;
ssssT = form.queryfield.options[selectIndex].text ;
if(ssssT.indexOf(".")!=-1)ssssT = ssssT.substring(ssssT.indexOf(".")+1);
Spreadsheet.Activesheet.Cells(row,col).value = "["+ssssT+"]";
fieldnode.setAttribute("row",row);
fieldnode.setAttribute("col",col); //修改行列值
break;
}
}
}
}
}
}
else
{
iteminfoValues=allinfoarray[2].split("^");
var definedNode ;
var datanode;
var seledtable;
defined = true;
var selectIndex=-1; //选中的option
var kkkk;
for(tt=0;tt<iteminfoValues.length-1;tt++)
{
//alert("tt:"+tt);
if(true)
{
nodecount=0;
data = iteminfoValues[tt];
optionsValues=data.split("&,&");
fieldname = optionsValues[1];
for(i=0;i<dataXMLDOC.documentElement.childNodes.length;i++)
{
datanode = dataXMLDOC.documentElement.childNodes.item(i);
tablename = datanode.getAttribute("name");
if(optionsValues[1]==tablename)
{
seledtable=i;
break;
}
nodecount++;
}
var rowrow;
var colcol;
if(nodecount==dataXMLDOC.documentElement.childNodes.length)
{
newDataNode = dataXMLDOC.createElement("table");
newDataNode.setAttribute("name",optionsValues[1]);
newDataNode.setAttribute("rep","0");
newDataNode.setAttribute("timemark",allinfoarray[4]);
dataElement = dataXMLDOC.documentElement;
dataElement.appendChild(newDataNode);
newDataNode = dataXMLDOC.createElement("field");
newDataNode.setAttribute("name",optionsValues[2]);
newDataNode.setAttribute("showname",optionsValues[4]);
newDataNode.setAttribute("condition","");
//newDataNode.setAttribute("actcount","0");
newDataNode.setAttribute("type",optionsValues[3]);
if(optionsValues[3]=="3")
{
newDataNode.setAttribute("format","yy-MM-dd");
}
if(optionsValues[5]!=""&&optionsValues[5]!=null)
{
newDataNode.setAttribute("code",optionsValues[5]);
}
if(optionsValues[6]!=""&&optionsValues[6]!=null)
{
newDataNode.setAttribute("consql",optionsValues[6]);
}
chfieldname = optionsValues[4];
}
else
{
var eqcount=0;
for(eqc=0;eqc<datanode.childNodes.length;eqc++)
{
eqtmpdatanode = datanode.childNodes.item(eqc);
if(eqtmpdatanode.getAttribute("name")==optionsValues[2])
{
break;
}
eqcount++;
}
if(eqcount==datanode.childNodes.length)
{
newDataNode = datanode;
dataElement = dataXMLDOC.documentElement;
dataElement.appendChild(newDataNode);
newDataNode = dataXMLDOC.createElement("field");
newDataNode.setAttribute("name",optionsValues[2]);
newDataNode.setAttribute("showname",optionsValues[4]);
newDataNode.setAttribute("condition","");
//newDataNode.setAttribute("actcount","0");
newDataNode.setAttribute("type",optionsValues[3]);
if(optionsValues[3]=="3")
{
newDataNode.setAttribute("format","yy-MM-dd");
}
if(optionsValues[5]!=""&&optionsValues[5]!=null)
{
newDataNode.setAttribute("code",optionsValues[5]);
}
if(optionsValues[6]!=""&&optionsValues[6]!=null)
{
newDataNode.setAttribute("consql",optionsValues[6]);
}
//newDataNode.setAttribute("rep","0");
chfieldname = optionsValues[4];
}
}
for(x=0;x<dataXMLDOC.documentElement.childNodes.length;x++)
{
datanode = dataXMLDOC.documentElement.childNodes.item(x);
for(i=0;i<datanode.childNodes.length;i++)
{
fieldnode = datanode.childNodes.item(i);
break ;
}
}
}
for(x=0;x<dataXMLDOC.documentElement.childNodes.length;x++)
{
datanode = dataXMLDOC.documentElement.childNodes.item(x);
datanode.appendChild(newDataNode);
}
if(chfieldname.indexOf(".")!=-1)
{
activecell.value="["+chfieldname.substring(chfieldname.indexOf(".")+1)+"]";
}
else
{
}
}
}
if(allinfoarray[0]!="0")
{
//alert("allinfoarray[0]!=0");
parsecondition(allinfoarray[3],allinfoarray[0]);
}
}
function parsecondition(str,rep)
{
var tmpstring;
//alert("parsecondition(str:"+str);
//alert("rep:"+rep);
iteminfoValues=str.split("^");
for(tt=0;tt<iteminfoValues.length-1;tt++)
{
optionsValues=iteminfoValues[tt].split("&,&");
for(i=0;i<dataXMLDOC.documentElement.childNodes.length;i++)
{
datanode = dataXMLDOC.documentElement.childNodes.item(i);
for(j=0;j<datanode.childNodes.length;j++)
{
fieldnode = datanode.childNodes.item(j);
//alert("optionsValues[8]:"+optionsValues[8]);
if(optionsValues[2]==fieldnode.getAttribute("name"))
{
if(optionsValues[3]=="4"&&optionsValues[7]!="like"||optionsValues[3]=="7"&&optionsValues[7]!="like")
{
tmpstring="'"+optionsValues[8]+"'";
}
else if(optionsValues[3]=="3")
{
tmpstring="["+optionsValues[8]+"]";
}
else
{
tmpstring=optionsValues[8]
}
//alert("optionsValues[3]:"+optionsValues[3]);
//alert("optionsValues[9]:"+optionsValues[9]);
tmpconvalue=fieldnode.getAttribute("condition");
switch(optionsValues[7])
{
case 'like':
//tmpconvalue+=optionsValues[1]+"."+optionsValues[2]+" like "+"'%"+optionsValues[8]+"%' and ";
tmpconvalue+=optionsValues[1]+"."+optionsValues[2]+" like "+"'%"+optionsValues[8]+"%' "+optionsValues[9]+" ";
//alert("tmpconvalue:"+tmpconvalue);
fieldnode.setAttribute("condition",tmpconvalue);
break;
case 'm':
//tmpconvalue+=optionsValues[1]+"."+optionsValues[2]+">"+tmpstring+" and ";
tmpconvalue+=optionsValues[1]+"."+optionsValues[2]+">"+tmpstring+" "+optionsValues[9]+" ";
//alert("tmpconvalue:"+tmpconvalue);
fieldnode.setAttribute("condition",tmpconvalue);
break;
case 'l':
//tmpconvalue+=optionsValues[1]+"."+optionsValues[2]+"<"+tmpstring+" and ";
tmpconvalue+=optionsValues[1]+"."+optionsValues[2]+"<"+tmpstring+" "+optionsValues[9]+" ";
//alert("tmpconvalue:"+tmpconvalue);
fieldnode.setAttribute("condition",tmpconvalue);
break;
case 'me':
//tmpconvalue+=optionsValues[1]+"."+optionsValues[2]+">="+tmpstring+" and ";
tmpconvalue+=optionsValues[1]+"."+optionsValues[2]+">="+tmpstring+" "+optionsValues[9]+" ";
//alert("tmpconvalue:"+tmpconvalue);
fieldnode.setAttribute("condition",tmpconvalue);
break;
case 'le':
//tmpconvalue+=optionsValues[1]+"."+optionsValues[2]+"<="+tmpstring+" and ";
tmpconvalue+=optionsValues[1]+"."+optionsValues[2]+"<="+tmpstring+" "+optionsValues[9]+" ";
//alert("tmpconvalue:"+tmpconvalue);
fieldnode.setAttribute("condition",tmpconvalue);
break;
case 'e':
//tmpconvalue+=optionsValues[1]+"."+optionsValues[2]+"="+tmpstring+" and ";
tmpconvalue+=optionsValues[1]+"."+optionsValues[2]+"="+tmpstring+" "+optionsValues[9]+" ";
//alert("tmpconvalue:"+tmpconvalue);
fieldnode.setAttribute("condition",tmpconvalue);
break;
default:
break;
}
}
}
}
}
if(rep=="2")
{
//去除未设条件的节点
var tmpvalue;
//var tmparraya;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -