Parcourir la source

修复清单重复判断

ellisran il y a 1 an
Parent
commit
c8f43d69d8
1 fichiers modifiés avec 4 ajouts et 3 suppressions
  1. 4 3
      app/public/js/change_information_set.js

+ 4 - 3
app/public/js/change_information_set.js

@@ -947,7 +947,7 @@ $(document).ready(() => {
 
             if (hadcid !== 0) gclGatherData[ggd].cid = 1;
         }
-        console.log(gclGatherData);
+        // console.log(gclGatherData);
         // 数组去重
         const dealBillList = result.dealBills;
         for (const db of gclGatherData) {
@@ -959,7 +959,7 @@ $(document).ready(() => {
             }
         }
         changeListData = gclGatherData.concat(dealBillList).sort(sortByCode);
-        // console.log(changeListData);
+        console.log(changeListData);
         // 先加载台账数据
         let listHtml = '';
         let list_index = 1;
@@ -2026,6 +2026,7 @@ function checkChangeFrom() {
     }
     // 判断非空白变更清单是否有重复值(gcl_id及mx_id),如果存在完全相同则需要提示并删除,上报失败,这功能主要是因为清单数据过多服务器处理不过来偶然出现
     const doubleList = findDuplicates(_.filter(changeList, item => item.lid != 0));
+    console.log(doubleList);
     if (doubleList.length > 0) {
         for (const double of doubleList) {
             const msgIndex = [];
@@ -2056,7 +2057,7 @@ function checkAuditorFrom () {
     return true;
 }
 // 找出数组中相同的清单
-function findDuplicates(arr, keys = ['gcl_id', 'mx_id']) {
+function findDuplicates(arr, keys = ['lid', 'gcl_id', 'mx_id']) {
     const groupedData = _.groupBy(arr, item => JSON.stringify(_.pick(item, keys)));
     const duplicates = _.filter(groupedData, group => group.length > 1);
     return _.values(duplicates);