Browse Source

fix: 信息价空数据ai填值后操作bug

vian 8 months ago
parent
commit
f546e3dfb5
1 changed files with 9 additions and 5 deletions
  1. 9 5
      web/maintain/price_info_lib/js/priceEmpty.js

+ 9 - 5
web/maintain/price_info_lib/js/priceEmpty.js

@@ -115,7 +115,7 @@ const EMPTY_BOOK = (() => {
   }
 
   // 编辑处理
-  async function handleEdit(changedCells, diffMap, needRefresh) {
+  async function handleEdit(changedCells, diffMap, needRefresh, saveAll) {
     const postData = []; // 请求用
     // 更新缓存用
     const updateData = [];
@@ -130,7 +130,7 @@ const EMPTY_BOOK = (() => {
             if (diffMap) {
               diffData = diffMap[row];
             } else {
-              diffData = getRowDiffData(rowData, cache[row], setting.header);
+              diffData = saveAll ? getRowAllData(rowData, setting.header) : getRowDiffData(rowData, cache[row], setting.header);
             }
             if (diffData) {
               // 改一行, 实际可能是改多行,表格一行数据是多行合并显示的
@@ -158,7 +158,9 @@ const EMPTY_BOOK = (() => {
         }
       });
       if (postData.length) {
-        $.bootstrapLoading.start();
+        if (!saveAll) {
+          $.bootstrapLoading.start();
+        }
         await ajaxPost('/priceInfo/editPriceData', { postData }, TIME_OUT);
         // 更新缓存,先更新然后删除,最后再新增,防止先新增后缓存数据的下标与更新、删除数据的下标对应不上
         updateData.forEach(item => {
@@ -198,7 +200,9 @@ const EMPTY_BOOK = (() => {
         if (deleteData.length || insertData.length || needRefresh) {
           showData(workBookObj.sheet, cache, setting.header);
         }
-        $.bootstrapLoading.end();
+        if (!saveAll) {
+          $.bootstrapLoading.end();
+        }
         CLASS_BOOK.reload();
       }
     } catch (err) {
@@ -469,7 +473,7 @@ const EMPTY_BOOK = (() => {
       let percent = 0;
       const step = 100 / (chunks.length || 1);
       for (const chunk of chunks) {
-        await handleEdit(chunk);
+        await handleEdit(chunk, undefined, undefined, true);
         percent += parseInt(`${step}`);
         $("#progress_modal_bar").css('width', `${percent}%`);
         await setTimeoutSync(200);