|
@@ -233,6 +233,16 @@ const gatherChapter = {
|
|
|
{name: '暂列金额(不含计日工总额)(即10×暂列金额比列)', order: 5, match: [{node_type: '暂列金额'}, {field: 'name', part: '暂列金额'}, {field: 'name', part: '暂定金额'}]},
|
|
|
{name: '投标报价、台账价(8+11+12)=13', order_calc: 'o1+o4+o5', order: 6},
|
|
|
],
|
|
|
+ rela: [
|
|
|
+ {
|
|
|
+ table: 'deal_bills', key: 'code',
|
|
|
+ fields: {source: 'total_price', target: 'ex_value1'},
|
|
|
+ },
|
|
|
+ {
|
|
|
+ table: 'mem_change_bills', key: 'code',
|
|
|
+ fields: {source: '', target: 'ex_value2'},
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
_getCalcChapter: function (chapter, options) {
|
|
|
const gclChapter = [], otherChapter = [], customChapter = [];
|
|
@@ -285,11 +295,11 @@ const gatherChapter = {
|
|
|
}
|
|
|
return [gclChapter, otherChapter, customChapter];
|
|
|
},
|
|
|
- _getGclChapter: function (chapter, data) {
|
|
|
+ _getGclChapter: function (chapter, data, field) {
|
|
|
for (const c of chapter) {
|
|
|
if (c.filter) {
|
|
|
const reg = new RegExp(c.filter);
|
|
|
- if (reg.test(data.b_code)) {
|
|
|
+ if (reg.test(data[field])) {
|
|
|
return c;
|
|
|
}
|
|
|
} else {
|
|
@@ -303,6 +313,40 @@ const gatherChapter = {
|
|
|
}
|
|
|
return false;
|
|
|
},
|
|
|
+ _gatherRela: function (ctx, data, rela, gclChapter, otherChapter) {
|
|
|
+ if (!rela) return;
|
|
|
+
|
|
|
+ const gatherRelaFields = function (chapter, source, field) {
|
|
|
+ const fields = field instanceof Array ? field : [field];
|
|
|
+ for (const f of fields) {
|
|
|
+ chapter[f.target] = ctx.helper.add(chapter[f.target], source[f.source]);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const relaBills = rela instanceof Array ? rela : [rela];
|
|
|
+ for (const rb of relaBills) {
|
|
|
+ if (!rb.table) continue;
|
|
|
+
|
|
|
+ const relaData = data[rb.table];
|
|
|
+ if (!relaData) continue;
|
|
|
+
|
|
|
+ for (const rd of relaData) {
|
|
|
+ for (const c of otherChapter) {
|
|
|
+ if (c.cType === 41) {
|
|
|
+ gatherRelaFields(c, rd, rb.fields);
|
|
|
+ } else if (c.cType === 31 && (!rd[rb.key] || rd[rb.key] === '')) {
|
|
|
+ gatherRelaFields(c, rd, rb.fields);
|
|
|
+ } else if (c.cType === 11 && (rd[rb.key])) {
|
|
|
+ gatherRelaFields(c, rd, rb.fields);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (rd[rb.key]) {
|
|
|
+ const c = this._getGclChapter(gclChapter, rd, rb.key);
|
|
|
+ gatherRelaFields(c, rd, rb.fields);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
_orderCalc: function (ctx, chapter, fields) {
|
|
|
const orderMatch = new RegExp('o[0-9]+', 'igm');
|
|
|
for (const c of chapter) {
|
|
@@ -387,10 +431,11 @@ const gatherChapter = {
|
|
|
}
|
|
|
}
|
|
|
if (d.b_code) {
|
|
|
- const c = this._getGclChapter(gclChapter, d);
|
|
|
+ const c = this._getGclChapter(gclChapter, d, 'b_code');
|
|
|
gatherData(c, d);
|
|
|
}
|
|
|
}
|
|
|
+ this._gatherRela(ctx, data, options.rela, gclChapter, otherChapter);
|
|
|
const chapter = gclChapter.concat(otherChapter).concat(customChapter);
|
|
|
this._orderCalc(ctx, chapter, calcFields);
|
|
|
chapter.sort(function (a, b) {return a.serialNo - b.serialNo});
|
|
@@ -405,6 +450,7 @@ const gatherChapter = {
|
|
|
return true;
|
|
|
}
|
|
|
});
|
|
|
+ //console.log(data[fieldsKey[0].table]);
|
|
|
},
|
|
|
};
|
|
|
const join = {
|
|
@@ -691,6 +737,7 @@ const union = {
|
|
|
fun: function(ctx, data, fields, options) {
|
|
|
if (!options || !options.union) return;
|
|
|
|
|
|
+ console.log(data.mem_stage_pay);
|
|
|
const result = [];
|
|
|
for (const u of options.union) {
|
|
|
const unionData = data[u.table];
|
|
@@ -707,6 +754,7 @@ const union = {
|
|
|
}
|
|
|
}
|
|
|
data.mem_union_data = result;
|
|
|
+ //console.log(data.mem_union_data);
|
|
|
}
|
|
|
};
|
|
|
|