|
@@ -270,8 +270,8 @@ var projectObj = {
|
|
|
project.ration_glj.updateFromMainSpread(value,node,fieldName);
|
|
|
}if(node.sourceType==ModuleNames.ration&&node.data.type==rationType.gljRation){
|
|
|
gljOprObj.updateRationTypeGLJ(value,node,fieldName);
|
|
|
- } else if (value !== calcFees.getFee(node.data, fieldName)) {
|
|
|
- if (fieldName === 'code') {
|
|
|
+ } else if (value !== calcFees.getFee(node.data, fieldName)||fieldName == 'quantity') {//工程量需要进行转换,所以做特殊处理
|
|
|
+ if (fieldName === 'code' && !project.calcProgram.isVolumePrice(node)) {
|
|
|
projectObj.updateCode(node, value);
|
|
|
}
|
|
|
else if(fieldName ==='feeRate'){
|
|
@@ -282,7 +282,11 @@ var projectObj = {
|
|
|
if (fieldName === 'quantity') {
|
|
|
if (value) {
|
|
|
value = project.quantity_detail.autoTransformQuantity(value,node);
|
|
|
- value = value.toDecimal(decimalObj.decimal(fieldName,node))
|
|
|
+ value = scMathUtil.roundForObj(value,decimalObj.decimal(fieldName,node));
|
|
|
+ if(value==node.data[fieldName]){
|
|
|
+ projectObj.mainController.refreshTreeNode([node]);
|
|
|
+ return;
|
|
|
+ }
|
|
|
};
|
|
|
if(project.quantity_detail.quantityEditChecking(value,node,fieldName)){
|
|
|
node.data.isFromDetail=0;
|
|
@@ -461,6 +465,7 @@ var projectObj = {
|
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.EnterCell, that.mainSpreadEnterCell);
|
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.EditEnded, that.mainSpreadEditEnded);
|
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.RangeChanged, that.mainSpreadRangeChanged);
|
|
|
+ that.mainSpread.bind(GC.Spread.Sheets.Events.SelectionChanged, that.amountAreaNumber);
|
|
|
that.loadMainSpreadContextMenu();
|
|
|
that.loadFocusLocation();
|
|
|
}
|
|
@@ -607,7 +612,95 @@ var projectObj = {
|
|
|
this.mainController.setTreeSelected(this.mainController.tree.items[row]);//触发树节点选中事件
|
|
|
}
|
|
|
},
|
|
|
+ // 选中区域合计数字
|
|
|
+ amountAreaNumber: function(e, info) {
|
|
|
+ if (info.newSelections === undefined || info.newSelections.length <= 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const selectedArea = info.newSelections[0];
|
|
|
+ const sheet = info.sheet;
|
|
|
+ if (selectedArea.colCount <= 1 && selectedArea.rowCount <= 1) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 获取鼠标位置
|
|
|
+ let x = window.event.clientX;
|
|
|
+ let y = window.event.clientY;
|
|
|
+
|
|
|
+ // 匹配数字或小数
|
|
|
+ const regular = /^([0-9]+[.]{1}[0-9]+)$|^([1-9]{1}\d+)$/;
|
|
|
+ // 小数点最高位数
|
|
|
+ let max = 0;
|
|
|
+ let total = 0;
|
|
|
+ for (let col = selectedArea.col; col < (selectedArea.colCount + selectedArea.col); col++) {
|
|
|
+ for (let row = selectedArea.row; row < (selectedArea.rowCount + selectedArea.row); row++) {
|
|
|
+ const value = sheet.getCell(row, col).value();
|
|
|
+ if (!regular.test(value)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 获取当前数据小数位数
|
|
|
+ let pointPosition = value.toString().indexOf(".");
|
|
|
+ pointPosition = pointPosition < 0 ? pointPosition : pointPosition + 1;
|
|
|
+ const current = pointPosition > 0 ? value.toString().substring(pointPosition, value.toString().length).length : 0;
|
|
|
+ max = current > max ? current : max;
|
|
|
+ total += parseFloat(value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 如果不为0则悬浮显示
|
|
|
+ if (total > 0) {
|
|
|
+ const div = $('<div id="total-tips"><p>合计: <input type="text" id="total" readonly="readonly" style="border: none;"/></p><p><a href="javascript:void(0);">复制</a></p></div>');
|
|
|
+ div.css({
|
|
|
+ position: "absolute",
|
|
|
+ border: "1px #C0C0C0 solid",
|
|
|
+ background: "#fff",
|
|
|
+ boxShadow: "1px 2px 5px rgba(0,0,0,0.4)",
|
|
|
+ });
|
|
|
+ div.children("p").css({
|
|
|
+ textAlign: "center",
|
|
|
+ padding: 8,
|
|
|
+ marginBottom: 2,
|
|
|
+ });
|
|
|
+ div.children("p").first().css({
|
|
|
+ borderBottom: "1px #C0C0C0 solid"
|
|
|
+ });
|
|
|
+ const totalString = total.toFixed(max);
|
|
|
+ // input长度
|
|
|
+ const inputWidth = totalString.length * 8;
|
|
|
+ // 计算是否会超出显示范围
|
|
|
+ const baseWidth = 48;
|
|
|
+ const baseHeight = 81;
|
|
|
+ const canvasWidth = $("#billsSpreadvp_vp").width();
|
|
|
+ const canvasHeight = $("#billsSpreadvp_vp").height();
|
|
|
+ x = x + baseWidth + inputWidth > canvasWidth ? x - baseWidth - inputWidth : x;
|
|
|
+ y = y + baseHeight > canvasHeight ? y - baseHeight : y;
|
|
|
+ div.css({
|
|
|
+ left: x,
|
|
|
+ top: y,
|
|
|
+ });
|
|
|
+
|
|
|
+ div.children().children("#total").width(inputWidth).val(totalString);
|
|
|
+ $("body").append(div);
|
|
|
+ // 用于判断是否要关闭窗体
|
|
|
+ setTimeout(function() {
|
|
|
+ isTotalShowing = true;
|
|
|
+ }, 200);
|
|
|
+ };
|
|
|
+ }
|
|
|
};
|
|
|
+// 点击合计框中的复制
|
|
|
+$("body").on("click", "#total-tips a", function() {
|
|
|
+ const totalElement = $(this).parent().siblings("p").find("#total");
|
|
|
+ totalElement.select();
|
|
|
+ document.execCommand("Copy");
|
|
|
+ $(this).text("已复制");
|
|
|
+});
|
|
|
+// 合计框点击其他位置关闭
|
|
|
+let isTotalShowing = false;
|
|
|
+$("body").on("click", function(e) {
|
|
|
+ if (isTotalShowing && !$(e.target).is("#total-tips") && !$(e.target).is("#total-tips p") && !$(e.target).is("#total-tips p a")) {
|
|
|
+ $("#total-tips").remove();
|
|
|
+ isTotalShowing = false;
|
|
|
+ }
|
|
|
+});
|
|
|
|
|
|
$('#insert').click(function () {
|
|
|
var controller = projectObj.mainController, project = projectObj.project;
|
|
@@ -752,16 +845,22 @@ $('#property_ok').click(function () {
|
|
|
//清单工程量精度
|
|
|
let newBillsDecimalDatas = billsDecimalView.toBillsDecimalDatas(billsDecimalView.cache);
|
|
|
if(billsDecimalView.toUpdate(billsQuanDecimal.datas, newBillsDecimalDatas)){
|
|
|
+ billsQuanDecimal.datas = newBillsDecimalDatas;
|
|
|
reCalcBills = true;
|
|
|
properties['property.billsQuantityDecimal'] = newBillsDecimalDatas;
|
|
|
}
|
|
|
//小数位数
|
|
|
let updateDecimal = m_getDecimalData($('input', '#poj-settings-decimal'));
|
|
|
- if(toUpdateDecimal(decimalObj, updateDecimal)){
|
|
|
+ if(toUpdateDecimal(decimalObj, updateDecimal)) {
|
|
|
+ let frChanged = decimalObj.feeRate != updateDecimal.feeRate;
|
|
|
+ setDecimal(decimalObj, updateDecimal);
|
|
|
+ if (frChanged) {
|
|
|
+ project.calcProgram.compileAllTemps()
|
|
|
+ }
|
|
|
reCalcRations = true;
|
|
|
reCalcBills = true;
|
|
|
properties['property.decimal'] = updateDecimal;
|
|
|
- };
|
|
|
+ }
|
|
|
// 呈现选项
|
|
|
projDisplayView.updateChecking(projectID, properties);
|
|
|
|
|
@@ -776,7 +875,6 @@ $('#property_ok').click(function () {
|
|
|
reCalcRations = true;
|
|
|
reCalcBills = true;
|
|
|
};
|
|
|
- console.log(properties);
|
|
|
// 重新计算树节点
|
|
|
let changedNodes = [];
|
|
|
if (reCalcRations) // 定额动,全部计算。
|
|
@@ -806,8 +904,9 @@ $('#property_ok').click(function () {
|
|
|
};
|
|
|
};
|
|
|
|
|
|
- console.log(mixDatas);
|
|
|
- // return; // for test.
|
|
|
+ // for test.
|
|
|
+/* console.log(mixDatas);
|
|
|
+ return; */
|
|
|
function hasMixData() {
|
|
|
return Object.keys(mixDatas.properties).length > 0 ||
|
|
|
mixDatas.labourCoes.updateData || mixDatas.rations.length > 0 || mixDatas.bills.length > 0;
|