|
@@ -1618,9 +1618,25 @@ function checkChangeFrom() {
|
|
|
if(!checkAuditorFrom ()) {
|
|
|
returnFlag = true;
|
|
|
}
|
|
|
+ // 判断非空白变更清单是否有重复值(gcl_id及mx_id),如果存在完全相同则需要提示并删除,上报失败,这功能主要是因为清单数据过多服务器处理不过来偶然出现
|
|
|
+ const doubleList = findDuplicates(_.filter(changeList, item => item.lid != 0));
|
|
|
+ if (doubleList.length > 0) {
|
|
|
+ for (const double of doubleList) {
|
|
|
+ const msgIndex = [];
|
|
|
+ for (const one of double) {
|
|
|
+ const index = _.findIndex(changeList, { id: one.id });
|
|
|
+ if (index !== -1) msgIndex.push(index+1);
|
|
|
+ }
|
|
|
+ if (msgIndex.length > 0) {
|
|
|
+ toastr.error('第 ' + msgIndex.splice(',') + ' 行变更清单 ' + double[0].code + ' 重复,请只保留一条数据');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ returnFlag = true;
|
|
|
+ }
|
|
|
if (returnFlag) {
|
|
|
return false;
|
|
|
}
|
|
|
+ return false;
|
|
|
}
|
|
|
// 检查上报情况
|
|
|
function checkAuditorFrom () {
|
|
@@ -1634,6 +1650,12 @@ function checkAuditorFrom () {
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
+// 找出数组中相同的清单
|
|
|
+function findDuplicates(arr, keys = ['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);
|
|
|
+}
|
|
|
|
|
|
function tableDataRemake(changeListData) {
|
|
|
$('#table-list-select tr').removeClass('table-warning');
|