fix: Issues #242 done.

This commit is contained in:
chiayin
2024-03-05 16:07:22 +08:00
parent 50ff27f377
commit d333453578

View File

@@ -202,7 +202,9 @@ export default {
*/
updateValidationData(data) {
const nameOccurrences = {};
const noSortedRepeatedData = []; // 未排序的重複選擇的 data
let selectedData = [] // 已經選擇的 data
this.informData = []; // 尚未選擇的 data
this.repeatedData = []; // 重複選擇的 data
@@ -213,7 +215,10 @@ export default {
// 'Not Assigned'、'Case Attribute' 不列入驗證
if(!code || code === 'case_attributes') return;
nameOccurrences[name]++;
this.repeatedData.push(item);
// 重複的選項只出現一次
nameOccurrences[name] === 2 ? noSortedRepeatedData.push(item) : false;
// 要按照選單的順序排序
this.repeatedData = this.columnType.filter(column => noSortedRepeatedData.includes(column));
}else {
nameOccurrences[name] = 1;
selectedData.push(name);