|
@@ -19,16 +19,16 @@ describe('test/app/service/report_memory.test.js', () => {
|
|
|
before(function* () {
|
|
|
const ctx = app.mockContext();
|
|
|
// 模拟登录session
|
|
|
- // const postData = {
|
|
|
- // account: 'fuqingqing',
|
|
|
- // project: 'P0505',
|
|
|
- // project_password: '123456',
|
|
|
- // };
|
|
|
const postData = {
|
|
|
- account: '734406061@qq.com',
|
|
|
- project: 'T201711273363',
|
|
|
- project_password: 'mai654321',
|
|
|
+ account: 'fuqingqing',
|
|
|
+ project: 'P0505',
|
|
|
+ project_password: '123456',
|
|
|
};
|
|
|
+ // const postData = {
|
|
|
+ // account: '734406061@qq.com',
|
|
|
+ // project: 'T201711273363',
|
|
|
+ // project_password: 'mai654321',
|
|
|
+ // };
|
|
|
ctx.session = {};
|
|
|
const loginResult = yield ctx.service.projectAccount.accountLogin(postData, 2);
|
|
|
assert(loginResult);
|
|
@@ -119,6 +119,7 @@ describe('test/app/service/report_memory.test.js', () => {
|
|
|
tender_id: stage.tid,
|
|
|
stage_id: stage.id,
|
|
|
};
|
|
|
+ const params = {tender_id: 2072};
|
|
|
const filters = ['mem_stage_bills', 'tender_info'];
|
|
|
const data = yield ctx.service.report.getReportData(params, filters, {
|
|
|
mem_stage_bills: [
|
|
@@ -136,11 +137,11 @@ describe('test/app/service/report_memory.test.js', () => {
|
|
|
'chapter',
|
|
|
]
|
|
|
});
|
|
|
- const bills = data.mem_stage_bills.find(function (x) {return x.b_code === '103-3-a'});
|
|
|
reportDataAnalysis.analysisObj.gatherChapter.fun(ctx, data, [
|
|
|
{field: 'b_code', table: 'mem_stage_bills'},
|
|
|
{field: 'is_leaf', table: 'mem_stage_bills'},
|
|
|
]);
|
|
|
+ console.log(data.mem_stage_bills);
|
|
|
const chapter100 = ctx.helper._.find(data.mem_stage_bills, {code: '100'});
|
|
|
assert(chapter100.total_price === 1045756);
|
|
|
const chapter200 = ctx.helper._.find(data.mem_stage_bills, {code: '200'});
|
|
@@ -149,6 +150,55 @@ describe('test/app/service/report_memory.test.js', () => {
|
|
|
const chapter400 = ctx.helper._.find(data.mem_stage_bills, {code: '400'});
|
|
|
assert(chapter400.total_price.toFixed(0) == 1231018);
|
|
|
});
|
|
|
+ // it('test gatherChapter custom', function* () {
|
|
|
+ // const ctx = app.mockContext(mockData);
|
|
|
+ //
|
|
|
+ // const params = {tender_id: 2072};
|
|
|
+ // const filters = ['mem_stage_bills', 'tender_info'];
|
|
|
+ // const data = yield ctx.service.report.getReportData(params, filters, {
|
|
|
+ // mem_stage_bills: [
|
|
|
+ // 'id', 'tender_id', 'ledger_id', 'ledger_pid', 'level', 'order', 'full_path', 'is_leaf',
|
|
|
+ // 'code', 'b_code', 'name', 'unit', 'unit_price',
|
|
|
+ // 'deal_qty', 'deal_tp',
|
|
|
+ // 'sgfh_qty', 'sgfh_tp', 'sjcl_qty', 'sjcl_tp', 'qtcl_qty', 'qtcl_tp', 'quantity', 'total_price',
|
|
|
+ // 'dgn_qty1', 'dgn_qty2',
|
|
|
+ // 'drawing_code', 'memo', 'node_type', 'is_tp',
|
|
|
+ // 'qc_bgl_code',
|
|
|
+ // 'chapter',
|
|
|
+ // ]
|
|
|
+ // });
|
|
|
+ // reportDataAnalysis.analysisObj.gatherChapter.fun(ctx, data, [
|
|
|
+ // {field: 'b_code', table: 'mem_stage_bills'},
|
|
|
+ // {field: 'is_leaf', table: 'mem_stage_bills'},
|
|
|
+ // ], {
|
|
|
+ // count: 7,
|
|
|
+ // gclSum: {
|
|
|
+ // name: '第100章至700章清单合计',
|
|
|
+ // order: 1,
|
|
|
+ // },
|
|
|
+ // custom: [
|
|
|
+ // {name: '已包含在清单合计中的材料、工程设备、专业工程暂估价', order: 2},
|
|
|
+ // {name: '清单合计减去材料、工程设备、专业工程暂估价(即8-9=10)', order_calc: 'o1-o2', order: 3},
|
|
|
+ // {name: '计日工合计', node_type: '计日工', order: 4},
|
|
|
+ // {name: '暂列金额(不含计日工总额)(即10×暂列金额比列)', node_type: '暂列金额', order: 5},
|
|
|
+ // {name: '投标报价、台账价(8+11+12)=13', order_calc: 'o1+o4+o5', order: 6},
|
|
|
+ // ],
|
|
|
+ // });
|
|
|
+ // const chapter100 = ctx.helper._.find(data.mem_stage_bills, {code: '100'});
|
|
|
+ // assert(ctx.helper.checkZero(chapter100.total_price));
|
|
|
+ // const chapter200 = ctx.helper._.find(data.mem_stage_bills, {code: '200'});
|
|
|
+ // assert(chapter200.total_price === 33211);
|
|
|
+ // const chapterGclSum = ctx.helper._.find(data.mem_stage_bills, {cType: 11});
|
|
|
+ // assert(chapterGclSum.total_price == 33211);
|
|
|
+ // const chapterJRG = ctx.helper._.find(data.mem_stage_bills, {name: '计日工合计'});
|
|
|
+ // assert(chapterJRG.total_price === 1076);
|
|
|
+ // const chapterSumWithoutZGJ = ctx.helper._.find(data.mem_stage_bills, {serialNo: 11});
|
|
|
+ // assert(chapterSumWithoutZGJ.total_price === 33211);
|
|
|
+ // const chapterZL = ctx.helper._.find(data.mem_stage_bills, {serialNo: 13});
|
|
|
+ // assert(chapterZL.total_price === 500000);
|
|
|
+ // const chapterSum = ctx.helper._.find(data.mem_stage_bills, {serialNo: 14});
|
|
|
+ // assert(chapterSum.total_price === 534287);
|
|
|
+ // });
|
|
|
it('test analysisDefine', function() {
|
|
|
const define = reportDataAnalysis.analysisDefine;
|
|
|
assert(define.length === 4);
|