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); + }); + } +}