From e5807e0df208fc52104ede077972a0e243d91311 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 30 May 2022 11:51:19 +0800 Subject: [PATCH 1/3] =?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 --- .../gas-oil-price-routing.module.ts | 7 +- .../gas-oil-price/gas-oil-price.module.ts | 14 +- .../oil-price-task-edit.component.html | 1 + .../oil-price-task-edit.component.scss | 0 .../oil-price-task-edit.component.spec.ts | 25 ++++ .../oil-price-task-edit.component.ts | 15 +++ .../oil-price-task-list.component.html | 99 ++++++++++++++ .../oil-price-task-list.component.scss | 0 .../oil-price-task-list.component.spec.ts | 25 ++++ .../oil-price-task-list.component.ts | 122 ++++++++++++++++++ .../admin/index/index/index.component.html | 16 +-- .../oil-price/oil-price-task.service.ts | 64 +++++++++ 12 files changed, 372 insertions(+), 16 deletions(-) create mode 100644 src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.html create mode 100644 src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.scss create mode 100644 src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.spec.ts create mode 100644 src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.ts create mode 100644 src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.html create mode 100644 src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.scss create mode 100644 src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.spec.ts create mode 100644 src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.ts create mode 100644 src/app/services/oil-price/oil-price-task.service.ts diff --git a/src/app/admin/gas-oil-price/gas-oil-price-routing.module.ts b/src/app/admin/gas-oil-price/gas-oil-price-routing.module.ts index 38a18b6..17ad1dc 100644 --- a/src/app/admin/gas-oil-price/gas-oil-price-routing.module.ts +++ b/src/app/admin/gas-oil-price/gas-oil-price-routing.module.ts @@ -1,10 +1,13 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import {OilPriceOfficialListComponent} from './oil-price-official-list/oil-price-official-list.component'; - +import {OilPriceTaskListComponent} from './oil-price-task-list/oil-price-task-list.component'; +import {OilPriceTaskEditComponent} from './oil-price-task-edit/oil-price-task-edit.component'; const routes: Routes = [ - { path: 'official-list', component: OilPriceOfficialListComponent} + { path: 'official-list', component: OilPriceOfficialListComponent }, + { path: 'task-list', component: OilPriceTaskListComponent }, + { path: 'task-edit', component: OilPriceTaskEditComponent } ]; @NgModule({ diff --git a/src/app/admin/gas-oil-price/gas-oil-price.module.ts b/src/app/admin/gas-oil-price/gas-oil-price.module.ts index 4422682..d9937f9 100644 --- a/src/app/admin/gas-oil-price/gas-oil-price.module.ts +++ b/src/app/admin/gas-oil-price/gas-oil-price.module.ts @@ -3,15 +3,17 @@ import { CommonModule } from '@angular/common'; import { GasOilPriceRoutingModule } from './gas-oil-price-routing.module'; import { OilPriceOfficialListComponent } from './oil-price-official-list/oil-price-official-list.component'; -import {NgZorroAntdModule} from "_ng-zorro-antd@9.3.0@ng-zorro-antd"; -import {FormsModule, ReactiveFormsModule} from "_@angular_forms@9.0.7@@angular/forms"; -import {BreadcrumbModule} from "../../common/breadcrumb/breadcrumb.module"; -import {AppCommonModule} from "../../app-common.module"; -import {NgxEchartsModule} from "_ngx-echarts@4.2.2@ngx-echarts"; +import {NgZorroAntdModule} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {FormsModule, ReactiveFormsModule} from '_@angular_forms@9.0.7@@angular/forms'; +import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; +import {AppCommonModule} from '../../app-common.module'; +import {NgxEchartsModule} from '_ngx-echarts@4.2.2@ngx-echarts'; +import { OilPriceTaskListComponent } from './oil-price-task-list/oil-price-task-list.component'; +import { OilPriceTaskEditComponent } from './oil-price-task-edit/oil-price-task-edit.component'; @NgModule({ - declarations: [OilPriceOfficialListComponent], + declarations: [OilPriceOfficialListComponent, OilPriceTaskListComponent, OilPriceTaskEditComponent], imports: [ CommonModule, GasOilPriceRoutingModule, diff --git a/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.html b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.html new file mode 100644 index 0000000..debeda2 --- /dev/null +++ b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.html @@ -0,0 +1 @@ +

oil-price-task-edit works!

diff --git a/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.scss b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.spec.ts b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.spec.ts new file mode 100644 index 0000000..864af65 --- /dev/null +++ b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { OilPriceTaskEditComponent } from './oil-price-task-edit.component'; + +describe('OilPriceTaskEditComponent', () => { + let component: OilPriceTaskEditComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ OilPriceTaskEditComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(OilPriceTaskEditComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.ts b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.ts new file mode 100644 index 0000000..4b48296 --- /dev/null +++ b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-oil-price-task-edit', + templateUrl: './oil-price-task-edit.component.html', + styleUrls: ['./oil-price-task-edit.component.scss'] +}) +export class OilPriceTaskEditComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.html b/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.html new file mode 100644 index 0000000..d73c73e --- /dev/null +++ b/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.html @@ -0,0 +1,99 @@ + + + + + + +
+
+
+ +
+ + 区域名称 + + + + +
+ +
+ + 油品号 + + + + + + +
+ +
+ + 油品类型 + + + + + + + +
+ +
+ +
+
+ + +
+
+
+
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ +
+ + + + + + 序号 + 区域名称 + 国标价 + 油品号 + 油品类型 + 操作 + + + + + {{i+1}} + {{data.regionName}} + {{data.priceOfficial}} + {{data.oilNo}} + {{data.oilTypeName}} + + 操作列表 + + + + + + + +
+
+ diff --git a/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.scss b/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.spec.ts b/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.spec.ts new file mode 100644 index 0000000..d738e69 --- /dev/null +++ b/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { OilPriceTaskListComponent } from './oil-price-task-list.component'; + +describe('OilPriceTaskListComponent', () => { + let component: OilPriceTaskListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ OilPriceTaskListComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(OilPriceTaskListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.ts b/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.ts new file mode 100644 index 0000000..d6a9f31 --- /dev/null +++ b/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.ts @@ -0,0 +1,122 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +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 {LocalStorageService} from '../../../services/local-storage.service'; +import {OilPriceOfficialService} from '../../../services/oil-price/oil-price-official.service'; +import {CommonsService} from '../../../services/commons.service'; +import {Router} from '_@angular_router@9.0.7@@angular/router'; +import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; +import {OilPriceTaskService} from "../../../services/oil-price/oil-price-task.service"; + +@Component({ + selector: 'app-oil-price-task-list', + templateUrl: './oil-price-task-list.component.html', + styleUrls: ['./oil-price-task-list.component.scss'] +}) +export class OilPriceTaskListComponent implements OnInit { + FILE_URL = environment.imageUrl; + roleType; + adminFlag; + loadingObject = { + spinning: false, + msg: '加载中' + }; + + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + oilNoArray = []; + + constructor(private modal: NzModalService, + private message: NzMessageService, + private store: LocalStorageService, + private oilPriceTaskService: OilPriceTaskService, + private commonsService: CommonsService, + private router: Router, + 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], + oilNo: [null], + oilType: [null], + }); + + this.commonsService.getDictionary('GAS_OIL_TYPE', data => { + this.oilNoArray = data['return_data']; + }); + + this.requestData(1); + } + + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.oilPriceTaskService.getTaskList(this.whereObject, data => { + if (data['return_code'] === '000000') { + this.dataObject = data['return_data']; + } 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(); + } + + + /** + * 弹出删除对话框 + */ + showDelConfirm(id: number): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否删除任务?任务一旦被删除,不会执行。', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.delData(id) + }); + } + + /** + * 禁用数据 + */ + delData(id: number) { + this.oilPriceTaskService.delTask(id, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } +} diff --git a/src/app/admin/index/index/index.component.html b/src/app/admin/index/index/index.component.html index f37ae00..bb119fb 100644 --- a/src/app/admin/index/index/index.component.html +++ b/src/app/admin/index/index/index.component.html @@ -20,22 +20,22 @@ - + - + - + - + @@ -43,22 +43,22 @@ - + - + - + - + diff --git a/src/app/services/oil-price/oil-price-task.service.ts b/src/app/services/oil-price/oil-price-task.service.ts new file mode 100644 index 0000000..b586061 --- /dev/null +++ b/src/app/services/oil-price/oil-price-task.service.ts @@ -0,0 +1,64 @@ +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 OilPriceTaskService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + + /** + * 批量增加任务 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public batchAddTask(paramsObject: object, callBack) { + this.http.post(environment.baseUrl + 'gasOilPriceTask/batchAddTask', paramsObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 删除任务 + * + * @param id 任务id + * @param callBack 回调 + */ + public delTask(id: number, callBack) { + this.http.post(environment.baseUrl + 'gasOilPriceTask/delTask', { taskId: id }).subscribe(data => { + callBack(data); + }); + } + + /** + * 批量增加任务 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getTaskDetail(id: number, callBack) { + this.http.get(environment.baseUrl + 'gasOilPriceTask/getTaskDetail?taskId=' + id).subscribe(data => { + callBack(data); + }); + } + + /** + * 批量增加任务 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getTaskList(param: object, callBack) { + this.http.get(environment.baseUrl + 'gasOilPriceTask/getTaskList?' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } +} From 0df9afd428453892311d65d067024e6d882fb16c Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 30 May 2022 16:29:04 +0800 Subject: [PATCH 2/3] =?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 --- .../oil-price-task-list.component.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.html b/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.html index d73c73e..afa1e0d 100644 --- a/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.html +++ b/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.html @@ -70,9 +70,15 @@ 序号 区域名称 - 国标价 + 油站名称 油品号 油品类型 + 价格类型 + 价格 + 执行方式 + 执行时间 + 状态 + 操作人 操作 From e0378f733c19ec237ccb5496501a391e06a2b534 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 31 May 2022 16:33:19 +0800 Subject: [PATCH 3/3] =?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 --- .../oil-price-task-edit.component.html | 91 ++++++++++- .../oil-price-task-edit.component.scss | 13 ++ .../oil-price-task-edit.component.ts | 147 +++++++++++++++++- .../oil-price-task-list.component.html | 94 +++++++++-- .../oil-price-task-list.component.ts | 22 ++- src/app/app-common.module.ts | 6 + .../oil-price-task-execution-type.pipe.ts | 17 ++ .../oil-price-task-price-type.pipe.ts | 19 +++ .../oil-price-task-status.pipe.ts | 17 ++ src/app/services/commons.service.ts | 20 +++ src/environments/environment.ts | 8 +- 11 files changed, 431 insertions(+), 23 deletions(-) create mode 100644 src/app/pipes/gas-oil-price/oil-price-task-execution-type.pipe.ts create mode 100644 src/app/pipes/gas-oil-price/oil-price-task-price-type.pipe.ts create mode 100644 src/app/pipes/gas-oil-price/oil-price-task-status.pipe.ts diff --git a/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.html b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.html index debeda2..c00c3a7 100644 --- a/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.html +++ b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.html @@ -1 +1,90 @@ -

oil-price-task-edit works!

+ + + + +
+
+
+
+
+ + 油号 + + + + + + +
+ +
+ + 价格类型 + + + + + + +
+ +
+ + 执行地区 + + + + + + +
+ +
+ + 加油站 + + + + + + +
+ +
+ + 执行价格(¥) + + + + +
+ +
+ + 执行方式 + + + + + + + +
+ +
+ + 执行时间 + + + + +
+ +
+ +
+ +
+
+
+
diff --git a/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.scss b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.scss index e69de29..f28a63f 100644 --- a/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.scss +++ b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.scss @@ -0,0 +1,13 @@ +.btn-div { + width: 100%; + text-align: center; +} +.btn-post { + width: 25%; +} +nz-input-number { + width: 100%; +} +nz-date-picker { + width: 100%; +} diff --git a/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.ts b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.ts index 4b48296..752ca77 100644 --- a/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.ts +++ b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.ts @@ -1,4 +1,11 @@ import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; +import {NzModalService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {ActivatedRoute, Router} from '_@angular_router@9.0.7@@angular/router'; +import {CommonsService} from '../../../services/commons.service'; +import {OilPriceTaskService} from '../../../services/oil-price/oil-price-task.service'; +import {LocalStorageService} from "../../../services/local-storage.service"; +import {ADMIN_INFO_OBJECT} from "../../../services/local-storage.namespace"; @Component({ selector: 'app-oil-price-task-edit', @@ -6,10 +13,148 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./oil-price-task-edit.component.scss'] }) export class OilPriceTaskEditComponent implements OnInit { + dataFrom: FormGroup; + btnLoading = false; - constructor() { } + oilNoArray = []; + priceTypeArray = []; + regionArray = []; + gasArray = []; + + secUserObjectType: number; + + constructor(private formBuilder: FormBuilder, + private modal: NzModalService, + private oilPriceTaskService: OilPriceTaskService, + private activatedRoute: ActivatedRoute, + private commonsService: CommonsService, + private localStorageService: LocalStorageService , // 请求缓存 + private router: Router) { + this.secUserObjectType = Number(this.localStorageService.get(ADMIN_INFO_OBJECT)['secUser']['objectType']); + } ngOnInit(): void { + + this.dataFrom = this.formBuilder.group({ + oilNo: ['92', [Validators.required]], + priceType: [null, [Validators.required]], + price: [0, [Validators.required]], + executionType: ['1', [Validators.required]], + startTime: [null], + regionId: [null], + merStoreIdArray: [[]], + }); + + // 管理员 + if (this.secUserObjectType === 0) { + // 价格类型 1. 国标价 2. 油站价 3. 优惠幅度 + this.priceTypeArray.push({ codeValue: 1, codeName: '国标价' }); + this.priceTypeArray.push({ codeValue: 2, codeName: '油站价' }); + this.priceTypeArray.push({ codeValue: 3, codeName: '优惠幅度'}); + + // 获取全部省级地区 + this.commonsService.getProvinceList(data => { + this.regionArray = data['return_data']; + }); + + this.commonsService.getGasSelectList( data => { + this.gasArray = data['return_data']; + }); + + // 分公司 + } else if (this.secUserObjectType === 1) { + // 价格类型 1. 国标价 2. 油站价 3. 优惠幅度 + this.priceTypeArray.push({ codeValue: 1, codeName: '国标价' }); + this.priceTypeArray.push({ codeValue: 2, codeName: '油站价' }); + this.priceTypeArray.push({ codeValue: 3, codeName: '优惠幅度'}); + + this.regionArray.push({ regionId: this.localStorageService.get(ADMIN_INFO_OBJECT)['bsCompany']['regionId'], + regionName: this.localStorageService.get(ADMIN_INFO_OBJECT)['bsCompany']['regionName'] }); + + this.commonsService.getGasSelectList( data => { + this.gasArray = data['return_data']; + }); + + // 商户 + } else if (this.secUserObjectType === 2) { + this.priceTypeArray.push({ codeValue: 2, codeName: '油站价' }); + this.priceTypeArray.push({ codeValue: 3, codeName: '优惠幅度' }); + + this.commonsService.getGasSelectList( data => { + this.gasArray = data['return_data']; + }); + + // 加油站 + } else if (this.secUserObjectType === 3) { + this.priceTypeArray.push({ codeValue: 2, codeName: '油站价' }); + this.priceTypeArray.push({ codeValue: 3, codeName: '优惠幅度' }); + + this.dataFrom.patchValue({ merStoreIdArray: [ this.localStorageService.get(ADMIN_INFO_OBJECT)['merchantStore']['id'] ] }); + } + + this.commonsService.getDictionary('GAS_OIL_TYPE', data => { + this.oilNoArray = data['return_data']; + }); + + } + + /** + * 提交 + */ + submitFrom() { + for (const i in this.dataFrom.controls) { + this.dataFrom.controls[i].markAsDirty(); + this.dataFrom.controls[i].updateValueAndValidity(); + } + if (this.dataFrom.status == null || this.dataFrom.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请规范填写所有的必填项信息', + }); + return; + } + + const dataFromValue = this.dataFrom.value; + const dataArray = []; + + if (dataFromValue.priceType === '1') { + dataArray.push({ + regionId: dataFromValue.regionId, + oilNo: dataFromValue.oilNo, + priceType: dataFromValue.priceType, + price: dataFromValue.price, + executionType: dataFromValue.executionType, + startTime: dataFromValue.startTime, + }); + } else { + for (const storeId of this.dataFrom.value.merStoreIdArray) { + dataArray.push({ + merStoreId: storeId, + oilNo: dataFromValue.oilNo, + priceType: dataFromValue.priceType, + price: dataFromValue.price, + executionType: dataFromValue.executionType, + startTime: dataFromValue.startTime, + }); + } + } + + this.btnLoading = true; + this.oilPriceTaskService.batchAddTask(dataArray, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '添加成功', + nzOnOk: () => this.router.navigateByUrl('admin/gas-oil-price/task-list') + }); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + this.btnLoading = false; + }); } } diff --git a/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.html b/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.html index afa1e0d..75eff96 100644 --- a/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.html +++ b/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.html @@ -8,7 +8,7 @@
-
+
区域名称 @@ -17,6 +17,24 @@
+
+ + 油站编号 + + + + +
+ +
+ + 油站名称 + + + + +
+
油品号 @@ -40,6 +58,41 @@
+
+ + 价格类型 + + + + + + +
+ +
+ + 执行方式 + + + + + + + +
+ +
+ + 任务状态 + + + + + + + +
+
@@ -69,31 +122,42 @@ 序号 - 区域名称 - 油站名称 - 油品号 - 油品类型 - 价格类型 - 价格 - 执行方式 - 执行时间 - 状态 - 操作人 - 操作 + 区域名称 + 油站编号 + 油站名称 + 油品号 + 油品类型 + 价格类型 + 执行价格 + 执行方式 + 执行时间 + 任务状态 + 创建时间 + 创建人 + 操作 {{i+1}} - {{data.regionName}} - {{data.priceOfficial}} + {{data.regionName}} + {{data.merStoreKey?data.merStoreKey:'无'}} + {{data.merStoreName?data.merStoreName:'无'}} {{data.oilNo}} {{data.oilTypeName}} + {{data.priceType | oilPriceTaskPriceType}} + ¥{{data.price}} + {{data.executionType | oilPriceTaskExecutionType}} + {{data.startTime | date : 'yyyy-MM-dd HH:mm:ss'}} + {{data.status | oilPriceTaskStatus}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + {{data.opUserName}} 操作列表 diff --git a/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.ts b/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.ts index d6a9f31..5b7bab5 100644 --- a/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.ts +++ b/src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.ts @@ -3,11 +3,10 @@ import {environment} from '../../../../environments/environment'; 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 {LocalStorageService} from '../../../services/local-storage.service'; -import {OilPriceOfficialService} from '../../../services/oil-price/oil-price-official.service'; import {CommonsService} from '../../../services/commons.service'; import {Router} from '_@angular_router@9.0.7@@angular/router'; import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; -import {OilPriceTaskService} from "../../../services/oil-price/oil-price-task.service"; +import {OilPriceTaskService} from '../../../services/oil-price/oil-price-task.service'; @Component({ selector: 'app-oil-price-task-list', @@ -30,29 +29,48 @@ export class OilPriceTaskListComponent implements OnInit { whereObject: any = {}; oilNoArray = []; + priceTypeArray = []; + secUserObjectType: number; constructor(private modal: NzModalService, private message: NzMessageService, private store: LocalStorageService, private oilPriceTaskService: OilPriceTaskService, + private localStorageService: LocalStorageService , // 请求缓存 private commonsService: CommonsService, private router: Router, 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); + this.secUserObjectType = Number(this.localStorageService.get(ADMIN_INFO_OBJECT)['secUser']['objectType']); } ngOnInit(): void { this.searchForm = this.form.group({ regionName: [null], + merStoreKey: [null], + merStoreName: [null], oilNo: [null], oilType: [null], + priceType: [null], + executionType: [null], + status: [null], }); this.commonsService.getDictionary('GAS_OIL_TYPE', data => { this.oilNoArray = data['return_data']; }); + // 管理员 、分公司 + if (this.secUserObjectType === 0 || this.secUserObjectType === 1) { + // 价格类型 1. 国标价 2. 油站价 3. 优惠幅度 + this.priceTypeArray.push({codeValue: 1, codeName: '国标价'}); + this.priceTypeArray.push({codeValue: 2, codeName: '油站价'}); + this.priceTypeArray.push({codeValue: 3, codeName: '优惠幅度'}); + } else { + this.priceTypeArray.push({codeValue: 2, codeName: '油站价'}); + this.priceTypeArray.push({codeValue: 3, codeName: '优惠幅度'}); + } this.requestData(1); } diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts index 06874e4..c13d402 100644 --- a/src/app/app-common.module.ts +++ b/src/app/app-common.module.ts @@ -46,6 +46,9 @@ import { import {OilCardStatusPipe} from './pipes/oil-card/oil-card-status.pipe'; import { OilTypePipe } from './pipes/store/oil-type.pipe'; import {GasStaffStatusPipe} from './pipes/gas-staff/gas-staff-status.pipe'; +import {OilPriceTaskStatusPipe} from "./pipes/gas-oil-price/oil-price-task-status.pipe"; +import {OilPriceTaskExecutionTypePipe} from "./pipes/gas-oil-price/oil-price-task-execution-type.pipe"; +import {OilPriceTaskPriceTypePipe} from "./pipes/gas-oil-price/oil-price-task-price-type.pipe"; @@ -88,6 +91,9 @@ const PIPES = [ OilCardRecordTypePipe, OilCardRecordSourceTypePipe, GasStaffStatusPipe, + OilPriceTaskStatusPipe, + OilPriceTaskExecutionTypePipe, + OilPriceTaskPriceTypePipe, ]; diff --git a/src/app/pipes/gas-oil-price/oil-price-task-execution-type.pipe.ts b/src/app/pipes/gas-oil-price/oil-price-task-execution-type.pipe.ts new file mode 100644 index 0000000..c373a7f --- /dev/null +++ b/src/app/pipes/gas-oil-price/oil-price-task-execution-type.pipe.ts @@ -0,0 +1,17 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'oilPriceTaskExecutionType' +}) +export class OilPriceTaskExecutionTypePipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '立刻执行'; + case 2: + return '定时执行'; + } + } + +} diff --git a/src/app/pipes/gas-oil-price/oil-price-task-price-type.pipe.ts b/src/app/pipes/gas-oil-price/oil-price-task-price-type.pipe.ts new file mode 100644 index 0000000..2d988f3 --- /dev/null +++ b/src/app/pipes/gas-oil-price/oil-price-task-price-type.pipe.ts @@ -0,0 +1,19 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'oilPriceTaskPriceType' +}) +export class OilPriceTaskPriceTypePipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '国标价'; + case 2: + return '油站价'; + case 3: + return '优惠幅度'; + } + } + +} diff --git a/src/app/pipes/gas-oil-price/oil-price-task-status.pipe.ts b/src/app/pipes/gas-oil-price/oil-price-task-status.pipe.ts new file mode 100644 index 0000000..703e6db --- /dev/null +++ b/src/app/pipes/gas-oil-price/oil-price-task-status.pipe.ts @@ -0,0 +1,17 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'oilPriceTaskStatus' +}) +export class OilPriceTaskStatusPipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '等待中'; + case 2: + return '已执行'; + } + } + +} diff --git a/src/app/services/commons.service.ts b/src/app/services/commons.service.ts index cecb47c..05e0179 100644 --- a/src/app/services/commons.service.ts +++ b/src/app/services/commons.service.ts @@ -117,6 +117,26 @@ export class CommonsService { }); } + /** + * 查询省级列表 + * @param callBack 回调 + */ + public getProvinceList(callBack) { + this.http.get(environment.baseUrl + 'common/getProvinceList').subscribe(data => { + callBack(data); + }); + } + + /** + * 查询省级列表 + * @param callBack 回调 + */ + public getGasSelectList(callBack) { + this.http.get(environment.baseUrl + 'highGas/getGasSelectList').subscribe(data => { + callBack(data); + }); + } + /** * 根据数组对象去重 diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 5a795b3..8ebb4f1 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,10 +4,10 @@ export const environment = { production: false, - // baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) - // imageUrl: 'http://localhost:9302/filesystem/', - baseUrl: 'https://hsg.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) - imageUrl: 'https://hsg.dctpay.com/filesystem/', + baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) + imageUrl: 'http://localhost:9302/filesystem/', +/* baseUrl: 'https://hsg.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) + imageUrl: 'https://hsg.dctpay.com/filesystem/',*/ key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=', inviteUrl: 'https://hsgcs.dctpay.com/wx/?action=ic&id=', };