|
|
@@ -155,6 +155,30 @@ const ImportXML = (() => {
|
|
|
'"': 'escape{quot}',
|
|
|
''': 'escape{apos}'
|
|
|
};
|
|
|
+ // 第x册定额名称包含字符与计算程序ID的匹配映射
|
|
|
+ const NameProgramMapping = {
|
|
|
+ '机械设备': 25,
|
|
|
+ '热力设备': 26,
|
|
|
+ '静置设备与工艺金属结构制作': 27,
|
|
|
+ '电气设备': 28,
|
|
|
+ '建筑智能化': 29,
|
|
|
+ '自动化控制仪表': 30,
|
|
|
+ '通风空调': 31,
|
|
|
+ '工业管道': 32,
|
|
|
+ '消防': 33,
|
|
|
+ '给排水、采暖、燃气': 34,
|
|
|
+ '刷油、防腐蚀、绝热': 35
|
|
|
+ };
|
|
|
+ // 获取定额取费专业,根据名称匹配有无固定映射,若没有则取单位工程取费专业(后台配置)
|
|
|
+ function getProgramID(name, mapping, projectEngineering) {
|
|
|
+ for (let mapName in mapping) {
|
|
|
+ const reg = new RegExp(`第.{1,2}册\\s*${mapName}(安装)?工程`);
|
|
|
+ if (name.match(reg)) {
|
|
|
+ return mapping[mapName];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return projectEngineering;
|
|
|
+ }
|
|
|
// 避免字符实体进行转义。原文本中含有xml字符实体,转换为其他字符。
|
|
|
function escapeXMLEntity(str) {
|
|
|
for (let [key, value] of Object.entries(XML_ENTITY)) {
|
|
|
@@ -1695,8 +1719,7 @@ const ImportXML = (() => {
|
|
|
billsHasRations.forEach(bills => {
|
|
|
//处理定额
|
|
|
bills.rations.forEach(ration => {
|
|
|
- // 定额的取费专业在定额库默认为空的话,取单位工程取费专业(后台配置)
|
|
|
- ration.programID = tenderData.property.projectEngineering;
|
|
|
+ ration.programID = getProgramID(ration.name, NameProgramMapping, tenderData.property.projectEngineering);
|
|
|
ration.ID = uuid.v1();
|
|
|
ration.projectID = tenderData.ID;
|
|
|
ration.billsItemID = bills.ID;
|