|
@@ -163,6 +163,52 @@ class EngineeringLibModel extends BaseModel {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取对应标准库数量
|
|
|
+ *
|
|
|
+ * @param {Object} valuationData
|
|
|
+ * @return {Object}
|
|
|
+ */
|
|
|
+ async getLibCount(valuationData) {
|
|
|
+ let result = {};
|
|
|
+ if (valuationData.engineering_list === undefined || valuationData.engineering_list.length <= 0) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 整理需要查找的数据
|
|
|
+ let findIdList = [];
|
|
|
+ for(let engineering of valuationData.engineering_list) {
|
|
|
+ findIdList.push(engineering.engineering_id);
|
|
|
+ }
|
|
|
+
|
|
|
+ let condition = {_id: {$in: findIdList}};
|
|
|
+ let libData = await this.findDataByCondition(condition, null, false);
|
|
|
+ if (libData === null) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 整理数据
|
|
|
+ let countData = {};
|
|
|
+ for(let tmp of libData) {
|
|
|
+ countData[tmp._id] = {
|
|
|
+ bill_count: tmp.bill_lib.length,
|
|
|
+ ration_count: tmp.ration_lib.length,
|
|
|
+ glj_count: tmp.glj_lib.length,
|
|
|
+ fee_count: tmp.fee_lib.length,
|
|
|
+ artificial_count: tmp.artificial_lib.length,
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ for(let engineering of valuationData.engineering_list) {
|
|
|
+ if (countData[engineering.engineering_id] !== undefined) {
|
|
|
+ result[engineering.engineering] = countData[engineering.engineering_id];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
export default EngineeringLibModel;
|