Browse Source

广东接口导入导出费率的处理

vian 5 years ago
parent
commit
61f87c06df
2 changed files with 28 additions and 20 deletions
  1. 12 12
      web/over_write/js/guangdong_2018_export.js
  2. 16 8
      web/over_write/js/guangdong_2018_import.js

+ 12 - 12
web/over_write/js/guangdong_2018_export.js

@@ -1094,9 +1094,9 @@ const XMLStandard = (function () {
                     name: 'TaxModel', dName: '计税模式', type: _type.INT, required: true,
                     value: tenderData.property.taxType
                 },
-                // 地区类别 取建设项目-基本信息-地区类别
+                // 地区类别 取建设项目-基本信息-地区类别,基本信息那已经自检一次,这里不自检 //type: _type.INT, required: true, enumeration: Object.values(AreaKind), enumerationHint: Object.keys(AreaKind)
                 {
-                    name: 'AreaKind', dName: '地区类别', type: _type.INT, required: true, enumeration: Object.values(AreaKind), enumerationHint: Object.keys(AreaKind),
+                    name: 'AreaKind', dName: '地区类别', 
                     value: AreaKind[_util.getValueByKey(basicInformation, 'regionalCategories')]
                 },
                 // 金额
@@ -1261,7 +1261,7 @@ const XMLStandard = (function () {
                 // 费率
                 {
                     name: 'Rate', type: _type.DECIMAL,
-                    value: commonUtil.isDef(bills.feeRate) ? bills.feeRate : '100'
+                    value: !commonUtil.isEmptyVal(bills.feeRate) ? bills.feeRate : '100'
                 },
                 {
                     name: 'Total', type: _type.DECIMAL,
@@ -1447,7 +1447,7 @@ const XMLStandard = (function () {
                 // 工程量
                 { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
                 // 计算基数
-                { name: 'QtyFormula', type: _type.DECIMAL, value: getQtyFormula(node) },
+                { name: 'QtyFormula', value: getQtyFormula(node) },
                 // 单价(元)
                 { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
                 // 设备单价(元)指清单项目所采用设备的综合单价
@@ -1457,7 +1457,7 @@ const XMLStandard = (function () {
                 // 最高限价(元)
                 { name: 'PriceHigh', type: _type.DECIMAL, value: bills.maxPrice },
                 // 费率(%)
-                { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
+                { name: 'Rate', type: _type.DECIMAL, value: !commonUtil.isEmptyVal(bills.feeRate) ? bills.feeRate : '100' },
                 // 合价(元)
                 { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
                 // 主要清单
@@ -1590,7 +1590,7 @@ const XMLStandard = (function () {
         }
         //子目单价计算
         function UnitPriceCalculationOfItem(calcItem) {
-            const feeRate = commonUtil.isDef(calcItem.feeRate) ? calcItem.feeRate : '100';
+            const feeRate = !commonUtil.isEmptyVal(calcItem.feeRate) ? calcItem.feeRate : '100';
             const attrs = [
                 // 费用名称
                 { name: 'Name', dName: '费用名称', required: true, value: calcItem.name },
@@ -1661,7 +1661,7 @@ const XMLStandard = (function () {
                 // 单价
                 { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
                 // 费率
-                { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
+                { name: 'Rate', type: _type.DECIMAL, value: !commonUtil.isEmptyVal(bills.feeRate) ? bills.feeRate : '100' },
                 // 金额
                 { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
                 // 费用代号
@@ -1703,7 +1703,7 @@ const XMLStandard = (function () {
                 // 单价
                 { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
                 // 费率
-                { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
+                { name: 'Rate', type: _type.DECIMAL, value: !commonUtil.isEmptyVal(bills.feeRate) ? bills.feeRate : '100' },
                 // 金额
                 { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
                 // 汇总类型
@@ -1770,7 +1770,7 @@ const XMLStandard = (function () {
                 // 单价
                 { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
                 // 费率
-                { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
+                { name: 'Rate', type: _type.DECIMAL, value: !commonUtil.isEmptyVal(bills.feeRate) ? bills.feeRate : '100' },
                 // 金额
                 { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
                 // 汇总类型
@@ -1846,7 +1846,7 @@ const XMLStandard = (function () {
                 // 计算基数
                 { name: 'QtyFormula', value: getQtyFormula(node) },
                 // 费率
-                { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
+                { name: 'Rate', type: _type.DECIMAL, value: !commonUtil.isEmptyVal(bills.feeRate) ? bills.feeRate : '100' },
                 // 金额
                 { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
                 // 汇总类型
@@ -1886,7 +1886,7 @@ const XMLStandard = (function () {
                 // 单价
                 { name: 'Price', value: _util.getFee(bills.fees, 'common.unitFee') },
                 // 费率
-                { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
+                { name: 'Rate', type: _type.DECIMAL, value: !commonUtil.isEmptyVal(bills.feeRate) ? bills.feeRate : '100' },
                 // 金额
                 { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
                 // 依据
@@ -1917,7 +1917,7 @@ const XMLStandard = (function () {
                 // 计算基数
                 { name: 'QtyFormula', value: getQtyFormula(node) },
                 // 费率
-                { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
+                { name: 'Rate', type: _type.DECIMAL, value: !commonUtil.isEmptyVal(bills.feeRate) ? bills.feeRate : '100' },
                 // 金额
                 { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
                 // 费用代号

+ 16 - 8
web/over_write/js/guangdong_2018_import.js

@@ -28,7 +28,7 @@ const importXML = (() => {
     //导入的文件类型,界面选的文件类型是生成项目的文件类型,这里的文件类型指的是,要导入文件的类型,
     //导入文件类型不同,导入数据不同
     let importFileKind = '';
-    //文件类型
+    // 文件类型
     const FileKind = {
         '6': 1, // 投标
         'tender': 1,
@@ -37,6 +37,13 @@ const importXML = (() => {
         '5': 3, // 控制价
         'control': 3,
     };
+    // 地区类别
+    const AreaKind = {
+        '1': '一类地区',
+        '2': '二类地区',
+        '3': '三类地区',
+        '4': '四类地区',
+    }
     // 一些数据是需要从后端获取自增数字后赋值的,这里是记录,用完会在extractProject清空
     const countData = {
         projectCount: 0,    //项目数量
@@ -115,7 +122,7 @@ const importXML = (() => {
             { key: 'projNum', value: getValue(projectSrc, ['_Number']) }, // 编码
             { key: 'projectCategory', value: getValue(projectSrc, ['_ProjectCategory']) }, // 工程类别
             { key: 'constructionType', value: getValue(projectSrc, ['_ConstructionType']) }, // 建设性质
-            { key: 'regionalCategories', value: getValue(projectSrc, ['_AreaKind']) }, // 地区类被
+            { key: 'regionalCategories', value: AreaKind[getValue(projectSrc, ['_AreaKind'])] }, // 地区类被
             { key: 'projLocation', value: getValue(projectSrc, ['_ProjectSite']) }, // 工程地点
             { key: 'constructingUnits', value: getValue(projectSrc, ['_BulidUnit']) }, // 建设单位
             { key: 'constructingUnitsPerson', value: getValue(projectSrc, ['_BulidAuthorizer']) }, // 建设单位法定代表人或其授权人
@@ -255,7 +262,8 @@ const importXML = (() => {
             };
             if (curField[0] === fields[1][0]) {
                 item.calcBase = getValue(src, ['_QtyFormula']);
-                item.feeRate = getValue(src, ['_Rate']);
+                const feeRate = getValue(src, ['_Rate']);
+                item.feeRate = +feeRate !== 100 && feeRate || undefined;
             }
             if (importFileKind !== FileKind.tender) {
                 delete item.feeRate
@@ -339,9 +347,7 @@ const importXML = (() => {
             // 分项不需要基数、费率
             bills.calcBase = getValue(workElementSrc, ['_QtyFormula']);
             const feeRate = getValue(workElementSrc, ['_Rate']);
-            if (+feeRate) {
-                bills.feeRate = feeRate;
-            }
+            bills.feeRate = +feeRate !== 100 && feeRate || undefined;
         }
         // 投标和控制价,需要导入最高限价
         if ([FileKind.tender, FileKind.control].includes(importFileKind)) {
@@ -564,11 +570,12 @@ const importXML = (() => {
                     remark: getValue(itemSrc, ['_Remark'])
                 };
             } else {
+                const feeRate = getValue(itemSrc, ['_Rate']);
                 source = {
                     name: getValue(itemSrc, ['_Name']),
                     unit: getValue(itemSrc, ['_Unit']),
                     calcBase: getValue(itemSrc, ['_QtyFormula']),
-                    feeRate: getValue(itemSrc, ['_Rate']),
+                    feeRate: +feeRate !== 100 && feeRate || undefined,
                     fees: importFileKind === FileKind.tender ? [{ fieldName: 'common', unitFee: getValue(itemSrc, ['_Price']), totalFee: getValue(itemSrc, ['_Total']) }] : [],
                     feeCode: getValue(itemSrc, ['_Code']),
                     remark: getValue(itemSrc, ['_Remark'])
@@ -614,10 +621,11 @@ const importXML = (() => {
             items: itemsSrc.map(extractTaxItem)
         };
         function extractTaxItem(src) {
+            const feeRate = getValue(src, ['_Rate']);
             return {
                 name: getValue(src, ['_Name']),
                 calcBase: getValue(src, ['_QtyFormula']),
-                feeRate: getValue(src, ['_Rate']),
+                feeRate: +feeRate !== 100 && feeRate || undefined,
                 fees: importFileKind === FileKind.tender ? [{ fieldName: 'common', totalFee: getValue(src, ['_Total']) }] : [],
                 feeCode: getValue(src, ['_Code']),
                 remark: getValue(src, ['_Remark'])