|
|
@@ -335,83 +335,97 @@ module.exports = {
|
|
|
if (sessionCompilation === undefined || sessionCompilation === null) {
|
|
|
return response.redirect('/logout');
|
|
|
}
|
|
|
- let compilationModel = new CompilationModel();
|
|
|
- //更新编办信息
|
|
|
- let compilationData = await compilationModel.getCompilationById(sessionCompilation._id);
|
|
|
- request.session.sessionCompilation = compilationData;
|
|
|
- sessionCompilation = request.session.sessionCompilation;
|
|
|
- //更新用户的使用过的费用定额列表
|
|
|
- let isFirst = await pm_facade.isFirst(request.session.sessionUser.id, compilationData._id.toString());
|
|
|
-
|
|
|
- let engineeringLibModel = new EngineeringLibModel();
|
|
|
-
|
|
|
- // 建议估算
|
|
|
- let suggestionValuation = sessionCompilation.suggestion_valuation !== undefined ?
|
|
|
- sessionCompilation.suggestion_valuation : [];
|
|
|
- suggestionValuation = await engineeringLibModel.getLib(suggestionValuation);
|
|
|
-
|
|
|
- // 可行性估算
|
|
|
- let feasibilityValuation = sessionCompilation.feasibility_valuation !== undefined ?
|
|
|
- sessionCompilation.feasibility_valuation : [];
|
|
|
- feasibilityValuation = await engineeringLibModel.getLib(feasibilityValuation);
|
|
|
-
|
|
|
- // 估算
|
|
|
- let estimationValuation = sessionCompilation.estimation_valuation !== undefined ?
|
|
|
- sessionCompilation.estimation_valuation : [];
|
|
|
- estimationValuation = await engineeringLibModel.getLib(estimationValuation);
|
|
|
-
|
|
|
- // 概算
|
|
|
- let roughValuation = sessionCompilation.rough_valuation !== undefined ?
|
|
|
- sessionCompilation.rough_valuation : [];
|
|
|
- roughValuation = await engineeringLibModel.getLib(roughValuation);
|
|
|
-
|
|
|
- // 清单计价
|
|
|
- let billValuation = sessionCompilation.bill_valuation !== undefined ?
|
|
|
- sessionCompilation.bill_valuation : [];
|
|
|
- billValuation = await engineeringLibModel.getLib(billValuation);
|
|
|
-
|
|
|
- // 定额计价
|
|
|
- let rationValuation = sessionCompilation.ration_valuation !== undefined ?
|
|
|
- sessionCompilation.ration_valuation : [];
|
|
|
- rationValuation = await engineeringLibModel.getLib(rationValuation);
|
|
|
-
|
|
|
- if (sessionCompilation.name === '四川养护(2013)' || sessionCompilation.name === '部颁2018计价标准') {
|
|
|
- billValuation = rationValuation;
|
|
|
- }
|
|
|
-
|
|
|
- let absoluteUrl = compilationData.overWriteUrl ? request.app.locals.rootDir + compilationData.overWriteUrl : request.app.locals.rootDir;
|
|
|
- let overWriteUrl = fs.existsSync(absoluteUrl) && fs.statSync(absoluteUrl).isFile() ? compilationData.overWriteUrl : null;
|
|
|
- //欢迎页显示控制
|
|
|
- let [isShow,context,showTime] = await pm_facade.getWelcomeInfo(sessionCompilation._id,request.session.sessionUser,request.session.compilationVersion.includes('学习'));
|
|
|
- const unreadShareList = await pm_facade.getUnreadShareListByCompilation(request.session.sessionUser.id, sessionCompilation._id);
|
|
|
const isFree = userModelObj.isFreeFromSession(request.session.compilationVersion);
|
|
|
- let renderData = {
|
|
|
- unreadShareList: JSON.stringify(unreadShareList),
|
|
|
- isFirst: isFirst,
|
|
|
- isShow:isShow,
|
|
|
- context:context,
|
|
|
- showTime:showTime,
|
|
|
- userAccount: request.session.userAccount,
|
|
|
- userID: request.session.sessionUser.id,
|
|
|
- isFree,
|
|
|
- compilationData: JSON.stringify(sessionCompilation),
|
|
|
- overWriteUrl: overWriteUrl,
|
|
|
- suggestionValuation: JSON.stringify(suggestionValuation),
|
|
|
- feasibilityValuation: JSON.stringify(feasibilityValuation),
|
|
|
- estimationValuation: JSON.stringify(estimationValuation),
|
|
|
- roughValuation: JSON.stringify(roughValuation),
|
|
|
- billValuation: JSON.stringify(billValuation),
|
|
|
- rationValuation: JSON.stringify(rationValuation),
|
|
|
- engineeringList: JSON.stringify(engineering.List),
|
|
|
- adminLevelType: JSON.stringify(AdminLevelType),
|
|
|
- compilationName: sessionCompilation.name,
|
|
|
- versionName: request.session.compilationVersion,
|
|
|
- socketPort:config[process.env.NODE_ENV].socketPort?config[process.env.NODE_ENV].socketPort:5500,
|
|
|
- LicenseKey:config.getLicenseKey(process.env.NODE_ENV),
|
|
|
- title:getTitle(request.headers.host)
|
|
|
- };
|
|
|
+ if (false && isFree && config.prod_sc.title !== '纵横公路云造价') {
|
|
|
+ let renderData = {
|
|
|
+ userAccount: request.session.userAccount,
|
|
|
+ userID: request.session.sessionUser.id,
|
|
|
+ compilationName: sessionCompilation.name,
|
|
|
+ versionName: request.session.compilationVersion,
|
|
|
|
|
|
- response.render('building_saas/pm/html/project-management.html', renderData);
|
|
|
+ title:getTitle(request.headers.host)
|
|
|
+ };
|
|
|
+
|
|
|
+ response.render('building_saas/pm/html/blank-project.html', renderData);
|
|
|
+ } else {
|
|
|
+ let compilationModel = new CompilationModel();
|
|
|
+ //更新编办信息
|
|
|
+ let compilationData = await compilationModel.getCompilationById(sessionCompilation._id);
|
|
|
+ request.session.sessionCompilation = compilationData;
|
|
|
+ sessionCompilation = request.session.sessionCompilation;
|
|
|
+ //更新用户的使用过的费用定额列表
|
|
|
+ let isFirst = await pm_facade.isFirst(request.session.sessionUser.id, compilationData._id.toString());
|
|
|
+
|
|
|
+ let engineeringLibModel = new EngineeringLibModel();
|
|
|
+
|
|
|
+ // 建议估算
|
|
|
+ let suggestionValuation = sessionCompilation.suggestion_valuation !== undefined ?
|
|
|
+ sessionCompilation.suggestion_valuation : [];
|
|
|
+ suggestionValuation = await engineeringLibModel.getLib(suggestionValuation);
|
|
|
+
|
|
|
+ // 可行性估算
|
|
|
+ let feasibilityValuation = sessionCompilation.feasibility_valuation !== undefined ?
|
|
|
+ sessionCompilation.feasibility_valuation : [];
|
|
|
+ feasibilityValuation = await engineeringLibModel.getLib(feasibilityValuation);
|
|
|
+
|
|
|
+ // 估算
|
|
|
+ let estimationValuation = sessionCompilation.estimation_valuation !== undefined ?
|
|
|
+ sessionCompilation.estimation_valuation : [];
|
|
|
+ estimationValuation = await engineeringLibModel.getLib(estimationValuation);
|
|
|
+
|
|
|
+ // 概算
|
|
|
+ let roughValuation = sessionCompilation.rough_valuation !== undefined ?
|
|
|
+ sessionCompilation.rough_valuation : [];
|
|
|
+ roughValuation = await engineeringLibModel.getLib(roughValuation);
|
|
|
+
|
|
|
+ // 清单计价
|
|
|
+ let billValuation = sessionCompilation.bill_valuation !== undefined ?
|
|
|
+ sessionCompilation.bill_valuation : [];
|
|
|
+ billValuation = await engineeringLibModel.getLib(billValuation);
|
|
|
+
|
|
|
+ // 定额计价
|
|
|
+ let rationValuation = sessionCompilation.ration_valuation !== undefined ?
|
|
|
+ sessionCompilation.ration_valuation : [];
|
|
|
+ rationValuation = await engineeringLibModel.getLib(rationValuation);
|
|
|
+
|
|
|
+ if (sessionCompilation.name === '四川养护(2013)' || sessionCompilation.name === '部颁2018计价标准') {
|
|
|
+ billValuation = rationValuation;
|
|
|
+ }
|
|
|
+
|
|
|
+ let absoluteUrl = compilationData.overWriteUrl ? request.app.locals.rootDir + compilationData.overWriteUrl : request.app.locals.rootDir;
|
|
|
+ let overWriteUrl = fs.existsSync(absoluteUrl) && fs.statSync(absoluteUrl).isFile() ? compilationData.overWriteUrl : null;
|
|
|
+ //欢迎页显示控制
|
|
|
+ let [isShow,context,showTime] = await pm_facade.getWelcomeInfo(sessionCompilation._id,request.session.sessionUser,request.session.compilationVersion.includes('学习'));
|
|
|
+ const unreadShareList = await pm_facade.getUnreadShareListByCompilation(request.session.sessionUser.id, sessionCompilation._id);
|
|
|
+ let renderData = {
|
|
|
+ unreadShareList: JSON.stringify(unreadShareList),
|
|
|
+ isFirst: isFirst,
|
|
|
+ isShow:isShow,
|
|
|
+ context:context,
|
|
|
+ showTime:showTime,
|
|
|
+ userAccount: request.session.userAccount,
|
|
|
+ userID: request.session.sessionUser.id,
|
|
|
+ isFree,
|
|
|
+ compilationData: JSON.stringify(sessionCompilation),
|
|
|
+ overWriteUrl: overWriteUrl,
|
|
|
+ suggestionValuation: JSON.stringify(suggestionValuation),
|
|
|
+ feasibilityValuation: JSON.stringify(feasibilityValuation),
|
|
|
+ estimationValuation: JSON.stringify(estimationValuation),
|
|
|
+ roughValuation: JSON.stringify(roughValuation),
|
|
|
+ billValuation: JSON.stringify(billValuation),
|
|
|
+ rationValuation: JSON.stringify(rationValuation),
|
|
|
+ engineeringList: JSON.stringify(engineering.List),
|
|
|
+ adminLevelType: JSON.stringify(AdminLevelType),
|
|
|
+ compilationName: sessionCompilation.name,
|
|
|
+ versionName: request.session.compilationVersion,
|
|
|
+ socketPort:config[process.env.NODE_ENV].socketPort?config[process.env.NODE_ENV].socketPort:5500,
|
|
|
+ LicenseKey:config.getLicenseKey(process.env.NODE_ENV),
|
|
|
+ cloudTitle: config.prod_sc.title,
|
|
|
+ title:getTitle(request.headers.host)
|
|
|
+ };
|
|
|
+
|
|
|
+ response.render('building_saas/pm/html/project-management.html', renderData);
|
|
|
+ }
|
|
|
},
|
|
|
//第一次进入该费用定额时准备的初始数据
|
|
|
prepareInitialData: async function (request, response) {
|