|
@@ -421,7 +421,7 @@ const gclGatherModel = (function () {
|
|
|
}
|
|
|
|
|
|
function _getCalcChapter(chapter, option) {
|
|
|
- const gclChapter = [], otherChapter = [], gclChapterFilter = [];
|
|
|
+ const gclChapter = [], otherChapter = {}, gclChapterFilter = [];
|
|
|
let serialNo = 1;
|
|
|
for (const c of chapter) {
|
|
|
const cc = { code: c.code, name: c.name, cType: 1 };
|
|
@@ -431,7 +431,7 @@ const gclGatherModel = (function () {
|
|
|
}
|
|
|
gclChapter.push({ name: '未计入章节清单合计', cType: 21, serialNo: serialNo+1 });
|
|
|
|
|
|
- otherChapter.push({ name: '合计(C=A+B+Z)', cType: 41, serialNo: serialNo+5, deal_bills_tp: option.zlj.deal_bills_tp });
|
|
|
+ otherChapter.hj = { name: '合计(C=A+B+Z)', cType: 41, serialNo: serialNo+5, deal_bills_tp: option.zlj.deal_bills_tp };
|
|
|
gclChapterFilter.push({node_type: option.jrg.value});
|
|
|
gclChapterFilter.push({field: 'name', part: option.jrg.text});
|
|
|
const zlChapter = {
|
|
@@ -440,10 +440,10 @@ const gclGatherModel = (function () {
|
|
|
};
|
|
|
zlChapter.match.push({node_type: option.zlj.value});
|
|
|
zlChapter.match.push({field: 'name', part: option.zlj.text});
|
|
|
- otherChapter.push(zlChapter);
|
|
|
+ otherChapter.zlj = zlChapter;
|
|
|
|
|
|
- otherChapter.push({ name: '清单小计(A)', cType: 11, serialNo: serialNo+2 });
|
|
|
- otherChapter.push({ name: '非清单项费用(B)', cType: 31, serialNo: serialNo+3 });
|
|
|
+ otherChapter.qd = { name: '清单小计(A)', cType: 11, serialNo: serialNo+2 };
|
|
|
+ otherChapter.fqd = { name: '非清单项费用(B)', cType: 31, serialNo: serialNo+3 };
|
|
|
|
|
|
return [gclChapter, otherChapter, gclChapterFilter];
|
|
|
}
|
|
@@ -479,7 +479,7 @@ const gclGatherModel = (function () {
|
|
|
}
|
|
|
|
|
|
function gatherChapterData(chapter, option, fields) {
|
|
|
- const calcFilterPath = [], chapterFilterPath = [];
|
|
|
+ const chapterFilterPath = [];
|
|
|
const checkFilterPath = function (data, filterPath) {
|
|
|
for (const fp of filterPath) {
|
|
|
if (data.full_path.indexOf(fp + '-') === 0 || data.full_path === fp) return true;
|
|
@@ -490,46 +490,40 @@ const gclGatherModel = (function () {
|
|
|
const [gclChapter, otherChapter, gclChapterFilter] = _getCalcChapter(chapter, option);
|
|
|
for (const d of gsTree.nodes) {
|
|
|
if (_checkFilter(d, gclChapterFilter)) chapterFilterPath.push(d.full_path);
|
|
|
+ if (_checkFilter(d, otherChapter.zlj.match)) otherChapter.zlj.matchPath.push(d.full_path);
|
|
|
if (d.children && d.children.length > 0) continue;
|
|
|
- if (checkFilterPath(d, calcFilterPath)) continue;
|
|
|
|
|
|
- for (const c of otherChapter) {
|
|
|
- if (d.name.indexOf('暂列金额') > -1) console.log(c);
|
|
|
- if (c.cType === 41) {
|
|
|
- gatherfields(c, d, fields);
|
|
|
- }
|
|
|
- if (c.cType === 32 && _checkFilter(d, c.match)) {
|
|
|
- gatherfields(c, d, fields);
|
|
|
- calcFilterPath.push(d.full_path);
|
|
|
- break;
|
|
|
+ if (checkFilterPath(d,otherChapter.zlj.matchPath)) {
|
|
|
+ gatherfields(otherChapter.zlj, d, fields);
|
|
|
+ gatherfields(otherChapter.hj, d, fields);
|
|
|
+ } else {
|
|
|
+ gatherfields(otherChapter.hj, d, fields);
|
|
|
+ if (d.b_code) {
|
|
|
+ gatherfields(otherChapter.qd, d, fields);
|
|
|
}
|
|
|
- if (c.cType === 11 && (d.b_code)) {
|
|
|
- gatherfields(c, d, fields);
|
|
|
+ if (!d.b_code || d.b_code === '') {
|
|
|
+ gatherfields(otherChapter.fqd, d, fields);
|
|
|
}
|
|
|
- if (c.cType === 31 && (!d.b_code || d.b_code === '')) {
|
|
|
+
|
|
|
+ if (d.b_code) {
|
|
|
+ const c = checkFilterPath(d, chapterFilterPath)
|
|
|
+ ? gclChapter.find(x => { return x.cType === 21})
|
|
|
+ : _getGclChapter(gclChapter, d);
|
|
|
gatherfields(c, d, fields);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (d.b_code) {
|
|
|
- const c = checkFilterPath(d, chapterFilterPath)
|
|
|
- ? gclChapter.find(x => { return x.cType === 21})
|
|
|
- : _getGclChapter(gclChapter, d);
|
|
|
- gatherfields(c, d, fields);
|
|
|
- }
|
|
|
}
|
|
|
for (const d of deal) {
|
|
|
if (!d.quantity || !d.unit_price) continue;
|
|
|
- for (const c of otherChapter) {
|
|
|
- if (c.cType === 41 || c.cType === 11) {
|
|
|
- c.deal_bills_tp = ZhCalc.add(c.deal_bills_tp, d.total_price);
|
|
|
- }
|
|
|
- }
|
|
|
+ otherChapter.hj.deal_bills_tp = ZhCalc.add(otherChapter.hj.deal_bills_tp, d.total_price);
|
|
|
+ otherChapter.qd.deal_bills_tp = ZhCalc.add(otherChapter.qd.deal_bills_tp, d.total_price);
|
|
|
const c = _getGclChapter(gclChapter, d);
|
|
|
c.deal_bills_tp = ZhCalc.add(c.deal_bills_tp, d.total_price);
|
|
|
}
|
|
|
- otherChapter.sort((x, y) => {return x.serialNo - y.serialNo});
|
|
|
- return gclChapter.concat(otherChapter);
|
|
|
+
|
|
|
+ const result = gclChapter.concat([otherChapter.hj, otherChapter.zlj, otherChapter.qd, otherChapter.fqd]);
|
|
|
+ result.sort((x, y) => {return x.serialNo - y.serialNo});
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
return {
|