|
@@ -11,10 +11,10 @@ import STDRationLibMapModel from "../../common/std/std_ration_lib_map_model";
|
|
|
import STDBillLibListsModel from "../../common/std/std_bills_lib_lists_model";
|
|
|
import STDGLJLibMapModel from "../../common/std/std_glj_lib_map_model";
|
|
|
import STDFeeRateLibsModel from "../../common/std/std_fee_rate_libs_model";
|
|
|
-import {default as EngineeringConst, List as EngineeringList} from "../../common/const/engineering";
|
|
|
+import { default as EngineeringConst, List as EngineeringList } from "../../common/const/engineering";
|
|
|
import BillsTemplateModel from "../models/bills_template_model";
|
|
|
-import {default as BillsFixedFlagConst, List as BillsFixedFlagList} from "../../common/const/bills_fixed.js";
|
|
|
-import {default as BillsTypeFlagConst, List as BillsTypeFlagList} from "../../common/const/bills_type.js";
|
|
|
+import { default as BillsFixedFlagConst, List as BillsFixedFlagList } from "../../common/const/bills_fixed.js";
|
|
|
+import { default as BillsTypeFlagConst, List as BillsTypeFlagList } from "../../common/const/bills_type.js";
|
|
|
import EngineeringLibModel from "../models/engineering_lib_model";
|
|
|
import STDLabourCoesModel from "../../common/std/std_labour_coes_model";
|
|
|
import STDCalcProgramModel from "../../common/std/std_calc_program_model";
|
|
@@ -30,8 +30,8 @@ import quantityFacade from "../../main_quantity_lib/facade/quantity_facade";
|
|
|
import economicFacade from "../../economic_lib/facade/economic_facade";
|
|
|
import overHeightFacade from "../../over_height_lib/facade/over_height_facade";
|
|
|
import progressiveFacade from "../../progressive_interval_lib/facade/progressive_facade";
|
|
|
-import {default as category, List as categoryList} from "../../common/const/category_const.js";
|
|
|
-import locationList from "../../common/const/locationList";
|
|
|
+import { default as category, List as categoryList } from "../../common/const/category_const.js";
|
|
|
+import locationList from "../../common/const/locationList";
|
|
|
|
|
|
let config = require("../../../config/config.js");
|
|
|
const fs = require('fs');
|
|
@@ -78,10 +78,10 @@ class CompilationController extends BaseController {
|
|
|
id: id,
|
|
|
compilationList: compilationList,
|
|
|
categoryList: categoryList,
|
|
|
- locationList:locationList,
|
|
|
+ locationList: locationList,
|
|
|
selectedCompilation: selectedCompilation,
|
|
|
layout: 'users/views/layout/layout',
|
|
|
- LicenseKey:config.getLicenseKey(process.env.NODE_ENV)
|
|
|
+ LicenseKey: config.getLicenseKey(process.env.NODE_ENV)
|
|
|
};
|
|
|
|
|
|
response.render('users/views/compilation/index', renderData);
|
|
@@ -159,7 +159,7 @@ class CompilationController extends BaseController {
|
|
|
// 获取计价规则中对应的标准库数据
|
|
|
let engineeringLibModel = new EngineeringLibModel();
|
|
|
engineeringList = await engineeringLibModel.getLibsByValuationID(valuationId);
|
|
|
- engineeringList = _.sortBy(engineeringList,['seq'])
|
|
|
+ engineeringList = _.sortBy(engineeringList, ['seq'])
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
|
}
|
|
@@ -173,7 +173,7 @@ class CompilationController extends BaseController {
|
|
|
valuationId: valuationId,
|
|
|
section: section,
|
|
|
layout: 'users/views/layout/layout',
|
|
|
- LicenseKey:config.getLicenseKey(process.env.NODE_ENV)
|
|
|
+ LicenseKey: config.getLicenseKey(process.env.NODE_ENV)
|
|
|
};
|
|
|
response.render('users/views/compilation/add', renderData);
|
|
|
}
|
|
@@ -200,13 +200,13 @@ class CompilationController extends BaseController {
|
|
|
billsTemplateData = [],
|
|
|
featureList = [],
|
|
|
infoList = [],
|
|
|
- engineerInfoList=[],
|
|
|
+ engineerInfoList = [],
|
|
|
progressiveList = [],
|
|
|
- engineerFeatureList=[],
|
|
|
- materialList=[],
|
|
|
- mainQuantityList=[],
|
|
|
- economicList=[],
|
|
|
- overHeightList=[];
|
|
|
+ engineerFeatureList = [],
|
|
|
+ materialList = [],
|
|
|
+ mainQuantityList = [],
|
|
|
+ economicList = [],
|
|
|
+ overHeightList = [];
|
|
|
let valuationData = {}, valuationList = {}, artificialCoefficientList = [], calculationList = [], billsGuidanceList = [], mainTreeColList = [];
|
|
|
let billTemplateList = [];
|
|
|
try {
|
|
@@ -241,7 +241,7 @@ class CompilationController extends BaseController {
|
|
|
//获取列设置库
|
|
|
mainTreeColList = await mainColFacade.getColLibsByCompilationID(selectedCompilation._id);
|
|
|
|
|
|
- //获取清单模板库
|
|
|
+ //获取清单模板库
|
|
|
billTemplateList = await billTemplateFacade.getTemplateLibByCompilationID(selectedCompilation._id);
|
|
|
|
|
|
// 获取对应的计价规则数据
|
|
@@ -252,40 +252,40 @@ class CompilationController extends BaseController {
|
|
|
|
|
|
// 获取对应专业工程下的标准库数据
|
|
|
let engineeringLibModel = new EngineeringLibModel();
|
|
|
- libData = await engineeringLibModel.findDataByCondition({_id:engineerID});
|
|
|
+ libData = await engineeringLibModel.findDataByCondition({ _id: engineerID });
|
|
|
|
|
|
// 获取清单模板数据
|
|
|
let billsTemplateModel = new BillsTemplateModel();
|
|
|
billsTemplateData = await billsTemplateModel.getTemplateData(valuationId, libData.engineering);
|
|
|
|
|
|
//获取清单指引数据
|
|
|
- billsGuidanceList = await billsGuidanceFc.getBillsGuideLibs({compilationId: selectedCompilation._id, $or: [{deleted: null}, {deleted: false}]});
|
|
|
+ billsGuidanceList = await billsGuidanceFc.getBillsGuideLibs({ compilationId: selectedCompilation._id, $or: [{ deleted: null }, { deleted: false }] });
|
|
|
|
|
|
//获取工程特征库
|
|
|
- featureList = await projectFeatureFacade.findByCondition({compilationId: selectedCompilation._id},null,false);
|
|
|
+ featureList = await projectFeatureFacade.findByCondition({ compilationId: selectedCompilation._id }, null, false);
|
|
|
|
|
|
//获取基本信息库
|
|
|
- infoList = await basicInfoFacade.findByCondition({},null,false);
|
|
|
+ infoList = await basicInfoFacade.findByCondition({}, null, false);
|
|
|
|
|
|
- engineerInfoList = await engineerInfoFacade.findByCondition({},null,false);
|
|
|
+ engineerInfoList = await engineerInfoFacade.findByCondition({}, null, false);
|
|
|
|
|
|
//获取累进区间库
|
|
|
- progressiveList = await progressiveFacade.findByCondition({},null,false);
|
|
|
+ progressiveList = await progressiveFacade.findByCondition({}, null, false);
|
|
|
|
|
|
//工程特征指标库
|
|
|
- engineerFeatureList = await engineerFeatureFacade.findByCondition({},null,false);
|
|
|
+ engineerFeatureList = await engineerFeatureFacade.findByCondition({}, null, false);
|
|
|
|
|
|
//主要工料指标
|
|
|
- materialList = await materialFacade.findByCondition({},null,false);
|
|
|
+ materialList = await materialFacade.findByCondition({}, null, false);
|
|
|
|
|
|
//主要工程量指标
|
|
|
- mainQuantityList = await quantityFacade.findByCondition({},null,false);
|
|
|
+ mainQuantityList = await quantityFacade.findByCondition({}, null, false);
|
|
|
|
|
|
//主要工程量指标
|
|
|
- economicList = await economicFacade.findByCondition({},null,false);
|
|
|
+ economicList = await economicFacade.findByCondition({}, null, false);
|
|
|
|
|
|
//超高降效
|
|
|
- overHeightList = await overHeightFacade.findByCondition({},null,false);
|
|
|
+ overHeightList = await overHeightFacade.findByCondition({}, null, false);
|
|
|
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
@@ -306,22 +306,22 @@ class CompilationController extends BaseController {
|
|
|
artificialCoefficientList: JSON.stringify(artificialCoefficientList),
|
|
|
feeRateList: JSON.stringify(feeRateList),
|
|
|
billsTemplateData: JSON.stringify(billsTemplateData),
|
|
|
- billTemplateList:JSON.stringify(billTemplateList),
|
|
|
+ billTemplateList: JSON.stringify(billTemplateList),
|
|
|
mainTreeColList: JSON.stringify(mainTreeColList),
|
|
|
- gljCol:JSON.stringify(libData.glj_col),
|
|
|
+ gljCol: JSON.stringify(libData.glj_col),
|
|
|
calculationList: JSON.stringify(calculationList),
|
|
|
billsGuidanceList: JSON.stringify(billsGuidanceList),
|
|
|
- featureList:JSON.stringify(featureList),
|
|
|
+ featureList: JSON.stringify(featureList),
|
|
|
infoList: JSON.stringify(infoList),
|
|
|
- engineerInfoList:JSON.stringify(engineerInfoList),
|
|
|
- progressiveList:JSON.stringify(progressiveList),
|
|
|
- engineerFeatureList:JSON.stringify(engineerFeatureList),
|
|
|
- materialList:JSON.stringify(materialList),
|
|
|
- mainQuantityList:JSON.stringify(mainQuantityList),
|
|
|
- economicList:JSON.stringify(economicList),
|
|
|
- overHeightList:JSON.stringify(overHeightList),
|
|
|
+ engineerInfoList: JSON.stringify(engineerInfoList),
|
|
|
+ progressiveList: JSON.stringify(progressiveList),
|
|
|
+ engineerFeatureList: JSON.stringify(engineerFeatureList),
|
|
|
+ materialList: JSON.stringify(materialList),
|
|
|
+ mainQuantityList: JSON.stringify(mainQuantityList),
|
|
|
+ economicList: JSON.stringify(economicList),
|
|
|
+ overHeightList: JSON.stringify(overHeightList),
|
|
|
layout: 'users/views/layout/layout',
|
|
|
- LicenseKey:config.getLicenseKey(process.env.NODE_ENV)
|
|
|
+ LicenseKey: config.getLicenseKey(process.env.NODE_ENV)
|
|
|
};
|
|
|
response.render('users/views/compilation/engineering', renderData);
|
|
|
}
|
|
@@ -362,22 +362,22 @@ class CompilationController extends BaseController {
|
|
|
* @param response
|
|
|
* @returns {Promise.<void>}
|
|
|
*/
|
|
|
- async deleteEngineer(request,response){
|
|
|
- let result={
|
|
|
- error:0
|
|
|
+ async deleteEngineer(request, response) {
|
|
|
+ let result = {
|
|
|
+ error: 0
|
|
|
};
|
|
|
try {
|
|
|
let data = request.body.data;
|
|
|
data = JSON.parse(data);
|
|
|
- if(data.id ){
|
|
|
+ if (data.id) {
|
|
|
let engineeringLibModel = new EngineeringLibModel();
|
|
|
- result.data = await engineeringLibModel.deleteById(data.id,true);
|
|
|
- }else {
|
|
|
+ result.data = await engineeringLibModel.deleteById(data.id, true);
|
|
|
+ } else {
|
|
|
throw new Error("提交数据有误");
|
|
|
}
|
|
|
- }catch (err){
|
|
|
+ } catch (err) {
|
|
|
console.log(err);
|
|
|
- result.error=1;
|
|
|
+ result.error = 1;
|
|
|
result.message = err.message;
|
|
|
}
|
|
|
response.json(result);
|
|
@@ -389,23 +389,23 @@ class CompilationController extends BaseController {
|
|
|
* @param response
|
|
|
* @returns {Promise.<void>}
|
|
|
*/
|
|
|
- async updateEngineer(request,response){
|
|
|
- let result={
|
|
|
- error:0
|
|
|
+ async updateEngineer(request, response) {
|
|
|
+ let result = {
|
|
|
+ error: 0
|
|
|
};
|
|
|
try {
|
|
|
let data = request.body.data;
|
|
|
data = JSON.parse(data);
|
|
|
- if(data.id && data.updateData){
|
|
|
+ if (data.id && data.updateData) {
|
|
|
let engineeringLibModel = new EngineeringLibModel();
|
|
|
- result.data = await engineeringLibModel.updateById(data.id,data.updateData);
|
|
|
- }else {
|
|
|
+ result.data = await engineeringLibModel.updateById(data.id, data.updateData);
|
|
|
+ } else {
|
|
|
throw new Error("提交数据有误");
|
|
|
}
|
|
|
|
|
|
- }catch (err){
|
|
|
+ } catch (err) {
|
|
|
console.log(err);
|
|
|
- result.error=1;
|
|
|
+ result.error = 1;
|
|
|
result.message = err.message;
|
|
|
}
|
|
|
response.json(result);
|
|
@@ -513,7 +513,7 @@ class CompilationController extends BaseController {
|
|
|
* @param {object} response
|
|
|
* @return {void}
|
|
|
*/
|
|
|
- async setFileTypes(request, response) {
|
|
|
+ async setFileTypes(request, response) {
|
|
|
let id = request.body.id;
|
|
|
let section = request.params.section;
|
|
|
let fileTypes = request.body.fileTypes;
|
|
@@ -605,34 +605,46 @@ class CompilationController extends BaseController {
|
|
|
response.json(responseData);
|
|
|
}
|
|
|
|
|
|
- async setDescription(request, response){
|
|
|
+ async setDescription(request, response) {
|
|
|
let compilationId = request.body.id;
|
|
|
let description = request.body.description;
|
|
|
- try{
|
|
|
+ try {
|
|
|
let compilationModel = new CompilationModel();
|
|
|
await compilationModel.setDescription(compilationId, description);
|
|
|
- response.json({err: 0, msg: '', data: null});
|
|
|
+ response.json({ err: 0, msg: '', data: null });
|
|
|
}
|
|
|
- catch (err){
|
|
|
- response.json({err: 1, msg: err, data: null});
|
|
|
+ catch (err) {
|
|
|
+ response.json({ err: 1, msg: err, data: null });
|
|
|
}
|
|
|
}
|
|
|
- async setEdition(request, response){
|
|
|
+ async setEdition(request, response) {
|
|
|
let compilationId = request.body.id;
|
|
|
let edition = request.body.edition;
|
|
|
- try{
|
|
|
+ try {
|
|
|
let compilationModel = new CompilationModel();
|
|
|
await compilationModel.setEdition(compilationId, edition);
|
|
|
- response.json({err: 0, msg: '', data: null});
|
|
|
+ response.json({ err: 0, msg: '', data: null });
|
|
|
}
|
|
|
- catch (err){
|
|
|
- response.json({err: 1, msg: err, data: null});
|
|
|
+ catch (err) {
|
|
|
+ response.json({ err: 1, msg: err, data: null });
|
|
|
}
|
|
|
}
|
|
|
- async setOverWriteUrl(request, response){
|
|
|
+ async setSerialNumber(request, response) {
|
|
|
+ let compilationId = request.body.id;
|
|
|
+ let serialNumber = request.body.serialNumber;
|
|
|
+ try {
|
|
|
+ let compilationModel = new CompilationModel();
|
|
|
+ await compilationModel.setSerialNumber(compilationId, serialNumber);
|
|
|
+ response.json({ err: 0, msg: '', data: null });
|
|
|
+ }
|
|
|
+ catch (err) {
|
|
|
+ response.json({ err: 1, msg: err, data: null });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ async setOverWriteUrl(request, response) {
|
|
|
let compilationId = request.body.id;
|
|
|
let overWriteUrl = request.body.overWriteUrl;
|
|
|
- try{
|
|
|
+ try {
|
|
|
let compilationModel = new CompilationModel();
|
|
|
//绝对路径
|
|
|
let absoluteUrl = request.app.locals.rootDir + overWriteUrl;
|
|
@@ -640,33 +652,33 @@ class CompilationController extends BaseController {
|
|
|
let fileExists = fs.existsSync(absoluteUrl);
|
|
|
let pricePropertiesTemplate = [],
|
|
|
consumeAmtPropertiesTemplate = [];
|
|
|
- if(fileExists && fs.statSync(absoluteUrl).isFile()){
|
|
|
+ if (fileExists && fs.statSync(absoluteUrl).isFile()) {
|
|
|
//读取配置文件并赋值
|
|
|
let overWriteExports = require(absoluteUrl);
|
|
|
- if(overWriteExports){
|
|
|
+ if (overWriteExports) {
|
|
|
pricePropertiesTemplate = overWriteExports.pricePropertiesTemplate ? overWriteExports.pricePropertiesTemplate : [];
|
|
|
consumeAmtPropertiesTemplate = overWriteExports.consumeAmtPropertiesTemplate ? overWriteExports.consumeAmtPropertiesTemplate : [];
|
|
|
}
|
|
|
}
|
|
|
await compilationModel.setOverWriteUrl(compilationId, overWriteUrl, pricePropertiesTemplate, consumeAmtPropertiesTemplate);
|
|
|
- response.json({err: 0, msg: '', data: null});
|
|
|
+ response.json({ err: 0, msg: '', data: null });
|
|
|
}
|
|
|
- catch (err){
|
|
|
+ catch (err) {
|
|
|
console.log(err);
|
|
|
- response.json({err: 1, msg: err, data: null});
|
|
|
+ response.json({ err: 1, msg: err, data: null });
|
|
|
}
|
|
|
}
|
|
|
- async setExample(request, response){
|
|
|
+ async setExample(request, response) {
|
|
|
let compilationId = request.body.id,
|
|
|
example = request.body.example;
|
|
|
try {
|
|
|
let compilationModel = new CompilationModel();
|
|
|
await compilationModel.setExample(compilationId, example);
|
|
|
- response.json({err: 0, msg: 'success', data: null});
|
|
|
+ response.json({ err: 0, msg: 'success', data: null });
|
|
|
}
|
|
|
- catch (err){
|
|
|
+ catch (err) {
|
|
|
console.log(err);
|
|
|
- response.json({err: 1, msg: err, data: null});
|
|
|
+ response.json({ err: 1, msg: err, data: null });
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -719,7 +731,7 @@ class CompilationController extends BaseController {
|
|
|
valuationId: valuationId,
|
|
|
section: section,
|
|
|
layout: 'users/views/layout/layout',
|
|
|
- LicenseKey:config.getLicenseKey(process.env.NODE_ENV)
|
|
|
+ LicenseKey: config.getLicenseKey(process.env.NODE_ENV)
|
|
|
};
|
|
|
response.render('users/views/compilation/template', renderData);
|
|
|
}
|
|
@@ -740,9 +752,9 @@ class CompilationController extends BaseController {
|
|
|
let result = await billsTemplateModel.updateTemplate(valuationId, engineering, data);
|
|
|
|
|
|
if (result) {
|
|
|
- response.json({error: 0, message: '', data: data});
|
|
|
+ response.json({ error: 0, message: '', data: data });
|
|
|
} else {
|
|
|
- response.json({error: 1, message: '更新数据错误', data: null});
|
|
|
+ response.json({ error: 1, message: '更新数据错误', data: null });
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -770,11 +782,11 @@ class CompilationController extends BaseController {
|
|
|
|
|
|
}
|
|
|
|
|
|
- async addEngineer(request,response){
|
|
|
+ async addEngineer(request, response) {
|
|
|
let engineeringLibModel = new EngineeringLibModel();
|
|
|
try {
|
|
|
await engineeringLibModel.addEngineer(request.body);
|
|
|
- }catch (error) {
|
|
|
+ } catch (error) {
|
|
|
console.log(error);
|
|
|
}
|
|
|
response.redirect(request.headers.referer);
|
|
@@ -795,60 +807,60 @@ class CompilationController extends BaseController {
|
|
|
let compilationModel = new CompilationModel();
|
|
|
let result = await compilationModel.updateCategory(valuationId, category);
|
|
|
if (result) {
|
|
|
- response.json({error: 0, message: '', data: null});
|
|
|
+ response.json({ error: 0, message: '', data: null });
|
|
|
} else {
|
|
|
- response.json({error: 1, message: '更新数据错误', data: null});
|
|
|
+ response.json({ error: 1, message: '更新数据错误', data: null });
|
|
|
}
|
|
|
- } catch(error) {
|
|
|
- response.json({error: 1, message: '更新数据错误', data: null});
|
|
|
+ } catch (error) {
|
|
|
+ response.json({ error: 1, message: '更新数据错误', data: null });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 更改编办默认工程所在工
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param response
|
|
|
- * @return {Promise.<void>}
|
|
|
- */
|
|
|
- async changeLocation(request, response) {
|
|
|
+ /**
|
|
|
+ * 更改编办默认工程所在工
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return {Promise.<void>}
|
|
|
+ */
|
|
|
+ async changeLocation(request, response) {
|
|
|
let compilationId = request.body.id;
|
|
|
let location = request.body.location;
|
|
|
try {
|
|
|
let compilationModel = new CompilationModel();
|
|
|
let result = await compilationModel.updateLocation(compilationId, location);
|
|
|
if (result) {
|
|
|
- response.json({error: 0, message: '', data: null});
|
|
|
+ response.json({ error: 0, message: '', data: null });
|
|
|
} else {
|
|
|
- response.json({error: 1, message: '更新数据错误', data: null});
|
|
|
+ response.json({ error: 1, message: '更新数据错误', data: null });
|
|
|
}
|
|
|
- } catch(error) {
|
|
|
- response.json({error: 1, message: '更新数据错误', data: null});
|
|
|
+ } catch (error) {
|
|
|
+ response.json({ error: 1, message: '更新数据错误', data: null });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 更改编办默认工程所在工
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param response
|
|
|
- * @return {Promise.<void>}
|
|
|
- */
|
|
|
- async changeFreeUse(request, response) {
|
|
|
+ /**
|
|
|
+ * 更改编办默认工程所在工
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return {Promise.<void>}
|
|
|
+ */
|
|
|
+ async changeFreeUse(request, response) {
|
|
|
let compilationId = request.body.id;
|
|
|
let freeUse = request.body.freeUse;
|
|
|
try {
|
|
|
let compilationModel = new CompilationModel();
|
|
|
let result = await compilationModel.updateFreeUse(compilationId, freeUse);
|
|
|
if (result) {
|
|
|
- response.json({error: 0, message: '', data: null});
|
|
|
+ response.json({ error: 0, message: '', data: null });
|
|
|
} else {
|
|
|
- response.json({error: 1, message: '更新数据错误', data: null});
|
|
|
+ response.json({ error: 1, message: '更新数据错误', data: null });
|
|
|
}
|
|
|
- } catch(error) {
|
|
|
- response.json({error: 1, message: '更新数据错误', data: null});
|
|
|
+ } catch (error) {
|
|
|
+ response.json({ error: 1, message: '更新数据错误', data: null });
|
|
|
}
|
|
|
}
|
|
|
|