提交代码

pull/1/head
胡锐 3 years ago
parent c799096f1b
commit 33b64fdeec
  1. 1
      src/app/admin/tuanyou-agent/order-st/order-st.component.html
  2. 0
      src/app/admin/tuanyou-agent/order-st/order-st.component.scss
  3. 25
      src/app/admin/tuanyou-agent/order-st/order-st.component.spec.ts
  4. 15
      src/app/admin/tuanyou-agent/order-st/order-st.component.ts
  5. 208
      src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html
  6. 3
      src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.scss
  7. 570
      src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.ts
  8. 2
      src/app/admin/tuanyou-agent/tuanyou-agent-routing.module.ts
  9. 3
      src/app/admin/tuanyou-agent/tuanyou-agent.module.ts
  10. 26
      src/app/services/organization.service.ts
  11. 92
      src/app/services/ty-agent-oil-station.service.ts

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { OrderStComponent } from './order-st.component';
describe('OrderStComponent', () => {
let component: OrderStComponent;
let fixture: ComponentFixture<OrderStComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ OrderStComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(OrderStComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-order-st',
templateUrl: './order-st.component.html',
styleUrls: ['./order-st.component.scss']
})
export class OrderStComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

@ -1 +1,207 @@
<p>petrol-station-manage works!</p>
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<!--条件搜索-->
<nz-spin [nzSpinning]="loadingObject.spinning" nzTip="{{loadingObject.msg}}">
<div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)">
<div nz-row>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="8">地区</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="regionName" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="8">加油站名称</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="storeName" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8" *ngIf="roleType == 5 && adminFlag == 1" >
<nz-form-item>
<nz-form-label [nzSpan]="8">分配代理公司</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select ngModel="lucy" nzAllowClear formControlName="isAssignOrgId">
<nz-option nzValue="true" nzLabel="是"></nz-option>
<nz-option nzValue="false" nzLabel="否"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8" *ngIf="roleType == 5 && adminFlag == 1" >
<nz-form-item>
<nz-form-label [nzSpan]="8">代理公司</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="organizationName" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8" *ngIf="roleType == 5 && adminFlag == 0" >
<nz-form-item>
<nz-form-label [nzSpan]="8">分配代理商</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select ngModel="lucy" nzAllowClear formControlName="isAssignTyAgent">
<nz-option nzValue="true" nzLabel="是"></nz-option>
<nz-option nzValue="false" nzLabel="否"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8" *ngIf="roleType == 5 && adminFlag == 0" >
<nz-form-item>
<nz-form-label [nzSpan]="8">代理商</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="tyAgentName" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8" *ngIf="roleType == 8" >
<nz-form-item>
<nz-form-label [nzSpan]="8">分配业务员</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select ngModel="lucy" nzAllowClear formControlName="isAssignTySalesman">
<nz-option nzValue="true" nzLabel="是"></nz-option>
<nz-option nzValue="false" nzLabel="否"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8" *ngIf="roleType == 8">
<nz-form-item>
<nz-form-label [nzSpan]="8">业务员</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="tySalesmanName" />
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-row>
<div nz-col nzSpan="24" class="search-button">
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button>
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button>
</div>
</div>
</form>
</div>
<div class="inner-content">
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span>
<div class="operating-button">
<button nz-button nzType="primary" class="right-btn" *ngIf="roleType == 5 && adminFlag == 1" (click)="showAssignOrgModal()"><i nz-icon nzType="plus" nzTheme="outline"></i>分配代理公司</button>
<button nz-button nzType="primary" class="right-btn" *ngIf="roleType == 5 && adminFlag == 1" (click)="showUnbindOrgConfirm()"><i nz-icon nzType="minus" nzTheme="outline"></i>解绑代理公司</button>
<button nz-button nzType="primary" class="right-btn" *ngIf="roleType == 5 && adminFlag == 0" (click)="showAssignAgentModal()"><i nz-icon nzType="plus" nzTheme="outline"></i>分配代理商</button>
<button nz-button nzType="primary" class="right-btn" *ngIf="roleType == 5 && adminFlag == 0" (click)="showUnbindAgentConfirm()"><i nz-icon nzType="minus" nzTheme="outline"></i>解绑代理商</button>
<button nz-button nzType="primary" class="right-btn" *ngIf="roleType == 8" (click)="showAssignSalesmanModal()"><i nz-icon nzType="plus" nzTheme="outline"></i>分配业务员</button>
<button nz-button nzType="primary" class="right-btn" *ngIf="roleType == 8" (click)="showUnbindSalesmanConfirm()"><i nz-icon nzType="minus" nzTheme="outline"></i>解绑业务员</button>
</div>
<!--数组表格 -->
<nz-table #basicTable
[nzData]="dataObject.list"
[nzTotal]="dataObject.total"
[nzFrontPagination]="false"
[nzLoading]="tableLoading"
[nzPageIndex]="whereObject.pageNum"
(nzPageIndexChange)="requestData($event)"
[nzScroll]="{ x: '1150px'}">
<thead>
<tr>
<th nzWidth="50px" [(nzChecked)]="allChecked" [nzShowCheckbox]="true" (nzCheckedChange)="onAllChecked($event)"></th>
<th nzWidth="70px">地区</th>
<th nzWidth="90px">加油站ID</th>
<th nzWidth="130px">加油站名称</th>
<th nzWidth="130px">加油站地址</th>
<th nzWidth="100px">代理公司</th>
<th nzWidth="100px">代理商</th>
<th nzWidth="100px">业务员</th>
<th nzWidth="100px" nzRight="0px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data;let i = index">
<td
[nzShowCheckbox]="true"
[nzChecked]="data.checked"
[nzDisabled]="data.disabled"
(nzCheckedChange)="checkedChange(data, $event)"
></td>
<td>{{data.regionName}}</td>
<td>{{data.storeKey}}</td>
<td>{{data.storeName}}</td>
<td>{{data.address}}</td>
<td>{{data.organizationName?data.organizationName:'未分配'}}</td>
<td>{{data.tyAgentName?data.tyAgentName:'未分配'}}</td>
<td>{{data.tySalesmanName?data.tySalesmanName:'未分配'}}</td>
<td nzRight="0px" class="table-td-operation">
<a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
</ul>
</nz-dropdown-menu>
</td>
</tr>
</tbody>
</nz-table>
</div>
<nz-modal [(nzVisible)]="assignOrgModal" nzTitle="分配代理商公司" (nzOnCancel)="closeAssignOrgModal()" nzWidth="500px" [nzFooter]="null">
<form nz-form [formGroup]="assignOrgForm">
<nz-form-item>
<nz-form-label [nzSpan]="6">
代理商公司
</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择代理商公司" formControlName="orgId">
<nz-option *ngFor="let data of orgArray" nzLabel="{{data.name}}" nzValue="{{data.id}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<div style="text-align: center;">
<button nz-button nzType="primary" style="width: 150px;" (click)="submitAssignOrg()">确定</button>
</div>
</form>
</nz-modal>
<nz-modal [(nzVisible)]="assignAgentModal" nzTitle="分配代理商" (nzOnCancel)="closeAssignAgentModal()" nzWidth="500px" [nzFooter]="null">
<form nz-form [formGroup]="assignAgentForm">
<nz-form-item>
<nz-form-label [nzSpan]="6">
代理商
</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择代理商" formControlName="agentId">
<nz-option *ngFor="let data of agentArray" nzLabel="{{data.agentName}}" nzValue="{{data.id}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<div style="text-align: center;">
<button nz-button nzType="primary" style="width: 150px;" (click)="submitAssignAgent()">确定</button>
</div>
</form>
</nz-modal>
<nz-modal [(nzVisible)]="assignSalesmanModal" nzTitle="分配业务员" (nzOnCancel)="closeAssignSalesmanModal()" nzWidth="500px" [nzFooter]="null">
<form nz-form [formGroup]="assignSalesmanForm">
<nz-form-item>
<nz-form-label [nzSpan]="6">
业务员
</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择业务员" formControlName="salesmanId">
<nz-option *ngFor="let data of salesmanArray" nzLabel="{{data.salesmanName}}" nzValue="{{data.id}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<div style="text-align: center;">
<button nz-button nzType="primary" style="width: 150px;" (click)="submitAssignSalesman()">确定</button>
</div>
</form>
</nz-modal>
</nz-spin>

