|
@@ -35,8 +35,8 @@ class CompilationModel extends BaseModel {
|
|
|
*/
|
|
|
async getCompilationList() {
|
|
|
// 筛选字段
|
|
|
- let field = {_id: 1, name: 1, is_release: 1, description: 1, "ration_valuation._id": 1, "ration_valuation.name": 1, "ration_valuation.enable": 1,
|
|
|
- "bill_valuation._id": 1, "bill_valuation.name": 1, "bill_valuation.enable": 1};
|
|
|
+ let field = {_id: 1, name: 1, is_release: 1, description: 1, "ration_valuation.id": 1, "ration_valuation.name": 1, "ration_valuation.enable": 1,
|
|
|
+ "bill_valuation.id": 1, "bill_valuation.name": 1, "bill_valuation.enable": 1};
|
|
|
let compilationData = await this.findDataByCondition({name: {$ne: ''}}, field, false);
|
|
|
|
|
|
return compilationData === null ? [] : compilationData;
|
|
@@ -113,8 +113,10 @@ class CompilationModel extends BaseModel {
|
|
|
}
|
|
|
|
|
|
let insertData = {};
|
|
|
+ data.id = "12580";
|
|
|
insertData[section + '_valuation'] = data;
|
|
|
let result = await this.db.addToSet(condition, insertData);
|
|
|
+ console.log(result);
|
|
|
|
|
|
return result.ok === undefined ? false : result.ok;
|
|
|
}
|
|
@@ -205,7 +207,7 @@ class CompilationModel extends BaseModel {
|
|
|
let sectionString = section + '_valuation';
|
|
|
|
|
|
for(let valuation of compilationData[sectionString]) {
|
|
|
- if (valuation._id.toString() === id) {
|
|
|
+ if (valuation.id.toString() === id) {
|
|
|
result = valuation;
|
|
|
break;
|
|
|
}
|
|
@@ -292,7 +294,7 @@ class CompilationModel extends BaseModel {
|
|
|
async getEngineeringLib(valuationId, section, engineering) {
|
|
|
let sectionString = section + "_valuation";
|
|
|
let condition = {};
|
|
|
- condition[sectionString + "._id"] = valuationId;
|
|
|
+ condition[sectionString + ".id"] = valuationId;
|
|
|
|
|
|
let compilationData = await this.findDataByCondition(condition);
|
|
|
if (compilationData === null) {
|
|
@@ -300,7 +302,7 @@ class CompilationModel extends BaseModel {
|
|
|
}
|
|
|
let valuationData = null;
|
|
|
for(let valuation of compilationData[sectionString]) {
|
|
|
- if(valuation._id.toString() === valuationId) {
|
|
|
+ if(valuation.id === valuationId) {
|
|
|
valuationData = valuation;
|
|
|
}
|
|
|
}
|
|
@@ -333,7 +335,7 @@ class CompilationModel extends BaseModel {
|
|
|
async addEngineeringLib(valuationId, section, data) {
|
|
|
let sectionString = section + "_valuation";
|
|
|
let condition = {};
|
|
|
- condition[sectionString + "._id"] = valuationId;
|
|
|
+ condition[sectionString + ".id"] = valuationId;
|
|
|
|
|
|
let insertData = {};
|
|
|
insertData[sectionString + ".$.engineering_list"] = data;
|