|
@@ -28,6 +28,25 @@ module.exports = app => {
|
|
|
}
|
|
|
return data;
|
|
|
}
|
|
|
+
|
|
|
+ async addInitialStageData(stage, preStage, transaction) {
|
|
|
+ if (!stage || !preStage) {
|
|
|
+ throw '标段数据有误';
|
|
|
+ }
|
|
|
+ const preDatas = await this.getAllDataByCondition({
|
|
|
+ where: {sid: preStage.id}
|
|
|
+ });
|
|
|
+ if (preDatas.length > 0) {
|
|
|
+ for (const pd of preDatas) {
|
|
|
+ delete pd.id;
|
|
|
+ pd.sid = stage.id;
|
|
|
+ }
|
|
|
+ const result = await transaction.insert(this.tableName, preDatas);
|
|
|
+ return result.affectedRows === preDatas.length;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return RptCustomDefine;
|