Jelajahi Sumber

1. 调用变更令,支持公式运算
2. 其他流程设置至计量期审批,保存审批顺序数据

MaiXinRong 1 tahun lalu
induk
melakukan
d7dcc2fc58
2 mengubah file dengan 31 tambahan dan 6 penghapusan
  1. 30 6
      app/public/js/stage.js
  2. 1 0
      app/service/shenpi_audit.js

+ 30 - 6
app/public/js/stage.js

@@ -411,7 +411,22 @@ $(document).ready(() => {
 
                     const sortData = info.sheet.zh_dataType === 'tree' ? info.sheet.zh_tree.nodes : info.sheet.zh_data;
                     const node = sortData[info.row];
-                    node[col.field] = col.type === 'Number' ? parseFloat(info.editingText) : info.editingText;
+                    if (col.type === 'Number') {
+                        const num = _.toNumber(info.editingText);
+                        if (_.isFinite(num)) {
+                            node[col.field] = num;
+                        } else {
+                            try {
+                                node[col.field] = math.evaluate(transExpr(info.editingText));
+                            } catch(err) {
+                                toastr.error('输入的表达式非法');
+                                SpreadJsObj.reLoadRowData(info.sheet, info.row);
+                                return;
+                            }
+                        }
+                    } else {
+                        node[col.field] = info.editingText;
+                    }
                     // 刷新界面
                     SpreadJsObj.reLoadRowData(info.sheet, info.row, 1);
                 }
@@ -423,7 +438,20 @@ $(document).ready(() => {
                         const curRow = iRow + info.cellRange.row;
                         const curCol = info.cellRange.col;
                         const col = info.sheet.zh_setting.cols[info.cellRange.col];
-                        sortData[curRow][col.field] = col.type === 'Number' ? _.toNumber(info.sheet.getText(curRow, curCol)) : info.sheet.getText(curRow, curCol);
+                        if (col.type === 'Number') {
+                            const num = _.toNumber(info.sheet.getText(curRow, curCol));
+                            if (_.isFinite(num)) {
+                                sortData[curRow][col.field] = num;
+                            } else {
+                                try {
+                                    sortData[curRow][col.field] = math.evaluate(transExpr(info.sheet.getText(curRow, curCol)));
+                                } catch(err) {
+                                    // toastr.error('输入的表达式非法');
+                                }
+                            }
+                        } else {
+                            sortData[curRow][col.field] = info.sheet.getText(curRow, curCol);
+                        }
                     }
                     SpreadJsObj.reLoadRowData(sheet, info.cellRange.row, sel.cellRange.rowCount);
                 }
@@ -998,7 +1026,6 @@ $(document).ready(() => {
             if (posSearch) posSearch.search();
         },
         selectionChanged: function (e, info) {
-            console.log(SpreadJsObj.getSelectObject(info.sheet));
             if (!info.oldSelections || !info.oldSelections[0] || info.newSelections[0].row !== info.oldSelections[0].row) {
                 stageTreeSpreadObj.loadRelaData();
                 // 全选去除
@@ -4177,9 +4204,6 @@ $(document).ready(() => {
                             key: 'less', title: '漏计', valid: true,
                             check: function (node) {
                                 if (node.quantity) {
-                                    if (node.b_code === '204-1-g') {
-                                        console.log(ZhCalc.sub(ZhCalc.sum([node.quantity, node.end_qc_qty, node.end_qc_minus_qty]), node.end_gather_qty));
-                                    }
                                     return ZhCalc.sub(ZhCalc.sum([node.quantity, node.end_qc_qty, node.end_qc_minus_qty]), node.end_gather_qty) > 0;
                                 } else if (node.total_price) {
                                     return ZhCalc.sub(ZhCalc.add(node.total_price, node.end_qc_tp), node.end_gather_tp) > 0;

+ 1 - 0
app/service/shenpi_audit.js

@@ -215,6 +215,7 @@ module.exports = app => {
                                     sp_type: shenpiConst.sp_type[code],
                                     sp_status: shenpi_status,
                                     audit_id: parseInt(aid),
+                                    audit_order: insertList.length + 1,
                                 };
                                 insertList.push(insertData);
                             }