|
@@ -7,6 +7,8 @@
|
|
*/
|
|
*/
|
|
'use strict';
|
|
'use strict';
|
|
|
|
|
|
|
|
+const excel = require('node-xlsx');
|
|
|
|
+
|
|
/*const testNodeData = [
|
|
/*const testNodeData = [
|
|
{ ledger_id: 1, ledger_pid: -1, order: 1, level: 1, full_path: '1', code: '1', is_leaf: false },
|
|
{ ledger_id: 1, ledger_pid: -1, order: 1, level: 1, full_path: '1', code: '1', is_leaf: false },
|
|
{ ledger_id: 2, ledger_pid: 1, order: 1, level: 2, full_path: '1.2', code: '1-1', is_leaf: false },
|
|
{ ledger_id: 2, ledger_pid: 1, order: 1, level: 2, full_path: '1.2', code: '1-1', is_leaf: false },
|
|
@@ -334,7 +336,6 @@ describe('test/app/service/ledger.test.js', () => {
|
|
const ctx = app.mockContext();
|
|
const ctx = app.mockContext();
|
|
// 选中 1-1-2 升级
|
|
// 选中 1-1-2 升级
|
|
const resultData = yield ctx.service.ledger.upLevelNode(testTenderId, 13);
|
|
const resultData = yield ctx.service.ledger.upLevelNode(testTenderId, 13);
|
|
- console.log(resultData);
|
|
|
|
assert(resultData);
|
|
assert(resultData);
|
|
assert(resultData.update.length === 6);
|
|
assert(resultData.update.length === 6);
|
|
|
|
|
|
@@ -376,7 +377,6 @@ describe('test/app/service/ledger.test.js', () => {
|
|
const ctx = app.mockContext();
|
|
const ctx = app.mockContext();
|
|
// 选中1-3 降级
|
|
// 选中1-3 降级
|
|
const resultData = yield ctx.service.ledger.downLevelNode(testTenderId, 4);
|
|
const resultData = yield ctx.service.ledger.downLevelNode(testTenderId, 4);
|
|
- console.log(resultData);
|
|
|
|
// 1-3/1-3-1/1-4修改
|
|
// 1-3/1-3-1/1-4修改
|
|
assert(resultData.update.length === 3);
|
|
assert(resultData.update.length === 3);
|
|
|
|
|
|
@@ -900,7 +900,7 @@ describe('test/app/service/ledger.test.js', () => {
|
|
const ctx = app.mockContext();
|
|
const ctx = app.mockContext();
|
|
|
|
|
|
// 从标准库添加1-4-2-1
|
|
// 从标准库添加1-4-2-1
|
|
- const condition1 = { list_id: 1, code: '1-4-2-1'}
|
|
|
|
|
|
+ const condition1 = { list_id: 1, code: '1-4-2-1'};
|
|
const libData1 = yield ctx.service.stdChapter.getDataByCondition(condition1);
|
|
const libData1 = yield ctx.service.stdChapter.getDataByCondition(condition1);
|
|
assert(libData1);
|
|
assert(libData1);
|
|
const stdData1 = yield ctx.service.stdChapter.getDataByDataId(1, libData1.chapter_id);
|
|
const stdData1 = yield ctx.service.stdChapter.getDataByDataId(1, libData1.chapter_id);
|
|
@@ -912,7 +912,7 @@ describe('test/app/service/ledger.test.js', () => {
|
|
assert(!result1.update || result1.update.length === 0);
|
|
assert(!result1.update || result1.update.length === 0);
|
|
assert(!result1.expand || result1.expand.length === 0);
|
|
assert(!result1.expand || result1.expand.length === 0);
|
|
// 从标准库添加1-4-2-1-2
|
|
// 从标准库添加1-4-2-1-2
|
|
- const condition2 = { list_id: 1, code: '1-4-2-1-2'}
|
|
|
|
|
|
+ const condition2 = { list_id: 1, code: '1-4-2-1-2'};
|
|
const libData2 = yield ctx.service.stdChapter.getDataByCondition(condition2);
|
|
const libData2 = yield ctx.service.stdChapter.getDataByCondition(condition2);
|
|
assert(libData2);
|
|
assert(libData2);
|
|
const stdData2 = yield ctx.service.stdChapter.getDataByDataId(1, libData2.chapter_id);
|
|
const stdData2 = yield ctx.service.stdChapter.getDataByDataId(1, libData2.chapter_id);
|
|
@@ -926,7 +926,7 @@ describe('test/app/service/ledger.test.js', () => {
|
|
assert(!result2.update[0].is_leaf);
|
|
assert(!result2.update[0].is_leaf);
|
|
assert(result2.expand.length === 4);
|
|
assert(result2.expand.length === 4);
|
|
// 从标准库添加1-4-2-1-1
|
|
// 从标准库添加1-4-2-1-1
|
|
- const condition3 = { list_id: 1, code: '1-4-2-1-1'}
|
|
|
|
|
|
+ const condition3 = { list_id: 1, code: '1-4-2-1-1'};
|
|
const libData3 = yield ctx.service.stdChapter.getDataByCondition(condition3);
|
|
const libData3 = yield ctx.service.stdChapter.getDataByCondition(condition3);
|
|
assert(libData3);
|
|
assert(libData3);
|
|
const stdData3 = yield ctx.service.stdChapter.getDataByDataId(1, libData3.chapter_id);
|
|
const stdData3 = yield ctx.service.stdChapter.getDataByDataId(1, libData3.chapter_id);
|
|
@@ -957,6 +957,14 @@ describe('test/app/service/ledger.test.js', () => {
|
|
assert(result3 && result3.toFixed(8) == 60.00007146);
|
|
assert(result3 && result3.toFixed(8) == 60.00007146);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ // it('test ImportExcelData', function* () {
|
|
|
|
+ // const ctx = app.mockContext();
|
|
|
|
+ //
|
|
|
|
+ // const file = ctx.app.baseDir + '/test/app/test_file/ledger-upload-test.xls';
|
|
|
|
+ // const sheets = excel.parse(file);
|
|
|
|
+ // const result = yield ctx.service.
|
|
|
|
+ // });
|
|
|
|
+
|
|
// 小数位数策略示例:
|
|
// 小数位数策略示例:
|
|
/* 先加总再保留3位小数:
|
|
/* 先加总再保留3位小数:
|
|
1 35.585
|
|
1 35.585
|