edit
This commit is contained in:
@ -2,23 +2,9 @@
|
||||
<div class="modal-title">{{ i.id === 0 ? '添加员工' : '编辑员工' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<sf #sf [ui]="ui" [schema]="schema" [button]="'none'">
|
||||
<ng-template sf-template="account" let-me let-ui="ui" let-schema="schema">
|
||||
<sv-container labelWidth="1">
|
||||
<sv label="">
|
||||
<div class="staffBox">
|
||||
<!-- <img [src]="i.avatar" alt="" /> -->
|
||||
<dl>
|
||||
<!-- <dt>{{ i.name }}</dt> -->
|
||||
<dd>{{ i.phone }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</sv>
|
||||
</sv-container>
|
||||
</ng-template>
|
||||
</sf>
|
||||
<sf #sf [ui]="ui" [schema]="schema" [button]="'none'"></sf>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button nz-button type="button" (click)="close()">取消</button>
|
||||
<button nz-button type="button" nzType="primary" (click)="sure()" [disabled]="!sf.valid">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -8,8 +8,7 @@ import { SystemService } from '../../../services/system.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-system-add',
|
||||
templateUrl: './staff-modal.component.html',
|
||||
styleUrls: ['./staff-modal.less']
|
||||
templateUrl: './staff-modal.component.html'
|
||||
})
|
||||
export class SystemStaffStaffModalComponent implements OnInit {
|
||||
@ViewChild('sf', { static: false })
|
||||
@ -17,20 +16,12 @@ export class SystemStaffStaffModalComponent implements OnInit {
|
||||
i: any;
|
||||
schema!: SFSchema;
|
||||
ui!: SFUISchema;
|
||||
roleList = [];
|
||||
roleNames: any = [];
|
||||
constructor(private modal: NzModalRef, public msgSrv: NzMessageService, public service: SystemService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.i?.userId !== 0) {
|
||||
// this.i.roleIds = this.i.roleId !== '' ? this.i.roleId.split(',') : [];
|
||||
}
|
||||
|
||||
this.initSF(this.i);
|
||||
}
|
||||
initSF(staff: any) {
|
||||
console.log(staff);
|
||||
|
||||
this.schema = {
|
||||
properties: {
|
||||
staffName: {
|
||||
@ -59,10 +50,11 @@ export class SystemStaffStaffModalComponent implements OnInit {
|
||||
asyncData: () => {
|
||||
return this.service.request(this.service.$api_getAppRoleList).pipe(
|
||||
map((res: any) => {
|
||||
this.roleList = res;
|
||||
return res.map((item: any) => {
|
||||
return { label: item.roleName, value: item.id };
|
||||
});
|
||||
return res
|
||||
.filter((role: any) => role.roleCode !== 'Administrator')
|
||||
.map((item: any) => {
|
||||
return { label: item.roleName, value: item.id };
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
@ -81,10 +73,10 @@ export class SystemStaffStaffModalComponent implements OnInit {
|
||||
}
|
||||
|
||||
sure() {
|
||||
// if (!this.sf.value.roleIds || this.sf.value.roleIds.length === 0) {
|
||||
// this.service.msgSrv.error('员工角色不能为空!');
|
||||
// return;
|
||||
// }
|
||||
if (!this.sf.value.roleId || this.sf.value.roleId.length === 0) {
|
||||
this.service.msgSrv.error('员工角色不能为空!');
|
||||
return;
|
||||
}
|
||||
if (this.i.userId === 0) {
|
||||
const params: any = {
|
||||
...this.sf.value,
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
.info {
|
||||
width: 100%;
|
||||
margin: 0 auto 10px auto;
|
||||
color: #333;
|
||||
text-indent: 24px;
|
||||
}
|
||||
.staffBox {
|
||||
display: flex;
|
||||
img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
overflow: hidden;
|
||||
border-radius: 50px;
|
||||
}
|
||||
dl {
|
||||
margin: 0 0 0 5px;
|
||||
dt {
|
||||
font-size: 14px;
|
||||
line-height: 28px;
|
||||
}
|
||||
dd {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user