diff --git a/dashboard/src2/components/JsiteDomainDNSRecords.vue b/dashboard/src2/components/JsiteDomainDNSRecords.vue index f4cfcb8..5f98d6a 100644 --- a/dashboard/src2/components/JsiteDomainDNSRecords.vue +++ b/dashboard/src2/components/JsiteDomainDNSRecords.vue @@ -3,8 +3,6 @@
-

DNS解析记录

-

管理域名的DNS解析记录

@@ -357,7 +355,7 @@ export default { dnsRecords: [], pagination: { pageno: 1, - limit: 5, + limit: 10, total: 0, pagecount: 0 }, @@ -387,11 +385,15 @@ export default { this.loading = false; if (response.status === 'success' && response.data) { // 为每个记录添加编辑状态 - this.dnsRecords = (response.data.items || []).map(record => ({ + const records = (response.data.items || []).map(record => ({ ...record, editing: false, isNew: false })); + + // 按类型排序 + this.dnsRecords = this.sortRecordsByType(records); + this.pagination = { pageno: response.data.pageno || 1, limit: response.data.limit || 20, @@ -456,7 +458,7 @@ export default { // 添加新行 addNewRow() { - this.dnsRecords.push({ + const newRecord = { id: null, // 新增记录没有ID item: '', type: 'A', @@ -466,7 +468,11 @@ export default { level: 10, editing: true, // 新增记录直接进入编辑模式 isNew: true - }); + }; + + // 添加新记录并重新排序 + this.dnsRecords.push(newRecord); + this.dnsRecords = this.sortRecordsByType(this.dnsRecords); }, // 编辑记录 @@ -715,6 +721,15 @@ export default { + // 按类型排序DNS记录 + sortRecordsByType(records) { + return records.sort((a, b) => { + const typeA = a.type || ''; + const typeB = b.type || ''; + return typeA.localeCompare(typeB); + }); + }, + // 获取可见的页码 getVisiblePages() { const current = this.pagination.pageno;