diff --git a/src/app/view/admin/admin-link/admin-link.component.html b/src/app/view/admin/admin-link/admin-link.component.html
index ff5ff8d..664abab 100644
--- a/src/app/view/admin/admin-link/admin-link.component.html
+++ b/src/app/view/admin/admin-link/admin-link.component.html
@@ -1,36 +1,18 @@
-
+
+
-
-
+
+
+
+
+
+ {{value}}
+ {{value}}
= new PageList();
- loading: boolean = true;
- pageIndex: number = 1;
- pageSize: number = 10;
+
modalVisible: boolean = false;
modalTitle: string = '';
formGroup: FormGroup;
-
- getLinks = () => this.apiService.adminLinks(this.pageSize, this.pageIndex).subscribe({
- next: data => this.pageList = data.result,
- error: () => this.loading = false,
- complete: () => this.loading = false,
- })
+ request: RequestObj;
+ @ViewChild('commonTableComponent') commonTableComponent: CommonTableComponent
+ headData: Data[];
ngOnInit(): void {
- this.getLinks();
+ this.request = {
+ path: '/admin/links',
+ method: 'GET',
+ queryParam: {
+ count: 10,
+ page: 1
+ }
+ }
+ this.headData = [
+ {title: '主键', fieldValue: 'id', show: false, primaryKey: true},
+ {title: '友链名称', fieldValue: 'name', show: true},
+ {title: '友链地址', fieldValue: 'url', show: true},
+ {title: '是否可见', fieldValue: 'open', show: true},
+ {title: '描述', fieldValue: 'desc', show: false},
+ {title: '图标', fieldValue: 'iconPath', show: false},
+ {title: '状态', fieldValue: 'delete', show: true},
+ {
+ title: '操作', fieldValue: '', show: true, isActionColumns: true, action: [
+ {name: '访问', click: (data) => window.open(data.url)},
+ {name: '编辑', click: (data) => this.showEdit(data)},
+ {name: '删除', color: 'red', needConfirm: true, click: (data) => this.delete(data.id)},
+ ]
+ },
+ ];
}
delete(id: number) {
this.apiService.deleteLink(id).subscribe({
next: data => {
this.messageService.success('删除成功');
- this.getLinks();
+ this.commonTableComponent.getData();
},
error: () => {
- this.loading = false;
this.messageService.error('删除失败');
},
- complete: () => this.loading = false,
+ complete: () => null,
})
}
@@ -84,7 +101,7 @@ export class AdminLinkComponent implements OnInit {
observable.subscribe({
next: data => this.messageService.success('操作成功'),
error: err => this.messageService.error('操作失败,' + err.msg),
- complete: () => this.getLinks()
+ complete: () => this.commonTableComponent.getData()
})
}
diff --git a/src/app/view/admin/admin-link/admin-link.module.ts b/src/app/view/admin/admin-link/admin-link.module.ts
index d69b05a..5c78133 100644
--- a/src/app/view/admin/admin-link/admin-link.module.ts
+++ b/src/app/view/admin/admin-link/admin-link.module.ts
@@ -2,16 +2,9 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {RouterModule} from '@angular/router';
import {AdminLinkComponent} from './admin-link.component';
-import {
- NzButtonModule,
- NzCardModule,
- NzDividerModule,
- NzFormModule, NzIconModule, NzInputModule,
- NzModalModule,
- NzPopconfirmModule, NzSelectModule,
- NzTableModule
-} from 'ng-zorro-antd';
-import {ReactiveFormsModule} from '@angular/forms';
+import {CommonTableModule} from '../components/common-table/common-table.module';
+import {NzCheckboxModule, NzFormModule, NzInputModule, NzModalModule, NzSelectModule, NzTagModule} from 'ng-zorro-antd';
+import {FormsModule, ReactiveFormsModule} from '@angular/forms';
@NgModule({
@@ -21,17 +14,16 @@ import {ReactiveFormsModule} from '@angular/forms';
imports: [
CommonModule,
RouterModule.forChild([{path: '', component: AdminLinkComponent}]),
- NzCardModule,
- NzTableModule,
- NzDividerModule,
- NzPopconfirmModule,
+ CommonTableModule,
+ NzCheckboxModule,
NzModalModule,
+ FormsModule,
NzFormModule,
ReactiveFormsModule,
NzInputModule,
NzSelectModule,
- NzButtonModule,
- NzIconModule
+ NzTagModule,
+
]
})
export class AdminLinkModule {