提交代码

pull/1/head
胡锐 3 years ago
parent 716ce5841b
commit 33d8aac59a
  1. 17
      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.assignOrgForm.value['storeList'] = storeList;
this.tyAgentOilStationService.assignOrg(this.assignOrgForm.value, data => { this.tyAgentOilStationService.assignOrg(this.assignOrgForm.value, data => {
this.loadingObject.spinning = false;
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.modal.success({ this.modal.success({
nzTitle: '提示', nzTitle: '提示',
nzContent: '分配成功', nzContent: '分配成功',
}); });
this.checkedData = []; this.checkedData = [];
this.loadingObject.spinning = false;
this.requestData(this.whereObject['pageNum']); this.requestData(this.whereObject['pageNum']);
this.closeAssignOrgModal(); this.closeAssignOrgModal();
} else { } else {
this.loadingObject.spinning = false;
this.modal.error({ this.modal.error({
nzTitle: '提示', nzTitle: '提示',
nzContent: data['return_msg'], nzContent: data['return_msg'],
@ -325,17 +324,16 @@ export class PetrolStationManageComponent implements OnInit {
} }
this.assignAgentForm.value['oilStationList'] = storeList; this.assignAgentForm.value['oilStationList'] = storeList;
this.tyAgentOilStationService.assignAgent(this.assignAgentForm.value, data => { this.tyAgentOilStationService.assignAgent(this.assignAgentForm.value, data => {
this.loadingObject.spinning = false;
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.modal.success({ this.modal.success({
nzTitle: '提示', nzTitle: '提示',
nzContent: '分配成功', nzContent: '分配成功',
}); });
this.checkedData = []; this.checkedData = [];
this.loadingObject.spinning = false;
this.requestData(this.whereObject['pageNum']); this.requestData(this.whereObject['pageNum']);
this.closeAssignAgentModal(); this.closeAssignAgentModal();
} else { } else {
this.loadingObject.spinning = false;
this.modal.error({ this.modal.error({
nzTitle: '提示', nzTitle: '提示',
nzContent: data['return_msg'], nzContent: data['return_msg'],
@ -466,17 +464,16 @@ export class PetrolStationManageComponent implements OnInit {
} }
this.assignSalesmanForm.value['oilStationList'] = oilStationList; this.assignSalesmanForm.value['oilStationList'] = oilStationList;
this.tyAgentOilStationService.assignSalesman(this.assignSalesmanForm.value, data => { this.tyAgentOilStationService.assignSalesman(this.assignSalesmanForm.value, data => {
this.loadingObject.spinning = false;
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.modal.success({ this.modal.success({
nzTitle: '提示', nzTitle: '提示',
nzContent: '分配成功', nzContent: '分配成功',
}); });
this.checkedData = []; this.checkedData = [];
this.loadingObject.spinning = false;
this.requestData(this.whereObject['pageNum']); this.requestData(this.whereObject['pageNum']);
this.closeAssignSalesmanModal(); this.closeAssignSalesmanModal();
} else { } else {
this.loadingObject.spinning = false;
this.modal.error({ this.modal.error({
nzTitle: '提示', nzTitle: '提示',
nzContent: data['return_msg'], nzContent: data['return_msg'],
@ -606,7 +603,7 @@ export class PetrolStationManageComponent implements OnInit {
if (checked === true) { if (checked === true) {
const filterArray = this.dataObject['list'].filter(({ disabled }) => !disabled); const filterArray = this.dataObject['list'].filter(({ disabled }) => !disabled);
for (const data of filterArray) { 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; data['checked'] = true;
this.checkedData.push(data); this.checkedData.push(data);
} }
@ -615,7 +612,7 @@ export class PetrolStationManageComponent implements OnInit {
const filterArray = this.dataObject['list'].filter(({ disabled }) => !disabled); const filterArray = this.dataObject['list'].filter(({ disabled }) => !disabled);
for (const data of filterArray) { for (const data of filterArray) {
data['checked'] = false; 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); this.checkedData.splice(findIndex, 1);
} }
} }
@ -628,13 +625,13 @@ export class PetrolStationManageComponent implements OnInit {
*/ */
checkedChange(data: object, checked: boolean) { checkedChange(data: object, checked: boolean) {
if (checked === true) { 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; data['checked'] = true;
this.checkedData.push(data); this.checkedData.push(data);
} }
} else { } else {
data['checked'] = true; 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); this.checkedData.splice(findIndex, 1);
} }
} }

Loading…
Cancel
Save