Browse Source

feat: 没数据的时候不进行操作

vian 10 months ago
parent
commit
f7c6273a6e
1 changed files with 8 additions and 2 deletions
  1. 8 2
      web/maintain/price_info_lib/js/priceEmpty.js

+ 8 - 2
web/maintain/price_info_lib/js/priceEmpty.js

@@ -342,6 +342,9 @@ const EMPTY_BOOK = (() => {
           noMatchRows.push(i);
         }
       }
+      if (!changedCells.length) {
+        return;
+      }
       const classCodeCol = setting.header.findIndex(h => h.dataCode === 'classCode');
       const expStringCol = setting.header.findIndex(h => h.dataCode === 'expString');
       const chunks = _.chunk(changedCells, 20);
@@ -426,8 +429,6 @@ const EMPTY_BOOK = (() => {
   // 保存ai填值
   const saveData = async () => {
     try {
-      $.bootstrapLoading.progressStart('保存AI填值', false);
-      $("#progress_modal_body").text('正在保存AI填值,请稍后...');
       await setTimeoutSync(500);
       // 分批保存数据,以免数据库压力过大
       const totalRows = workBookObj.sheet.getRowCount();
@@ -435,6 +436,11 @@ const EMPTY_BOOK = (() => {
       for (let i = 0; i < totalRows; i++) {
         changedCells.push({ row: i });
       }
+      if (!changedCells.length) {
+        return;
+      }
+      $.bootstrapLoading.progressStart('保存AI填值', false);
+      $("#progress_modal_body").text('正在保存AI填值,请稍后...');
       const chunks = _.chunk(changedCells, 100);
       let percent = 0;
       const step = 100 / (chunks.length || 1);