Переглянути джерело

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

Tony Kang 6 місяців тому
батько
коміт
5c75bf15db

+ 7 - 5
app/public/js/ledger.js

@@ -2233,6 +2233,7 @@ $(document).ready(function() {
                     }
                 }
                 const lastOrder = sortData.length > 0 ? sortData[sortData.length - 1].porder + 1 : 1;
+                let filterExprFields = [];
                 for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
                     let bPaste = false;
                     const curRow = info.cellRange.row + iRow;
@@ -2241,23 +2242,24 @@ $(document).ready(function() {
                         const curCol = info.cellRange.col + iCol;
                         const colSetting = info.sheet.zh_setting.cols[curCol];
                         if (!colSetting) continue;
+                        const checkExprInfo = getExprInfo(colSetting.field);
+                        if (checkExprInfo) filterExprFields.push(checkExprInfo.expr);
+                        if (filterExprFields.indexOf(colSetting.field) >= 0) continue;
 
                         posData[colSetting.field] = colSetting.wordWrap ? info.sheet.getText(curRow, curCol) : trimInvalidChar(info.sheet.getText(curRow, curCol));
                         if (colSetting.type === 'Number') {
+                            const exprInfo = getExprInfo(colSetting.field);
                             const num = _.toNumber(posData[colSetting.field]);
                             if (num) {
                                 posData[colSetting.field] = num;
+                                if (exprInfo) posData[exprInfo.expr] = '';
                                 bPaste = true;
                             } else {
                                 try {
+                                    if (exprInfo) posData[exprInfo.expr] = posData[colSetting.field];
                                     posData[colSetting.field] = ZhCalc.mathCalcExpr(transExpr(posData[colSetting.field]));
-                                    const exprInfo = getExprInfo(colSetting.field);
-                                    if (exprInfo) {
-                                        posData[exprInfo.expr] = trimInvalidChar(info.sheet.getText(curRow, curCol));
-                                    }
                                     bPaste = true;
                                 } catch (err) {
-
                                     delete posData[colSetting.field];
                                     toastMessageUniq(hint.expr);
                                 }

+ 17 - 2
app/public/js/phase_pay_detail.js

@@ -134,6 +134,7 @@ $(document).ready(() => {
                 this.addBase = add;
                 this.orderReg = /f\d+/ig;
                 this.nodeReg = /<<[a-z0-9\-]+>>/ig;
+                this.firstNodeReg = /^<<[a-z0-9\-]+>>/ig;
             }
             hasBase(expr) {
                 if (!expr) return false;
@@ -177,7 +178,7 @@ $(document).ready(() => {
                             base = '';
                         }
                         num = num + expr[i];
-                    } else if (this.nodeReg.test(subExpr)) {
+                    } else if (this.firstNodeReg.test(subExpr)) {
                         if (num !== '') {
                             param.push({type: 'num', value: num});
                             num = '';
@@ -187,7 +188,7 @@ $(document).ready(() => {
                             base = '';
                         }
                         // const node = this.nodeReg.exec(subExpr);
-                        const node = subExpr.match(this.nodeReg);
+                        const node = subExpr.match(this.firstNodeReg);
                         param.push({type: 'node', value: node[0]});
                         i = i + node[0].length - 1;
                     } else if (/^[a-z]/.test(expr[i])) {
@@ -287,6 +288,7 @@ $(document).ready(() => {
                     }
                     if (p.type === 'left') {
                         iLeftCount += 1;
+                        // if (i !== 0 && (param[i-1].type !== 'calc' || param[i-1].type !== 'left'))
                         if (i !== 0 && param[i-1].type !== 'calc')
                             return [false, '输入的表达式非法:(前应有运算符'];
                     }
@@ -510,6 +512,19 @@ $(document).ready(() => {
                 colWidth: true,
             },
             pos: SpreadJsObj.getObjPos($('#pay-spread')[0]),
+            getColor: function (sheet, data, row, col, defaultColor) {
+                if (!data) return defaultColor;
+
+                if (data.expr && data.expr.indexOf('#ref!') >= 0) {
+                    return spreadColor.pay.expr_err;
+                } else if (data.is_pause) {
+                    return '#f2f2f2';
+                } else if (data.create_phase_order > 1 && data.create_phase_order === phasePay.phase_order) {
+                    return '#FFFFE1';
+                } else {
+                    return defaultColor;
+                }
+            }
         };
         sjsSettingObj.setFxTreeStyle(spreadSetting, sjsSettingObj.FxTreeStyle.phasePay);
         SpreadJsObj.initSheet(sheet, spreadSetting);

+ 7 - 4
app/public/js/revise.js

@@ -1945,6 +1945,7 @@ $(document).ready(() => {
                 settle: {type: 'warning', msg: '计量单元已结算,不可修改台账数据,已过滤'},
             };
             const lastOrder = sortData.length > 0 ? sortData[sortData.length - 1].porder + 1 : 1;
+            let filterExprFields = [];
             for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
                 let bPaste = true;
                 const curRow = info.cellRange.row + iRow;
@@ -1953,6 +1954,9 @@ $(document).ready(() => {
                     const curCol = info.cellRange.col + iCol;
                     const colSetting = info.sheet.zh_setting.cols[curCol];
                     if (!colSetting) continue;
+                    const checkExprInfo = getExprInfo(colSetting.field);
+                    if (checkExprInfo) filterExprFields.push(checkExprInfo.expr);
+                    if (filterExprFields.indexOf(colSetting.field) >= 0) continue;
 
                     posData[colSetting.field] = colSetting.wordWrap ? info.sheet.getText(curRow, curCol) : trimInvalidChar(info.sheet.getText(curRow, curCol));
                     if (posData.id && colSetting.type === 'Number' && sortData[curRow].settle_status === settleStatus.finish) {
@@ -1961,16 +1965,15 @@ $(document).ready(() => {
                         continue;
                     }
                     if (colSetting.type === 'Number') {
+                        const exprInfo = getExprInfo(colSetting.field);
                         const num = _.toNumber(posData[colSetting.field]);
                         if (num) {
                             posData[colSetting.field] = num;
+                            if (exprInfo) posData[exprInfo.expr] = '';
                         } else {
                             try {
+                                if (exprInfo) posData[exprInfo.expr] = posData[colSetting.field];
                                 posData[colSetting.field] = ZhCalc.mathCalcExpr(transExpr(posData[colSetting.field]));
-                                const exprInfo = getExprInfo(colSetting.field);
-                                if (exprInfo) {
-                                    posData[exprInfo.expr] = trimInvalidChar(info.sheet.getText(curRow, curCol));
-                                }
                             } catch (err) {
                                 toastMessageUniq(hint.expr);
                                 bPaste = false;

+ 1 - 1
app/service/phase_pay_detail.js

@@ -472,7 +472,7 @@ class PhasePayDetail extends TreeService {
         const insertData = [];
         for (let i = 1; i <= count ; i++) {
             const data = {
-                tree_id: maxId + i, tree_pid: select.tree_id, tree_order: children.length + 1 + i,
+                tree_id: maxId + i, tree_pid: select.tree_id, tree_order: children.length + i,
                 tree_level: select.tree_level + 1, tree_is_leaf: 1
             };
             data.tree_full_path = select.tree_full_path + '-' + data.tree_id;