parent
8934655228
commit
e5807e0df2
@ -0,0 +1 @@ |
||||
<p>oil-price-task-edit works!</p> |
@ -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<OilPriceTaskEditComponent>; |
||||
|
||||
beforeEach(async(() => { |
||||
TestBed.configureTestingModule({ |
||||
declarations: [ OilPriceTaskEditComponent ] |
||||
}) |
||||
.compileComponents(); |
||||
})); |
||||
|
||||
beforeEach(() => { |
||||
fixture = TestBed.createComponent(OilPriceTaskEditComponent); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -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 { |
||||
} |
||||
|
||||
} |
@ -0,0 +1,99 @@ |
||||
<!-- 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"> |
||||
<nz-select nzAllowClear formControlName="oilNo"> |
||||
<nz-option *ngFor="let item of oilNoArray" nzLabel="{{item.codeName}}" nzValue="{{item.codeValue}}"></nz-option> |
||||
</nz-select> |
||||
</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"> |
||||
<nz-select nzAllowClear formControlName="oilType"> |
||||
<nz-option nzLabel="汽油" nzValue="1"></nz-option> |
||||
<nz-option nzLabel="柴油" nzValue="2"></nz-option> |
||||
</nz-select> |
||||
</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" [routerLink]="['/admin/gas-oil-price/task-edit']" ><i nz-icon nzType="plus" 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: '1100px'}"> |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="60px">序号</th> |
||||
<th nzWidth="100px">区域名称</th> |
||||
<th nzWidth="100px">国标价</th> |
||||
<th nzWidth="100px">油品号</th> |
||||
<th nzWidth="100px">油品类型</th> |
||||
<th nzWidth="80px" nzRight="0px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data;let i = index"> |
||||
<td>{{i+1}}</td> |
||||
<td>{{data.regionName}}</td> |
||||
<td>{{data.priceOfficial}}</td> |
||||
<td>{{data.oilNo}}</td> |
||||
<td>{{data.oilTypeName}}</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> |
||||
<li nz-menu-item ><a>删除</a></li> |
||||
</ul> |
||||
</nz-dropdown-menu> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
</nz-table> |
||||
</div> |
||||
</nz-spin> |
||||
|
@ -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<OilPriceTaskListComponent>; |
||||
|
||||
beforeEach(async(() => { |
||||
TestBed.configureTestingModule({ |
||||
declarations: [ OilPriceTaskListComponent ] |
||||
}) |
||||
.compileComponents(); |
||||
})); |
||||
|
||||
beforeEach(() => { |
||||
fixture = TestBed.createComponent(OilPriceTaskListComponent); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -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'] |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
} |
@ -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); |
||||
}); |
||||
} |
||||
} |
Loading…
Reference in new issue