优化域名解析列表页排版
This commit is contained in:
parent
41412190ef
commit
88e8491720
@ -3,8 +3,6 @@
|
||||
<!-- 标题和操作按钮 -->
|
||||
<div class="flex items-center justify-between">
|
||||
<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 class="flex gap-2">
|
||||
<Button
|
||||
@ -32,7 +30,7 @@
|
||||
size="sm"
|
||||
>
|
||||
<PlusIcon class="h-4 w-4 mr-1" />
|
||||
添加行
|
||||
添加记录
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user