沈斌
2017-12-19 0e1e92f2e14b07942f2d8c21b4d96468322aecfe
updates
4 files modified
32 ■■■■ changed files
src/app/routes/users/installer/edit/edit.component.html 18 ●●●● patch | view | raw | blame | history
src/app/routes/users/installer/edit/edit.component.ts 6 ●●●● patch | view | raw | blame | history
src/app/routes/users/installer/installer.component.html 2 ●●● patch | view | raw | blame | history
src/app/routes/users/installer/installer.component.ts 6 ●●●● patch | view | raw | blame | history
src/app/routes/users/installer/edit/edit.component.html
@@ -1,15 +1,15 @@
<div class="modal-header">
  <div class="modal-title">{{i.id > 0 ? '编辑' : '添加'}}-安装用户</div>
  <div class="modal-title">{{user.id > 0 ? '编辑' : '添加'}}-安装用户</div>
</div>
<form #f="ngForm" (ngSubmit)="save()" nz-form [nzType]="'horizontal'">
  <div nz-form-item nz-row class="mb-sm">
    <div nz-form-label nz-col [nzSpan]="4"><label>姓名</label></div>
    <div nz-form-control nz-col [nzSpan]="8">
      <input nz-input [(ngModel)]="i.name" name="name" maxlength="30" required />
      <input nz-input [(ngModel)]="user.name" name="name" maxlength="30" required />
    </div>
    <div nz-form-label nz-col [nzSpan]="4"><label>性别</label></div>
    <div nz-form-control nz-col [nzSpan]="8">
      <nz-select [(ngModel)]="i.sex" name="sex" required [nzAllowClear]="false">
      <nz-select [(ngModel)]="user.sex" name="sex" required [nzAllowClear]="false">
        <nz-option
          *ngFor="let i of gender"
          [nzLabel]="i"
@@ -21,31 +21,31 @@
  <div nz-form-item nz-row class="mb-sm">
    <div nz-form-label nz-col [nzSpan]="4"><label>账号</label></div>
    <div nz-form-control nz-col [nzSpan]="8">
      <input nz-input [(ngModel)]="i.mobile" name="mobile" maxlength="11" required />
      <input nz-input [(ngModel)]="user.mobile" name="mobile" maxlength="11" required />
    </div>
    <div nz-form-label nz-col [nzSpan]="4"><label>密码</label></div>
    <div nz-form-control nz-col [nzSpan]="8">
      <input nz-input [(ngModel)]="i.password" name="password" maxlength="50" required />
      <input nz-input [(ngModel)]="user.password" name="password" maxlength="50" required />
    </div>
  </div>
  <div nz-form-item nz-row class="mb-sm">
    <div nz-form-label nz-col [nzSpan]="4"><label>电子邮件</label></div>
    <div nz-form-control nz-col [nzSpan]="8">
      <input nz-input [(ngModel)]="i.email" name="email" required />
      <input nz-input [(ngModel)]="user.email" name="email" required />
    </div>
    <div nz-form-label nz-col [nzSpan]="4"><label>微信号</label></div>
    <div nz-form-control nz-col [nzSpan]="8">
      <input nz-input [(ngModel)]="i.weixin" name="weixin" required />
      <input nz-input [(ngModel)]="user.weixin" name="weixin" required />
    </div>
  </div>
  <div nz-form-item nz-row class="mb-sm">
    <div nz-form-label nz-col [nzSpan]="4"><label>组织</label></div>
    <div nz-form-control nz-col [nzSpan]="8">
      <input nz-input [(ngModel)]="i.organization" name="organization" maxlength="50" placeholder="50字以内" />
      <input nz-input [(ngModel)]="user.organization" name="organization" maxlength="50" placeholder="50字以内" />
    </div>
    <div nz-form-label nz-col [nzSpan]="4"><label>昵称</label></div>
    <div nz-form-control nz-col [nzSpan]="8">
      <input nz-input [(ngModel)]="i.nickname" name="nickname" maxlength="20" placeholder="20字以内" />
      <input nz-input [(ngModel)]="user.nickname" name="nickname" maxlength="20" placeholder="20字以内" />
    </div>
  </div>
  <div class="modal-footer">
src/app/routes/users/installer/edit/edit.component.ts
@@ -11,7 +11,7 @@
})
export class UserInstallerEditComponent implements OnInit {
  i: any;
  user: any;
  gender: string[] = [ '男', '女' ];
  constructor(
@@ -21,8 +21,8 @@
    public http: _HttpClient) { }
  ngOnInit() {
    if (this.i.id > 0) {
      this.http.get('./assets/pois.json').subscribe(res => this.i = res.data[0]);
    if (this.user.id > 0) {
      this.http.get('./assets/pois.json').subscribe(res => this.user = res.data[0]);
    }
  }
src/app/routes/users/installer/installer.component.html
@@ -20,7 +20,7 @@
      </div>
      <div nz-col [nzSpan]="8" class="mb-md">
        <button nz-button type="submit" [nzType]="'primary'" [nzLoading]="loading" [nzSize]="'large'">查询</button>
        <button nz-button type="reset" (click)="getData()" [nzSize]="'large'" class="mx-sm">重置</button>
        <button nz-button type="reset" (click)="load(true)" [nzSize]="'large'" class="mx-sm">重置</button>
      </div>
    </div>
  </form>
src/app/routes/users/installer/installer.component.ts
@@ -68,9 +68,9 @@
    });
  }
  edit(i) {
    this.modalHelper.static(UserInstallerEditComponent, { i }).subscribe(() => {
      this.load();
  edit(user) {
    this.modalHelper.static(UserInstallerEditComponent, { user }).subscribe(() => {
      this.load(true);
      this.msgSrv.info('回调,重新发起列表刷新');
    });
  }