|
@@ -69,12 +69,13 @@ class EngineeringLibModel extends BaseModel {
|
|
|
let compilationModel = new CompilationModel();
|
|
|
let engineeringLib = await compilationModel.getEngineeringLib(valuationId, data.section, data.engineering);
|
|
|
|
|
|
- let result = false;
|
|
|
if (engineeringLib === null) {
|
|
|
// 不存在则插入
|
|
|
result = await this.db.create(data);
|
|
|
} else {
|
|
|
- engineeringLib = engineeringLib.length > 0 ? engineeringLib[0] : {};
|
|
|
+ delete data.id;
|
|
|
+ delete data.section;
|
|
|
+ delete data.engineering;
|
|
|
// 存在则直接更新
|
|
|
let condition = {_id: engineeringLib.engineering_id};
|
|
|
result = await this.db.update(condition, data);
|
|
@@ -96,11 +97,12 @@ class EngineeringLibModel extends BaseModel {
|
|
|
throw '新增编办数据中的专业工程失败!';
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
|
result = false;
|
|
|
}
|
|
|
-
|
|
|
+ console.log(result ? 'pass' : 'fail');
|
|
|
return result;
|
|
|
}
|
|
|
|