提交代码

pull/1/head
胡锐 2 years ago
parent 0df9afd428
commit e0378f733c
  1. 91
      src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.html
  2. 13
      src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.scss
  3. 147
      src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.ts
  4. 94
      src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.html
  5. 22
      src/app/admin/gas-oil-price/oil-price-task-list/oil-price-task-list.component.ts
  6. 6
      src/app/app-common.module.ts
  7. 17
      src/app/pipes/gas-oil-price/oil-price-task-execution-type.pipe.ts
  8. 19
      src/app/pipes/gas-oil-price/oil-price-task-price-type.pipe.ts
  9. 17
      src/app/pipes/gas-oil-price/oil-price-task-status.pipe.ts
  10. 20
      src/app/services/commons.service.ts
  11. 8
      src/environments/environment.ts

@ -1 +1,90 @@
<p>oil-price-task-edit works!</p>
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<div class="inner-content">
<div class="main">
<form nz-form [formGroup]="dataFrom">
<div nz-row>
<div nz-col class="gutter-row" [nzSpan]="24">
<nz-form-item>
<nz-form-label [nzSpan]="8" nzRequired>油号</nz-form-label>
<nz-form-control [nzSpan]="8">
<nz-select 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 class="gutter-row" [nzSpan]="24">
<nz-form-item>
<nz-form-label [nzSpan]="8" nzRequired>价格类型</nz-form-label>
<nz-form-control [nzSpan]="8">
<nz-select formControlName="priceType" [nzPlaceHolder]="'请选择价格类型'">
<nz-option *ngFor="let item of priceTypeArray" nzLabel="{{item.codeName}}" nzValue="{{item.codeValue}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col class="gutter-row" [nzSpan]="24" *ngIf="dataFrom.value.priceType == 1">
<nz-form-item>
<nz-form-label [nzSpan]="8" nzRequired>执行地区</nz-form-label>
<nz-form-control [nzSpan]="8">
<nz-select formControlName="regionId" nzShowSearch [nzPlaceHolder]="'设置执行地区'">
<nz-option *ngFor="let item of regionArray" nzLabel="{{item.regionName}}" nzValue="{{item.regionId}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col class="gutter-row" [nzSpan]="24" *ngIf="(secUserObjectType == 0 || secUserObjectType == 1 || secUserObjectType == 2) && (dataFrom.value.priceType == 2 || dataFrom.value.priceType == 3)">
<nz-form-item>
<nz-form-label [nzSpan]="8" nzRequired>加油站</nz-form-label>
<nz-form-control [nzSpan]="8">
<nz-select formControlName="merStoreIdArray" nzMode="multiple" [nzPlaceHolder]="'请选择加油站'">
<nz-option *ngFor="let item of gasArray" nzLabel="{{'【' + item.storeKey + '】' + item.storeName}}" nzValue="{{item.id}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col class="gutter-row" [nzSpan]="24">
<nz-form-item>
<nz-form-label [nzSpan]="8" nzRequired>执行价格(¥)</nz-form-label>
<nz-form-control [nzSpan]="8">
<nz-input-number formControlName="price" [nzMin]="0" [nzMax]="999" [nzStep]="1" [nzPrecision]="2"></nz-input-number>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col class="gutter-row" [nzSpan]="24">
<nz-form-item>
<nz-form-label [nzSpan]="8" nzRequired>执行方式</nz-form-label>
<nz-form-control [nzSpan]="8">
<nz-radio-group formControlName="executionType">
<label nz-radio nzValue="1">立刻执行</label>
<label nz-radio nzValue="2">定时执行</label>
</nz-radio-group>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col class="gutter-row" [nzSpan]="24" *ngIf="dataFrom.value.executionType == 2">
<nz-form-item>
<nz-form-label [nzSpan]="8" nzRequired>执行时间</nz-form-label>
<nz-form-control [nzSpan]="8">
<nz-date-picker formControlName="startTime" nzFormat="yyyy-MM-dd HH:mm:ss" nzShowTime [nzPlaceHolder]="'设置执行时间'"></nz-date-picker>
</nz-form-control>
</nz-form-item>
</div>
</div>
<div class="btn-div">
<button class="btn-post" nz-button nzType="primary" (click)="submitFrom()" [nzLoading]="btnLoading" nzBlock>保存</button>
</div>
</form>
</div>
</div>

