Selaa lähdekoodia

汇总表,签约清单,特殊标汇总问题

MaiXinRong 5 vuotta sitten
vanhempi
commit
6aa47f6463

+ 2 - 1
app/controller/stage_extra_controller.js

@@ -203,7 +203,8 @@ module.exports = app => {
                         throw '未发现上传文件!';
                     }
                     if (!bonus) bonus = await ctx.service.stageBonus.getStageDataById(parts.field.bonus_id);
-                    if (!bonus) throw '往期数据不允许上传附件';
+                    if (!bonus) throw '该奖罚金,当前不允许上传附件';
+
                     const fileInfo = path.parse(stream.filename);
                     const dirName = 'app/public/upload/extra/' + moment().format('YYYYMMDD');
                     const fileName = create_time + '_' + index + fileInfo.ext;

+ 2 - 1
app/service/rpt_gather_memory.js

@@ -17,6 +17,7 @@ const payConst = require('../const/deal_pay');
 const moment = require('moment');
 
 const indexPre = 'id_';
+const normalPrefix = 't_', sumPrefix = 's_', specPrefix = 'ts_';
 
 const gatherUtils = {
     completeGatherData: function (datas, completeDatas) {
@@ -770,7 +771,7 @@ module.exports = app => {
         async _gatherSpecialDealBills(sTender, sKey) {
             const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
             await this._gatherDealBills(tender, function (gatherData, sourceData) {
-                const prefix = 'st_' + sKey + '_';
+                const prefix = 'ts_' + sKey + '_';
 
                 gatherData[prefix + 'qty'] = sourceData.quantity;
                 gatherData[prefix + 'tp'] = sourceData.total_price;

+ 62 - 20
test/app/service/report_memory_temp.test.js

@@ -13,6 +13,64 @@ const path = require('path');
 let savePath;
 const mockData = {};
 
+const testSetting1 = {
+    postData: {
+        account: 'fuqingqing',
+        project: 'P0505',
+        project_password: '123456',
+    },
+    define: {
+        enable: true,
+        setting: JSON.stringify({
+            title: '请选择汇总的标段',
+            type: 'final',
+        })
+    },
+    select: {
+        tenders: [{tid: 2283}, {tid: 2281}],
+        type: 'final',
+    }
+};
+const testSetting2 = {
+    postData: {
+        account: 'zengpeiwen',
+        project: 'P1201',
+        project_password: '123456',
+    },
+    define: {
+        enable: true,
+        setting: JSON.stringify({
+            title: '请选择汇总的标段',
+            type: 'final',
+        })
+    },
+    select: {
+        tenders: [{tid: 2046}, {tid: 1942}, {tid: 2217}],
+        type: 'final',
+    }
+};
+const testSetting3 = {
+    postData: {
+        account: 'zengpeiwen',
+        project: 'P1201',
+        project_password: '123456',
+    },
+    define: {
+        enable: true,
+        setting: JSON.stringify({
+            "title": "请选择汇总的标段",
+            "type": "final",
+            "nameColWidth": 180,
+            "special": [
+                {"title": "估算", "key": "gu", "width": 60},
+                {"title": "概算", "key": "gai", "width": 60},
+                {"title": "预算", "key": "yu", "width": 60}
+            ]
+        })
+    },
+    select: JSON.parse('{"tenders":[{"tid":1942},{"tid":2217},{"tid":2046},{"tid":2172,"gu":true},{"tid":2324,"gai":true},{"tid":2326,"yu":true}],"type":"final"}')
+};
+
 const reportDataAnalysis = require('../../../app/lib/rpt_data_analysis');
 
 describe('test/app/service/report_memory.test.js', () => {
@@ -60,31 +118,15 @@ describe('test/app/service/report_memory.test.js', () => {
         yield ctx.helper.saveBufferFile(JSON.stringify(data.mem_gather_stage_pay, "", "\t"), path.join(savePath, 'mem_gather_stage_pay_converse.json'));
     });
     // 汇总签约清单
-    it('test getGatherStagePay', function* () {
+    it('test getGatherDealBills', function* () {
         const ctx = app.mockContext();
-        const postData = {
-            account: 'zengpeiwen',
-            project: 'P1201',
-            project_password: '123456',
-        };
+        const testSetting = testSetting3;
         ctx.session = {};
-        const loginResult = yield ctx.service.projectAccount.accountLogin(postData, 2);
+        const loginResult = yield ctx.service.projectAccount.accountLogin(testSetting.postData, 2);
         assert(loginResult);
 
-        const select = {
-            tenders: [{tid: 2046}, {tid: 1942}, {tid: 2217}],
-            type: 'final',
-        };
-        const define = {
-            enable: true,
-            setting: JSON.stringify({
-                title: '请选择汇总的标段',
-                type: 'final',
-            })
-        };
-
         const data = {};
-        data.mem_gather_deal_bills = yield ctx.service.rptGatherMemory.getGatherDealBills([], define, select);
+        data.mem_gather_deal_bills = yield ctx.service.rptGatherMemory.getGatherDealBills([], testSetting.define, testSetting.select);
         yield ctx.helper.saveBufferFile(JSON.stringify(data.mem_gather_deal_bills, "", "\t"), path.join(savePath, 'mem_gather_deal_bills.json'));
     });
 });