Kaynağa Gözat

台账分解、修订,复制粘贴,过滤名称为空并 提示

MaiXinRong 3 yıl önce
ebeveyn
işleme
394b34ece2
2 değiştirilmiş dosya ile 24 ekleme ve 8 silme
  1. 14 3
      app/public/js/ledger.js
  2. 10 5
      app/public/js/revise.js

+ 14 - 3
app/public/js/ledger.js

@@ -1845,7 +1845,7 @@ $(document).ready(function() {
                 const data = {};
                 if (col.field === 'name') {
                     if (newText === '' && posData) {
-                        toastr.error('部位名称不可为空');
+                        toastr.error('计量单元名称不可为空');
                         SpreadJsObj.reLoadRowData(info.sheet, info.row);
                         return;
                     } else if (!posData) {
@@ -2013,6 +2013,10 @@ $(document).ready(function() {
                 return;
             }
 
+            const hint = {
+                name: {type: 'warning', msg: '计量单元名称不可为空,已过滤'},
+                expr: {type: 'warning', msg: '粘贴了表达式非法,已过滤'},
+            };
             if (info.sheet.zh_setting) {
                 const data = [];
                 const sortData = info.sheet.zh_data || [];
@@ -2048,11 +2052,18 @@ $(document).ready(function() {
                                         posData[exprInfo.expr] = trimInvalidChar(info.sheet.getText(curRow, curCol));
                                     }
                                     bPaste = true;
-                                } catch(err) {
+                                } catch (err) {
                                     delete posData[colSetting.field];
-                                    toastr.warning('粘贴了表达式非法,已过滤');
+                                    toastMessageUniq(hint.expr);
                                 }
                             }
+                        } else if (colSetting.field === 'name') {
+                            if (!posData[colSetting.field]) {
+                                delete posData[colSetting.field];
+                                toastMessageUniq(hint.name);
+                            } else {
+                                bPaste = true;
+                            }
                         } else {
                             bPaste = true;
                         }

+ 10 - 5
app/public/js/revise.js

@@ -1683,7 +1683,10 @@ $(document).ready(() => {
                     return;
                 }
             }
-            let bHint = false;
+            const hint = {
+                name: {type: 'warning', msg: '计量单元名称不可为空,已过滤'},
+                expr: {type: 'warning', msg: '粘贴了表达式非法,已过滤'},
+            };
             const lastOrder = sortData.length > 0 ? sortData[sortData.length - 1].porder + 1 : 1;
             for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
                 let bPaste = true;
@@ -1707,13 +1710,15 @@ $(document).ready(() => {
                                     posData[exprInfo.expr] = trimInvalidChar(info.sheet.getText(curRow, curCol));
                                 }
                             } catch (err) {
-                                if (!bHint) {
-                                    toastr.warning('粘贴了非法表达式,已过滤');
-                                    bHint = true;
-                                }
+                                toastMessageUniq(hint.expr);
                                 bPaste = false;
                             }
                         }
+                    } else if (colSetting.field === 'name') {
+                        if (!posData[colSetting.field]) {
+                            toastMessageUniq(hint.name);
+                            bPaste = false;
+                        }
                     }
                 }
                 if (bPaste) {