|
|
@@ -52,6 +52,8 @@ const CHAR_MAP: Record<string, Record<string, string>> = {
|
|
|
},
|
|
|
};
|
|
|
|
|
|
+const MARKET_TYPE_ORDER = ['2', '1', '0'];
|
|
|
+
|
|
|
const clients = ref<SyncClient[]>([]);
|
|
|
const loading = ref(false);
|
|
|
const autoRefresh = ref(true);
|
|
|
@@ -193,6 +195,23 @@ const sortGroupEntries = (entries: Array<[string, SyncClient[]]>) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const sortMarketEntries = (entries: Array<[string, SyncClient[]]>) => {
|
|
|
+ return entries.sort(([keyA], [keyB]) => {
|
|
|
+ const indexA = MARKET_TYPE_ORDER.indexOf(keyA);
|
|
|
+ const indexB = MARKET_TYPE_ORDER.indexOf(keyB);
|
|
|
+ if (indexA >= 0 && indexB >= 0) {
|
|
|
+ return indexA - indexB;
|
|
|
+ }
|
|
|
+ if (indexA >= 0) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ if (indexB >= 0) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ return keyA.localeCompare(keyB, 'zh-CN', { numeric: true });
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
const sortClientsByGroupSequence = (items: SyncClient[]) => {
|
|
|
return [...items].sort((a, b) => {
|
|
|
const sequenceA = getGroupKey(a.groupSequence);
|
|
|
@@ -207,29 +226,45 @@ const sortClientsByGroupSequence = (items: SyncClient[]) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const createPlatformRows = (items: SyncClient[], keyPrefix: string) => {
|
|
|
+ const platformGroups = groupByField(items, 'platform');
|
|
|
+ return sortGroupEntries(Object.entries(platformGroups)).map(([platform, platformItems]) => {
|
|
|
+ return createGroupRow(
|
|
|
+ 'platform',
|
|
|
+ `${keyPrefix}:platform:${platform}`,
|
|
|
+ getGroupTitle('platform', platform === '__empty__' ? undefined : platform),
|
|
|
+ platformItems,
|
|
|
+ sortClientsByGroupSequence(platformItems).map(createClientRow),
|
|
|
+ );
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
const groupedClients = computed<SyncClientRow[]>(() => {
|
|
|
- const marketGroups = groupByField(clients.value, 'marketType');
|
|
|
+ const listClients = clients.value.filter(item => String(item.dataType) === '1');
|
|
|
+ const marketClients = clients.value.filter(item => String(item.dataType) !== '1');
|
|
|
+ const rows: SyncClientRow[] = [];
|
|
|
+
|
|
|
+ if (listClients.length) {
|
|
|
+ rows.push(createGroupRow(
|
|
|
+ 'dataType',
|
|
|
+ 'data:1',
|
|
|
+ getGroupTitle('dataType', '1'),
|
|
|
+ listClients,
|
|
|
+ createPlatformRows(listClients, 'data:1'),
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
+ const marketGroups = groupByField(marketClients, 'marketType');
|
|
|
|
|
|
- return sortGroupEntries(Object.entries(marketGroups)).map(([marketType, marketItems]) => {
|
|
|
+ const marketRows = sortMarketEntries(Object.entries(marketGroups)).map(([marketType, marketItems]) => {
|
|
|
const dataGroups = groupByField(marketItems, 'dataType');
|
|
|
const dataChildren = sortGroupEntries(Object.entries(dataGroups)).map(([dataType, dataItems]) => {
|
|
|
- const platformGroups = groupByField(dataItems, 'platform');
|
|
|
- const platformChildren = sortGroupEntries(Object.entries(platformGroups)).map(([platform, platformItems]) => {
|
|
|
- return createGroupRow(
|
|
|
- 'platform',
|
|
|
- `market:${marketType}:data:${dataType}:platform:${platform}`,
|
|
|
- getGroupTitle('platform', platform === '__empty__' ? undefined : platform),
|
|
|
- platformItems,
|
|
|
- sortClientsByGroupSequence(platformItems).map(createClientRow),
|
|
|
- );
|
|
|
- });
|
|
|
-
|
|
|
return createGroupRow(
|
|
|
'dataType',
|
|
|
`market:${marketType}:data:${dataType}`,
|
|
|
getGroupTitle('dataType', dataType === '__empty__' ? undefined : dataType),
|
|
|
dataItems,
|
|
|
- platformChildren,
|
|
|
+ createPlatformRows(dataItems, `market:${marketType}:data:${dataType}`),
|
|
|
);
|
|
|
});
|
|
|
|
|
|
@@ -241,6 +276,8 @@ const groupedClients = computed<SyncClientRow[]>(() => {
|
|
|
dataChildren,
|
|
|
);
|
|
|
});
|
|
|
+
|
|
|
+ return [...rows, ...marketRows];
|
|
|
});
|
|
|
|
|
|
const expandedRowKeys = computed(() => {
|