Commit 6409fdab authored by van.chen's avatar van.chen

修改公司

parent b1809dd1
...@@ -55,9 +55,9 @@ ...@@ -55,9 +55,9 @@
<app-search-select *ngIf="!isUpdate" isMust="true" inModal="true" [label]="'maxRole' | translate" <app-search-select *ngIf="!isUpdate" isMust="true" inModal="true" [label]="'maxRole' | translate"
[(value)]="req.roleNo" optV="roleNo" optL="roleName" [(value)]="req.roleNo" optV="roleNo" optL="roleName"
[data]="roles"></app-search-select> [data]="roles"></app-search-select>
<app-search-select isMust="true" (valueChange)="getCitys()" inModal="true" [label]="'province' | translate" <app-search-select isMust="true" (valueChange)="getCitys($event, '')" inModal="true" [label]="'province' | translate"
[(value)]="req.province" [data]="procs" optL="province" optV="province"></app-search-select> [(value)]="req.province" [data]="procs" optL="province" optV="province"></app-search-select>
<app-search-select isMust="true" (valueChange)="getAreas()" inModal="true" [label]="'city' | translate" <app-search-select isMust="true" (valueChange)="getAreas($event, '')" inModal="true" [label]="'city' | translate"
[(value)]="req.city" [data]="citys" optL="city" optV="city"></app-search-select> [(value)]="req.city" [data]="citys" optL="city" optV="city"></app-search-select>
<app-search-select isMust="true" inModal="true" [label]="'area' | translate" <app-search-select isMust="true" inModal="true" [label]="'area' | translate"
[(value)]="req.area" [data]="areas" optV="area" optL="area"></app-search-select> [(value)]="req.area" [data]="areas" optV="area" optL="area"></app-search-select>
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<ng-template #foot1> <ng-template #foot1>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel()"> <button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel()">
<span>{{'cancel' | translate}}</span></button> <span>{{'cancel' | translate}}</span></button>
<button nz-button class="searchBtn" nzType="primary" [nzLoading]="isLoading" (click)="save('req')"> <button nz-button class="searchBtn" nzType="primary" [nzLoading]="isLoading" (click)="save()">
<span>{{'confirm' | translate}}</span></button> <span>{{'confirm' | translate}}</span></button>
</ng-template> </ng-template>
</nz-modal> </nz-modal>
...@@ -42,6 +42,7 @@ export class CompanyComponent implements OnInit { ...@@ -42,6 +42,7 @@ export class CompanyComponent implements OnInit {
this.data = data; this.data = data;
} else if (data.code === 1) { } else if (data.code === 1) {
this.message.success(data.message ? data.message : '操作成功'); this.message.success(data.message ? data.message : '操作成功');
this.isAddConV = false;
this.getData(); this.getData();
} else if (data.code === 0) { } else if (data.code === 0) {
this.message.error(data.message ? data.message : '操作失败'); this.message.error(data.message ? data.message : '操作失败');
...@@ -67,7 +68,7 @@ export class CompanyComponent implements OnInit { ...@@ -67,7 +68,7 @@ export class CompanyComponent implements OnInit {
} }
getCitys(province, city) { getCitys(province, city) {
this.api.city.getByProvince([{province: province ? province : this.req.province}, (data) => { this.api.city.getByProvince([{province}, (data) => {
if (data.constructor === Array) { if (data.constructor === Array) {
this.citys = data; this.citys = data;
this.req.city = city; this.req.city = city;
...@@ -78,7 +79,7 @@ export class CompanyComponent implements OnInit { ...@@ -78,7 +79,7 @@ export class CompanyComponent implements OnInit {
} }
getAreas(city, area) { getAreas(city, area) {
this.api.area.getByCity([{city: city ? city : this.req.city}, (data) => { this.api.area.getByCity([{city}, (data) => {
if (data.constructor === Array) { if (data.constructor === Array) {
this.areas = data; this.areas = data;
this.req.area = area; this.req.area = area;
...@@ -129,7 +130,11 @@ export class CompanyComponent implements OnInit { ...@@ -129,7 +130,11 @@ export class CompanyComponent implements OnInit {
this.isAddConV = false; this.isAddConV = false;
} }
save(v) { save() {
this.isAddConV = false; if (this.isUpdate) {
this.api.company.updateCompany([this.req, this.next]);
} else {
this.api.company.addCompany([this.req, this.next]);
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment