From 33b64fdeec9c5ca4f07eb2b02a007679cfd700f0 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Fri, 1 Apr 2022 14:26:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order-st/order-st.component.html | 1 + .../order-st/order-st.component.scss | 0 .../order-st/order-st.component.spec.ts | 25 + .../order-st/order-st.component.ts | 15 + .../petrol-station-manage.component.html | 208 ++++++- .../petrol-station-manage.component.scss | 3 + .../petrol-station-manage.component.ts | 570 +++++++++++++++++- .../tuanyou-agent-routing.module.ts | 2 + .../tuanyou-agent/tuanyou-agent.module.ts | 3 +- src/app/services/organization.service.ts | 26 + .../services/ty-agent-oil-station.service.ts | 92 +++ 11 files changed, 942 insertions(+), 3 deletions(-) create mode 100644 src/app/admin/tuanyou-agent/order-st/order-st.component.html create mode 100644 src/app/admin/tuanyou-agent/order-st/order-st.component.scss create mode 100644 src/app/admin/tuanyou-agent/order-st/order-st.component.spec.ts create mode 100644 src/app/admin/tuanyou-agent/order-st/order-st.component.ts create mode 100644 src/app/services/organization.service.ts create mode 100644 src/app/services/ty-agent-oil-station.service.ts diff --git a/src/app/admin/tuanyou-agent/order-st/order-st.component.html b/src/app/admin/tuanyou-agent/order-st/order-st.component.html new file mode 100644 index 0000000..82e6e65 --- /dev/null +++ b/src/app/admin/tuanyou-agent/order-st/order-st.component.html @@ -0,0 +1 @@ +

order-st works!

diff --git a/src/app/admin/tuanyou-agent/order-st/order-st.component.scss b/src/app/admin/tuanyou-agent/order-st/order-st.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/tuanyou-agent/order-st/order-st.component.spec.ts b/src/app/admin/tuanyou-agent/order-st/order-st.component.spec.ts new file mode 100644 index 0000000..9b0f7a3 --- /dev/null +++ b/src/app/admin/tuanyou-agent/order-st/order-st.component.spec.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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ OrderStComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(OrderStComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/tuanyou-agent/order-st/order-st.component.ts b/src/app/admin/tuanyou-agent/order-st/order-st.component.ts new file mode 100644 index 0000000..765a103 --- /dev/null +++ b/src/app/admin/tuanyou-agent/order-st/order-st.component.ts @@ -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 { + } + +} diff --git a/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html index 138496a..f212319 100644 --- a/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html +++ b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html @@ -1 +1,207 @@ -

petrol-station-manage works!

+ + + + + + +
+
+
+
+ + 地区 + + + + +
+
+ + 加油站名称 + + + + +
+
+ + 分配代理公司 + + + + + + + +
+
+ + 代理公司 + + + + +
+
+ + 分配代理商 + + + + + + + +
+
+ + 代理商 + + + + +
+
+ + 分配业务员 + + + + + + + +
+
+ + 业务员 + + + + +
+
+ +
+
+ + +
+
+
+
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ + + + + + +
+ + + + + + + 地区 + 加油站ID + 加油站名称 + 加油站地址 + 代理公司 + 代理商 + 业务员 + 操作 + + + + + + {{data.regionName}} + {{data.storeKey}} + {{data.storeName}} + {{data.address}} + {{data.organizationName?data.organizationName:'未分配'}} + {{data.tyAgentName?data.tyAgentName:'未分配'}} + {{data.tySalesmanName?data.tySalesmanName:'未分配'}} + + 操作列表 + +
    +
+
+ + + +
+
+ + +
+ + + 代理商公司 + + + + + + + +
+ +
+
+
+ + +
+ + + 代理商 + + + + + + + +
+ +
+
+
+ + +
+ + + 业务员 + + + + + + + +
+ +
+
+
+
diff --git a/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.scss b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.scss index e69de29..690993b 100644 --- a/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.scss +++ b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.scss @@ -0,0 +1,3 @@ +.table-td-operation a { + padding: 0px 5px; +} diff --git a/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.ts b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.ts index aa3af4b..1201dca 100644 --- a/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.ts +++ b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.ts @@ -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); + } } } diff --git a/src/app/admin/tuanyou-agent/tuanyou-agent-routing.module.ts b/src/app/admin/tuanyou-agent/tuanyou-agent-routing.module.ts index 3fb190c..ee57d83 100644 --- a/src/app/admin/tuanyou-agent/tuanyou-agent-routing.module.ts +++ b/src/app/admin/tuanyou-agent/tuanyou-agent-routing.module.ts @@ -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({ diff --git a/src/app/admin/tuanyou-agent/tuanyou-agent.module.ts b/src/app/admin/tuanyou-agent/tuanyou-agent.module.ts index e31d124..8f3394a 100644 --- a/src/app/admin/tuanyou-agent/tuanyou-agent.module.ts +++ b/src/app/admin/tuanyou-agent/tuanyou-agent.module.ts @@ -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, diff --git a/src/app/services/organization.service.ts b/src/app/services/organization.service.ts new file mode 100644 index 0000000..c90c3ee --- /dev/null +++ b/src/app/services/organization.service.ts @@ -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); + }); + } +} diff --git a/src/app/services/ty-agent-oil-station.service.ts b/src/app/services/ty-agent-oil-station.service.ts new file mode 100644 index 0000000..1569123 --- /dev/null +++ b/src/app/services/ty-agent-oil-station.service.ts @@ -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); + }); + } + +}