@ -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%;
}

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

@ -8,7 +8,7 @@
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)">
<div nz-row>
<div nz-col nzSpan="8">
<div nz-col nzSpan="8" *ngIf="this.secUserObjectType !== 3">
<nz-form-item>
<nz-form-label [nzSpan]="8">区域名称</nz-form-label>
<nz-form-control [nzSpan]="14">
@ -17,6 +17,24 @@
</nz-form-item>
</div>
<div nz-col nzSpan="8" *ngIf="this.secUserObjectType !== 3">
<nz-form-item>
<nz-form-label [nzSpan]="8">油站编号</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="merStoreKey" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8" *ngIf="this.secUserObjectType !== 3">
<nz-form-item>
<nz-form-label [nzSpan]="8">油站名称</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="merStoreName" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="8">油品号</nz-form-label>
@ -40,6 +58,41 @@
</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="priceType">
<nz-option *ngFor="let item of priceTypeArray" 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="executionType">
<nz-option nzLabel="立刻执行" nzValue="1"></nz-option>
<nz-option nzLabel="定时执行" nzValue="2"></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="status">
<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>
@ -69,31 +122,42 @@
<thead>
<tr>
<th nzWidth="60px">序号</th>
<th nzWidth="100px">区域名称</th>
<th nzWidth="100px">油站名称</th>
<th nzWidth="100px">油品号</th>
<th nzWidth="100px">油品类型</th>
<th nzWidth="100px">价格类型</th>
<th nzWidth="100px">价格</th>
<th nzWidth="100px">执行方式</th>
<th nzWidth="100px">执行时间</th>
<th nzWidth="100px">状态</th>
<th nzWidth="100px">操作人</th>
<th nzWidth="80px" nzRight="0px">操作</th>
<th nzWidth="100px" *ngIf="this.secUserObjectType !== 3">区域名称</th>
<th nzWidth="100px" *ngIf="this.secUserObjectType !== 3">油站编号</th>
<th nzWidth="200px" *ngIf="this.secUserObjectType !== 3">油站名称</th>
<th nzWidth="80px">油品号</th>
<th nzWidth="90px">油品类型</th>
<th nzWidth="90px">价格类型</th>
<th nzWidth="90px">执行价格</th>
<th nzWidth="90px">执行方式</th>
<th nzWidth="160px">执行时间</th>
<th nzWidth="90px">任务状态</th>
<th nzWidth="160px">创建时间</th>
<th nzWidth="120px">创建人</th>
<th nzWidth="110px" 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 *ngIf="this.secUserObjectType !== 3">{{data.regionName}}</td>
<td *ngIf="this.secUserObjectType !== 3">{{data.merStoreKey?data.merStoreKey:'无'}}</td>
<td *ngIf="this.secUserObjectType !== 3">{{data.merStoreName?data.merStoreName:'无'}}</td>
<td>{{data.oilNo}}</td>
<td>{{data.oilTypeName}}</td>
<td>{{data.priceType | oilPriceTaskPriceType}}</td>
<td>¥{{data.price}}</td>
<td>{{data.executionType | oilPriceTaskExecutionType}}</td>
<td>{{data.startTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
<td>{{data.status | oilPriceTaskStatus}}</td>
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
<td>{{data.opUserName}}</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>
<li nz-menu-item *ngIf="data.status == 1" (click)="showDelConfirm(data.id)"><a>删除任务</a></li>
<li nz-menu-item *ngIf="data.status != 1" nzDisabled>暂无操作</li>
</ul>
</nz-dropdown-menu>
</td>

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

@ -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,
];

@ -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 '定时执行';
}
}
}

@ -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 '优惠幅度';
}
}
}

@ -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 '已执行';
}
}
}

@ -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);
});
}
/**
*

@ -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=',
};

Loading…
Cancel
Save