|
@@ -14,9 +14,13 @@ let projSetting = require('./proj_setting_model');
|
|
|
let volumePriceData = require('../../volume_price/models/volume_price_model');
|
|
|
var labour_coe_facade = require('../facade/labour_coe_facade');
|
|
|
var calc_program_facade = require('../facade/calc_program_facade');
|
|
|
+
|
|
|
+const ProjectModel = require('../../pm/models/project_model').project;
|
|
|
+import GLJListModel from "../../glj/models/glj_list_model";
|
|
|
+
|
|
|
var consts = require('./project_consts');
|
|
|
var projectConsts = consts.projectConst;
|
|
|
-var async = require("async");
|
|
|
+var asyncTool = require("async");
|
|
|
|
|
|
var moduleMap = {};
|
|
|
|
|
@@ -73,7 +77,7 @@ Project.prototype.save = function(datas, callback){
|
|
|
functions.push(saveModule(item));
|
|
|
}
|
|
|
|
|
|
- async.parallel(functions, function(err, results) {
|
|
|
+ asyncTool.parallel(functions, function(err, results) {
|
|
|
if (!err){
|
|
|
callback(null, '', results)
|
|
|
}
|
|
@@ -98,7 +102,7 @@ Project.prototype.getData = function(projectID, callback){
|
|
|
})(itemName))
|
|
|
}
|
|
|
|
|
|
- async.parallel(functions, function(err, results) {
|
|
|
+ asyncTool.parallel(functions, function(err, results) {
|
|
|
if (!err){
|
|
|
callback(null, '', results)
|
|
|
}
|
|
@@ -111,11 +115,29 @@ Project.prototype.getData = function(projectID, callback){
|
|
|
Project.prototype.getFilterData = function (projectID, filter, callback) {
|
|
|
let functions = [];
|
|
|
let getModuleData = function (moduleName) {
|
|
|
- return function (cb) {
|
|
|
+ return async function (cb) {
|
|
|
if (moduleMap[moduleName]) {
|
|
|
moduleMap[moduleName].getData(projectID, function (err, name, data) {
|
|
|
cb(err, {'moduleName': name, 'data': data})
|
|
|
});
|
|
|
+ } else if (moduleName === projectConsts.PROJECTGLJ) {
|
|
|
+ try {
|
|
|
+ if (isNaN(projectID) || projectID <= 0) {
|
|
|
+ throw '标段id有误';
|
|
|
+ }
|
|
|
+ // 获取标段对应的单价文件id
|
|
|
+ let unitPriceFileId = await ProjectModel.getUnitPriceFileId(projectID);
|
|
|
+ if (unitPriceFileId <= 0) {
|
|
|
+ throw '没有对应的单价文件';
|
|
|
+ }
|
|
|
+ // 先获取对应标段的项目工料机数据
|
|
|
+ let gljListModel = new GLJListModel();
|
|
|
+ let [gljList, mixRatioConnectData] = await gljListModel.getListByProjectId(projectID, unitPriceFileId);
|
|
|
+
|
|
|
+ cb(null, {'moduleName': moduleName, 'data': gljList});
|
|
|
+ } catch (error) {
|
|
|
+ cb(error, null);
|
|
|
+ }
|
|
|
} else {
|
|
|
throw '要查询的项目模块不存在';
|
|
|
}
|
|
@@ -124,7 +146,8 @@ Project.prototype.getFilterData = function (projectID, filter, callback) {
|
|
|
for (let itemName of filter) {
|
|
|
functions.push(getModuleData(itemName));
|
|
|
}
|
|
|
- async.parallel(functions, function (err, results) {
|
|
|
+ asyncTool.parallel(functions, function (err, results) {
|
|
|
+ console.log(results);
|
|
|
if (err) {
|
|
|
throw '获取项目数据出错';
|
|
|
} else {
|