|
@@ -12,7 +12,8 @@ let fileType = {
|
|
|
feeRateFile: 'FeeRateFile'
|
|
feeRateFile: 'FeeRateFile'
|
|
|
};
|
|
};
|
|
|
//先导出后require可以解决循环引用问题
|
|
//先导出后require可以解决循环引用问题
|
|
|
-module.exports ={ project: new ProjectsDAO(),
|
|
|
|
|
|
|
+module.exports = {
|
|
|
|
|
+ project: new ProjectsDAO(),
|
|
|
projType: projectType,
|
|
projType: projectType,
|
|
|
fileType: fileType
|
|
fileType: fileType
|
|
|
};
|
|
};
|
|
@@ -64,24 +65,24 @@ ProjectsDAO.prototype.getAllUnitProjects = async function (userId, compilation,
|
|
|
let projects = await Projects.find({
|
|
let projects = await Projects.find({
|
|
|
'$or': [
|
|
'$or': [
|
|
|
{
|
|
{
|
|
|
- 'userID': userId,
|
|
|
|
|
- 'compilation': compilation,
|
|
|
|
|
- 'property.rootProjectID': rootPrjID,
|
|
|
|
|
- 'deleteInfo': null
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ 'userID': userId,
|
|
|
|
|
+ 'compilation': compilation,
|
|
|
|
|
+ 'property.rootProjectID': rootPrjID,
|
|
|
|
|
+ 'deleteInfo': null
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
- 'userID': userId,
|
|
|
|
|
- 'compilation': compilation,
|
|
|
|
|
|
|
+ 'userID': userId,
|
|
|
|
|
+ 'compilation': compilation,
|
|
|
'property.rootProjectID': rootPrjID,
|
|
'property.rootProjectID': rootPrjID,
|
|
|
- 'deleteInfo.deleted': {'$in': [null, false]}
|
|
|
|
|
|
|
+ 'deleteInfo.deleted': { '$in': [null, false] }
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
- }, '-_id', {lean: true});
|
|
|
|
|
- let projIDs= [];
|
|
|
|
|
|
|
+ }, '-_id', { lean: true });
|
|
|
|
|
+ let projIDs = [];
|
|
|
const allIDs = [];
|
|
const allIDs = [];
|
|
|
- for(let project of projects){
|
|
|
|
|
|
|
+ for (let project of projects) {
|
|
|
allIDs.push(project.ID);
|
|
allIDs.push(project.ID);
|
|
|
- if(project.projType === projectType.project){
|
|
|
|
|
|
|
+ if (project.projType === projectType.project) {
|
|
|
projIDs.push(project.ID);
|
|
projIDs.push(project.ID);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -91,7 +92,7 @@ ProjectsDAO.prototype.getAllUnitProjects = async function (userId, compilation,
|
|
|
project.shareInfo = shareMap[project.ID] || [];
|
|
project.shareInfo = shareMap[project.ID] || [];
|
|
|
});
|
|
});
|
|
|
// 当前费用定额未读的分享的条目数量
|
|
// 当前费用定额未读的分享的条目数量
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 设置汇总字段
|
|
// 设置汇总字段
|
|
|
let summaryInfo = await pmFacade.getSummaryInfo(projIDs);
|
|
let summaryInfo = await pmFacade.getSummaryInfo(projIDs);
|
|
|
pmFacade.setupSummaryFields(summaryInfo, projects);
|
|
pmFacade.setupSummaryFields(summaryInfo, projects);
|
|
@@ -104,30 +105,39 @@ ProjectsDAO.prototype.getAllUnitProjects = async function (userId, compilation,
|
|
|
|
|
|
|
|
ProjectsDAO.prototype.getUserProjects = async function (userId, compilation, callback) {
|
|
ProjectsDAO.prototype.getUserProjects = async function (userId, compilation, callback) {
|
|
|
try {//
|
|
try {//
|
|
|
|
|
+ const date1 = Date.now();
|
|
|
let projects = await Projects.find({
|
|
let projects = await Projects.find({
|
|
|
'$or': [{
|
|
'$or': [{
|
|
|
'userID': userId,
|
|
'userID': userId,
|
|
|
'compilation': compilation,
|
|
'compilation': compilation,
|
|
|
'deleteInfo': null
|
|
'deleteInfo': null
|
|
|
- }, {'userID': userId, 'compilation': compilation, 'deleteInfo.deleted': {'$in': [null, false]}}]
|
|
|
|
|
- }, '-_id', {lean: true});
|
|
|
|
|
|
|
+ }, { 'userID': userId, 'compilation': compilation, 'deleteInfo.deleted': { '$in': [null, false] } }]
|
|
|
|
|
+ }, '-_id', { lean: true });
|
|
|
|
|
+ const date2 = Date.now();
|
|
|
|
|
+ console.log('date2 - date1', date2 - date1);
|
|
|
await pmFacade.checkFiles(projects);
|
|
await pmFacade.checkFiles(projects);
|
|
|
- let projIDs= [];
|
|
|
|
|
|
|
+ const date3 = Date.now();
|
|
|
|
|
+ console.log('date3 - date2', date3 - date2);
|
|
|
|
|
+ let projIDs = [];
|
|
|
const allIDs = [];
|
|
const allIDs = [];
|
|
|
- for(let project of projects){
|
|
|
|
|
|
|
+ for (let project of projects) {
|
|
|
allIDs.push(project.ID);
|
|
allIDs.push(project.ID);
|
|
|
- if(project.projType === projectType.project){
|
|
|
|
|
|
|
+ if (project.projType === projectType.project) {
|
|
|
projIDs.push(project.ID);
|
|
projIDs.push(project.ID);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 设置分享信息
|
|
// 设置分享信息
|
|
|
const shareMap = await pmFacade.getShareInfoMap(allIDs);
|
|
const shareMap = await pmFacade.getShareInfoMap(allIDs);
|
|
|
|
|
+ const date4 = Date.now();
|
|
|
|
|
+ console.log('date4 - date3', date4 - date3);
|
|
|
projects.forEach(project => {
|
|
projects.forEach(project => {
|
|
|
project.shareInfo = shareMap[project.ID] || [];
|
|
project.shareInfo = shareMap[project.ID] || [];
|
|
|
});
|
|
});
|
|
|
//设置汇总字段
|
|
//设置汇总字段
|
|
|
let summaryInfo = await pmFacade.getSummaryInfo(projIDs);
|
|
let summaryInfo = await pmFacade.getSummaryInfo(projIDs);
|
|
|
pmFacade.setupSummaryFields(summaryInfo, projects);
|
|
pmFacade.setupSummaryFields(summaryInfo, projects);
|
|
|
|
|
+ const date5 = Date.now();
|
|
|
|
|
+ console.log('date5 - date4', date5 - date4);
|
|
|
/* for(let proj of projects){
|
|
/* for(let proj of projects){
|
|
|
let summaryProj = summaryInfo[proj.ID];
|
|
let summaryProj = summaryInfo[proj.ID];
|
|
|
if(summaryProj){
|
|
if(summaryProj){
|
|
@@ -143,7 +153,7 @@ ProjectsDAO.prototype.getUserProjects = async function (userId, compilation, cal
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
ProjectsDAO.prototype.getUserProjectAsync = async function (userId, ProjId) {
|
|
ProjectsDAO.prototype.getUserProjectAsync = async function (userId, ProjId) {
|
|
|
- let template = await Projects.findOne({$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], ID: ProjId}, '-_id');
|
|
|
|
|
|
|
+ let template = await Projects.findOne({ $or: [{ deleteInfo: null }, { 'deleteInfo.deleted': false }], ID: ProjId }, '-_id');
|
|
|
if (template && userId !== template.userID) {
|
|
if (template && userId !== template.userID) {
|
|
|
template._doc.readOnly = true;
|
|
template._doc.readOnly = true;
|
|
|
}
|
|
}
|
|
@@ -151,12 +161,12 @@ ProjectsDAO.prototype.getUserProjectAsync = async function (userId, ProjId) {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
ProjectsDAO.prototype.getUserProject = function (userId, ProjId, callback) {
|
|
ProjectsDAO.prototype.getUserProject = function (userId, ProjId, callback) {
|
|
|
- Projects.findOne({$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], ID: ProjId}, '-_id', function (err, template) {
|
|
|
|
|
|
|
+ Projects.findOne({ $or: [{ deleteInfo: null }, { 'deleteInfo.deleted': false }], ID: ProjId }, '-_id', function (err, template) {
|
|
|
if (err) {
|
|
if (err) {
|
|
|
callback(1, '找不到标段数据', null);
|
|
callback(1, '找不到标段数据', null);
|
|
|
} else {
|
|
} else {
|
|
|
//打开分享的项目,只读
|
|
//打开分享的项目,只读
|
|
|
- if(template && userId !== template.userID){
|
|
|
|
|
|
|
+ if (template && userId !== template.userID) {
|
|
|
template._doc.readOnly = true;
|
|
template._doc.readOnly = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -186,19 +196,19 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
|
|
|
data.updateData.name = data.updateData.name.trim();
|
|
data.updateData.name = data.updateData.name.trim();
|
|
|
}
|
|
}
|
|
|
if (data.updateType === 'update') {
|
|
if (data.updateType === 'update') {
|
|
|
- Projects.update({userID: userId, ID: data.updateData.ID}, data.updateData, updateAll);
|
|
|
|
|
|
|
+ Projects.update({ userID: userId, ID: data.updateData.ID }, data.updateData, updateAll);
|
|
|
}
|
|
}
|
|
|
else if (data.updateType === 'new') {
|
|
else if (data.updateType === 'new') {
|
|
|
let overWrite;
|
|
let overWrite;
|
|
|
- if(compilation.overWriteUrl && compilation.overWriteUrl!=""){
|
|
|
|
|
- overWrite = require("../../.."+compilation.overWriteUrl);
|
|
|
|
|
|
|
+ if (compilation.overWriteUrl && compilation.overWriteUrl != "") {
|
|
|
|
|
+ overWrite = require("../../.." + compilation.overWriteUrl);
|
|
|
}
|
|
}
|
|
|
data.updateData.GUID = uuidV1();
|
|
data.updateData.GUID = uuidV1();
|
|
|
data.updateData['userID'] = userId;
|
|
data.updateData['userID'] = userId;
|
|
|
data.updateData['compilation'] = compilationId;
|
|
data.updateData['compilation'] = compilationId;
|
|
|
data.updateData['createDateTime'] = new Date();
|
|
data.updateData['createDateTime'] = new Date();
|
|
|
data.updateData['fileVer'] = await index.getVersion();
|
|
data.updateData['fileVer'] = await index.getVersion();
|
|
|
- if(data.updateData.projType === projectType.project){
|
|
|
|
|
|
|
+ if (data.updateData.projType === projectType.project) {
|
|
|
//设置建设项目基本信息,多个单位工程共用
|
|
//设置建设项目基本信息,多个单位工程共用
|
|
|
const fileKind = data.updateData.property.boqType;
|
|
const fileKind = data.updateData.property.boqType;
|
|
|
if (fileKind) {
|
|
if (fileKind) {
|
|
@@ -220,7 +230,7 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
|
|
|
user_id: userId,
|
|
user_id: userId,
|
|
|
root_project_id: data.updateData.property.rootProjectID
|
|
root_project_id: data.updateData.property.rootProjectID
|
|
|
};
|
|
};
|
|
|
- if(overWrite && overWrite.getDefalutAssistProductionFeeRate) insertData.assistProductionFeeRate = overWrite.getDefalutAssistProductionFeeRate();
|
|
|
|
|
|
|
+ if (overWrite && overWrite.getDefalutAssistProductionFeeRate) insertData.assistProductionFeeRate = overWrite.getDefalutAssistProductionFeeRate();
|
|
|
let addResult = await unitPriceFileModel.add(insertData);
|
|
let addResult = await unitPriceFileModel.add(insertData);
|
|
|
if (!addResult) {
|
|
if (!addResult) {
|
|
|
callback(1, '新增单价文件失败.', null);
|
|
callback(1, '新增单价文件失败.', null);
|
|
@@ -228,11 +238,11 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
|
|
|
}
|
|
}
|
|
|
data.updateData.property.unitPriceFile.id = addResult.id;
|
|
data.updateData.property.unitPriceFile.id = addResult.id;
|
|
|
//新增单价文件的同时,在项目工料机和空白的单价文件中先插入机械组成物等信息
|
|
//新增单价文件的同时,在项目工料机和空白的单价文件中先插入机械组成物等信息
|
|
|
- await gljFacade.addMixRatioForNew(data.updateData.ID,addResult.id,data.updateData.property.engineering_id,pmFacade.getExtendData(data.updateData.property,compilation));
|
|
|
|
|
|
|
+ await gljFacade.addMixRatioForNew(data.updateData.ID, addResult.id, data.updateData.property.engineering_id, pmFacade.getExtendData(data.updateData.property, compilation));
|
|
|
}
|
|
}
|
|
|
if (data.updateData.projType === projectType.tender) {
|
|
if (data.updateData.projType === projectType.tender) {
|
|
|
//单价文件
|
|
//单价文件
|
|
|
- data.updateData.property.unitPriceFile.id=parseInt(data.updateData.property.unitPriceFile.id);
|
|
|
|
|
|
|
+ data.updateData.property.unitPriceFile.id = parseInt(data.updateData.property.unitPriceFile.id);
|
|
|
//小数位数
|
|
//小数位数
|
|
|
data.updateData.property.decimal = overWrite && overWrite.defaultDecimal || defaultDecimal;
|
|
data.updateData.property.decimal = overWrite && overWrite.defaultDecimal || defaultDecimal;
|
|
|
//清单工程量精度
|
|
//清单工程量精度
|
|
@@ -241,7 +251,7 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
|
|
|
//basicInformation[0]['items'][1]['value'] = data.updateData.property.engineeringName || '';
|
|
//basicInformation[0]['items'][1]['value'] = data.updateData.property.engineeringName || '';
|
|
|
//data.updateData.property.basicInformation = basicInformation;
|
|
//data.updateData.property.basicInformation = basicInformation;
|
|
|
//工程特征
|
|
//工程特征
|
|
|
- if(data.updateData.property.featureLibID){
|
|
|
|
|
|
|
+ if (data.updateData.property.featureLibID) {
|
|
|
const matchedConstructionProject = datas.find(item => item.updateData.projType === projectType.project);
|
|
const matchedConstructionProject = datas.find(item => item.updateData.projType === projectType.project);
|
|
|
let constructionProjectName = '';
|
|
let constructionProjectName = '';
|
|
|
if (matchedConstructionProject) {
|
|
if (matchedConstructionProject) {
|
|
@@ -283,24 +293,24 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
|
|
|
data.updateData.property.growthPeriod = 0;
|
|
data.updateData.property.growthPeriod = 0;
|
|
|
}
|
|
}
|
|
|
//安装增加费
|
|
//安装增加费
|
|
|
- if(data.updateData.property.isInstall == true || data.updateData.property.isInstall=='true'){//判断是否安装工程
|
|
|
|
|
- await installationFacade.copyInstallationFeeFromLib(data.updateData.ID,data.updateData.property.engineering_id);
|
|
|
|
|
|
|
+ if (data.updateData.property.isInstall == true || data.updateData.property.isInstall == 'true') {//判断是否安装工程
|
|
|
|
|
+ await installationFacade.copyInstallationFeeFromLib(data.updateData.ID, data.updateData.property.engineering_id);
|
|
|
}
|
|
}
|
|
|
//锁定清单
|
|
//锁定清单
|
|
|
data.updateData.property.lockBills = false;
|
|
data.updateData.property.lockBills = false;
|
|
|
//工料机单价调整系数
|
|
//工料机单价调整系数
|
|
|
data.updateData.property.tenderSetting = tenderSetting;
|
|
data.updateData.property.tenderSetting = tenderSetting;
|
|
|
//书签和批注
|
|
//书签和批注
|
|
|
- data.updateData.property.bookmarkSetting = bookmarkSetting;
|
|
|
|
|
|
|
+ data.updateData.property.bookmarkSetting = bookmarkSetting;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
newProject = new Projects(data.updateData);
|
|
newProject = new Projects(data.updateData);
|
|
|
- /* // 查找同级是否存在同名数据
|
|
|
|
|
- let exist = await this.isExist(userId, compilationId, data.updateData.name, data.updateData.ParentID);
|
|
|
|
|
- if (exist) {
|
|
|
|
|
- callback(1, '同级目录已存在相同名称数据.', null);
|
|
|
|
|
- return;
|
|
|
|
|
- }*/
|
|
|
|
|
|
|
+ /* // 查找同级是否存在同名数据
|
|
|
|
|
+ let exist = await this.isExist(userId, compilationId, data.updateData.name, data.updateData.ParentID);
|
|
|
|
|
+ if (exist) {
|
|
|
|
|
+ callback(1, '同级目录已存在相同名称数据.', null);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }*/
|
|
|
if (data.updateData.projType === 'Tender') {
|
|
if (data.updateData.projType === 'Tender') {
|
|
|
let feeRateFileID = await feeRateFacade.newFeeRateFile(userId, data.updateData);
|
|
let feeRateFileID = await feeRateFacade.newFeeRateFile(userId, data.updateData);
|
|
|
newProject.property.feeFile = feeRateFileID ? feeRateFileID : -1;
|
|
newProject.property.feeFile = feeRateFileID ? feeRateFileID : -1;
|
|
@@ -378,7 +388,7 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
ProjectsDAO.prototype.udpateUserFiles = async function (userId, datas, callback) {
|
|
ProjectsDAO.prototype.udpateUserFiles = async function (userId, datas, callback) {
|
|
|
- let updateType = {update: 'update', delete: 'delete'};
|
|
|
|
|
|
|
+ let updateType = { update: 'update', delete: 'delete' };
|
|
|
let deleteInfo = Object.create(null);
|
|
let deleteInfo = Object.create(null);
|
|
|
deleteInfo.deleted = true;
|
|
deleteInfo.deleted = true;
|
|
|
deleteInfo.deleteBy = userId;
|
|
deleteInfo.deleteBy = userId;
|
|
@@ -387,26 +397,26 @@ ProjectsDAO.prototype.udpateUserFiles = async function (userId, datas, callback)
|
|
|
for (let i = 0, len = datas.length; i < len; i++) {
|
|
for (let i = 0, len = datas.length; i < len; i++) {
|
|
|
let data = datas[i];
|
|
let data = datas[i];
|
|
|
if (data.updateType === updateType.update && data.fileType === fileType.unitPriceFile) {
|
|
if (data.updateType === updateType.update && data.fileType === fileType.unitPriceFile) {
|
|
|
- await UnitPriceFiles.update({user_id: userId, id: parseInt(data.updateData.id)}, data.updateData);
|
|
|
|
|
|
|
+ await UnitPriceFiles.update({ user_id: userId, id: parseInt(data.updateData.id) }, data.updateData);
|
|
|
await Projects.update({
|
|
await Projects.update({
|
|
|
userID: userId,
|
|
userID: userId,
|
|
|
'property.unitPriceFile.id': data.updateData.id
|
|
'property.unitPriceFile.id': data.updateData.id
|
|
|
- }, {$set: {'property.unitPriceFile.name': data.updateData.name}}, {multi: true});
|
|
|
|
|
|
|
+ }, { $set: { 'property.unitPriceFile.name': data.updateData.name } }, { multi: true });
|
|
|
}
|
|
}
|
|
|
else if (data.updateType === updateType.update && data.fileType === fileType.feeRateFile) {
|
|
else if (data.updateType === updateType.update && data.fileType === fileType.feeRateFile) {
|
|
|
- await FeeRateFiles.update({ID: data.updateData.ID}, data.updateData);
|
|
|
|
|
|
|
+ await FeeRateFiles.update({ ID: data.updateData.ID }, data.updateData);
|
|
|
await Projects.update({
|
|
await Projects.update({
|
|
|
userID: userId,
|
|
userID: userId,
|
|
|
'property.feeFile.id': data.updateData.ID
|
|
'property.feeFile.id': data.updateData.ID
|
|
|
- }, {$set: {'property.feeFile.name': data.updateData.name}}, {multi: true});
|
|
|
|
|
|
|
+ }, { $set: { 'property.feeFile.name': data.updateData.name } }, { multi: true });
|
|
|
}
|
|
}
|
|
|
else if (data.updateType === updateType.delete && data.fileType === fileType.unitPriceFile) {
|
|
else if (data.updateType === updateType.delete && data.fileType === fileType.unitPriceFile) {
|
|
|
data.updateData.deleteInfo = deleteInfo;
|
|
data.updateData.deleteInfo = deleteInfo;
|
|
|
- await UnitPriceFiles.update({user_id: userId, id: parseInt(data.updateData.id)}, data.updateData);
|
|
|
|
|
|
|
+ await UnitPriceFiles.update({ user_id: userId, id: parseInt(data.updateData.id) }, data.updateData);
|
|
|
}
|
|
}
|
|
|
else if (data.updateType === updateType.delete && data.fileType === fileType.feeRateFile) {
|
|
else if (data.updateType === updateType.delete && data.fileType === fileType.feeRateFile) {
|
|
|
data.updateData.deleteInfo = deleteInfo;
|
|
data.updateData.deleteInfo = deleteInfo;
|
|
|
- await FeeRateFiles.update({ID: data.updateData.ID}, data.updateData);
|
|
|
|
|
|
|
+ await FeeRateFiles.update({ ID: data.updateData.ID }, data.updateData);
|
|
|
}
|
|
}
|
|
|
else throw '未知文件类型,删除失败'
|
|
else throw '未知文件类型,删除失败'
|
|
|
}
|
|
}
|
|
@@ -434,7 +444,7 @@ ProjectsDAO.prototype.copyUserProjects = function (userId, compilationId, datas,
|
|
|
for (i = 0; i < datas.length && !hasError; i++) {
|
|
for (i = 0; i < datas.length && !hasError; i++) {
|
|
|
data = datas[i];
|
|
data = datas[i];
|
|
|
if (data.updateType === 'update') {
|
|
if (data.updateType === 'update') {
|
|
|
- Projects.update({userID: userId, ID: data.updateData.ID}, data.updateData, updateAll)
|
|
|
|
|
|
|
+ Projects.update({ userID: userId, ID: data.updateData.ID }, data.updateData, updateAll)
|
|
|
} else if (data.updateType === 'copy') {
|
|
} else if (data.updateType === 'copy') {
|
|
|
console.log(userId);
|
|
console.log(userId);
|
|
|
data.updateData['userID'] = userId;
|
|
data.updateData['userID'] = userId;
|
|
@@ -468,13 +478,13 @@ ProjectsDAO.prototype.rename = async function (userId, compilationId, data, call
|
|
|
}
|
|
}
|
|
|
data.newName = data.newName.trim();
|
|
data.newName = data.newName.trim();
|
|
|
//重名前端控制
|
|
//重名前端控制
|
|
|
- /* // 查找同级是否存在同名数据
|
|
|
|
|
- let exist = await this.isExist(userId, compilationId, data.newName, data.parentID);
|
|
|
|
|
- if (exist) {
|
|
|
|
|
- throw '同级目录已存在相同名称数据';
|
|
|
|
|
- }*/
|
|
|
|
|
|
|
+ /* // 查找同级是否存在同名数据
|
|
|
|
|
+ let exist = await this.isExist(userId, compilationId, data.newName, data.parentID);
|
|
|
|
|
+ if (exist) {
|
|
|
|
|
+ throw '同级目录已存在相同名称数据';
|
|
|
|
|
+ }*/
|
|
|
|
|
|
|
|
- Projects.update({userID: userId, ID: data.id}, {name: data.newName}, function (err) {
|
|
|
|
|
|
|
+ Projects.update({ userID: userId, ID: data.id }, { name: data.newName }, function (err) {
|
|
|
if (err) {
|
|
if (err) {
|
|
|
throw '项目不存在';
|
|
throw '项目不存在';
|
|
|
}
|
|
}
|
|
@@ -488,7 +498,7 @@ ProjectsDAO.prototype.rename = async function (userId, compilationId, data, call
|
|
|
|
|
|
|
|
ProjectsDAO.prototype.beforeOpenProject = function (userId, projectId, updateData, callback) {
|
|
ProjectsDAO.prototype.beforeOpenProject = function (userId, projectId, updateData, callback) {
|
|
|
updateData['recentDateTime'] = new Date();
|
|
updateData['recentDateTime'] = new Date();
|
|
|
- Projects.update({userID: userId, ID: projectId}, updateData, function (err) {
|
|
|
|
|
|
|
+ Projects.update({ userID: userId, ID: projectId }, updateData, function (err) {
|
|
|
if (err) {
|
|
if (err) {
|
|
|
callback(1, '项目不存在.');
|
|
callback(1, '项目不存在.');
|
|
|
} else {
|
|
} else {
|
|
@@ -502,7 +512,7 @@ ProjectsDAO.prototype.getNewProjectID = function (count, callback) {
|
|
|
console.log(result);
|
|
console.log(result);
|
|
|
let highID = result.sequence_value;
|
|
let highID = result.sequence_value;
|
|
|
if (!err) {
|
|
if (!err) {
|
|
|
- callback(0, '', {lowID: highID - count + 1, highID: highID});
|
|
|
|
|
|
|
+ callback(0, '', { lowID: highID - count + 1, highID: highID });
|
|
|
} else {
|
|
} else {
|
|
|
callback(1, '获取主键失败', null);
|
|
callback(1, '获取主键失败', null);
|
|
|
}
|
|
}
|
|
@@ -511,7 +521,7 @@ ProjectsDAO.prototype.getNewProjectID = function (count, callback) {
|
|
|
|
|
|
|
|
ProjectsDAO.prototype.getProject = function (key, callback) {
|
|
ProjectsDAO.prototype.getProject = function (key, callback) {
|
|
|
if (callback) {
|
|
if (callback) {
|
|
|
- Projects.findOne({'_id': key}, function (err, result) {
|
|
|
|
|
|
|
+ Projects.findOne({ '_id': key }, function (err, result) {
|
|
|
if (err) {
|
|
if (err) {
|
|
|
callback(1, '查找标段失败');
|
|
callback(1, '查找标段失败');
|
|
|
} else {
|
|
} else {
|
|
@@ -519,12 +529,12 @@ ProjectsDAO.prototype.getProject = function (key, callback) {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
- return Projects.findOne({$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], 'ID': key}).exec();
|
|
|
|
|
|
|
+ return Projects.findOne({ $or: [{ deleteInfo: null }, { 'deleteInfo.deleted': false }], 'ID': key }).exec();
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
ProjectsDAO.prototype.getProjectsByIds = async function (userId, compilationId, ids) {
|
|
ProjectsDAO.prototype.getProjectsByIds = async function (userId, compilationId, ids) {
|
|
|
- return await Projects.find({userID: userId, compilation: compilationId, ID: {$in: ids}}, '-_id -property');
|
|
|
|
|
|
|
+ return await Projects.find({ userID: userId, compilation: compilationId, ID: { $in: ids } }, '-_id -property');
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
ProjectsDAO.prototype.getGCFiles = async function (fileType, userID) {
|
|
ProjectsDAO.prototype.getGCFiles = async function (fileType, userID) {
|
|
@@ -546,13 +556,13 @@ ProjectsDAO.prototype.getGCFiles = async function (fileType, userID) {
|
|
|
}
|
|
}
|
|
|
if (!isExist) throw '不存在此项目类型!';
|
|
if (!isExist) throw '不存在此项目类型!';
|
|
|
rst = await Projects.find(
|
|
rst = await Projects.find(
|
|
|
- {userID: userID, projType: fileType, 'deleteInfo.deleted': true, '$or': [{'deleteInfo.completeDeleted': false}, {'deleteInfo.completeDeleted': null}]});
|
|
|
|
|
|
|
+ { userID: userID, projType: fileType, 'deleteInfo.deleted': true, '$or': [{ 'deleteInfo.completeDeleted': false }, { 'deleteInfo.completeDeleted': null }] });
|
|
|
}
|
|
}
|
|
|
return rst;
|
|
return rst;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
ProjectsDAO.prototype.getFirstNodeID = async function (userID, compilationId, pid) {
|
|
ProjectsDAO.prototype.getFirstNodeID = async function (userID, compilationId, pid) {
|
|
|
- let nodes = await Projects.find({userID: userID, compilation: compilationId, ParentID: pid, deleteInfo: null});
|
|
|
|
|
|
|
+ let nodes = await Projects.find({ userID: userID, compilation: compilationId, ParentID: pid, deleteInfo: null });
|
|
|
if (nodes.length === 0) {
|
|
if (nodes.length === 0) {
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
@@ -596,10 +606,10 @@ ProjectsDAO.prototype.recGC = async function (userID, compilationId, datas, call
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
if (datas[i].updateType === projectType.project && datas[i].updateData.NextSiblingID === undefined) {//则为待查询NextSiblingID,前端无法查询
|
|
if (datas[i].updateType === projectType.project && datas[i].updateData.NextSiblingID === undefined) {//则为待查询NextSiblingID,前端无法查询
|
|
|
- let projData = await Projects.find({userID: userID, ID: datas[i].findData.ID});//建设项目原本可能属于某文件夹、文件夹的存在需要判断
|
|
|
|
|
|
|
+ let projData = await Projects.find({ userID: userID, ID: datas[i].findData.ID });//建设项目原本可能属于某文件夹、文件夹的存在需要判断
|
|
|
let projPid = projData[0].ParentID;
|
|
let projPid = projData[0].ParentID;
|
|
|
if (projPid !== -1) {
|
|
if (projPid !== -1) {
|
|
|
- let projFolder = await Projects.find({userID: userID, ID: projPid});
|
|
|
|
|
|
|
+ let projFolder = await Projects.find({ userID: userID, ID: projPid });
|
|
|
if (projFolder.length === 0) {//文件夹已不存在
|
|
if (projFolder.length === 0) {//文件夹已不存在
|
|
|
projPid = -1;
|
|
projPid = -1;
|
|
|
datas[i].updateData.ParentID = -1;
|
|
datas[i].updateData.ParentID = -1;
|
|
@@ -613,43 +623,43 @@ ProjectsDAO.prototype.recGC = async function (userID, compilationId, datas, call
|
|
|
}
|
|
}
|
|
|
for (let i = 0, len = updateDatas.length; i < len; i++) {
|
|
for (let i = 0, len = updateDatas.length; i < len; i++) {
|
|
|
functions.push((function (data) {
|
|
functions.push((function (data) {
|
|
|
- return function (cb) {
|
|
|
|
|
- if (data.updateType === fileType.unitPriceFile) {
|
|
|
|
|
- UnitPriceFiles.update({id: parseInt(data.findData.id)}, data.updateData, function (err) {
|
|
|
|
|
- if (err) cb(err);
|
|
|
|
|
- else {
|
|
|
|
|
- Projects.update({
|
|
|
|
|
- userID: userID,
|
|
|
|
|
- 'property.unitPriceFile.id': data.findData.id
|
|
|
|
|
- }, {$set: {'property.unitPriceFile.name': data.updateData.name}}, function (err) {
|
|
|
|
|
- if (err) cb(err);
|
|
|
|
|
- else cb(false);
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- } else if (data.updateType === fileType.feeRateFile) {
|
|
|
|
|
- FeeRateFiles.update(data.findData, data.updateData, function (err) {
|
|
|
|
|
- if (err) cb(err);
|
|
|
|
|
- else {
|
|
|
|
|
- Projects.update({
|
|
|
|
|
- userID: userID,
|
|
|
|
|
- 'property.feeFile.id': data.findData.ID
|
|
|
|
|
- }, {$set: {'property.feeFile.name': data.updateData.name}}, function (err) {
|
|
|
|
|
- if (err) cb(err);
|
|
|
|
|
- else cb(false);
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- if (data) {
|
|
|
|
|
- Projects.update(data.findData, data.updateData, function (err) {
|
|
|
|
|
|
|
+ return function (cb) {
|
|
|
|
|
+ if (data.updateType === fileType.unitPriceFile) {
|
|
|
|
|
+ UnitPriceFiles.update({ id: parseInt(data.findData.id) }, data.updateData, function (err) {
|
|
|
|
|
+ if (err) cb(err);
|
|
|
|
|
+ else {
|
|
|
|
|
+ Projects.update({
|
|
|
|
|
+ userID: userID,
|
|
|
|
|
+ 'property.unitPriceFile.id': data.findData.id
|
|
|
|
|
+ }, { $set: { 'property.unitPriceFile.name': data.updateData.name } }, function (err) {
|
|
|
|
|
+ if (err) cb(err);
|
|
|
|
|
+ else cb(false);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ } else if (data.updateType === fileType.feeRateFile) {
|
|
|
|
|
+ FeeRateFiles.update(data.findData, data.updateData, function (err) {
|
|
|
|
|
+ if (err) cb(err);
|
|
|
|
|
+ else {
|
|
|
|
|
+ Projects.update({
|
|
|
|
|
+ userID: userID,
|
|
|
|
|
+ 'property.feeFile.id': data.findData.ID
|
|
|
|
|
+ }, { $set: { 'property.feeFile.name': data.updateData.name } }, function (err) {
|
|
|
if (err) cb(err);
|
|
if (err) cb(err);
|
|
|
else cb(false);
|
|
else cb(false);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (data) {
|
|
|
|
|
+ Projects.update(data.findData, data.updateData, function (err) {
|
|
|
|
|
+ if (err) cb(err);
|
|
|
|
|
+ else cb(false);
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- })(updateDatas[i]));
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ })(updateDatas[i]));
|
|
|
}
|
|
}
|
|
|
async_c.parallel(functions, function (err, results) {
|
|
async_c.parallel(functions, function (err, results) {
|
|
|
if (err) callback(err, 'fail', null);
|
|
if (err) callback(err, 'fail', null);
|
|
@@ -673,7 +683,7 @@ ProjectsDAO.prototype.isExist = async function (userId, compilationId, name, par
|
|
|
compilation: compilationId,
|
|
compilation: compilationId,
|
|
|
ParentID: parentID,
|
|
ParentID: parentID,
|
|
|
name: name,
|
|
name: name,
|
|
|
- "$or": [{deleteInfo: null}, {"deleteInfo.deleted": false}]
|
|
|
|
|
|
|
+ "$or": [{ deleteInfo: null }, { "deleteInfo.deleted": false }]
|
|
|
};
|
|
};
|
|
|
let count = await Projects.count(condition);
|
|
let count = await Projects.count(condition);
|
|
|
return count > 0;
|
|
return count > 0;
|
|
@@ -688,7 +698,7 @@ ProjectsDAO.prototype.isExist = async function (userId, compilationId, name, par
|
|
|
ProjectsDAO.prototype.getTenderByProjectId = async function (projectId) {
|
|
ProjectsDAO.prototype.getTenderByProjectId = async function (projectId) {
|
|
|
let result = [];
|
|
let result = [];
|
|
|
// 首先获取对应的单位工程id
|
|
// 首先获取对应的单位工程id
|
|
|
- let engineeringData = await Projects.find({ParentID: projectId});
|
|
|
|
|
|
|
+ let engineeringData = await Projects.find({ ParentID: projectId });
|
|
|
if (engineeringData.length <= 0) {
|
|
if (engineeringData.length <= 0) {
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
@@ -699,7 +709,7 @@ ProjectsDAO.prototype.getTenderByProjectId = async function (projectId) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 查找对应的单位工程id
|
|
// 查找对应的单位工程id
|
|
|
- let tenderData = await Projects.find({ParentID: {$in: engineeringIdList},deleteInfo: null});
|
|
|
|
|
|
|
+ let tenderData = await Projects.find({ ParentID: { $in: engineeringIdList }, deleteInfo: null });
|
|
|
if (tenderData.length <= 0) {
|
|
if (tenderData.length <= 0) {
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
@@ -726,8 +736,8 @@ ProjectsDAO.prototype.getTenderByUnitPriceFileId = async function (unitPriceFile
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//let condition = {projType: 'Tender', "property.unitPriceFile.id": unitPriceFileId};
|
|
//let condition = {projType: 'Tender', "property.unitPriceFile.id": unitPriceFileId};
|
|
|
- let condition = {"property.unitPriceFile.id": unitPriceFileId,deleteInfo:null};
|
|
|
|
|
- result = await Projects.find(condition,['ID','name','property']);
|
|
|
|
|
|
|
+ let condition = { "property.unitPriceFile.id": unitPriceFileId, deleteInfo: null };
|
|
|
|
|
+ result = await Projects.find(condition, ['ID', 'name', 'property']);
|
|
|
|
|
|
|
|
return result;
|
|
return result;
|
|
|
};
|
|
};
|
|
@@ -740,7 +750,7 @@ ProjectsDAO.prototype.getTenderByUnitPriceFileId = async function (unitPriceFile
|
|
|
*/
|
|
*/
|
|
|
ProjectsDAO.prototype.getProjectProperty = async function (projectId) {
|
|
ProjectsDAO.prototype.getProjectProperty = async function (projectId) {
|
|
|
let result = null;
|
|
let result = null;
|
|
|
- let projectData = await Projects.findOne({ID: projectId},['property']);
|
|
|
|
|
|
|
+ let projectData = await Projects.findOne({ ID: projectId }, ['property']);
|
|
|
if (projectData === null) {
|
|
if (projectData === null) {
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
@@ -753,13 +763,13 @@ ProjectsDAO.prototype.getProjectProperty = async function (projectId) {
|
|
|
* @paraconsolem {Number} userId
|
|
* @paraconsolem {Number} userId
|
|
|
* @return {Promise}
|
|
* @return {Promise}
|
|
|
*/
|
|
*/
|
|
|
-ProjectsDAO.prototype.getUserProjectData = async function (userId,compilation) {
|
|
|
|
|
|
|
+ProjectsDAO.prototype.getUserProjectData = async function (userId, compilation) {
|
|
|
let projectList = await Projects.find({
|
|
let projectList = await Projects.find({
|
|
|
'$or': [
|
|
'$or': [
|
|
|
- {'userID': userId, 'compilation': compilation, 'deleteInfo': null, projType: 'Project'},
|
|
|
|
|
- {'userID': userId, 'compilation': compilation,'deleteInfo.deleted': {'$in': [null, false]}, projType: 'Project'}
|
|
|
|
|
|
|
+ { 'userID': userId, 'compilation': compilation, 'deleteInfo': null, projType: 'Project' },
|
|
|
|
|
+ { 'userID': userId, 'compilation': compilation, 'deleteInfo.deleted': { '$in': [null, false] }, projType: 'Project' }
|
|
|
]
|
|
]
|
|
|
- }, {_id: 0, name: 1, ID: 1, NextSiblingID: 1, ParentID: 1});
|
|
|
|
|
|
|
+ }, { _id: 0, name: 1, ID: 1, NextSiblingID: 1, ParentID: 1 });
|
|
|
|
|
|
|
|
return projectList;
|
|
return projectList;
|
|
|
};
|
|
};
|
|
@@ -776,7 +786,7 @@ ProjectsDAO.prototype.changeUnitPriceFileInfo = async function (projectId, chang
|
|
|
if (isNaN(projectId) || projectId <= 0) {
|
|
if (isNaN(projectId) || projectId <= 0) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- let result = await Projects.update({ID: projectId}, {"property.unitPriceFile": changeInfo});
|
|
|
|
|
|
|
+ let result = await Projects.update({ ID: projectId }, { "property.unitPriceFile": changeInfo });
|
|
|
|
|
|
|
|
return result.ok === 1;
|
|
return result.ok === 1;
|
|
|
};
|
|
};
|
|
@@ -789,30 +799,30 @@ ProjectsDAO.prototype.changeUnitPriceFileInfo = async function (projectId, chang
|
|
|
* @param {Object} propertyData - 项目属性数据
|
|
* @param {Object} propertyData - 项目属性数据
|
|
|
* @return {Promise}
|
|
* @return {Promise}
|
|
|
*/
|
|
*/
|
|
|
-ProjectsDAO.prototype.updateProjectProperty = async function(projectId, propertyData) {
|
|
|
|
|
|
|
+ProjectsDAO.prototype.updateProjectProperty = async function (projectId, propertyData) {
|
|
|
projectId = parseInt(projectId);
|
|
projectId = parseInt(projectId);
|
|
|
if (isNaN(projectId) || projectId <= 0 || propertyData.property === undefined || propertyData.data === undefined) {
|
|
if (isNaN(projectId) || projectId <= 0 || propertyData.property === undefined || propertyData.data === undefined) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
const updateData = {};
|
|
const updateData = {};
|
|
|
updateData["property." + propertyData.property] = propertyData.data;
|
|
updateData["property." + propertyData.property] = propertyData.data;
|
|
|
- let result = await Projects.update({ID: projectId}, updateData);
|
|
|
|
|
|
|
+ let result = await Projects.update({ ID: projectId }, updateData);
|
|
|
|
|
|
|
|
return result.ok === 1;
|
|
return result.ok === 1;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// CSL, 2018-01-11 获取指定ID节点(如单项工程、建设项目)下所有单位工程的各项汇总金额,用于报表计算汇总。
|
|
// CSL, 2018-01-11 获取指定ID节点(如单项工程、建设项目)下所有单位工程的各项汇总金额,用于报表计算汇总。
|
|
|
ProjectsDAO.prototype.getSummaryFees = async function (ID) {
|
|
ProjectsDAO.prototype.getSummaryFees = async function (ID) {
|
|
|
- async function getProject(ID){
|
|
|
|
|
- return await Projects.findOne({'ID': ID, deleteInfo: null}, need);
|
|
|
|
|
|
|
+ async function getProject(ID) {
|
|
|
|
|
+ return await Projects.findOne({ 'ID': ID, deleteInfo: null }, need);
|
|
|
};
|
|
};
|
|
|
- async function getChildrenDocs(IDs){
|
|
|
|
|
- return await Projects.find({'ParentID': {"$in":IDs}, deleteInfo: null}, need);
|
|
|
|
|
|
|
+ async function getChildrenDocs(IDs) {
|
|
|
|
|
+ return await Projects.find({ 'ParentID': { "$in": IDs }, deleteInfo: null }, need);
|
|
|
};
|
|
};
|
|
|
- async function getEgrIDs(ID){
|
|
|
|
|
- let _docs = await Projects.find({'ParentID': ID, deleteInfo: null}, ['ID', '-_id']);
|
|
|
|
|
|
|
+ async function getEgrIDs(ID) {
|
|
|
|
|
+ let _docs = await Projects.find({ 'ParentID': ID, deleteInfo: null }, ['ID', '-_id']);
|
|
|
let arr = [];
|
|
let arr = [];
|
|
|
- for (let doc of _docs){
|
|
|
|
|
|
|
+ for (let doc of _docs) {
|
|
|
arr.push(doc.ID);
|
|
arr.push(doc.ID);
|
|
|
};
|
|
};
|
|
|
return arr;
|
|
return arr;
|
|
@@ -823,26 +833,26 @@ ProjectsDAO.prototype.getSummaryFees = async function (ID) {
|
|
|
let _doc = await getProject(ID);
|
|
let _doc = await getProject(ID);
|
|
|
if (!_doc) return _doc;
|
|
if (!_doc) return _doc;
|
|
|
|
|
|
|
|
- if (_doc.projType.sameText('Engineering')){
|
|
|
|
|
|
|
+ if (_doc.projType.sameText('Engineering')) {
|
|
|
return await getChildrenDocs([ID]);
|
|
return await getChildrenDocs([ID]);
|
|
|
}
|
|
}
|
|
|
- else if (_doc.projType.sameText('Project')){
|
|
|
|
|
|
|
+ else if (_doc.projType.sameText('Project')) {
|
|
|
let eIDs = await getEgrIDs(ID);
|
|
let eIDs = await getEgrIDs(ID);
|
|
|
return await getChildrenDocs(eIDs);
|
|
return await getChildrenDocs(eIDs);
|
|
|
}
|
|
}
|
|
|
- else{
|
|
|
|
|
|
|
+ else {
|
|
|
return _doc;
|
|
return _doc;
|
|
|
};
|
|
};
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-ProjectsDAO.prototype.updateUnitFileToProject=async function(projectID,unitFile){
|
|
|
|
|
- return await Projects.findOneAndUpdate({'ID':projectID},{'property.unitPriceFile':unitFile});
|
|
|
|
|
|
|
+ProjectsDAO.prototype.updateUnitFileToProject = async function (projectID, unitFile) {
|
|
|
|
|
+ return await Projects.findOneAndUpdate({ 'ID': projectID }, { 'property.unitPriceFile': unitFile });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
ProjectsDAO.prototype.getBasicInfo = async function (projectID) {
|
|
ProjectsDAO.prototype.getBasicInfo = async function (projectID) {
|
|
|
//获取建设项目
|
|
//获取建设项目
|
|
|
let constructionProject = await pmFacade.getConstructionProject(projectID);
|
|
let constructionProject = await pmFacade.getConstructionProject(projectID);
|
|
|
- if(!constructionProject || !constructionProject.property || !constructionProject.property.basicInformation){
|
|
|
|
|
|
|
+ if (!constructionProject || !constructionProject.property || !constructionProject.property.basicInformation) {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
return constructionProject.property.basicInformation;
|
|
return constructionProject.property.basicInformation;
|
|
@@ -851,14 +861,14 @@ ProjectsDAO.prototype.getBasicInfo = async function (projectID) {
|
|
|
//恢复默认系统设置
|
|
//恢复默认系统设置
|
|
|
ProjectsDAO.prototype.defaultSettings = async function (userID, compilation, projectID) {
|
|
ProjectsDAO.prototype.defaultSettings = async function (userID, compilation, projectID) {
|
|
|
const compilationId = compilation._id;
|
|
const compilationId = compilation._id;
|
|
|
- let project = await Projects.findOne({ID: projectID});
|
|
|
|
|
- if(!project){
|
|
|
|
|
|
|
+ let project = await Projects.findOne({ ID: projectID });
|
|
|
|
|
+ if (!project) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
let cloneProperty = _.cloneDeep(project.property);
|
|
let cloneProperty = _.cloneDeep(project.property);
|
|
|
let overWrite;
|
|
let overWrite;
|
|
|
- if(compilation.overWriteUrl && compilation.overWriteUrl!=""){
|
|
|
|
|
- overWrite = require("../../.."+compilation.overWriteUrl);
|
|
|
|
|
|
|
+ if (compilation.overWriteUrl && compilation.overWriteUrl != "") {
|
|
|
|
|
+ overWrite = require("../../.." + compilation.overWriteUrl);
|
|
|
}
|
|
}
|
|
|
//关于计算
|
|
//关于计算
|
|
|
let defaultCalcMode = overWrite && overWrite.defaultCalcMode || ((project.property.valuationType !== ValuationType.BOQ) ? 2 : 1);
|
|
let defaultCalcMode = overWrite && overWrite.defaultCalcMode || ((project.property.valuationType !== ValuationType.BOQ) ? 2 : 1);
|
|
@@ -872,12 +882,12 @@ ProjectsDAO.prototype.defaultSettings = async function (userID, compilation, pro
|
|
|
//呈现选项
|
|
//呈现选项
|
|
|
cloneProperty.displaySetting = displaySetting;
|
|
cloneProperty.displaySetting = displaySetting;
|
|
|
//列设置
|
|
//列设置
|
|
|
- let stdColLib = await mainColLibModel.findOne({ID: project.property.colLibID});
|
|
|
|
|
- if(stdColLib){
|
|
|
|
|
- await projSettingModel.update({projectID: projectID}, {$set: {main_tree_col: stdColLib.main_tree_col}});
|
|
|
|
|
|
|
+ let stdColLib = await mainColLibModel.findOne({ ID: project.property.colLibID });
|
|
|
|
|
+ if (stdColLib) {
|
|
|
|
|
+ await projSettingModel.update({ projectID: projectID }, { $set: { main_tree_col: stdColLib.main_tree_col } });
|
|
|
}
|
|
}
|
|
|
//系统选项
|
|
//系统选项
|
|
|
- await optionModel.update({user_id: userID, compilation_id: compilationId}, {$set: {options: optionSetting}});
|
|
|
|
|
- await Projects.update({ID: projectID}, {$set: {property: cloneProperty}});
|
|
|
|
|
|
|
+ await optionModel.update({ user_id: userID, compilation_id: compilationId }, { $set: { options: optionSetting } });
|
|
|
|
|
+ await Projects.update({ ID: projectID }, { $set: { property: cloneProperty } });
|
|
|
return true;
|
|
return true;
|
|
|
};
|
|
};
|