[size=xx-small][b]xmlDom对象[/b][/size]
//--------------------------------xml封装----------------------------------------
/**
* 新的xml对象方法
*/
var XmlUtil = (function(){
var useMozDom = document.implementation && document.implementation.createDocument; //用于判断是否支持火狐浏览器
if (useMozDom) { //判断是否使用火狐浏览器,IE返回false,火狐返回true
// 给FF Node对象原型添加xml属性 (该Node是火狐浏览器的内置对象)
Node.prototype.__defineGetter__("xml", function() {
return new XMLSerializer().serializeToString(this, "text/xml");
});
// 给FF Node对象原型添加text属性
Node.prototype.__defineGetter__("text", function() {
var text = [], childNodes = this.childNodes;
for (var i = 0, n; i < childNodes.length; i++) {
n = childNodes[i];
text.push(n.hasChildNodes() ? n.text : n.nodeValue);
}
return text.join();
});
}
return {
/**
* 创建xml对象
*/
createXmlDom : useMozDom ?
function() {
return document.implementation.createDocument("", "", null);
} :
function() {
var MSXMLVers = ["MSXML2.DOMDocument.6.0","MSXML2.DOMDocument.5.0","MSXML2.DOMDocument.4.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument"];
for (var i = 0; i < MSXMLVers.length; i++) {
try {
return new ActiveXObject(MSXMLVers[i]);
} catch(e) {}
}
},
/**
* 加载xml字符串,返回新的XML DOM对象
*/
loadXML : useMozDom ?
function(sXml) {
// 遗留: DOMParser对象,最初是局部变量,每次都new一个,后来发现firefox3.0会出问题,于是改用全局变量只new一次
return new DOMParser().parseFromString(sXml.replace(/\>\s+\</g, "\>\<"), "text/xml");
} :
function(sXml) {
var doc = this.createXmlDom();
doc.loadXML(sXml.replace(/\>\s+\</g, "\>\<"));
return doc;
},
/**
* 深度复制node节点
*/
clone : function(doc, node) {
// 获得XML DOM对象
doc = doc.ownerDocument || doc;
// 获取XML DOM对象根节点
node = node.documentElement || node;
var root, attrs, nodes, e;
// 创建根节点,设置节点属性
root = doc.createElement(node.nodeName);
attrs = node.attributes;
if (attrs.length > 0) {
for (var i = 0; i < attrs.length; i++) {
root.setAttribute(attrs[i].nodeName, attrs[i].nodeValue);
}
}
// 添加子节点
if (node.hasChildNodes()) {
nodes = node.childNodes;
for (var i = 0, n; i < nodes.length; i++) {
n = nodes[i];
switch (n.nodeType) {
case 1: // 递归添加元素节点
e = this.clone(doc, n);
root.appendChild(e);
break;
case 3: // 添加文本节点
e = doc.createTextNode(n.data);
root.appendChild(e);
break;
case 4: // 添加CDATA节点
e = doc.createCDATASection(n.data);
root.appendChild(e);
break;
default:
break;
}
}
}
return root;
}
}
})();
/*******************************************************************************
函数名: XmlDom
功能: 初始化XMLDOM对象
*******************************************************************************/
function XmlDom()
{
//生成DOM对象
return XmlUtil.createXmlDom();
}
/*******************************************************************************
函数名: creatRequestNode
功能: 封装的XML的根节点
输入doc为dom对象 cmd为字符串
返回结果格式如下:
<request cmd="RSM_CMD_GET_MEAS_DATA">
</request>
*******************************************************************************/
function creatRequestNode(doc,cmd)
{
if(null == doc)
{
return null;
}
var requestNode = doc.createElement("request"); //创建xml根节点
if(null != cmd)
{
var requestAttribute = doc.createAttribute("cmd"); //创建属性节点cmd
requestAttribute.value = cmd; //为属性节点赋值
requestNode.setAttributeNode(requestAttribute); //设置节点属性
}
return requestNode;
}
/*******************************************************************************
函数名: creatParaNode
功能: 封装的XML的根节点
输入doc为dom对象 cmd为字符串
返回结果格式如下:
<para name="NEID">
</para>
*******************************************************************************/
function creatParaNode(doc,name) //doc=xmldoc对象 name="USERID","UIPAGE"
{
if(null == doc)
{
return null;
}
var paraNode = doc.createElement("para"); //创建para节点
if(null != name)
{
var paraAttribute = doc.createAttribute("name"); //创建name属性
paraAttribute.value = name; //将参数name赋值给属性value
paraNode.setAttributeNode(paraAttribute); //为para节点设置属性节点,属性值为paraAttribute
}
return paraNode //返回para节点
}
/*******************************************************************************
函数名: creatSingleChildParaNode
功能: 封装一个带有子节点的参数para节点:
输入doc为dom对象 name,valueText为字符串
返回结果格式如下:
<para name="NEID">
<value>0</value>
</para>
*******************************************************************************/
// 参数分别为:xmlDom对象 USERID常量 "admin"
function creatSingleChildParaNode(doc,name,valueText) //valueText为随即产生的整数
{
if(null == doc)
{
return null;
}
var paraNode = creatParaNode(doc,name); //创建para节点及节点属性name
if(null != valueText)
{
var valueNode = doc.createElement("value"); //创建子节点value
var textNode = doc.createTextNode(valueText); //创建文本节点:admin
valueNode.appendChild(textNode); //value节点添加文本子节点
paraNode.appendChild(valueNode); //para节点添加子节点value
}
return paraNode //返回para节点
}
/*******************************************************************************
函数名: creatMulitChildParaNode
功能: 封装的带多个子节点的para节点:
输入doc为dom对象
name为字符串,
valueList为一维数组格式如:[valueText1,valueText2,valueText3]
返回结果格式如下:
<para name="NEID">
<value>0</value>
<value>0</value>
<value>0</value>
</para>
*******************************************************************************/
function creatMulitChildParaNode(doc,name,valueList)
{
if(null == doc)
{
return null;
}
var paraNode = creatParaNode(doc,name);
if(null != valueList)
{
for(var i in valueList)
{
var valueNode = doc.createElement("value");
var textNode = doc.createTextNode(valueList[i]);
valueNode.appendChild(textNode);
paraNode.appendChild(valueNode);
valueNode = null;
}
}
return paraNode
}
/*******************************************************************************
函数名: creatPropertyNode
功能: 封装的带一个子节点的参数para节点:
输入doc为dom对象 name,valueText为字符串
返回结果格式如下:
<property name="questNum">1</property>
*******************************************************************************/
function creatPropertyNode(doc,name,valueText)
{
if(null == doc)
{
return null;
}
var propertyNode = doc.createElement("property"); //创建property节点
if(null != name)
{
var propertyAttribute = doc.createAttribute("name"); //创建name属性节点
propertyAttribute.value = name; //为name属性节点赋值
propertyNode.setAttributeNode(propertyAttribute); //为property节点设置属性节点
}
if(null != valueText)
{
var textNode = doc.createTextNode(valueText); //创建文本节点
propertyNode.appendChild(textNode); //为property节点设置文本子节点
}
return propertyNode
}
/*******************************************************************************
函数名: creatTimeNode
功能: 输入doc为dom对象
seriesFlag,beginDay,beginTime,endDay,endTime为字符串,
hotTime为一维数组
返回结果格式如下:
<para name="TIME">
<value>
<!-呈现方式标致,表示时间是分段的,枚举类型取值为"y"或"n"-->
<property name="seriesFlag">y</property>
<!--时间格式,HHMM为两位小时,取值从00到23为两位分钟,取值从00到59-->
<property name="beginDay">20070111</property>
<property name="beginTime">0800</property>
<property name="endDay">20070111</property>
<property name="endTime">1000</property>
</value>
</para>
*******************************************************************************/
function creatTimeNode(doc,seriesFlag,beginDay,beginTime,endDay,endTime,hotTime)
{
if(null == doc)
{
return null;
}
var paraNode = creatParaNode(doc,"TIME");
if(null != hotTime)
{
beginDay = FormatDate(beginDay);
endDay = FormatDate(endDay);
for(var i in hotTime)
{
if(null == hotTime[i])
{
continue;
}
var timeList = hotTime[i].split("-");
var valueNode = doc.createElement("value");
var beginDayNode = creatPropertyNode(doc,"beginDay",beginDay+timeList[0]);
valueNode.appendChild(beginDayNode);
var beginTimeNode = creatPropertyNode(doc,"beginTime",timeList[0]);
valueNode.appendChild(beginTimeNode);
var endDayStr = FormatDate(endDay) + FormatTime(endTime);
var endDayNode = creatPropertyNode(doc,"endDay",endDay+timeList[1]);
valueNode.appendChild(endDayNode);
var endTimeNode = creatPropertyNode(doc,"endTime",timeList[1]);
valueNode.appendChild(endTimeNode);
paraNode.appendChild(valueNode);
}
}
else
{
var valueNode = doc.createElement("value");
if(null != beginDay)
{
var beginDayStr = FormatDate(beginDay) + FormatTime(beginTime);
var beginDayNode = creatPropertyNode(doc,"beginDay",beginDayStr);
valueNode.appendChild(beginDayNode);
}
if(null != beginTime)
{
var beginTimeNode = creatPropertyNode(doc,"beginTime",FormatTime(beginTime));
valueNode.appendChild(beginTimeNode);
}
if(null != endDay)
{
var endDayStr = FormatDate(endDay) + FormatTime(endTime);
var endDayNode = creatPropertyNode(doc,"endDay",endDayStr);
valueNode.appendChild(endDayNode);
}
if(null != endTime)
{
var endTimeNode = creatPropertyNode(doc,"endTime",FormatTime(endTime));
valueNode.appendChild(endTimeNode);
}
paraNode.appendChild(valueNode);
/*
if(null != hotTime)
{
for(var i in hotTime)
{
if(null == hotTime[i])
{
continue;
}
var hotTimeValueNode = doc.createElement("value");
var textNode = doc.createTextNode(hotTime[i]);
hotTimeValueNode.appendChild(textNode);
paraNode.appendChild(hotTimeValueNode);
}
}
*/
}
//alert(paraNode.xml)
return paraNode
}
/*******************************************************************************
函数名: creatTimeNodeNotFormat
功能: 输入doc为dom对象
beginDay,beginTime,endDay,endTime为字符串,
hotTime为一维数组
返回结果格式如下:
<para name="TIME">
<value>
<!--时间格式,HHMM为两位小时,取值从00到23为两位分钟,取值从00到59-->
<property name="beginDay">20070111</property>
<property name="beginTime">0800</property>
<property name="endDay">20070111</property>
<property name="endTime">1000</property>
</value>
</para>
*******************************************************************************/
function creatTimeNodeNotFormat(doc,beginDay,beginTime,endDay,endTime,hotTime)
{
if(null == doc)
{
return null;
}
var paraNode = creatParaNode(doc,"TIME");
var valueNode = doc.createElement("value");
if(null != beginDay)
{
var beginDayNode = creatPropertyNode(doc,"beginDay",beginDay);
valueNode.appendChild(beginDayNode);
}
if(null != beginTime)
{
var beginTimeNode = creatPropertyNode(doc,"beginTime", beginTime);
valueNode.appendChild(beginTimeNode);
}
if(null != endDay)
{
var endDayNode = creatPropertyNode(doc,"endDay", endDay);
valueNode.appendChild(endDayNode);
}
if(null != endTime)
{
var endTimeNode = creatPropertyNode(doc,"endTime", endTime);
valueNode.appendChild(endTimeNode);
}
paraNode.appendChild(valueNode);
if(null != hotTime)
{
for(var i in hotTime)
{
if(null == hotTime[i])
{
continue;
}
var hotTimeValueNode = doc.createElement("value");
var textNode = doc.createTextNode(hotTime[i]);
hotTimeValueNode.appendChild(textNode);
paraNode.appendChild(hotTimeValueNode);
}
}
return paraNode
}
function FormatDate(sDate)
{
if(!sDate)
{
return "00000000";
}
var dateList = sDate.split("-");
if(dateList.length != 3)
{
return "00000000";
}
if(dateList[0].length != 4)
{
return "00000000";
}
if(1 == dateList[1].length)
{
dateList[1] = "0" + dateList[1];
}
if(1 == dateList[2].length)
{
dateList[2] = "0" + dateList[2];
}
return dateList.join("");
}
function FormatTime(sTime)
{
if(!sTime)
{
return "0000";
}
if(sTime.length > 5)
{
sTime = sTime.substr(0,5);
}
var timeList = sTime.split(":");
if(timeList.length < 2)
{
return "0000";
}
for(var i in timeList)
{
if(1 == timeList[i].length)
{
timeList[i] = "0" + timeList[i];
}
}
return timeList.join("");
}
/*
function FormatTime(sTime)
{
if(!sTime)
{
return "0000";
}
var timeList = sTime.split(":");
if(timeList.length != 2)
{
return "0000";
}
if(1 == timeList[0].length)
{
timeList[0] = "0" + timeList[0];
}
if(1 == timeList[1].length)
{
timeList[1] = "0" + timeList[1];
}
return timeList.join("");
}
*/
/*
function creatTimeNode(doc,seriesFlag,beginDay,beginTime,endDay,endTime,hotTime)
{
if(null == doc)
{
return null;
}
var paraNode = creatParaNode(doc,"TIME");
var valueNode = doc.createElement("value");
if(null != seriesFlag)
{
seriesFlagNode = creatPropertyNode(doc,"seriesFlag",seriesFlag)
valueNode.appendChild(seriesFlagNode);
}
if(null != beginDay)
{
var beginDayNode = creatPropertyNode(doc,"beginDay",beginDay)
valueNode.appendChild(beginDayNode);
}
if(null != beginTime)
{
var beginTimeNode = creatPropertyNode(doc,"beginTime",beginTime)
valueNode.appendChild(beginTimeNode);
}
if(null != endDay)
{
var endDayNode = creatPropertyNode(doc,"endDay",endDay)
valueNode.appendChild(endDayNode);
}
if(null != endTime)
{
var endTimeNode = creatPropertyNode(doc,"endTime",endTime)
valueNode.appendChild(endTimeNode);
}
paraNode.appendChild(valueNode);
if(null != hotTime)
{
for(var i in hotTime)
{
if(null != hotTime[i])
{
continue;
}
var hotTimeValueNode = doc.createElement("value");
var textNode = doc.createTextNode(hotTime[i]);
hotTimeValueNode.appendChild(textNode);
paraNode.appendChild(hotTimeValueNode);
}
}
return paraNode
}
*/
/*******************************************************************************
函数名: creatMulitChildValueNode
功能: 封装的带多个子节点的value节点:
输入doc为dom对象
name为字符串,
valueList为一维数组格式如:[valueText1,valueText2,valueText3]
返回结果格式如下:
<value>
<property name="conditionName">101</property>
<property name="operator">less than or equal to</property>
<property name="value">1000</property>
</value>
*******************************************************************************/
function creatMulitChildValueNode(doc,name,valueList)
{
if(null == doc)
{
return null;
}
var valueNode = doc.createElement("value");
if(null != name)
{
var valueAttribute = doc.createAttribute("name");
valueAttribute.value = name;
valueNode.setAttributeNode(valueAttribute);
}
if(null != valueList)
{
var attName = ""
for(var i in valueList)
{
if(null == valueList[i])
{
continue;
}
switch(i)
{
case "0":
attName = "conditionName"
break;
case "1":
attName = "operator"
break;
default:
attName = "value"
break;
}
var propertyNode = creatPropertyNode(doc,attName,valueList[i])
if(propertyNode)
{
valueNode.appendChild(propertyNode);
}
propertyNode = null;
}
}
return valueNode
}
/*******************************************************************************
函数名: creatValueNode
功能: 封装的带多个子节点的value节点:
输入doc为dom对象
conditionName,operator,为字符串,
valueList为一维数组格式如:[valueText1,valueText2,valueText3]
返回结果格式如下:
<value>
<property name="conditionName">101</property>
<property name="operator">less than or equal to</property>
<property name="value">valueText1</property>
<property name="value">valueText2</property>
<property name="value">valueText3</property>
</value>
*******************************************************************************/
function creatValueNode(doc,conditionName,operator,valueList)
{
if(null == doc)
{
return null;
}
var valueNode = doc.createElement("value");
if(null != conditionName)
{
var conditionNameNode = creatPropertyNode(doc,"conditionName",conditionName);
if(conditionNameNode)
{
valueNode.appendChild(conditionNameNode);
}
}
if(null != operator)
{
var operatorNode = creatPropertyNode(doc,"operator",operator);
if(operatorNode)
{
valueNode.appendChild(operatorNode);
}
}
if(null != valueList)
{
for(var i in valueList)
{
if(null == valueList[i])
{
continue;
}
var propertyNode = creatPropertyNode(doc,"value",valueList[i]);
if(propertyNode)
{
valueNode.appendChild(propertyNode);
}
propertyNode = null;
}
}
return valueNode
}
/*******************************************************************************
函数名: creatMultiValueNode
功能: 创建多值过滤的value节点:
输入doc为dom对象
conditionName,operator,为字符串,
valueList为一维数组格式如:[valueText1,valueText2,valueText3]
返回结果格式如下:
<value>
<property name="conditionName">101</property>
<property name="operator">less than or equal to</property>
<property name="value">valueText1;valueText2;valueText3</property>
</value>
*******************************************************************************/
function creatMultiValueNode(doc,conditionName,operator,valueList)
{
if (null == doc)
{
return null;
}
var valueNode = doc.createElement("value");
if (null != conditionName)
{
var conditionNameNode = creatPropertyNode(doc, "conditionName", conditionName);
if(conditionNameNode)
{
valueNode.appendChild(conditionNameNode);
}
}
if (null != operator)
{
var operatorNode = creatPropertyNode(doc, "operator", operator);
if(operatorNode)
{
valueNode.appendChild(operatorNode);
}
}
if (null != valueList)
{
var sValue = "";
if (valueList.length >= 1)//多值用;号分隔.
{
sValue = valueList.join(";");
}
else
{
sValue = valueList[0];
}
var propertyNode = creatPropertyNode(doc, "value", sValue);
if (propertyNode)
{
valueNode.appendChild(propertyNode);
}
propertyNode = null;
}
return valueNode;
}
/**
* 函数名:createPropertyValueNode
* 功 能:创建如下格式的value节点,为后续网络分析报告使用
* 参 数:id ,就是属性为id的值
* value ,就是属性为value的值
* 返回值:oValueNode 。格式如下:
* <value>
<property name="id">p_1003</property>
<property name="value">0</property>
</value>
*/
function createPropertyValueNode(oDoc, sId, sValue)
{
if(null == oDoc)
{
return null;
}
var oValueNode = oDoc.createElement("value");
//<property name="id">p_1003</property>
var oPropertyId = creatPropertyNode(oDoc, "id", sId);
//<property name="value">0</property>
var oPropertyValue = creatPropertyNode(oDoc, "value", sValue);
oValueNode.appendChild(oPropertyId);
oValueNode.appendChild(oPropertyValue);
return oValueNode;
}
/*******************************************************************************
函数名: creatOrderConditionNode
功能: 封装的带多个子节点的value节点:
输入doc为dom对象
conditionName value为字符串,
返回结果格式如下:
<para name="ORDER_CONDITION">
<value>
<property name="conditionName">0</property>
<property name="operator">ASC</property>
</value>
</para>
*******************************************************************************/
function creatOrderConditionNode(doc,conditionName,operator)
{
if(null == doc)
{
return null;
}
var paraNode = creatParaNode(doc,"ORDER_CONDITION");
var operatorNode = creatValueNode(doc,conditionName,operator);
paraNode.appendChild(operatorNode);
return paraNode;
}
function creatConditionGroupNode(doc)
{
if(null == doc)
{
return null;
}
return doc.createElement("conditionGroup");
}
/*******************************************************************************
函数名: creatRecordNode
功能: 输入doc为dom对象
参数questNum,beginRecord,endRecord,isSample,dispachRecord均为整型
返回结果格式如下:
<!-可选参数,查询的记录范围-->
<para name="RECORD_THRESHOLD">
<value>
<!--必选参数,UI请求的次数,CHR应用-->
<property name="questNum">1</property>
<!--获取的记录数范围,起始(注:当请求所有记录时填写特殊值-1)-->
<property name="beginRecord">1</property>
<!--获取的记录数范围,终止-->
<property name="endRecord">1000</property>
<!--必选参数,是否需要抽样,1:表示压缩;0表示不压缩-->
<property name="isSample">0</property>
<!--必选参数,UI反填的参数,CHR应用-->
<property name="dispatchRecord">500</property>
</value>
</para>
*******************************************************************************/
function creatRecordNode(doc,questNum,beginRecord,endRecord,isSample,dispatchRecord)
{
if(null == doc) //判断Dom是否为空
{
return null;
}
var paraNode = creatParaNode(doc,"RECORD_THRESHOLD"); //创建para节点,参数为记录入口
var valueNode = doc.createElement("value"); //创建value节点
//允许数字0的通过
if(null != questNum)
{
seriesFlagNode = creatPropertyNode(doc,"questNum",questNum) //创建请求次数属性节点
valueNode.appendChild(seriesFlagNode); //为value节点添加property子节点
}
if(null != beginRecord)
{
var beginDayNode = creatPropertyNode(doc,"beginRecord",beginRecord) //创建起始记录数属性节点
valueNode.appendChild(beginDayNode); //为value节点添加property子节点
}
if(null != endRecord)
{
var beginTimeNode = creatPropertyNode(doc,"endRecord",endRecord) //创建终止记录数属性节点
valueNode.appendChild(beginTimeNode); //为value节点添加property子节点
}
if(null != isSample)
{
var endDayNode = creatPropertyNode(doc,"isSample",isSample) //创建抽样属性节点
valueNode.appendChild(endDayNode); //为value节点添加property子节点
}
if(null != dispachRecord)
{
var endTimeNode = creatPropertyNode(doc,"dispatchRecord",dispachRecord) //创建UI反填参数属性节点
valueNode.appendChild(endTimeNode); //为value节点添加property子节点
}
paraNode.appendChild(valueNode); //为para节点添加自己点value
return paraNode
}
/*******************************************************************************
函数名: initXmlDom
功能: 创建一个XmlDom对象 并建立所有命令所必须的根节点requestNode以及UIPAGENode:
返回结果为对象数组:[doc,requestNode]
*******************************************************************************/
function initXmlDom(CMDCode) //1077249
{
var doc = new XmlDom(); //创建xmlDoc
var requestNode= creatRequestNode(doc,CMDCode); //创建request节点
var randomNumber = Math.floor(Math.random( )*10000)+10000; //创建随即整数
var UIPAGENode = creatSingleChildParaNode(doc,"UIPAGE",randomNumber); //创建para节点
requestNode.appendChild(UIPAGENode); //为根节点添加para子节点
return [doc,requestNode]; //返回xmlDoc对象及request节点
}
/**
* 函数名称: initXmlDomWithoutUIPage
* 函数功能: 创建一个XmlDom对象 并建立所有命令所必须的根节点requestNode,不包含UIPAGE
* 参数: CMDCode 命令码
* 返回: [doc, requestNode]
*/
function initXmlDomWithoutUIPage(CMDCode) //参数为:1081345
{
var doc = new XmlDom(); //创建xml对象
var requestNode= creatRequestNode(doc,CMDCode); //创建xml根节点
return [doc, requestNode]; //返回DOM对象和根节点
}
/*******************************************************************************
函数名: creatGetMSCListCMD
功能: 构造MSC列表请求命令
*******************************************************************************/
function creatGetMSCListCMD(BusiId)
{
var oXmlDom = initXmlDom(g_cmdCode.RSM_CMD_GET_MEAS_DATA);
var doc = oXmlDom[0];
var requestNode = oXmlDom[1];
//CHR应用为报表业务标识(枚举值)
REPORT_NAMENode = creatSingleChildParaNode(doc,"REPORT_NAME",g_report.CHR_GET_MSC_LIST);
requestNode.appendChild(REPORT_NAMENode);
//BEGIN:added by z00110907 2008-3-26 AQ5D01246 MSC 增加按照名称排序的问题 g_field.RSM_CHR_MSC_NAME 为 "e_10002" 为MSC名称字段, 全局唯一
var oSortNode = creatOrderConditionNode(doc,g_field.RSM_CHR_MSC_NAME,"ASC");
requestNode.appendChild(oSortNode);
//END:added by z00110907 2008-3-26 AQ5D01246
return requestNode;
}
/*******************************************************************************
函数名: creatGetLatSubListCMD
功能: 构造维度子列表请求命令
reportLatitude为g_report中的一个枚举值如CHR_GET_OFFICE_LIST
*******************************************************************************/
function creatGetLatSubListCMD(MSC,reportLatitude)
{
var oXmlDom = initXmlDom(g_cmdCode.RSM_CMD_GET_MEAS_DATA);
var doc = oXmlDom[0];
var requestNode = oXmlDom[1];
/*
if(MSC)
{
NEIDNode = creatSingleChildParaNode(doc,"NEID",MSC);
requestNode.appendChild(NEIDNode);
}
*/
//CHR应用为报表业务标识(枚举值)
REPORT_NAMENode = creatSingleChildParaNode(doc,"REPORT_NAME",reportLatitude);
requestNode.appendChild(REPORT_NAMENode);
var paraNode = creatParaNode(doc,"FILTER_CONDITION");
if(MSC)
{
if(typeof(MSC)=="string")
{
var valueNode = creatValueNode(doc,
g_field.RSM_CHR_MSC_ID,
g_filter.FILTER_EQUAL_TO,
[MSC]);
}
else
if(typeof(MSC)=="object")
{
var valueNode = creatValueNode(doc,
g_field.RSM_CHR_MSC_ID,
g_filter.FILTER_IN,
MSC);
}
var conditionGroupNode = creatConditionGroupNode(doc);
conditionGroupNode.appendChild(valueNode);
paraNode.appendChild(conditionGroupNode);
}
requestNode.appendChild(paraNode);
//BEGIN:added by z00110907 2008-3-26 AQ5D01246 增加排序字段
//增加按照局向、小区、中继群等名称的排序
var oSortNode = null;
switch (reportLatitude)
{
case g_report.CHR_GET_OFFICE_LIST:
// g_field.RSM_CHR_OFFICE_NAME 局向名称 "e_10004" 全局唯一
oSortNode = creatOrderConditionNode(doc,g_field.RSM_CHR_OFFICE_NAME,"ASC");
break;
case g_report.CHR_GET_CELL_LIST:
// g_field.RSM_CHR_CELL_NAME 小区名称 "e_10005" 全局唯一
oSortNode = creatOrderConditionNode(doc,g_field.RSM_CHR_CELL_NAME,"ASC");
break;
case g_report.CHR_GET_TBL_LONG_TRUNK:
// g_field.RSM_CHR_TRUNK_NAME 中继群名称 "e_10006" 全局唯一
oSortNode = creatOrderConditionNode(doc,g_field.RSM_CHR_TRUNK_NAME,"ASC");
break;
case g_report.CHR_GET_TBL_LONG_OFFICE:
// g_field.RSM_CHR_OFFICE_NAME 局向名称 "e_10004" 全局唯一
oSortNode = creatOrderConditionNode(doc,g_field.RSM_CHR_OFFICE_NAME,"ASC");
break;
default:
break;
}
if (oSortNode)
{
requestNode.appendChild(oSortNode);
}
//END:added by z00110907 2008-3-26 AQ5D01246 增加排序字段
return requestNode;
}
/*******************************************************************************
函数名: creatSaveCMD
功能: 构造保存文件命令
Return: XML片段(DOM)-成功 null-失败
*******************************************************************************/
function creatSaveCMD(questNum,fileType,tmpTblId,orderColId,orderType,beginRecord,endRecord,g_currentPage,outputlist)
{
if((null == questNum) || (null == fileType))
{
return null;
}
//if fileType无效
var oXmlDom = creatInputObjectNode(g_cmdCode.RSM_CMD_SAVE_MEAS_DATA);
var doc = oXmlDom[0];
var requestNode = oXmlDom[1];
var FORMATNode = creatSingleChildParaNode(doc,"FORMAT",fileType.toString(10))
requestNode.appendChild(FORMATNode);
var sessionId = parseCookie();
var SESSIONIDNode = creatSingleChildParaNode(doc,"SESSIONID",sessionId)
requestNode.appendChild(SESSIONIDNode);
var tmpTblIdNode = creatSingleChildParaNode(doc,"TEMP_TBL",tmpTblId)
requestNode.appendChild(tmpTblIdNode);
var OUTPUTLISTNode = creatMulitChildParaNode(doc,"SELECT_COLUMNS",outputlist);
requestNode.appendChild(OUTPUTLISTNode);
var orderConditionNode = creatOrderConditionNode(doc,orderColId,orderType)
requestNode.appendChild(orderConditionNode);
//var recordNode = creatRecordNode(doc,questNum,1,40000,0,1)
var recordNode = creatRecordNode(doc,questNum,beginRecord,endRecord,0,g_currentPage)
requestNode.appendChild(recordNode);
return requestNode;
}
/*******************************************************************************
函数名: creatNewPageCMD
功能: 构造获取新页请求命令
oRecordThreshold 包含questNum,beginRecord,endRecord,isSample,dispachRecord属性
Return: XML片段(DOM)-成功 null-失败
*******************************************************************************/
function creatNewPageCMD(oRecordThreshold,tmpTblId,orderColId,orderType,outPutList)
{
if(null == oRecordThreshold)
{
return null;
}
var oXmlDom = creatInputObjectNode(g_cmdCode.RSM_CMD_GET_MEAS_DATA);
var doc = oXmlDom[0];
var requestNode = oXmlDom[1];
var sessionId = parseCookie();
var SESSIONIDNode = creatSingleChildParaNode(doc,"SESSIONID",sessionId)
requestNode.appendChild(SESSIONIDNode);
var tmpTblIdNode = creatSingleChildParaNode(doc,"TEMP_TBL",tmpTblId)
requestNode.appendChild(tmpTblIdNode);
//处理auto_index问题,屏蔽掉Clearcode输出项的下发
var outPutListToServer = [];
for(var i in outPutList)
{
if(g_ClearCodeID != outPutList[i])
{
outPutListToServer.push(outPutList[i]);
}
}
var OUTPUTLISTNode = creatMulitChildParaNode(doc,"SELECT_COLUMNS",outPutListToServer);
requestNode.appendChild(OUTPUTLISTNode);
/*
var OUTPUTLISTNode = creatMulitChildParaNode(doc,"SELECT_COLUMNS",outPutList);
requestNode.appendChild(OUTPUTLISTNode);
*/
if(orderColId)
{
var orderConditionNode = creatOrderConditionNode(doc,orderColId,orderType)
requestNode.appendChild(orderConditionNode);
}
var recordNode = creatRecordNode(doc,
oRecordThreshold.questNum,
oRecordThreshold.beginRecord,
oRecordThreshold.endRecord,
oRecordThreshold.isSample,
oRecordThreshold.dispachRecord);
requestNode.appendChild(recordNode);
return requestNode;
}
/*******************************************************************************
函数名: creatGetGraphCMD
功能: 构造获取图形数据请求命令
目前直接调用creatNewPageCMD graphType作为参数传入供后续扩展
Return: XML片段(DOM)-成功 null-失败
*******************************************************************************/
function creatGetGraphCMD(graphType,oRecordThreshold,tmpTblId,orderColId,orderType,outPutList)
{
if("-1" == graphType)
{
return null;
}
return creatNewPageCMD(oRecordThreshold,tmpTblId,orderColId,orderType,outPutList);
}
/*******************************************************************************
函数名: creatDelTblCMD
功能: 构造获取新页请求命令
Return: XML片段(DOM)-成功 null-失败
*******************************************************************************/
function creatDelTblCMD(tmpTblId)
{
if("-1" == tmpTblId)
{
return null;
}
var oXmlDom = initXmlDom(g_cmdCode.RSM_CMD_DEL_RPT_TMP_TBL);
var doc = oXmlDom[0];
var requestNode = oXmlDom[1];
var sessionId = parseCookie();
var SESSIONIDNode = creatSingleChildParaNode(doc,"SESSIONID",sessionId)
requestNode.appendChild(SESSIONIDNode);
var tmpTblIdNode = creatSingleChildParaNode(doc,"TEMP_TBL",tmpTblId)
requestNode.appendChild(tmpTblIdNode);
return requestNode;
}