Bläddra i källkod

feat: 导出材料信息价,变更格式 (#GLY-5805)

vian 1 månad sedan
förälder
incheckning
a11994d4de
1 ändrade filer med 4 tillägg och 5 borttagningar
  1. 4 5
      modules/price_info_lib/facade/index.js

+ 4 - 5
modules/price_info_lib/facade/index.js

@@ -857,7 +857,6 @@ async function getZheJiangSheetData(from, to) {
     }
     const compilationID = '5de61133d46f6f000d15d347';
     const libs = await priceInfoLibModel.find({ compilationID, period: { $in: periods } }, '-_id ID name period').lean();
-    console.log(libs);
     const areas = await priceInfoAreaModel.find({ compilationID }, '-_id ID name').lean();
     const zjAreas = areas.filter(area => /浙江/.test(area.name) && /全市平均/.test(area.name));
     // 地区按照serialNo排序
@@ -874,22 +873,22 @@ async function getZheJiangSheetData(from, to) {
     const excelData = [['日期', '地区', '材料大类', '编码', '名称', '价格']];
     libs.forEach(lib => {
         // 日期
-        excelData.push([lib.period || '', '', '', '', '', '']);
+        // excelData.push([lib.period || '', '', '', '', '', '']);
         zjAreas.forEach(area => {
             // 地区
             const areaName = area.name.replace('浙江省-', '').replace('全市平均', '');
-            excelData.push(['', areaName || '', '', '', '', '']);
+            // excelData.push(['', areaName || '', '', '', '', '']);
             // 材料大类
             let priceItems = allPriceItems.filter(item => item.libID === lib.ID && item.areaID === area.ID);
             priceItems = _.sortBy(priceItems, 'code');
             priceClasses.forEach(priceClass => {
-                excelData.push(['', '', priceClass.name || '', '', '', '']);
+                // excelData.push(['', '', priceClass.name || '', '', '', '']);
                 priceItems.forEach(item => {
                     const code = item.code ? item.code.trim() : '';
                     const name = item.name ? item.name.trim() : '';
                     const price = item.noTaxPrice ? +item.noTaxPrice : '';
                     if (priceClass.codes.includes(code)) {
-                        excelData.push(['', '', '', code, name, price]);
+                        excelData.push([lib.period, areaName || '', priceClass.name || '', code, name, price]);
                     }
                 });
             });