|
@@ -0,0 +1,61 @@
|
|
|
+'use strict';
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ *
|
|
|
+ * @author Mai
|
|
|
+ * @date
|
|
|
+ * @version
|
|
|
+ */
|
|
|
+
|
|
|
+const RptMemBase = require('./base');
|
|
|
+const bindData = {};
|
|
|
+
|
|
|
+class rptMemChange extends RptMemBase {
|
|
|
+ constructor(ctx) {
|
|
|
+ super(ctx, bindData);
|
|
|
+ }
|
|
|
+
|
|
|
+ async doCheckAdvance(advanceId) {
|
|
|
+ if (this.ctx.advance) return;
|
|
|
+ this.ctx.advance = await this.ctx.service.advance.getDataByCondition({ cid: advanceId });
|
|
|
+ }
|
|
|
+
|
|
|
+ async doCheckTender(tenderId) {
|
|
|
+ if (this.ctx.tender) return;
|
|
|
+ this.ctx.tender = { id: tenderId };
|
|
|
+ this.ctx.tender.data = await this.ctx.service.tender.getTender(tenderId);
|
|
|
+ this.ctx.tender.info = await this.ctx.service.tenderInfo.getTenderInfo(tenderId);
|
|
|
+ }
|
|
|
+
|
|
|
+ async doBeforeLoadReport(params) {
|
|
|
+ await this.doCheckAdvance(params.advance_id);
|
|
|
+ await this.doCheckTender(this.ctx.change.tid);
|
|
|
+ }
|
|
|
+
|
|
|
+ async _getAdvanceAudit() {
|
|
|
+ const advanceAudit = await this.ctx.service.advanceAudit.getAllDataByCondition({ where: { vid: this.ctx.advance.id, times: this.ctx.advance.times }});
|
|
|
+ return this.ctx.helper.filterLastestData(advanceAudit, ['audit_id']);
|
|
|
+ }
|
|
|
+
|
|
|
+ getCommonData(params, tableName, fields, customDefine, customSelect) {
|
|
|
+ switch (tableName) {
|
|
|
+ case 'mem_advance':
|
|
|
+ return [this.ctx.advance];
|
|
|
+ case 'mem_advance_audit':
|
|
|
+ return this._getAdvanceAudit();
|
|
|
+ case 'mem_advance_file':
|
|
|
+ return this.ctx.service.advanceFile.getAllDataByCondition({ where: { vid: this.ctx.advance.id }});
|
|
|
+ case 'mem_project':
|
|
|
+ return this.ctx.service.project.getDataByCondition({ id: this.ctx.session.sessionProject.id });
|
|
|
+ case 'mem_tender':
|
|
|
+ return [this.ctx.tender.data];
|
|
|
+ case 'mem_tender_info':
|
|
|
+ return [this.ctx.tender.info];
|
|
|
+ default:
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+module.exports = rptMemChange;
|