diff --git a/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.ts b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.ts index 5c92767..2f80e6e 100644 --- a/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.ts +++ b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.ts @@ -187,17 +187,16 @@ export class PetrolStationManageComponent implements OnInit { } this.assignOrgForm.value['storeList'] = storeList; this.tyAgentOilStationService.assignOrg(this.assignOrgForm.value, data => { + this.loadingObject.spinning = false; if (data['return_code'] === '000000') { this.modal.success({ nzTitle: '提示', nzContent: '分配成功', }); this.checkedData = []; - this.loadingObject.spinning = false; this.requestData(this.whereObject['pageNum']); this.closeAssignOrgModal(); } else { - this.loadingObject.spinning = false; this.modal.error({ nzTitle: '提示', nzContent: data['return_msg'], @@ -325,17 +324,16 @@ export class PetrolStationManageComponent implements OnInit { } this.assignAgentForm.value['oilStationList'] = storeList; this.tyAgentOilStationService.assignAgent(this.assignAgentForm.value, data => { + this.loadingObject.spinning = false; if (data['return_code'] === '000000') { this.modal.success({ nzTitle: '提示', nzContent: '分配成功', }); this.checkedData = []; - this.loadingObject.spinning = false; this.requestData(this.whereObject['pageNum']); this.closeAssignAgentModal(); } else { - this.loadingObject.spinning = false; this.modal.error({ nzTitle: '提示', nzContent: data['return_msg'], @@ -466,17 +464,16 @@ export class PetrolStationManageComponent implements OnInit { } this.assignSalesmanForm.value['oilStationList'] = oilStationList; this.tyAgentOilStationService.assignSalesman(this.assignSalesmanForm.value, data => { + this.loadingObject.spinning = false; if (data['return_code'] === '000000') { this.modal.success({ nzTitle: '提示', nzContent: '分配成功', }); this.checkedData = []; - this.loadingObject.spinning = false; this.requestData(this.whereObject['pageNum']); this.closeAssignSalesmanModal(); } else { - this.loadingObject.spinning = false; this.modal.error({ nzTitle: '提示', nzContent: data['return_msg'], @@ -606,7 +603,7 @@ export class PetrolStationManageComponent implements OnInit { if (checked === true) { const filterArray = this.dataObject['list'].filter(({ disabled }) => !disabled); for (const data of filterArray) { - if (this.checkedData.find(o => Number(o['id']) === Number(data['id'])) == null) { + if (this.checkedData.find(o => Number(o['storeId']) === Number(data['storeId'])) == null) { data['checked'] = true; this.checkedData.push(data); } @@ -615,7 +612,7 @@ export class PetrolStationManageComponent implements OnInit { const filterArray = this.dataObject['list'].filter(({ disabled }) => !disabled); for (const data of filterArray) { data['checked'] = false; - const findIndex = this.checkedData.findIndex(o => Number(o['id']) === Number(data['id'])); + const findIndex = this.checkedData.findIndex(o => Number(o['storeId']) === Number(data['storeId'])); this.checkedData.splice(findIndex, 1); } } @@ -628,13 +625,13 @@ export class PetrolStationManageComponent implements OnInit { */ checkedChange(data: object, checked: boolean) { if (checked === true) { - if (this.checkedData.find(o => Number(o['id']) === Number(data['id'])) == null) { + if (this.checkedData.find(o => Number(o['storeId']) === Number(data['storeId'])) == null) { data['checked'] = true; this.checkedData.push(data); } } else { data['checked'] = true; - const findIndex = this.checkedData.findIndex(o => Number(o['id']) === Number(data['id'])); + const findIndex = this.checkedData.findIndex(o => Number(o['storeId']) === Number(data['storeId'])); this.checkedData.splice(findIndex, 1); } }