diff --git a/src/app/system-management/file-of-license/file-of-license.component.html b/src/app/system-management/file-of-license/file-of-license.component.html index 34d528c..75f0d11 100644 --- a/src/app/system-management/file-of-license/file-of-license.component.html +++ b/src/app/system-management/file-of-license/file-of-license.component.html @@ -9,7 +9,7 @@
add-update-of-license works!
+edit-update-of-license works!
+update-of-license works!
+ \ No newline at end of file diff --git a/src/app/system-management/update-of-license/update-of-license.component.scss b/src/app/system-management/update-of-license/update-of-license.component.scss index e69de29..2c00b6f 100644 --- a/src/app/system-management/update-of-license/update-of-license.component.scss +++ b/src/app/system-management/update-of-license/update-of-license.component.scss @@ -0,0 +1,57 @@ +.licenseBox { + width: 100%; + height: 100%; + background: #FFFFFF; + box-sizing: border-box; + padding: 20px; + overflow: hidden; + display: flex; + flex-direction: column; + + tbody { + tr { + td { + span { + margin-right: 18px; + } + } + + td:nth-child(1) { + padding-left: 40px; + } + } + + .operation { + a { + color: #2399FF; + margin-right: 8px; + } + + a:last-child { + color: rgba(0, 13, 33, 0.48); + } + } + + } +} + +.topbox { + width: 100%; + height: 36px; + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 12px; + + .lefttop { + span { + color: #000D21; + } + } +} + +.tablebox { + flex: 1; + overflow-y: auto; + +} diff --git a/src/app/system-management/update-of-license/update-of-license.component.ts b/src/app/system-management/update-of-license/update-of-license.component.ts index 3ce9e84..4517a3e 100644 --- a/src/app/system-management/update-of-license/update-of-license.component.ts +++ b/src/app/system-management/update-of-license/update-of-license.component.ts @@ -1,4 +1,10 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, TemplateRef, ViewContainerRef } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { NzModalService } from 'ng-zorro-antd/modal'; +import { NzMessageService } from 'ng-zorro-antd/message'; +import { HttpClient } from '@angular/common/http'; +import { AddUpdateOfLicenseComponent } from './add-update-of-license/add-update-of-license.component'; +import { EditUpdateOfLicenseComponent } from './edit-update-of-license/edit-update-of-license.component'; @Component({ selector: 'app-update-of-license', @@ -7,9 +13,127 @@ import { Component, OnInit } from '@angular/core'; }) export class UpdateOfLicenseComponent implements OnInit { - constructor() { } + constructor(private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient) { } ngOnInit(): void { + this.getLicense() } + listOfData: any[] = []; + + //获取证照列表 + isLoading = false + getLicense() { + this.isLoading = true + let params = { + SkipCount: '0', + MaxResultCount: '999' + } + this.http.get('/api/services/app/ValidityLicenseType/GetAll', { + params: params + }).subscribe((data: any) => { + console.log('证照列表', data.result.items) + this.isLoading = false + this.listOfData = data.result.items + }) + } + + addRole(): void { + const modal = this.modal.create({ + nzTitle: '新增证照', + nzContent: AddUpdateOfLicenseComponent, + nzViewContainerRef: this.viewContainerRef, + nzWidth: 588, + nzComponentParams: {}, + nzOnOk: async () => { + if (instance.validateForm.valid) { + await new Promise(resolve => { + console.log('表单信息', instance.validateForm) + let body = { + licenseName: instance.validateForm.value.name, + handleRemindDays: instance.validateForm.value.handleRemindDays, + closingRemindDays: instance.validateForm.value.closingRemindDays + } + this.http.post('/api/services/app/ValidityLicenseType/Create', body).subscribe(data => { + resolve(data) + this.message.create('success', '创建成功!'); + this.getLicense() + return true + }) + }) + } else { + this.message.create('warning', '请填写完整!'); + return false + } + } + }); + const instance = modal.getContentComponent(); + modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!')); + // Return a result when closed + modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result)); + } + + + edit(item) { + const modal = this.modal.create({ + nzTitle: '编辑证照', + nzContent: EditUpdateOfLicenseComponent, + nzViewContainerRef: this.viewContainerRef, + nzWidth: 588, + nzComponentParams: { + data: item + }, + nzOnOk: async () => { + if (instance.validateForm.valid) { + await new Promise(resolve => { + console.log('表单信息', instance.validateForm) + let body = { + id: item.id, + licenseName: instance.validateForm.value.name, + handleRemindDays: instance.validateForm.value.handleRemindDays, + closingRemindDays: instance.validateForm.value.closingRemindDays + } + this.http.put('/api/services/app/ValidityLicenseType/Update', body).subscribe(data => { + resolve(data) + this.message.create('success', '修改成功!'); + this.getLicense() + return true + }) + }) + } else { + this.message.create('warning', '请填写完整!'); + return false + } + } + }); + const instance = modal.getContentComponent(); + modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!')); + // Return a result when closed + modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result)); + } + + delete(item) { + console.log(item) + this.modal.confirm({ + nzTitle: `确定要删除${item.licenseName}这个证照吗?`, + nzOkText: '确定', + nzOkType: 'danger', + nzOnOk: () => { + this.http.delete('/api/services/app/ValidityLicenseType/Delete', { + params: { + Id: item.id + } + }).subscribe(data => { + this.message.create('success', '删除成功!'); + this.getLicense() + }) + }, + nzCancelText: '取消', + nzOnCancel: () => { + + } + }); + } + + } diff --git a/src/theme.less b/src/theme.less index 1891a40..eb9a8eb 100644 --- a/src/theme.less +++ b/src/theme.less @@ -505,7 +505,8 @@ #userBox, #roleBox, #hostbox, -#licenseBox { +#licenseBox, +#licenseBox2 { .ant-table-thead>tr>th { background: rgba(145, 204, 255, 0.15); }