提交代码

pull/1/head
胡锐 2 years ago
parent 38babbd3d9
commit 23aca9dbfe
  1. 19
      src/app/admin/system/system-user/system-user.component.html
  2. 24
      src/app/admin/system/system-user/system-user.component.ts

@ -61,6 +61,7 @@
</tbody>
</nz-table>
</div>
<!--添加添加弹出层-->
<nz-modal [(nzVisible)]="isVisible" nzTitle="添加" nzWidth="40%" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk(validateForm.value)">
<form nz-form [formGroup]="validateForm">
@ -146,6 +147,15 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>通知权限</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<nz-select style="width: 100%;" formControlName="roleId" nzShowSearch nzAllowClear nzPlaceHolder="请选择功能标签">
<nz-option *ngFor="let item of userLabelArray" [nzValue]="item.codeValue" [nzLabel]="item.codeName"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</form>
</nz-modal>
@ -235,5 +245,14 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>通知权限</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<nz-select style="width: 100%;" formControlName="label" nzMode="multiple" nzShowSearch nzAllowClear nzPlaceHolder="请选择功能标签">
<nz-option *ngFor="let item of userLabelArray" [nzValue]="item.codeValue" [nzLabel]="item.codeName"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</form>
</nz-modal>

@ -10,6 +10,7 @@ import {ValidatorsService} from '../../../services/validators.service';
import {LocalStorageService} from '../../../services/local-storage.service';
import {environment} from '../../../../environments/environment';
import { ADMIN_INFO_OBJECT } from '../../../services/local-storage.namespace';
import {CommonsService} from "../../../services/commons.service";
@Component({
selector: 'app-system-user',
@ -52,9 +53,12 @@ export class SystemUserComponent implements OnInit {
// tslint:disable-next-line:variable-name
BTN_systemuser_delete;
userLabelArray = [];
constructor(
private location: PlatformLocation, // 路径
private http: HttpClient, // http请求
private commonsService: CommonsService,
private message: NzMessageService, // 信息提示
private fb: FormBuilder, // 表单
private modalService: NzModalService, // 对话框
@ -85,13 +89,18 @@ export class SystemUserComponent implements OnInit {
loginName: [null, [Validators.required, ValidatorsService.minLength(3), ValidatorsService.maxLength(20)]],
password: [null, [Validators.required, ValidatorsService.minLength(6), ValidatorsService.maxLength(40)]],
telephone: [null],
label: [null],
roleId: [null, [Validators.required]],
});
// 调用请求方法
this.goRequest();
// 调用请求政策下拉列表
this.goRequestpoducetList();
this.goRequestCompanyList();
this.getUserLabel();
}
@ -117,6 +126,13 @@ export class SystemUserComponent implements OnInit {
});
}
// 查询用户标签
getUserLabel() {
this.commonsService.getDictionary('USER_LABEL', data => {
this.userLabelArray = data['return_data'];
});
}
// 获取部门列表
goRequestCompanyList() {
this.http.get(this.WEB_SERVE_URL + '/bsOrganization/getOrganizationList?companyId=' + this.store.get(ADMIN_INFO_OBJECT)['bsCompany'].id).subscribe(data => {
@ -193,6 +209,7 @@ export class SystemUserComponent implements OnInit {
password: value.password,
telephone: value.telephone,
roleId: value.roleId,
labelIdArray: value.label
};
this.isOkLoading = true;
this.http.post(this.WEB_SERVE_URL + '/secUser/addUser', params).subscribe(data => {
@ -246,6 +263,7 @@ export class SystemUserComponent implements OnInit {
this.secUser.password = value.password;
this.secUser.telephone = value.telephone;
this.secUser.roleId = value.roleId;
this.secUser.labelIdArray = value.label;
this.http.post(this.WEB_SERVE_URL + '/secUser/editUser', this.secUser).subscribe(data => {
if (data['return_code'] === '000000') {
@ -262,6 +280,7 @@ export class SystemUserComponent implements OnInit {
// 修改取消按钮
handleCancelEdit(): void {
this.validateForm.reset();
this.isVisibleEdit = false;
}
@ -283,6 +302,11 @@ export class SystemUserComponent implements OnInit {
this.http.get(this.WEB_SERVE_URL + '/secUser/getUserView?userId=' + userId).subscribe(data => {
if (data['return_code'] === '000000') {
this.secUser = data['return_data'];
const labelIdArray = [];
for (const labelId of this.secUser['labelIdArray']) {
labelIdArray.push(String(labelId));
}
this.validateForm.patchValue({ label: labelIdArray});
this.avatarImg = data['return_data']['avatar'];
} else {

Loading…
Cancel
Save