|
|
@@ -764,7 +764,7 @@ INTERFACE_EXPORT = (() => {
|
|
|
} else {
|
|
|
zhaoTBXX.children.push(new TouBiaoXX(CRCvals));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
const gongLGCHZ = new Element('公路工程汇总');
|
|
|
const gongLGCHZBT = new Element('公路工程汇总标题');
|
|
|
gongLGCHZ.children.push(gongLGCHZBT);
|
|
|
@@ -789,12 +789,17 @@ INTERFACE_EXPORT = (() => {
|
|
|
gongLGCHZBT.children.push(gongLGCHZMX);
|
|
|
});
|
|
|
gongLGCSJ.children.push(gongLGCHZ);
|
|
|
-
|
|
|
+
|
|
|
+ const newCRCvals = [];
|
|
|
+ newCRCvals.push(_toXMLStr([zhaoTBXX]));
|
|
|
+ newCRCvals.push(_toXMLStr([gongLGCHZ]));
|
|
|
+ // console.log(_toXMLStr([zhaoTBXX]));
|
|
|
+
|
|
|
// const md5Str = await md5(CRCvals.join(''));
|
|
|
- for (let crcIdx = 0; crcIdx < CRCvals.length; crcIdx++) {
|
|
|
- CRCvals[crcIdx] = CRCvals[crcIdx].replace(/ /g, '').replace(/\r/g, '').replace(/\n/g, '');
|
|
|
+ for (let crcIdx = 0; crcIdx < newCRCvals.length; crcIdx++) {
|
|
|
+ newCRCvals[crcIdx] = newCRCvals[crcIdx].replace(/ /g, '').replace(/\r/g, '').replace(/\n/g, '');
|
|
|
}
|
|
|
- const md5Str = md5Ex(CRCvals.join(''));
|
|
|
+ const md5Str = md5Ex(newCRCvals.join(''));
|
|
|
const binaryStr = hexToBinary(md5Str); // 转成二进制string
|
|
|
const finalMd5Str = window.btoa(binaryStr); // 还要做一次BASE64转换
|
|
|
const gongCXX = new GongCXX(finalMd5Str);
|
|
|
@@ -1031,7 +1036,33 @@ INTERFACE_EXPORT = (() => {
|
|
|
return String.fromCharCode(parseInt($1, 16)) + hexToBinary($2);
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ // 开始标签
|
|
|
+ function _startTag(ele) {
|
|
|
+ let rst = `<${ele.name}`;
|
|
|
+ for (const attr of ele.attrs) {
|
|
|
+ rst += ` ${attr.name}="${attr.value}"`;
|
|
|
+ }
|
|
|
+ rst += ele.children.length > 0 ? '>' : '/>';
|
|
|
+ return rst;
|
|
|
+ }
|
|
|
+ // 结束标签
|
|
|
+ function _endTag(ele) {
|
|
|
+ return `</${ele.name}>`;
|
|
|
+ }
|
|
|
+ // 拼接成xml字符串
|
|
|
+ function _toXMLStr(eles) {
|
|
|
+ let rst = '';
|
|
|
+ for (const ele of eles) {
|
|
|
+ rst += _startTag(ele);
|
|
|
+ if (ele.children.length > 0) {
|
|
|
+ rst += _toXMLStr(ele.children);
|
|
|
+ rst += _endTag(ele);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return rst;
|
|
|
+ }
|
|
|
+
|
|
|
return {
|
|
|
entry,
|
|
|
};
|