|
@@ -42,7 +42,7 @@ import overHeightFacade from "../../over_height_lib/facade/over_height_facade";
|
|
|
import progressiveFacade from "../../progressive_interval_lib/facade/progressive_facade";
|
|
import progressiveFacade from "../../progressive_interval_lib/facade/progressive_facade";
|
|
|
import {
|
|
import {
|
|
|
default as category,
|
|
default as category,
|
|
|
- List as categoryList,
|
|
|
|
|
|
|
+ getCategoryList,
|
|
|
} from "../../common/const/category_const.js";
|
|
} from "../../common/const/category_const.js";
|
|
|
import locationList from "../../common/const/locationList";
|
|
import locationList from "../../common/const/locationList";
|
|
|
|
|
|
|
@@ -92,10 +92,11 @@ class CompilationController extends BaseController {
|
|
|
) {
|
|
) {
|
|
|
selectedCompilation.example = selectedCompilation.example.join(";");
|
|
selectedCompilation.example = selectedCompilation.example.join(";");
|
|
|
}
|
|
}
|
|
|
|
|
+ let categoryData = await getCategoryList();
|
|
|
let renderData = {
|
|
let renderData = {
|
|
|
id: id,
|
|
id: id,
|
|
|
compilationList: compilationList,
|
|
compilationList: compilationList,
|
|
|
- categoryList: categoryList,
|
|
|
|
|
|
|
+ categoryList: categoryData,
|
|
|
locationList: locationList,
|
|
locationList: locationList,
|
|
|
selectedCompilation: selectedCompilation,
|
|
selectedCompilation: selectedCompilation,
|
|
|
layout: "users/views/layout/layout",
|
|
layout: "users/views/layout/layout",
|
|
@@ -134,7 +135,7 @@ class CompilationController extends BaseController {
|
|
|
let valuationId = await compilationModel.addValuation(
|
|
let valuationId = await compilationModel.addValuation(
|
|
|
id,
|
|
id,
|
|
|
section,
|
|
section,
|
|
|
- insertData
|
|
|
|
|
|
|
+ insertData,
|
|
|
);
|
|
);
|
|
|
if (!valuationId) {
|
|
if (!valuationId) {
|
|
|
throw "新增计价规则失败";
|
|
throw "新增计价规则失败";
|
|
@@ -176,7 +177,7 @@ class CompilationController extends BaseController {
|
|
|
[valuationData, valuationList] = await compilationModel.getValuation(
|
|
[valuationData, valuationList] = await compilationModel.getValuation(
|
|
|
selectedCompilation._id,
|
|
selectedCompilation._id,
|
|
|
valuationId,
|
|
valuationId,
|
|
|
- section
|
|
|
|
|
|
|
+ section,
|
|
|
);
|
|
);
|
|
|
if (Object.keys(valuationData).length <= 0) {
|
|
if (Object.keys(valuationData).length <= 0) {
|
|
|
throw "不存在数据";
|
|
throw "不存在数据";
|
|
@@ -184,9 +185,8 @@ class CompilationController extends BaseController {
|
|
|
|
|
|
|
|
// 获取计价规则中对应的标准库数据
|
|
// 获取计价规则中对应的标准库数据
|
|
|
let engineeringLibModel = new EngineeringLibModel();
|
|
let engineeringLibModel = new EngineeringLibModel();
|
|
|
- engineeringList = await engineeringLibModel.getLibsByValuationID(
|
|
|
|
|
- valuationId
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ engineeringList =
|
|
|
|
|
+ await engineeringLibModel.getLibsByValuationID(valuationId);
|
|
|
engineeringList = _.sortBy(engineeringList, ["seq"]);
|
|
engineeringList = _.sortBy(engineeringList, ["seq"]);
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
console.log(error);
|
|
@@ -263,7 +263,7 @@ class CompilationController extends BaseController {
|
|
|
// 获取费率标准库
|
|
// 获取费率标准库
|
|
|
let stdFeeRateLibsModel = new STDFeeRateLibsModel();
|
|
let stdFeeRateLibsModel = new STDFeeRateLibsModel();
|
|
|
feeRateList = await stdFeeRateLibsModel.getFeeRateList(
|
|
feeRateList = await stdFeeRateLibsModel.getFeeRateList(
|
|
|
- selectedCompilation._id
|
|
|
|
|
|
|
+ selectedCompilation._id,
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
// 获取人工系数标准库
|
|
// 获取人工系数标准库
|
|
@@ -273,24 +273,24 @@ class CompilationController extends BaseController {
|
|
|
// 获取计算程序库
|
|
// 获取计算程序库
|
|
|
let stdCalcProgramModel = new STDCalcProgramModel();
|
|
let stdCalcProgramModel = new STDCalcProgramModel();
|
|
|
calculationList = await stdCalcProgramModel.getProgramList(
|
|
calculationList = await stdCalcProgramModel.getProgramList(
|
|
|
- selectedCompilation._id
|
|
|
|
|
|
|
+ selectedCompilation._id,
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
//获取列设置库
|
|
//获取列设置库
|
|
|
mainTreeColList = await mainColFacade.getColLibsByCompilationID(
|
|
mainTreeColList = await mainColFacade.getColLibsByCompilationID(
|
|
|
- selectedCompilation._id
|
|
|
|
|
|
|
+ selectedCompilation._id,
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
//获取清单模板库
|
|
//获取清单模板库
|
|
|
billTemplateList = await billTemplateFacade.getTemplateLibByCompilationID(
|
|
billTemplateList = await billTemplateFacade.getTemplateLibByCompilationID(
|
|
|
- selectedCompilation._id
|
|
|
|
|
|
|
+ selectedCompilation._id,
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
// 获取对应的计价规则数据
|
|
// 获取对应的计价规则数据
|
|
|
[valuationData, valuationList] = await compilationModel.getValuation(
|
|
[valuationData, valuationList] = await compilationModel.getValuation(
|
|
|
selectedCompilation._id,
|
|
selectedCompilation._id,
|
|
|
valuationId,
|
|
valuationId,
|
|
|
- section
|
|
|
|
|
|
|
+ section,
|
|
|
);
|
|
);
|
|
|
if (Object.keys(valuationData).length <= 0) {
|
|
if (Object.keys(valuationData).length <= 0) {
|
|
|
throw "不存在数据";
|
|
throw "不存在数据";
|
|
@@ -306,7 +306,7 @@ class CompilationController extends BaseController {
|
|
|
let billsTemplateModel = new BillsTemplateModel();
|
|
let billsTemplateModel = new BillsTemplateModel();
|
|
|
billsTemplateData = await billsTemplateModel.getTemplateData(
|
|
billsTemplateData = await billsTemplateModel.getTemplateData(
|
|
|
valuationId,
|
|
valuationId,
|
|
|
- libData.engineering
|
|
|
|
|
|
|
+ libData.engineering,
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
//获取清单指引数据
|
|
//获取清单指引数据
|
|
@@ -319,7 +319,7 @@ class CompilationController extends BaseController {
|
|
|
featureList = await projectFeatureFacade.findByCondition(
|
|
featureList = await projectFeatureFacade.findByCondition(
|
|
|
{ compilationId: selectedCompilation._id },
|
|
{ compilationId: selectedCompilation._id },
|
|
|
"-feature",
|
|
"-feature",
|
|
|
- false
|
|
|
|
|
|
|
+ false,
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
//获取基本信息库
|
|
//获取基本信息库
|
|
@@ -329,27 +329,27 @@ class CompilationController extends BaseController {
|
|
|
itemIncreaseList = await itemIncreaseFacade.findByCondition(
|
|
itemIncreaseList = await itemIncreaseFacade.findByCondition(
|
|
|
{},
|
|
{},
|
|
|
"-template",
|
|
"-template",
|
|
|
- false
|
|
|
|
|
|
|
+ false,
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
engineerInfoList = await engineerInfoFacade.findByCondition(
|
|
engineerInfoList = await engineerInfoFacade.findByCondition(
|
|
|
{},
|
|
{},
|
|
|
null,
|
|
null,
|
|
|
- false
|
|
|
|
|
|
|
+ false,
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
//获取累进区间库
|
|
//获取累进区间库
|
|
|
progressiveList = await progressiveFacade.findByCondition(
|
|
progressiveList = await progressiveFacade.findByCondition(
|
|
|
{},
|
|
{},
|
|
|
null,
|
|
null,
|
|
|
- false
|
|
|
|
|
|
|
+ false,
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
//工程特征指标库
|
|
//工程特征指标库
|
|
|
engineerFeatureList = await engineerFeatureFacade.findByCondition(
|
|
engineerFeatureList = await engineerFeatureFacade.findByCondition(
|
|
|
{},
|
|
{},
|
|
|
null,
|
|
null,
|
|
|
- false
|
|
|
|
|
|
|
+ false,
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
//主要工料指标
|
|
//主要工料指标
|
|
@@ -506,7 +506,7 @@ class CompilationController extends BaseController {
|
|
|
let engineeringLibModel = new EngineeringLibModel();
|
|
let engineeringLibModel = new EngineeringLibModel();
|
|
|
result.data = await engineeringLibModel.updateById(
|
|
result.data = await engineeringLibModel.updateById(
|
|
|
data.id,
|
|
data.id,
|
|
|
- data.updateData
|
|
|
|
|
|
|
+ data.updateData,
|
|
|
);
|
|
);
|
|
|
} else {
|
|
} else {
|
|
|
throw new Error("提交数据有误");
|
|
throw new Error("提交数据有误");
|
|
@@ -536,7 +536,7 @@ class CompilationController extends BaseController {
|
|
|
let compilationModel = new CompilationModel();
|
|
let compilationModel = new CompilationModel();
|
|
|
let result = await compilationModel.saveValuation(
|
|
let result = await compilationModel.saveValuation(
|
|
|
valuationId,
|
|
valuationId,
|
|
|
- request.body
|
|
|
|
|
|
|
+ request.body,
|
|
|
);
|
|
);
|
|
|
if (!result) {
|
|
if (!result) {
|
|
|
throw "保存失败";
|
|
throw "保存失败";
|
|
@@ -579,7 +579,7 @@ class CompilationController extends BaseController {
|
|
|
let result = compilationModel.deleteValuation(
|
|
let result = compilationModel.deleteValuation(
|
|
|
selectedCompilation._id,
|
|
selectedCompilation._id,
|
|
|
id,
|
|
id,
|
|
|
- section
|
|
|
|
|
|
|
+ section,
|
|
|
);
|
|
);
|
|
|
if (!result) {
|
|
if (!result) {
|
|
|
throw "删除失败";
|
|
throw "删除失败";
|
|
@@ -783,7 +783,7 @@ class CompilationController extends BaseController {
|
|
|
compilationId,
|
|
compilationId,
|
|
|
overWriteUrl,
|
|
overWriteUrl,
|
|
|
pricePropertiesTemplate,
|
|
pricePropertiesTemplate,
|
|
|
- consumeAmtPropertiesTemplate
|
|
|
|
|
|
|
+ consumeAmtPropertiesTemplate,
|
|
|
);
|
|
);
|
|
|
response.json({ err: 0, msg: "", data: null });
|
|
response.json({ err: 0, msg: "", data: null });
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
@@ -829,21 +829,21 @@ class CompilationController extends BaseController {
|
|
|
[valuationData, valuationList] = await compilationModel.getValuation(
|
|
[valuationData, valuationList] = await compilationModel.getValuation(
|
|
|
selectedCompilation._id,
|
|
selectedCompilation._id,
|
|
|
valuationId,
|
|
valuationId,
|
|
|
- section
|
|
|
|
|
|
|
+ section,
|
|
|
);
|
|
);
|
|
|
compilationList = await compilationModel.getCompilationList();
|
|
compilationList = await compilationModel.getCompilationList();
|
|
|
|
|
|
|
|
// 获取标准清单
|
|
// 获取标准清单
|
|
|
let stdBillLibListsModel = new STDBillLibListsModel();
|
|
let stdBillLibListsModel = new STDBillLibListsModel();
|
|
|
billList = await stdBillLibListsModel.getBillList(
|
|
billList = await stdBillLibListsModel.getBillList(
|
|
|
- selectedCompilation._id
|
|
|
|
|
|
|
+ selectedCompilation._id,
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
// 获取清单模板数据
|
|
// 获取清单模板数据
|
|
|
let billsTemplateModel = new BillsTemplateModel();
|
|
let billsTemplateModel = new BillsTemplateModel();
|
|
|
billsTemplateData = await billsTemplateModel.getTemplateData(
|
|
billsTemplateData = await billsTemplateModel.getTemplateData(
|
|
|
valuationId,
|
|
valuationId,
|
|
|
- engineering
|
|
|
|
|
|
|
+ engineering,
|
|
|
);
|
|
);
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
console.log(error);
|
|
@@ -883,7 +883,7 @@ class CompilationController extends BaseController {
|
|
|
let result = await billsTemplateModel.updateTemplate(
|
|
let result = await billsTemplateModel.updateTemplate(
|
|
|
valuationId,
|
|
valuationId,
|
|
|
engineering,
|
|
engineering,
|
|
|
- data
|
|
|
|
|
|
|
+ data,
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
if (result) {
|
|
if (result) {
|
|
@@ -899,7 +899,7 @@ class CompilationController extends BaseController {
|
|
|
const engineeringLibModel = new EngineeringLibModel();
|
|
const engineeringLibModel = new EngineeringLibModel();
|
|
|
await engineeringLibModel.copyRationLibsToOthers(
|
|
await engineeringLibModel.copyRationLibsToOthers(
|
|
|
valuationID,
|
|
valuationID,
|
|
|
- engineeringID
|
|
|
|
|
|
|
+ engineeringID,
|
|
|
);
|
|
);
|
|
|
res.json({ error: 0, message: "复制成功", data: null });
|
|
res.json({ error: 0, message: "复制成功", data: null });
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
@@ -916,7 +916,7 @@ class CompilationController extends BaseController {
|
|
|
compilationID,
|
|
compilationID,
|
|
|
valuationType,
|
|
valuationType,
|
|
|
orgValuationID,
|
|
orgValuationID,
|
|
|
- newName
|
|
|
|
|
|
|
+ newName,
|
|
|
);
|
|
);
|
|
|
res.json({ error: 0, message: "复制成功", data: null });
|
|
res.json({ error: 0, message: "复制成功", data: null });
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
@@ -945,7 +945,7 @@ class CompilationController extends BaseController {
|
|
|
async changeCategory(request, response) {
|
|
async changeCategory(request, response) {
|
|
|
let valuationId = request.body.id;
|
|
let valuationId = request.body.id;
|
|
|
let category = request.body.category;
|
|
let category = request.body.category;
|
|
|
- category = parseInt(category);
|
|
|
|
|
|
|
+ // category = parseInt(category);
|
|
|
try {
|
|
try {
|
|
|
let compilationModel = new CompilationModel();
|
|
let compilationModel = new CompilationModel();
|
|
|
let result = await compilationModel.updateCategory(valuationId, category);
|
|
let result = await compilationModel.updateCategory(valuationId, category);
|
|
@@ -973,7 +973,7 @@ class CompilationController extends BaseController {
|
|
|
let compilationModel = new CompilationModel();
|
|
let compilationModel = new CompilationModel();
|
|
|
let result = await compilationModel.updateLocation(
|
|
let result = await compilationModel.updateLocation(
|
|
|
compilationId,
|
|
compilationId,
|
|
|
- location
|
|
|
|
|
|
|
+ location,
|
|
|
);
|
|
);
|
|
|
if (result) {
|
|
if (result) {
|
|
|
response.json({ error: 0, message: "", data: null });
|
|
response.json({ error: 0, message: "", data: null });
|