فهرست منبع

山东接口转义

Tony Kang 1 سال پیش
والد
کامیت
3059427389
1فایلهای تغییر یافته به همراه8 افزوده شده و 1 حذف شده
  1. 8 1
      web/building_saas/standard_interface/export/shandong_common.js

+ 8 - 1
web/building_saas/standard_interface/export/shandong_common.js

@@ -161,6 +161,13 @@ INTERFACE_EXPORT = (() => {
     , regRt1 = new RegExp('\n\r', 'g'), regRt2 = new RegExp('\r\n', 'g')
     ;
 
+  function getXMLTransitCharacters(orgStr) {
+    if ( typeof orgStr === 'string') {
+      return orgStr.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/&/g, '&amp;').replace(/'/g, '&apos;');
+    }
+    return orgStr;
+  }
+
   function getBasePrice(projectGLJID, tenderProject) {
     let glj = _.find(tenderProject.projectGLJ.datas.gljList, {
       id: projectGLJID
@@ -1636,7 +1643,7 @@ INTERFACE_EXPORT = (() => {
           let leafBillAttrs = [
             { name: 'ItemNo', value: sno },
             { name: 'Code', value: cacheObj[billIdKey].code },
-            { name: 'Name', value: cacheObj[billIdKey].name },
+            { name: 'Name', value: getXMLTransitCharacters(cacheObj[billIdKey].name) },
             { name: 'LaborWorkDays', value: _getNumValueByExportKind(scMathUtil.roundForObj(cacheObj[billIdKey].labourConsume / bQtn, decimalObj.glj.quantity)) },
             { name: 'LaborUnitPrice', value: _getNumValueByExportKind(scMathUtil.roundForObj(cacheObj[billIdKey].labourUnitPrice, decimalObj.glj.unitPrice)) },
             { name: 'LaborUnitTotal', value: _getNumValueByExportKind(scMathUtil.roundForObj(cacheObj[billIdKey].labourTotalPrice / bQtn, decimalObj.glj.unitPrice)) },