From 9e58dddf076547c37c89fccd7725e5ec712c2264 Mon Sep 17 00:00:00 2001 From: Taric Xin Date: Wed, 16 Feb 2022 17:32:07 +0800 Subject: [PATCH] edit --- .../audit-admin/audit-admin.component.ts | 9 +- .../enterprise-audit.component.ts | 96 ++++++++++--------- 2 files changed, 56 insertions(+), 49 deletions(-) diff --git a/src/app/routes/usercenter/components/freight/enterprise-audit/audit-admin/audit-admin.component.ts b/src/app/routes/usercenter/components/freight/enterprise-audit/audit-admin/audit-admin.component.ts index 7ce10374..ba089bb1 100644 --- a/src/app/routes/usercenter/components/freight/enterprise-audit/audit-admin/audit-admin.component.ts +++ b/src/app/routes/usercenter/components/freight/enterprise-audit/audit-admin/audit-admin.component.ts @@ -19,6 +19,7 @@ export class AuditAdminComponent implements OnInit { grid: { span: 20 } } }; + isReadOnly = false; constructor(public msgSrv: NzMessageService, public service: UsermanageService) {} ngOnInit(): void { @@ -35,9 +36,10 @@ export class AuditAdminComponent implements OnInit { initSF(user?: any) { console.log(user); - + this.schema = { properties: { + expand: { type: 'boolean', ui: { hidden: true } }, oldAdminName: { title: '当前管理员', type: 'string', @@ -87,7 +89,10 @@ export class AuditAdminComponent implements OnInit { ui: { placeholder: '审核不通过需要说明原因', widget: 'textarea', - autosize: { minRows: 3, maxRows: 6 } + autosize: { minRows: 3, maxRows: 6 }, + visibleIf: { + expand: (value: boolean) => !this.isReadOnly + } } } } diff --git a/src/app/routes/usercenter/components/freight/enterprise-audit/enterprise-audit.component.ts b/src/app/routes/usercenter/components/freight/enterprise-audit/enterprise-audit.component.ts index 3413ccab..021a2a9e 100644 --- a/src/app/routes/usercenter/components/freight/enterprise-audit/enterprise-audit.component.ts +++ b/src/app/routes/usercenter/components/freight/enterprise-audit/enterprise-audit.component.ts @@ -67,44 +67,46 @@ export class FreightComponentsEnterpriseAuditComponent implements OnInit { /** * 查看详情 */ - ViewAdimin(record: any) { + ViewAdimin(record: any, isReadOnly = false) { const modal = this.modal.create({ nzContent: AuditAdminComponent, - nzComponentParams: { i: { ...record } }, - nzFooter: [ - { - label: '驳回', - type: 'primary', - onClick: instance => { - if (!instance?.sf.value.approvalOpinion) { - this.service.msgSrv.warning('请填写备注'); - return false; + nzComponentParams: { i: { ...record }, isReadOnly }, + nzFooter: isReadOnly + ? [] + : [ + { + label: '驳回', + type: 'primary', + onClick: instance => { + if (!instance?.sf.value.approvalOpinion) { + this.service.msgSrv.warning('请填写备注'); + return false; + } + this.adminAuditUser( + { + id: record.id, + approvalStatus: '30', + approvalOpinion: instance?.sf.value.approvalOpinion + }, + modal + ); + return; + } + }, + { + label: '通过', + type: 'primary', + onClick: () => { + this.adminAuditUser( + { + id: record.id, + approvalStatus: '20' + }, + modal + ); + } } - this.adminAuditUser( - { - id: record.id, - approvalStatus: '30', - approvalOpinion: instance?.sf.value.approvalOpinion - }, - modal - ); - return; - } - }, - { - label: '通过', - type: 'primary', - onClick: () => { - this.adminAuditUser( - { - id: record.id, - approvalStatus: '20' - }, - modal - ); - } - } - ] + ] }); modal.afterClose.subscribe(res => { // this.st.load(1); @@ -175,12 +177,7 @@ export class FreightComponentsEnterpriseAuditComponent implements OnInit { fixed: 'right', width: '180px', className: 'text-center', - buttons: [ - { text: '查看', - click: _record => this.View(_record), - acl: { ability: ['USERCENTER-FREIGHT-ENTERPRISE-view'] }, - } - ] + buttons: [{ text: '查看', click: _record => this.View(_record), acl: { ability: ['USERCENTER-FREIGHT-ENTERPRISE-view'] } }] } ]; } @@ -209,12 +206,17 @@ export class FreightComponentsEnterpriseAuditComponent implements OnInit { fixed: 'right', width: '180px', className: 'text-center', - buttons: [{ - text: '审核', - click: _record => this.ViewAdimin(_record), - iif: (item: any) => item.approvalStatus === 10, - acl: { ability: ['USERCENTER-FREIGHT-LIST-audit'] }, - }] + buttons: [ + { + text: '审核', + click: _record => this.ViewAdimin(_record), + iif: (item: any) => item.approvalStatus === 10 + }, + { + text: '查看', + click: _record => this.ViewAdimin(_record, true) + } + ] } ]; }