@ -1,4 +1,13 @@
import { Component, OnInit } from '@angular/core';
import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms';
import {NzMessageService, NzModalService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd';
import {TyAgentService} from '../../../services/ty-agent.service';
import {TyAgentOilStationService} from '../../../services/ty-agent-oil-station.service';
import {Validators} from '@angular/forms';
import {OrganizationService} from "../../../services/organization.service";
import {LocalStorageService} from "../../../services/local-storage.service";
import {ADMIN_INFO_OBJECT} from "../../../services/local-storage.namespace";
import {TySalesmanService} from "../../../services/ty-salesman.service";
@Component({
selector: 'app-petrol-station-manage',
@ -6,10 +15,569 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./petrol-station-manage.component.scss']
})
export class PetrolStationManageComponent implements OnInit {
roleType;
adminFlag;
loadingObject = {
spinning: false,
msg: '加载中'
};
constructor() { }
dataObject: any = {};
tableLoading = true;
searchForm: FormGroup;
pageNum: number;
whereObject: any = {};
allChecked = false;
checkedData = [];
orgArray = [];
agentArray = [];
salesmanArray = [];
assignOrgModal = false;
assignOrgForm: FormGroup;
assignAgentModal = false;
assignAgentForm: FormGroup;
assignSalesmanModal = false;
assignSalesmanForm: FormGroup;
constructor(private modal: NzModalService,
private message: NzMessageService,
private tyAgentService: TyAgentService,
private tySalesmanService: TySalesmanService,
private organizationService: OrganizationService,
private tyAgentOilStationService: TyAgentOilStationService,
private store: LocalStorageService,
private form: FormBuilder) {
this.roleType = Number(this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType);
this.adminFlag = Number(this.store.get(ADMIN_INFO_OBJECT)['secUser'].adminFlag);
}
ngOnInit(): void {
this.searchForm = this.form.group({
regionName: [null],
storeName: [null],
isAssignOrgId: [null],
organizationName: [null],
isAssignTyAgent: [null],
tyAgentName: [null],
isAssignTySalesman: [null],
tySalesmanName: [null],
});
this.assignOrgForm = this.form.group({
orgId: [null, [Validators.required]],
});
this.assignAgentForm = this.form.group({
agentId: [null, [Validators.required]],
});
this.assignSalesmanForm = this.form.group({
salesmanId: [null, [Validators.required]],
});
this.requestData(1);
}
/**
*
*/
requestData(pageNum) {
this.tableLoading = true;
this.whereObject['pageNum'] = pageNum;
this.whereObject['pageSize'] = 10;
this.tyAgentOilStationService.getOilStationList(this.whereObject, data => {
if (data['return_code'] === '000000') {
this.dataObject = data['return_data'];
let checkoutNum = 0;
for (const dataObject of this.dataObject['list']) {
if (this.checkedData.find(o => Number(o['storeId']) === Number(dataObject['storeId'])) != null) {
checkoutNum++;
dataObject['checked'] = true;
}
}
if (Number(checkoutNum) === this.dataObject['list'].length) {
this.allChecked = true;
} else {
this.allChecked = false;
}
} else {
this.modal.error(data['return_msg']);
}
this.tableLoading = false;
});
}
/**
*
* @param whereObject
*/
search(whereObject: object) {
this.whereObject = whereObject;
this.requestData(1);
}
/**
*
*/
resetForm(): void {
this.searchForm.reset();
}
/**
*
*/
showAssignOrgModal() {
if (this.orgArray.length === 0) {
this.organizationService.getOrganizationList(this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['id'] , data => {
if (data['return_code'] === '000000') {
this.orgArray = data['return_data'];
}
});
}
this.assignOrgModal = true;
}
/**
*
*/
closeAssignOrgModal() {
this.assignOrgModal = false;
}
/**
*
*/
submitAssignOrg() {
this.loadingObject.spinning = true;
this.loadingObject.msg = '加油站分配中...';
this.closeAssignOrgModal();
for (const i in this.assignOrgForm.controls) {
this.assignOrgForm.controls[i].markAsDirty();
this.assignOrgForm.controls[i].updateValueAndValidity();
}
if (this.assignOrgForm.status == null || this.assignOrgForm.status !== 'VALID') {
this.modal.warning({
nzTitle: '提示',
nzContent: '请选择代理公司',
});
return;
}
if (this.checkedData.length === 0) {
this.modal.warning({
nzTitle: '提示',
nzContent: '请选择需要分配的油站',
});
return;
}
const storeList = [];
for (const data of this.checkedData) {
storeList.push({ storeId: data['storeId'] });
}
this.assignOrgForm.value['storeList'] = storeList;
this.tyAgentOilStationService.assignOrg(this.assignOrgForm.value, data => {
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'],
});
}
});
}
/**
*
*/
showUnbindOrgConfirm(): void {
if (this.checkedData.length === 0) {
this.modal.warning({
nzTitle: '提示',
nzContent: '请选择需要解绑的油站',
});
return;
}
this.modal.confirm({
nzTitle: '警告',
nzContent: '确定解绑油站吗',
nzOkText: '是',
nzCancelText: '否',
nzOkType: 'danger',
nzOnOk: () => this.unbindOrg()
});
}
/**
*
*
*/
unbindOrg() {
this.loadingObject.spinning = true;
this.loadingObject.msg = '加油站解绑中...';
const oilStationArray = [];
for (const data of this.checkedData) {
if ( data['tyAgentOilStationId'] != null) {
oilStationArray.push({ oilStationId: data['tyAgentOilStationId'] });
}
}
if (oilStationArray.length === 0) {
this.modal.warning({
nzTitle: '提示',
nzContent: '没有需要解绑加油站'
});
this.loadingObject.spinning = false;
return;
}
this.tyAgentOilStationService.unbindOrg({ oilStationList: oilStationArray}, data => {
if (data['return_code'] === '000000') {
this.loadingObject.spinning = false;
this.checkedData = [];
this.modal.success({
nzTitle: '提示',
nzContent: '解绑成功!'
});
this.requestData(this.whereObject['pageNum']);
} else {
this.loadingObject.spinning = false;
this.modal.error({
nzTitle: '提示',
nzContent: data['return_msg']
});
}
});
}
/**
*
*/
showAssignAgentModal() {
if (this.agentArray.length === 0) {
const param = {
orgId: this.store.get(ADMIN_INFO_OBJECT)['bsOrganization']['id'],
pageNum: 1,
pageSize: 99999,
};
this.tyAgentService.getAgentList(param , data => {
if (data['return_code'] === '000000') {
this.agentArray = data['return_data']['list'];
}
});
}
this.assignAgentModal = true;
}
/**
*
*/
closeAssignAgentModal() {
this.assignAgentModal = false;
}
/**
*
*/
submitAssignAgent() {
this.loadingObject.spinning = true;
this.loadingObject.msg = '加油站分配中...';
for (const i in this.assignAgentForm.controls) {
this.assignAgentForm.controls[i].markAsDirty();
this.assignAgentForm.controls[i].updateValueAndValidity();
}
if (this.assignAgentForm.status == null || this.assignAgentForm.status !== 'VALID') {
this.modal.warning({
nzTitle: '提示',
nzContent: '请选择代理商',
});
return;
}
if (this.checkedData.length === 0) {
this.modal.warning({
nzTitle: '提示',
nzContent: '请选择需要分配的油站',
});
return;
}
const storeList = [];
for (const data of this.checkedData) {
storeList.push({ oilStationId: data['tyAgentOilStationId'] });
}
this.assignAgentForm.value['oilStationList'] = storeList;
this.tyAgentOilStationService.assignAgent(this.assignAgentForm.value, data => {
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'],
});
}
});
}
/**
*
*/
showUnbindAgentConfirm(): void {
if (this.checkedData.length === 0) {
this.modal.warning({
nzTitle: '提示',
nzContent: '请选择需要解绑的油站',
});
return;
}
this.modal.confirm({
nzTitle: '警告',
nzContent: '确定解绑油站吗',
nzOkText: '是',
nzCancelText: '否',
nzOkType: 'danger',
nzOnOk: () => this.unbindAgent()
});
}
/**
*
*
*/
unbindAgent() {
this.loadingObject.spinning = true;
this.loadingObject.msg = '加油站解绑中...';
const oilStationArray = [];
for (const data of this.checkedData) {
if ( data['tyAgentOilStationId'] != null) {
oilStationArray.push({ oilStationId: data['tyAgentOilStationId'] });
}
}
if (oilStationArray.length === 0) {
this.modal.warning({
nzTitle: '提示',
nzContent: '没有需要解绑加油站'
});
this.loadingObject.spinning = false;
return;
}
this.tyAgentOilStationService.unbindAgent({ oilStationList: oilStationArray}, data => {
if (data['return_code'] === '000000') {
this.loadingObject.spinning = false;
this.checkedData = [];
this.modal.success({
nzTitle: '提示',
nzContent: '解绑成功!'
});
this.requestData(this.whereObject['pageNum']);
} else {
this.loadingObject.spinning = false;
this.modal.error({
nzTitle: '提示',
nzContent: data['return_msg']
});
}
});
}
/**
*
*/
showAssignSalesmanModal() {
if (this.salesmanArray.length === 0) {
const param = {
tyAgentId: this.store.get(ADMIN_INFO_OBJECT)['highTyAgent']['id'],
pageNum: 1,
pageSize: 99999,
};
this.tySalesmanService.getSalesmanList(param , data => {
if (data['return_code'] === '000000') {
this.salesmanArray = data['return_data']['list'];
}
});
}
this.assignSalesmanModal = true;
}
/**
*
*/
closeAssignSalesmanModal() {
this.assignSalesmanModal = false;
}
/**
*
*/
submitAssignSalesman() {
this.loadingObject.spinning = true;
this.loadingObject.msg = '加油站分配中...';
this.assignSalesmanModal = false;
for (const i in this.assignSalesmanForm.controls) {
this.assignSalesmanForm.controls[i].markAsDirty();
this.assignSalesmanForm.controls[i].updateValueAndValidity();
}
if (this.assignSalesmanForm.status == null || this.assignSalesmanForm.status !== 'VALID') {
this.modal.warning({
nzTitle: '提示',
nzContent: '请选择代理商',
});
this.loadingObject.spinning = false;
return;
}
if (this.checkedData.length === 0) {
this.modal.warning({
nzTitle: '提示',
nzContent: '请选择需要分配的油站',
});
this.loadingObject.spinning = false;
return;
}
const oilStationList = [];
for (const data of this.checkedData) {
oilStationList.push({ oilStationId: data['tyAgentOilStationId'] });
}
this.assignSalesmanForm.value['oilStationList'] = oilStationList;
this.tyAgentOilStationService.assignSalesman(this.assignSalesmanForm.value, data => {
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'],
});
}
});
}
/**
*
*/
showUnbindSalesmanConfirm(): void {
if (this.checkedData.length === 0) {
this.modal.warning({
nzTitle: '提示',
nzContent: '请选择需要解绑的油站',
});
return;
}
this.modal.confirm({
nzTitle: '警告',
nzContent: '确定解绑油站吗',
nzOkText: '是',
nzCancelText: '否',
nzOkType: 'danger',
nzOnOk: () => this.unbindSalesman()
});
}
/**
*
*
*/
unbindSalesman() {
this.loadingObject.spinning = true;
this.loadingObject.msg = '加油站解绑中...';
const oilStationArray = [];
for (const data of this.checkedData) {
if ( data['tyAgentOilStationId'] != null) {
oilStationArray.push({ oilStationId: data['tyAgentOilStationId'] });
}
}
if (oilStationArray.length === 0) {
this.modal.warning({
nzTitle: '提示',
nzContent: '没有需要解绑加油站'
});
this.loadingObject.spinning = false;
return;
}
this.tyAgentOilStationService.unbindSalesman({ oilStationList: oilStationArray}, data => {
if (data['return_code'] === '000000') {
this.loadingObject.spinning = false;
this.checkedData = [];
this.modal.success({
nzTitle: '提示',
nzContent: '解绑成功!'
});
this.requestData(this.whereObject['pageNum']);
} else {
this.loadingObject.spinning = false;
this.modal.error({
nzTitle: '提示',
nzContent: data['return_msg']
});
}
});
}
/**
*
* @param data
*/
onAllChecked(checked: boolean) {
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) {
data['checked'] = true;
this.checkedData.push(data);
}
}
} else {
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']));
this.checkedData.splice(findIndex, 1);
}
}
}
/**
*
* @param data
* @param checked
*/
checkedChange(data: object, checked: boolean) {
if (checked === true) {
if (this.checkedData.find(o => Number(o['id']) === Number(data['id'])) == null) {
data['checked'] = true;
this.checkedData.push(data);
}
} else {
data['checked'] = true;
const findIndex = this.checkedData.findIndex(o => Number(o['id']) === Number(data['id']));
this.checkedData.splice(findIndex, 1);
}
}
}

