优化域名解析列表页排版
This commit is contained in:
parent
41412190ef
commit
88e8491720
@ -3,8 +3,6 @@
|
|||||||
<!-- 标题和操作按钮 -->
|
<!-- 标题和操作按钮 -->
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<div>
|
<div>
|
||||||
<h2 class="text-lg font-medium text-gray-900">DNS解析记录</h2>
|
|
||||||
<p class="mt-1 text-sm text-gray-500">管理域名的DNS解析记录</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<Button
|
<Button
|
||||||
@ -32,7 +30,7 @@
|
|||||||
size="sm"
|
size="sm"
|
||||||
>
|
>
|
||||||
<PlusIcon class="h-4 w-4 mr-1" />
|
<PlusIcon class="h-4 w-4 mr-1" />
|
||||||
添加行
|
添加记录
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -357,7 +355,7 @@ export default {
|
|||||||
dnsRecords: [],
|
dnsRecords: [],
|
||||||
pagination: {
|
pagination: {
|
||||||
pageno: 1,
|
pageno: 1,
|
||||||
limit: 5,
|
limit: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
pagecount: 0
|
pagecount: 0
|
||||||
},
|
},
|
||||||
@ -387,11 +385,15 @@ export default {
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (response.status === 'success' && response.data) {
|
if (response.status === 'success' && response.data) {
|
||||||
// 为每个记录添加编辑状态
|
// 为每个记录添加编辑状态
|
||||||
this.dnsRecords = (response.data.items || []).map(record => ({
|
const records = (response.data.items || []).map(record => ({
|
||||||
...record,
|
...record,
|
||||||
editing: false,
|
editing: false,
|
||||||
isNew: false
|
isNew: false
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// 按类型排序
|
||||||
|
this.dnsRecords = this.sortRecordsByType(records);
|
||||||
|
|
||||||
this.pagination = {
|
this.pagination = {
|
||||||
pageno: response.data.pageno || 1,
|
pageno: response.data.pageno || 1,
|
||||||
limit: response.data.limit || 20,
|
limit: response.data.limit || 20,
|
||||||
@ -456,7 +458,7 @@ export default {
|
|||||||
|
|
||||||
// 添加新行
|
// 添加新行
|
||||||
addNewRow() {
|
addNewRow() {
|
||||||
this.dnsRecords.push({
|
const newRecord = {
|
||||||
id: null, // 新增记录没有ID
|
id: null, // 新增记录没有ID
|
||||||
item: '',
|
item: '',
|
||||||
type: 'A',
|
type: 'A',
|
||||||
@ -466,7 +468,11 @@ export default {
|
|||||||
level: 10,
|
level: 10,
|
||||||
editing: true, // 新增记录直接进入编辑模式
|
editing: true, // 新增记录直接进入编辑模式
|
||||||
isNew: 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() {
|
getVisiblePages() {
|
||||||
const current = this.pagination.pageno;
|
const current = this.pagination.pageno;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user