|
@@ -703,75 +703,75 @@ $('#poj-set').on('show.bs.modal', function () {
|
|
|
}
|
|
|
});
|
|
|
$('#property_ok').click(function () {
|
|
|
- let properties = [], projectID = parseInt(scUrlUtil.GetQueryString('project'));
|
|
|
- let project = projectObj.project, reCalcBills= false, reCalcRations= false;
|
|
|
- let b = parseInt($("input[name='calcFlag']:checked").val());
|
|
|
+ let project = projectObj.project,
|
|
|
+ projectID = project.ID(),
|
|
|
+
|
|
|
+ properties = {},
|
|
|
+ labourCoes = {},
|
|
|
+ rations = [],
|
|
|
+ bills = [],
|
|
|
+
|
|
|
+ mixDatas = {
|
|
|
+ projectID: projectID,
|
|
|
+ updateType: 'update',
|
|
|
+ properties: properties,
|
|
|
+ labourCoes: labourCoes,
|
|
|
+ rations: rations,
|
|
|
+ bills: bills
|
|
|
+ },
|
|
|
+
|
|
|
+ reCalcBills= false,
|
|
|
+ reCalcRations= false;
|
|
|
|
|
|
+ let b = parseInt($("input[name='calcFlag']:checked").val());
|
|
|
if (b !== project.property.billsCalcMode) {
|
|
|
- let bData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.billsCalcMode': b}};
|
|
|
- properties.push(bData);
|
|
|
+ properties['property.billsCalcMode'] = b;
|
|
|
project.property.billsCalcMode = b;
|
|
|
reCalcBills = true;
|
|
|
};
|
|
|
|
|
|
let zg = parseInt($("input[name='zangu']:checked").val());
|
|
|
if (zg !== project.property.zanguCalcMode) {
|
|
|
- let zgData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.zanguCalcMode': zg}};
|
|
|
- properties.push(zgData);
|
|
|
+ properties['property.zanguCalcMode'] = zg;
|
|
|
project.property.zanguCalcMode = zg;
|
|
|
reCalcBills = true;
|
|
|
};
|
|
|
|
|
|
//基本信息
|
|
|
if(basicInfoView.toUpdate(basicInfoView.orgDatas, basicInfoView.datas)){
|
|
|
- let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.basicInformation': basicInfoView.toSaveDatas(basicInfoView.datas)}};
|
|
|
- properties.push(updateData);
|
|
|
+ properties['property.basicInformation'] = basicInfoView.toSaveDatas(basicInfoView.datas);
|
|
|
}
|
|
|
//工程特征
|
|
|
if(projFeatureView.toUpdate(projFeatureView.orgDatas, projFeatureView.datas)){
|
|
|
- let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.projectFeature': projFeatureView.toSaveDatas(projFeatureView.datas)}};
|
|
|
- properties.push(updateData);
|
|
|
+ properties['property.projectFeature'] = projFeatureView.toSaveDatas(projFeatureView.datas);
|
|
|
}
|
|
|
//清单工程量精度
|
|
|
let newBillsDecimalDatas = billsDecimalView.toBillsDecimalDatas(billsDecimalView.cache);
|
|
|
if(billsDecimalView.toUpdate(billsQuanDecimal.datas, newBillsDecimalDatas)){
|
|
|
reCalcBills = true;
|
|
|
- let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.billsQuantityDecimal': newBillsDecimalDatas}};
|
|
|
- properties.push(updateData);
|
|
|
+ properties['property.billsQuantityDecimal'] = newBillsDecimalDatas;
|
|
|
}
|
|
|
//小数位数
|
|
|
- //获取更新的数据
|
|
|
let updateDecimal = m_getDecimalData($('input', '#poj-settings-decimal'));
|
|
|
if(toUpdateDecimal(decimalObj, updateDecimal)){
|
|
|
reCalcRations = true;
|
|
|
reCalcBills = true;
|
|
|
- let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.decimal': updateDecimal}};
|
|
|
- properties.push(updateData);
|
|
|
+ properties['property.decimal'] = updateDecimal;
|
|
|
};
|
|
|
+ // 呈现选项
|
|
|
+ projDisplayView.updateChecking(projectID, properties);
|
|
|
|
|
|
// 人工系数
|
|
|
- let lcData;
|
|
|
if (labourCoeView.needSave()){
|
|
|
reCalcRations = true;
|
|
|
reCalcBills = true;
|
|
|
project.calcProgram.compileAllTemps();
|
|
|
|
|
|
- let projectID = projectInfoObj.projectInfo.ID;
|
|
|
let libID = $("#std_labour_coe_files").children("option:selected").val();
|
|
|
let libName = $("#std_labour_coe_files").children("option:selected").text();
|
|
|
- lcData = {sourceType: 'labourCoe', projectID: projectID, libID: libID, libName: libName, newItemArr: labourCoeView.needUpdateDatas};
|
|
|
- properties.push(lcData);
|
|
|
- };
|
|
|
|
|
|
- // 呈现选项
|
|
|
- projDisplayView.updateChecking(projectID,properties);
|
|
|
- /* const autoHeight = $("#autoHeight:checked").length > 0;
|
|
|
- const disPlayMainMaterial = $("#disPlayMainMaterial:checked").length > 0;*/
|
|
|
-/* if (projDisplayView.needUpdate(autoHeight, disPlayMainMaterial)) {
|
|
|
- const displaySetting = { autoHeight, disPlayMainMaterial };
|
|
|
- let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.displaySetting': displaySetting}};
|
|
|
- properties.push(updateData);
|
|
|
- }*/
|
|
|
+ labourCoes.updateData = {libID: libID, libName: libName, newItemArr: labourCoeView.needUpdateDatas};
|
|
|
+ };
|
|
|
|
|
|
// 重新计算树节点
|
|
|
let changedNodes = [];
|
|
@@ -782,7 +782,7 @@ $('#property_ok').click(function () {
|
|
|
if (changedNodes.length > 0) {
|
|
|
for (let node of changedNodes){
|
|
|
let data = {
|
|
|
- projectID: project.ID(),
|
|
|
+ projectID: projectID,
|
|
|
ID: node.data.ID,
|
|
|
quantity: node.data.quantity,
|
|
|
calcBase: node.data.calcBase,
|
|
@@ -793,18 +793,27 @@ $('#property_ok').click(function () {
|
|
|
feeRate: node.data.feeRate,
|
|
|
feeRateID: node.data.feeRateID
|
|
|
};
|
|
|
- let dataObj = {sourceType: node.sourceType, updateType: 'ut_update', updateData: data};
|
|
|
- properties.push(dataObj);
|
|
|
+ if (node.sourceType == 'ration'){
|
|
|
+ rations.push(data);
|
|
|
+ }
|
|
|
+ else if (node.sourceType == 'bills'){
|
|
|
+ bills.push(data);
|
|
|
+ };
|
|
|
};
|
|
|
};
|
|
|
|
|
|
- console.log(properties);
|
|
|
- if(properties.length > 0){
|
|
|
- CommonAjax.post('/pm/api/updateMixDatas', {user_id: userID, updateData: properties}, function (rstData) {
|
|
|
+ console.log(mixDatas);
|
|
|
+ function hasMixData() {
|
|
|
+ return Object.keys(mixDatas.properties).length > 0 ||
|
|
|
+ mixDatas.labourCoes.updateData || mixDatas.rations.length > 0 || mixDatas.bills.length > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(hasMixData){
|
|
|
+ CommonAjax.post('/pm/api/updateMixDatas', {user_id: userID, mixDataArr: mixDatas}, function (rstData) {
|
|
|
if (changedNodes.length > 0) {
|
|
|
for (let node of changedNodes){delete node.changed};
|
|
|
};
|
|
|
- if (lcData) labourCoeView.refresh(lcData);
|
|
|
+ if (mixDatas.labourCoes.updateData) labourCoeView.refresh(mixDatas.labourCoes.updateData);
|
|
|
window.location.href = '/main?project=' + projectID;
|
|
|
});
|
|
|
}
|