|
@@ -11,7 +11,7 @@
|
|
|
|
|
|
const gclCompareModel = (function () {
|
|
|
const leafXmjs = [], mergeChar = ';';
|
|
|
- let gclList, gclChapter, otherChapter, chapterfilter;
|
|
|
+ let gclList, gclChapter, otherChapter, gclChapterFilter;
|
|
|
let ledgerSetting, gsTree;
|
|
|
|
|
|
function gatherfields(obj, src, fields, prefix = '') {
|
|
@@ -257,8 +257,8 @@ const gclCompareModel = (function () {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function _getCalcChapter(chapter) {
|
|
|
- const gclChapter = [], otherChapter = [];
|
|
|
+ function _getCalcChapter(chapter, option) {
|
|
|
+ const gclChapter = [], otherChapter = [], gclChapterFilter = [];
|
|
|
let serialNo = 1;
|
|
|
for (const c of chapter) {
|
|
|
const cc = { code: c.code, name: c.name, cType: 1 };
|
|
@@ -266,11 +266,23 @@ const gclCompareModel = (function () {
|
|
|
cc.filter = '^[^0-9]*' + c.code.substr(0, c.code.length - 2) + '[0-9]{2}-';
|
|
|
gclChapter.push(cc);
|
|
|
}
|
|
|
- gclChapter.push({ name: '未计入章节清单合计', cType: 21, serialNo: serialNo++, });
|
|
|
+ gclChapter.push({ name: '未计入章节清单合计', cType: 21, serialNo: serialNo++ });
|
|
|
+
|
|
|
otherChapter.push({ name: '清单小计(A)', cType: 11, serialNo: serialNo++ });
|
|
|
+
|
|
|
otherChapter.push({ name: '非清单项费用(B)', cType: 31, serialNo: serialNo++ });
|
|
|
- otherChapter.push({ name: '合计(C=A+B)', cType: 41, serialNo: serialNo });
|
|
|
- return [gclChapter, otherChapter];
|
|
|
+
|
|
|
+ gclChapterFilter.push({node_type: option.jrg.value});
|
|
|
+ gclChapterFilter.push({field: 'name', part: option.jrg.text});
|
|
|
+ const zlChapter = {
|
|
|
+ name: '暂列金额(Z)', cType: 32, serialNo: serialNo++,
|
|
|
+ deal_bills_tp: option.zlj.deal_bills_tp, match: [], matchPath: []
|
|
|
+ };
|
|
|
+ zlChapter.match.push({node_type: option.zlj.value});
|
|
|
+ zlChapter.match.push({field: 'name', part: option.zlj.text});
|
|
|
+ otherChapter.push(zlChapter);
|
|
|
+
|
|
|
+ otherChapter.push({ name: '合计(C=A+B+Z)', cType: 41, serialNo: serialNo });
|
|
|
}
|
|
|
|
|
|
function _gatherChapterFields(chapter, data, fields) {
|
|
@@ -304,8 +316,8 @@ const gclCompareModel = (function () {
|
|
|
}
|
|
|
|
|
|
function _gatherChapter() {
|
|
|
- const filterPath = [];
|
|
|
- const checkFilterPath = function (data) {
|
|
|
+ const calcFilterPath = [], chapterFilterPath = [];
|
|
|
+ const checkFilterPath = function (data, filterPath) {
|
|
|
for (const fp of filterPath) {
|
|
|
if (data.full_path.indexOf(fp + '-') === 0 || data.full_path === fp) return true;
|
|
|
}
|
|
@@ -313,15 +325,19 @@ const gclCompareModel = (function () {
|
|
|
};
|
|
|
|
|
|
for (const d of gsTree.nodes) {
|
|
|
- if (_checkFilter(d, chapterfilter)) {
|
|
|
- filterPath.push(d.full_path);
|
|
|
- }
|
|
|
+ if (_checkFilter(d, gclChapterFilter)) chapterFilterPath.push(d.full_path);
|
|
|
if (d.children && d.children.length > 0) continue;
|
|
|
+ if (checkFilterPath(d, calcFilterPath)) continue;
|
|
|
|
|
|
for (const c of otherChapter) {
|
|
|
if (c.cType === 41) {
|
|
|
gatherfields(c, d, ledgerSetting.chapterFields, ledgerSetting.prefix);
|
|
|
}
|
|
|
+ if (c.cType === 32 && _checkFilter(d, c.match)) {
|
|
|
+ gatherfields(c, d, ledgerSetting.chapterFields, ledgerSetting.prefix);
|
|
|
+ calcFilterPath.push(d.full_path);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
if (c.cType === 11 && (d.b_code)) {
|
|
|
gatherfields(c, d, ledgerSetting.chapterFields, ledgerSetting.prefix);
|
|
|
}
|
|
@@ -341,10 +357,9 @@ const gclCompareModel = (function () {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function init (gclData, chapter, filter) {
|
|
|
+ function init (gclData, chapter, option) {
|
|
|
gclList = gclData;
|
|
|
- [gclChapter, otherChapter] = _getCalcChapter(chapter);
|
|
|
- chapterfilter = filter || [];
|
|
|
+ [gclChapter, otherChapter, gclChapterFilter] = _getCalcChapter(chapter, option);
|
|
|
}
|
|
|
|
|
|
/**
|