@ -4,12 +4,14 @@ import {TyAgentListComponent} from './ty-agent/ty-agent-list/ty-agent-list.compo
import {TyAgentEditComponent} from './ty-agent/ty-agent-edit/ty-agent-edit.component';
import {TySalesmanListComponent} from './ty-salesman/ty-salesman-list/ty-salesman-list.component';
import {TySalesmanEditComponent} from './ty-salesman/ty-salesman-edit/ty-salesman-edit.component';
import {PetrolStationManageComponent} from './petrol-station-manage/petrol-station-manage.component';
const routes: Routes = [
{ path: 'agent-edit', component: TyAgentEditComponent },
{ path: 'agent-list', component: TyAgentListComponent },
{ path: 'salesman-list', component: TySalesmanListComponent },
{ path: 'salesman-edit', component: TySalesmanEditComponent },
{ path: 'petrol-station', component: PetrolStationManageComponent },
];
@NgModule({

@ -11,9 +11,10 @@ import {TyAgentListComponent} from './ty-agent/ty-agent-list/ty-agent-list.compo
import {AppCommonModule} from '../../app-common.module';
import { TySalesmanListComponent } from './ty-salesman/ty-salesman-list/ty-salesman-list.component';
import { TySalesmanEditComponent } from './ty-salesman/ty-salesman-edit/ty-salesman-edit.component';
import { OrderStComponent } from './order-st/order-st.component';
@NgModule({
declarations: [PetrolStationManageComponent, TyAgentListComponent, TyAgentEditComponent, TySalesmanListComponent, TySalesmanEditComponent],
declarations: [PetrolStationManageComponent, TyAgentListComponent, TyAgentEditComponent, TySalesmanListComponent, TySalesmanEditComponent, OrderStComponent],
imports: [
CommonModule,
TuanyouAgentRoutingModule,

@ -0,0 +1,26 @@
import { Injectable } from '@angular/core';
import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http';
import {CommonsService} from './commons.service';
import {environment} from '../../environments/environment';
@Injectable({
providedIn: 'root'
})
export class OrganizationService {
constructor(
private http: HttpClient,
private common: CommonsService
) { }
/**
*
* @param paramObject
* @param callBack
*/
getOrganizationList(companyId: number, callBack) {
this.http.get(environment.baseUrl + 'bsOrganization/getOrganizationList?companyId=' + companyId).subscribe(data => {
callBack(data);
});
}
}

@ -0,0 +1,92 @@
import { Injectable } from '@angular/core';
import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http';
import {CommonsService} from './commons.service';
import {environment} from '../../environments/environment';
@Injectable({
providedIn: 'root'
})
export class TyAgentOilStationService {
constructor(
private http: HttpClient,
private common: CommonsService
) { }
/**
*
* @param paramObject
* @param callBack
*/
assignOrg(paramObject: object, callBack) {
this.http.post(environment.baseUrl + 'tyAgentOilStation/assignOrg', paramObject).subscribe(data => {
callBack(data);
});
}
/**
*
* @param paramObject
* @param callBack
*/
unbindOrg(paramObject: object, callBack) {
this.http.post(environment.baseUrl + 'tyAgentOilStation/unbindOrg', paramObject).subscribe(data => {
callBack(data);
});
}
/**
*
* @param paramObject
* @param callBack
*/
assignAgent(paramObject: object, callBack) {
this.http.post(environment.baseUrl + 'tyAgentOilStation/assignAgent', paramObject).subscribe(data => {
callBack(data);
});
}
/**
*
* @param paramObject
* @param callBack
*/
unbindAgent(paramObject: object, callBack) {
this.http.post(environment.baseUrl + 'tyAgentOilStation/unbindAgent', paramObject).subscribe(data => {
callBack(data);
});
}
/**
*
* @param paramObject
* @param callBack
*/
assignSalesman(paramObject: object, callBack) {
this.http.post(environment.baseUrl + 'tyAgentOilStation/assignSalesman', paramObject).subscribe(data => {
callBack(data);
});
}
/**
*
* @param paramObject
* @param callBack
*/
unbindSalesman(paramObject: object, callBack) {
this.http.post(environment.baseUrl + 'tyAgentOilStation/unbindSalesman', paramObject).subscribe(data => {
callBack(data);
});
}
/**
*
* @param paramObject
* @param callBack
*/
getOilStationList(paramObject: object, callBack) {
this.http.get(environment.baseUrl + 'tyAgentOilStation/getOilStationList?' + this.common.getWhereCondition(paramObject)).subscribe(data => {
callBack(data);
});
}
}
Loading…
Cancel
Save