parent
e1ad1bb533
commit
aff577603f
@ -0,0 +1,152 @@ |
|||||||
|
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||||
|
<div nz-row [nzGutter]="24"> |
||||||
|
|
||||||
|
<div nz-col [nzSpan]="6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label>轮播图类型</nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<nz-select formControlName="type" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||||
|
<nz-option *ngFor="let item of cmsTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col [nzSpan]="6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label>状态</nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<nz-select formControlName="status" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||||
|
<nz-option *ngFor="let item of cmsStatusArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col [nzSpan]="6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label></nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||||
|
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||||
|
<button nz-button style="margin-right: 8px" (click)="showEditCmsModal(null)" [nzType]="'primary'" >新增轮播图</button> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
|
||||||
|
<nz-table #basicTable |
||||||
|
[nzScroll]="{ x: '2400' }" |
||||||
|
[nzBordered]="true" |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzShowQuickJumper]="true" |
||||||
|
[nzShowTotal]="totalTemplate" |
||||||
|
[(nzPageIndex)]="tablePageNum" |
||||||
|
(nzPageIndexChange)="queryData()" |
||||||
|
nzShowSizeChanger |
||||||
|
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||||
|
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||||
|
[nzTotal]="tableData.total" |
||||||
|
[nzData]="tableData.list" > |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<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 nzRight nzWidth="70px">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data"> |
||||||
|
<td>{{data.type | dictionary : 'CMS_TYPE'}}</td> |
||||||
|
<td> |
||||||
|
<span *ngIf="data.jumpType == 1">内链</span> |
||||||
|
<span *ngIf="data.jumpType == 2">外链</span> |
||||||
|
</td> |
||||||
|
<td>{{data.jumpUrl}}</td> |
||||||
|
<td><img nz-image width="100px" height="100px" nzSrc="{{IMAGE_URL + data.imgUrl}}" alt="" style="object-fit: contain;"></td> |
||||||
|
<td>{{data.status | dictionary : 'CMS_STATUS'}}</td> |
||||||
|
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<td nzRight> |
||||||
|
<a nz-dropdown [nzDropdownMenu]="menu"> |
||||||
|
操作列表 |
||||||
|
<span nz-icon nzType="down"></span> |
||||||
|
</a> |
||||||
|
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||||
|
<ul nz-menu nzSelectable> |
||||||
|
<li nz-menu-item *ngIf="data.status == 1"><a (click)="showEditCmsModal(data)">修改</a></li> |
||||||
|
<li nz-menu-item *ngIf="data.status == 1"><a (click)="online(data.id)">上线</a></li> |
||||||
|
<li nz-menu-item *ngIf="data.status == 2"><a (click)="offline(data.id)">下线</a></li> |
||||||
|
<li nz-menu-item *ngIf="data.status == 1"><a (click)="delCms(data.id)">删除</a></li> |
||||||
|
</ul> |
||||||
|
</nz-dropdown-menu></td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template>x |
||||||
|
</nz-table> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="editCmsModal" |
||||||
|
[nzWidth]="500" |
||||||
|
nzTitle="{{this.editCmsForm.controls['id'].value==null?'新增':'修改'}}" |
||||||
|
[nzFooter]="null" |
||||||
|
(nzOnCancel)="closeEditModal()"> |
||||||
|
<ng-container *nzModalContent> |
||||||
|
<form nz-form [formGroup]="editCmsForm"> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>轮播图类型</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-select formControlName="type" [nzPlaceHolder]="'请选择'"> |
||||||
|
<nz-option *ngFor="let item of cmsTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>轮播图图片</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-upload |
||||||
|
class="logo-uploader" |
||||||
|
nzAction="{{BASE_URL}}fileUpload/uploadfile" |
||||||
|
nzName="avatar" |
||||||
|
nzListType="picture-card" |
||||||
|
[nzShowUploadList]="false" |
||||||
|
[nzBeforeUpload]="beforeUpload" |
||||||
|
(nzChange)="handleChange($event)" |
||||||
|
> |
||||||
|
<ng-container *ngIf="!logoUrl"> |
||||||
|
<i class="upload-icon" nz-icon [nzType]="loading ? 'loading' : 'plus'"></i> |
||||||
|
<div class="ant-upload-text">上传</div> |
||||||
|
</ng-container> |
||||||
|
<img *ngIf="logoUrl" [src]="logoUrl" style="width: 100%" /> |
||||||
|
</nz-upload> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24">跳转类型</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-select formControlName="jumpType" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||||
|
<nz-option nzValue="1" nzLabel="内链"></nz-option> |
||||||
|
<nz-option nzValue="2" nzLabel="外链"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item *ngIf="editCmsForm.controls['jumpType'].value != null"> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24">跳转地址</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<input nz-input formControlName="jumpUrl" placeholder="请输入" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||||
|
<button nz-button nzType="primary" (click)="submitData()" class="submit-btn">保存</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</ng-container> |
||||||
|
</nz-modal> |
@ -0,0 +1,9 @@ |
|||||||
|
nz-input-number { |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
nz-date-picker { |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
.submit-btn { |
||||||
|
width: 150px; |
||||||
|
} |
@ -0,0 +1,321 @@ |
|||||||
|
import { Component } from '@angular/core'; |
||||||
|
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||||
|
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||||
|
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||||
|
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||||
|
import { |
||||||
|
NzCellFixedDirective, |
||||||
|
NzTableCellDirective, |
||||||
|
NzTableComponent, NzTableModule, |
||||||
|
NzTbodyComponent, NzTheadComponent, |
||||||
|
NzThMeasureDirective, NzTrDirective |
||||||
|
} from "ng-zorro-antd/table"; |
||||||
|
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||||
|
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||||
|
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||||
|
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||||
|
import {NzInputNumberComponent, NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||||
|
import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||||
|
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||||
|
import {NzMessageService} from "ng-zorro-antd/message"; |
||||||
|
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||||
|
import {OilTaskService} from "../../../services/mer-oil-price/oil-task.service"; |
||||||
|
import {CommonService} from "../../../services/common/common.service"; |
||||||
|
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||||
|
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||||
|
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||||
|
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||||
|
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||||
|
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||||
|
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||||
|
import {NzUploadComponent, NzUploadFile} from "ng-zorro-antd/upload"; |
||||||
|
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||||
|
import {NzImageModule} from "ng-zorro-antd/image"; |
||||||
|
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||||
|
import {environment} from "../../../../environments/environment"; |
||||||
|
import {CmsService} from "../../../services/cms/cms.service"; |
||||||
|
import {Observable, Observer} from "rxjs"; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-cms-list', |
||||||
|
standalone: true, |
||||||
|
imports: [ |
||||||
|
DatePipe, |
||||||
|
DictionaryPipe, |
||||||
|
FormsModule, |
||||||
|
NgForOf, |
||||||
|
NgIf, |
||||||
|
NzButtonComponent, |
||||||
|
NzCellFixedDirective, |
||||||
|
NzColDirective, |
||||||
|
NzDividerComponent, |
||||||
|
NzDropDownADirective, |
||||||
|
NzDropDownDirective, |
||||||
|
NzDropdownMenuComponent, |
||||||
|
NzFormControlComponent, |
||||||
|
NzFormDirective, |
||||||
|
NzFormItemComponent, |
||||||
|
NzFormLabelComponent, |
||||||
|
NzIconDirective, |
||||||
|
NzInputDirective, |
||||||
|
NzMenuDirective, |
||||||
|
NzMenuItemComponent, |
||||||
|
NzOptionComponent, |
||||||
|
NzRowDirective, |
||||||
|
NzSelectComponent, |
||||||
|
NzTableCellDirective, |
||||||
|
NzTableComponent, |
||||||
|
NzTbodyComponent, |
||||||
|
NzThMeasureDirective, |
||||||
|
NzTheadComponent, |
||||||
|
NzTrDirective, |
||||||
|
ReactiveFormsModule, |
||||||
|
NzTableModule, |
||||||
|
NzModalModule, |
||||||
|
NzFlexDirective, |
||||||
|
NzDescriptionsModule, |
||||||
|
NzUploadComponent, |
||||||
|
NzAvatarModule, |
||||||
|
NzImageModule, |
||||||
|
NzSwitchComponent, |
||||||
|
NzDatePickerComponent, |
||||||
|
NzInputNumberModule |
||||||
|
], |
||||||
|
templateUrl: './cms-list.component.html', |
||||||
|
styleUrl: './cms-list.component.less' |
||||||
|
}) |
||||||
|
export class CmsListComponent { |
||||||
|
BASE_URL = environment.baseUrl; |
||||||
|
IMAGE_URL = environment.imageUrl; |
||||||
|
loading = false; |
||||||
|
logoUrl?: string; |
||||||
|
// 表单页数
|
||||||
|
tablePageNum = 1; |
||||||
|
// 每页数量
|
||||||
|
tablePageSize = 10; |
||||||
|
// 表单数据
|
||||||
|
tableData: any = { |
||||||
|
total: 0, |
||||||
|
list: [], |
||||||
|
}; |
||||||
|
accountType = null; |
||||||
|
// 搜索表单
|
||||||
|
searchForm: FormGroup; |
||||||
|
// 编辑表单
|
||||||
|
editCmsForm: FormGroup; |
||||||
|
editCmsModal = false; |
||||||
|
|
||||||
|
// 轮播图类型
|
||||||
|
cmsTypeArray = new DictionaryPipe().getDictionaryList('CMS_TYPE'); |
||||||
|
// 轮播图状态
|
||||||
|
cmsStatusArray = new DictionaryPipe().getDictionaryList('CMS_STATUS'); |
||||||
|
constructor(private fb: NonNullableFormBuilder, |
||||||
|
private message: NzMessageService, |
||||||
|
private storage: BrowserStorageService, |
||||||
|
private cmsService: CmsService, |
||||||
|
private commonService: CommonService, |
||||||
|
private modal: NzModalService) { |
||||||
|
this.accountType = this.storage.get(DATA)['account']['objectType']; |
||||||
|
|
||||||
|
// 初始化搜索框
|
||||||
|
this.searchForm = this.fb.group({ |
||||||
|
type: [null], |
||||||
|
status: [null], |
||||||
|
}); |
||||||
|
|
||||||
|
this.editCmsForm = this.fb.group({ |
||||||
|
id: [''], |
||||||
|
type: ['', [Validators.required]], |
||||||
|
imgUrl: ['', [Validators.required]], |
||||||
|
jumpType: [''], |
||||||
|
jumpUrl: [''], |
||||||
|
}); |
||||||
|
// 查询数据
|
||||||
|
this.queryData(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取数据 |
||||||
|
*/ |
||||||
|
queryData() { |
||||||
|
this.searchForm.value.pageNum = this.tablePageNum; |
||||||
|
this.searchForm.value.pageSize = this.tablePageSize; |
||||||
|
this.searchForm.value.time = new Date().getTime(); |
||||||
|
this.cmsService.queryList(this.searchForm.value, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
this.tableData = data['return_data']; |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 搜索表单提交 |
||||||
|
*/ |
||||||
|
searchFormSubmit(): void { |
||||||
|
this.tablePageNum = 1; |
||||||
|
this.queryData(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 搜索表单重置 |
||||||
|
*/ |
||||||
|
searchFormReset(): void { |
||||||
|
this.searchForm.reset(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
*/ |
||||||
|
delCms(id: number) { |
||||||
|
this.modal.confirm({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '确定删除吗?', |
||||||
|
nzOnOk: () => |
||||||
|
this.cmsService.delete({id: id}, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
// 刷新数据
|
||||||
|
this.queryData(); |
||||||
|
this.message.create('success', '操作成功'); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}) |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 下线 |
||||||
|
*/ |
||||||
|
offline(id: number) { |
||||||
|
this.modal.confirm({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '确定轮播图下线吗?', |
||||||
|
nzOnOk: () => |
||||||
|
this.cmsService.offline({id: id}, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
// 刷新数据
|
||||||
|
this.queryData(); |
||||||
|
this.message.create('success', '操作成功'); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}) |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 上线 |
||||||
|
*/ |
||||||
|
online(id: number) { |
||||||
|
this.modal.confirm({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '确定轮播图上线吗?', |
||||||
|
nzOnOk: () => |
||||||
|
this.cmsService.online({id: id}, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
// 刷新数据
|
||||||
|
this.queryData(); |
||||||
|
this.message.create('success', '操作成功'); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}) |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 打开编辑模态框 |
||||||
|
*/ |
||||||
|
showEditCmsModal(data: any) { |
||||||
|
if (data != null) { |
||||||
|
this.logoUrl = this.IMAGE_URL + data['imgUrl']; |
||||||
|
data['type'] = ''+data['type']; |
||||||
|
data['jumpType'] = ''+data['jumpType']; |
||||||
|
} |
||||||
|
this.editCmsForm.patchValue(data); |
||||||
|
this.editCmsModal = true; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 提交数据 |
||||||
|
*/ |
||||||
|
submitData() { |
||||||
|
if (this.editCmsForm.valid) { |
||||||
|
this.cmsService.edit(this.editCmsForm.value, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
this.message.create('success', '操作成功'); |
||||||
|
// 刷新数据
|
||||||
|
this.queryData(); |
||||||
|
// 关闭弹窗
|
||||||
|
this.closeEditModal(); |
||||||
|
// 表单重置
|
||||||
|
this.editCmsForm.reset(); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} else { |
||||||
|
Object.values(this.editCmsForm.controls).forEach(control => { |
||||||
|
if (control.invalid) { |
||||||
|
control.markAsDirty(); |
||||||
|
control.updateValueAndValidity({ onlySelf: true }); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 关闭编辑任务模态框 |
||||||
|
*/ |
||||||
|
closeEditModal() { |
||||||
|
this.editCmsForm.reset(); |
||||||
|
this.logoUrl = ''; |
||||||
|
this.editCmsModal = false; |
||||||
|
} |
||||||
|
|
||||||
|
private getBase64(img: File, callback: (img: string) => void): void { |
||||||
|
const reader = new FileReader(); |
||||||
|
reader.addEventListener('load', () => callback(reader.result!.toString())); |
||||||
|
reader.readAsDataURL(img); |
||||||
|
} |
||||||
|
|
||||||
|
handleChange(info: { file: NzUploadFile }): void { |
||||||
|
switch (info.file.status) { |
||||||
|
case 'uploading': |
||||||
|
this.loading = true; |
||||||
|
break; |
||||||
|
case 'done': |
||||||
|
// Get this url from response in real world.
|
||||||
|
this.getBase64(info.file!.originFileObj!, (img: string) => { |
||||||
|
this.loading = false; |
||||||
|
this.logoUrl = img; |
||||||
|
}); |
||||||
|
// 不是自建站,拼接绝对路径访问链接
|
||||||
|
this.editCmsForm.patchValue({ imgUrl: info.file.response['return_data'][0]}); |
||||||
|
break; |
||||||
|
case 'error': |
||||||
|
this.message.error('网络错误!'); |
||||||
|
this.loading = false; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
beforeUpload = (file: NzUploadFile, _fileList: NzUploadFile[]) => { |
||||||
|
return new Observable((observer: Observer<boolean>) => { |
||||||
|
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; |
||||||
|
if (!isJpgOrPng) { |
||||||
|
this.message.error('只能上传JPG文件!'); |
||||||
|
observer.complete(); |
||||||
|
return; |
||||||
|
} |
||||||
|
const isLt2M = file.size! / 1024 / 1024 < 2; |
||||||
|
if (!isLt2M) { |
||||||
|
this.message.error('图片必须小于2MB!'); |
||||||
|
observer.complete(); |
||||||
|
return; |
||||||
|
} |
||||||
|
observer.next(isJpgOrPng && isLt2M); |
||||||
|
observer.complete(); |
||||||
|
}); |
||||||
|
}; |
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
<form nz-form [formGroup]="form" [nzLayout]="'vertical'"> |
||||||
|
<div nz-col [nzSpan]="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label>打印机打印内容</nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<nz-radio-group formControlName="receiptOutContent"> |
||||||
|
<label nz-radio nzValue="2">油站单打</label> |
||||||
|
<label nz-radio nzValue="1">油客双打</label> |
||||||
|
</nz-radio-group> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-flex > |
||||||
|
<button nz-button nzType="primary" class="submit-btn" (click)="submitForm()">保存</button> |
||||||
|
</div> |
||||||
|
</form> |
@ -0,0 +1,120 @@ |
|||||||
|
import { Component } from '@angular/core'; |
||||||
|
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||||
|
import {NgForOf, NgIf} from "@angular/common"; |
||||||
|
import {NzCascaderComponent, NzCascaderModule} from "ng-zorro-antd/cascader"; |
||||||
|
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||||
|
import { |
||||||
|
NzFormControlComponent, |
||||||
|
NzFormDirective, |
||||||
|
NzFormItemComponent, |
||||||
|
NzFormLabelComponent, |
||||||
|
NzFormModule |
||||||
|
} from "ng-zorro-antd/form"; |
||||||
|
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||||
|
import {NzUploadComponent, NzUploadModule} from "ng-zorro-antd/upload"; |
||||||
|
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||||
|
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||||
|
import {NzInputDirective, NzInputGroupComponent} from "ng-zorro-antd/input"; |
||||||
|
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||||
|
import {MerService} from "../../../services/merchant/mer.service"; |
||||||
|
import {MerChainBrandService} from "../../../services/merchant/mer-chain-brand.service"; |
||||||
|
import {RoleService} from "../../../services/role/role.service"; |
||||||
|
import {NzMessageService} from "ng-zorro-antd/message"; |
||||||
|
import {ActivatedRoute} from "@angular/router"; |
||||||
|
import {HttpClient} from "@angular/common/http"; |
||||||
|
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||||
|
import {NzInputNumberComponent} from "ng-zorro-antd/input-number"; |
||||||
|
import {DeviceService} from "../../../services/device/device.service"; |
||||||
|
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||||
|
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||||
|
import {NzRadioComponent, NzRadioGroupComponent} from "ng-zorro-antd/radio"; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-device-print', |
||||||
|
standalone: true, |
||||||
|
imports: [ |
||||||
|
FormsModule, |
||||||
|
NgForOf, |
||||||
|
NzButtonComponent, |
||||||
|
NzColDirective, |
||||||
|
NzFlexDirective, |
||||||
|
NzFormControlComponent, |
||||||
|
NzFormDirective, |
||||||
|
ReactiveFormsModule, |
||||||
|
NzFormItemComponent, |
||||||
|
NzFormLabelComponent, |
||||||
|
NzInputDirective, |
||||||
|
NzSelectComponent, |
||||||
|
NzOptionComponent, |
||||||
|
NzModalModule, |
||||||
|
NzFormModule, |
||||||
|
NzUploadModule, |
||||||
|
NzIconDirective, |
||||||
|
NgIf, |
||||||
|
NzInputGroupComponent, |
||||||
|
NzInputNumberComponent, |
||||||
|
NzCascaderModule, |
||||||
|
NzRadioGroupComponent, |
||||||
|
NzRadioComponent |
||||||
|
], |
||||||
|
templateUrl: './device-print.component.html', |
||||||
|
styleUrl: './device-print.component.less' |
||||||
|
}) |
||||||
|
export class DevicePrintComponent { |
||||||
|
form: FormGroup; |
||||||
|
|
||||||
|
constructor(private fb: NonNullableFormBuilder, |
||||||
|
private deviceService: DeviceService, |
||||||
|
private storage: BrowserStorageService, |
||||||
|
private message: NzMessageService, |
||||||
|
private activatedRoute: ActivatedRoute, |
||||||
|
private modal: NzModalService, |
||||||
|
private http: HttpClient) { |
||||||
|
|
||||||
|
// 初始化表单
|
||||||
|
this.form = this.fb.group({ |
||||||
|
merNo: [''], |
||||||
|
receiptOutContent: [''], |
||||||
|
}); |
||||||
|
|
||||||
|
let merNo = this.storage.get(DATA)['merchant']['merNo']; |
||||||
|
console.log(merNo); |
||||||
|
if (merNo == null) { |
||||||
|
this.modal.error({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '此功能由油站角色设置', |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
this.deviceService.getSettingReceipt({merNo: merNo}, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
this.form.controls['merNo'].setValue(merNo); |
||||||
|
this.form.controls['receiptOutContent'].setValue(''+data['return_data']); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 提交表单 |
||||||
|
*/ |
||||||
|
submitForm() { |
||||||
|
if (this.form.valid) { |
||||||
|
this.deviceService.settingReceipt(this.form.value, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
this.message.create('success', '操作成功'); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} else { |
||||||
|
Object.values(this.form.controls).forEach(control => { |
||||||
|
if (control.invalid) { |
||||||
|
control.markAsDirty(); |
||||||
|
control.updateValueAndValidity({ onlySelf: true }); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,110 @@ |
|||||||
|
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||||
|
<div nz-row [nzGutter]="24"> |
||||||
|
<div nz-col nzSpan="6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label>班组名称</nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<input nz-input formControlName="name" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col nzSpan="6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label>负责人名称</nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<input nz-input formControlName="principalName" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col nzSpan="6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label>负责人电话</nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<input nz-input formControlName="principalPhone" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col nzSpan="6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label></nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="search(searchForm.value)">查询</button> |
||||||
|
<button nz-button style="margin-right: 8px" (click)="resetForm()">重置</button> |
||||||
|
<button nz-button style="margin-right: 8px" (click)="showEditClassGroup(null)" [nzType]="'primary'" >添加班组</button> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
|
||||||
|
<div class="inner-content"> |
||||||
|
<!--数组表格 --> |
||||||
|
<nz-table #basicTable |
||||||
|
[nzData]="dataObject.list" |
||||||
|
[nzTotal]="dataObject.total" |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzShowQuickJumper]="true" |
||||||
|
[nzShowTotal]="totalTemplate" |
||||||
|
[nzLoading]="tableLoading" |
||||||
|
[nzPageIndex]="whereObject.pageNum" |
||||||
|
(nzPageIndexChange)="requestData($event)" |
||||||
|
[nzScroll]="{ x: '1150px'}"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th nzWidth="80px">序号</th> |
||||||
|
<th nzWidth="100px">班组名称</th> |
||||||
|
<th nzWidth="100px">负责人名称</th> |
||||||
|
<th nzWidth="100px">负责人电话</th> |
||||||
|
<th nzWidth="120px">创建时间</th> |
||||||
|
<th nzWidth="100px" nzRight="0px">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data;let i = index"> |
||||||
|
<td>{{i + 1}}</td> |
||||||
|
<td>{{data.name}}</td> |
||||||
|
<td>{{data.principalName}}</td> |
||||||
|
<td>{{data.principalPhone}}</td> |
||||||
|
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</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 (click)="showEditClassGroup(data)" >修改</a></li> |
||||||
|
<li nz-menu-item><a (click)="showDeleteConfirm(data.id)">删除</a></li> |
||||||
|
</ul> |
||||||
|
</nz-dropdown-menu> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template>x |
||||||
|
</nz-table> |
||||||
|
</div> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="classGroupModal" nzTitle="编辑班组" (nzOnCancel)="closeEditClassGroup()" nzWidth="500px" [nzFooter]="null"> |
||||||
|
<ng-container *nzModalContent> |
||||||
|
<form nz-form [formGroup]="classGroupForm"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6" nzRequired >班组名称</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="name" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6" nzRequired >负责人名称</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="principalName" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6" nzRequired >负责人电话</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="principalPhone" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
<div style="text-align: center;"> |
||||||
|
<button nz-button nzType="primary" style="width: 150px;" (click)="submitEditClassGroup()">保存</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</ng-container> |
||||||
|
</nz-modal> |
@ -0,0 +1,9 @@ |
|||||||
|
nz-input-number { |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
nz-date-picker { |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
.submit-btn { |
||||||
|
width: 150px; |
||||||
|
} |
@ -0,0 +1,245 @@ |
|||||||
|
import { Component } from '@angular/core'; |
||||||
|
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||||
|
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||||
|
import { |
||||||
|
NzCellFixedDirective, |
||||||
|
NzTableCellDirective, |
||||||
|
NzTableComponent, NzTableModule, |
||||||
|
NzTbodyComponent, NzTheadComponent, |
||||||
|
NzThMeasureDirective, NzTrDirective |
||||||
|
} from "ng-zorro-antd/table"; |
||||||
|
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||||
|
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||||
|
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||||
|
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||||
|
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||||
|
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||||
|
import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||||
|
import {NzWaveDirective} from "ng-zorro-antd/core/wave"; |
||||||
|
import {FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||||
|
import {NzMessageService} from "ng-zorro-antd/message"; |
||||||
|
import {MerClassGroupService} from "../../../services/merchant/mer-class-group.service"; |
||||||
|
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||||
|
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||||
|
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||||
|
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||||
|
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||||
|
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||||
|
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||||
|
import {NzImageModule} from "ng-zorro-antd/image"; |
||||||
|
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||||
|
import {NzDatePickerComponent, NzRangePickerComponent} from "ng-zorro-antd/date-picker"; |
||||||
|
import {NzRadioButtonDirective, NzRadioComponent, NzRadioGroupComponent} from "ng-zorro-antd/radio"; |
||||||
|
import {NzToolTipModule} from "ng-zorro-antd/tooltip"; |
||||||
|
import {NzTabsModule} from "ng-zorro-antd/tabs"; |
||||||
|
import {NzTagModule} from "ng-zorro-antd/tag"; |
||||||
|
import {NzCardModule} from "ng-zorro-antd/card"; |
||||||
|
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||||
|
import {NzQRCodeModule} from "ng-zorro-antd/qr-code"; |
||||||
|
import {RouterLink} from "@angular/router"; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-mer-class-group-list', |
||||||
|
standalone: true, |
||||||
|
imports: [ |
||||||
|
DatePipe, |
||||||
|
DictionaryPipe, |
||||||
|
FormsModule, |
||||||
|
NgForOf, |
||||||
|
NgIf, |
||||||
|
NzButtonComponent, |
||||||
|
NzCellFixedDirective, |
||||||
|
NzColDirective, |
||||||
|
NzDividerComponent, |
||||||
|
NzDropDownADirective, |
||||||
|
NzDropDownDirective, |
||||||
|
NzDropdownMenuComponent, |
||||||
|
NzFormControlComponent, |
||||||
|
NzFormDirective, |
||||||
|
NzFormItemComponent, |
||||||
|
NzFormLabelComponent, |
||||||
|
NzIconDirective, |
||||||
|
NzInputDirective, |
||||||
|
NzMenuDirective, |
||||||
|
NzMenuItemComponent, |
||||||
|
NzOptionComponent, |
||||||
|
NzRowDirective, |
||||||
|
NzSelectComponent, |
||||||
|
NzTableCellDirective, |
||||||
|
NzTableComponent, |
||||||
|
NzTbodyComponent, |
||||||
|
NzThMeasureDirective, |
||||||
|
NzTheadComponent, |
||||||
|
NzTrDirective, |
||||||
|
ReactiveFormsModule, |
||||||
|
NzTableModule, |
||||||
|
NzModalModule, |
||||||
|
NzFlexDirective, |
||||||
|
NzDescriptionsModule, |
||||||
|
NzUploadComponent, |
||||||
|
NzAvatarModule, |
||||||
|
NzImageModule, |
||||||
|
NzSwitchComponent, |
||||||
|
NzDatePickerComponent, |
||||||
|
NzRadioButtonDirective, |
||||||
|
NzRadioComponent, |
||||||
|
NzRadioGroupComponent, |
||||||
|
NzRangePickerComponent, |
||||||
|
NzToolTipModule, |
||||||
|
NzTabsModule, |
||||||
|
NzTagModule, |
||||||
|
NzCardModule, |
||||||
|
NzInputNumberModule, |
||||||
|
NzQRCodeModule, |
||||||
|
RouterLink |
||||||
|
], |
||||||
|
templateUrl: './mer-class-group-list.component.html', |
||||||
|
styleUrl: './mer-class-group-list.component.less' |
||||||
|
}) |
||||||
|
export class MerClassGroupListComponent { |
||||||
|
|
||||||
|
dataObject: any = {}; |
||||||
|
tableLoading = true; |
||||||
|
searchForm: FormGroup; |
||||||
|
pageNum: number = 1; |
||||||
|
whereObject: any = {}; |
||||||
|
|
||||||
|
classGroupModal = false; |
||||||
|
classGroupForm: FormGroup; |
||||||
|
|
||||||
|
constructor(private modal: NzModalService, |
||||||
|
private message: NzMessageService, |
||||||
|
private gasClassGroupService: MerClassGroupService, |
||||||
|
private form: FormBuilder) { |
||||||
|
this.searchForm = this.form.group({ |
||||||
|
name: [null], |
||||||
|
principalName: [null], |
||||||
|
principalPhone: [null], |
||||||
|
}); |
||||||
|
|
||||||
|
this.classGroupForm = this.form.group({ |
||||||
|
id: [null], |
||||||
|
name: [null, [Validators.required]], |
||||||
|
principalName: [null, [Validators.required]], |
||||||
|
principalPhone: [null, [Validators.required]], |
||||||
|
}); |
||||||
|
this.requestData(1); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 请求数据 |
||||||
|
*/ |
||||||
|
requestData(pageNum: number) { |
||||||
|
this.tableLoading = true; |
||||||
|
this.whereObject['pageNum'] = pageNum; |
||||||
|
this.whereObject['pageSize'] = 10; |
||||||
|
this.whereObject['time'] = new Date().getTime(); |
||||||
|
this.gasClassGroupService.getClassGroupList(this.whereObject, (data: any) => { |
||||||
|
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(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 弹出删除对话框 |
||||||
|
*/ |
||||||
|
showDeleteConfirm(groupId: number): void { |
||||||
|
this.modal.confirm({ |
||||||
|
nzTitle: '警告', |
||||||
|
nzContent: '是否删除班组', |
||||||
|
nzOkText: '是', |
||||||
|
nzCancelText: '否', |
||||||
|
nzOnOk: () => this.deleteData(groupId) |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除数据 |
||||||
|
* |
||||||
|
*/ |
||||||
|
deleteData(groupId: number) { |
||||||
|
this.gasClassGroupService.delClassGroup(groupId, (data: any) => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.requestData(this.whereObject['pageNum']); |
||||||
|
} else { |
||||||
|
this.modal.error({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: data['return_msg'] |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 打开编辑班组模态框 |
||||||
|
*/ |
||||||
|
showEditClassGroup(data: any) { |
||||||
|
if (data != null) { |
||||||
|
this.classGroupForm.patchValue(data); |
||||||
|
} |
||||||
|
this.classGroupModal = true; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 关闭编辑班组模态框 |
||||||
|
*/ |
||||||
|
closeEditClassGroup() { |
||||||
|
this.classGroupForm.reset(); |
||||||
|
this.classGroupModal = false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 提交编辑班组 |
||||||
|
*/ |
||||||
|
submitEditClassGroup(){ |
||||||
|
for (const i in this.classGroupForm.controls) { |
||||||
|
this.classGroupForm.controls[i].markAsDirty(); |
||||||
|
this.classGroupForm.controls[i].updateValueAndValidity(); |
||||||
|
} |
||||||
|
if (this.classGroupForm.status == null || this.classGroupForm.status !== 'VALID') { |
||||||
|
this.modal.warning({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '请填写所有必填项', |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
// 提交数据
|
||||||
|
this.gasClassGroupService.editClassGroup(this.classGroupForm.value, (data: any) => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.modal.success({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '保存成功', |
||||||
|
}); |
||||||
|
this.closeEditClassGroup(); |
||||||
|
this.requestData(this.whereObject['pageNum']); |
||||||
|
} else { |
||||||
|
this.modal.warning({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: data['return_msg'], |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,186 @@ |
|||||||
|
<!--<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="name" /> |
||||||
|
</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"> |
||||||
|
<nz-row [nzGutter]="16"> |
||||||
|
<nz-col [nzSpan]="4"> |
||||||
|
<nz-statistic [nzValue]="currentClassGroupCountData['classNum'] == null ? '无' : currentClassGroupCountData['classNum'] + ' 班'" [nzTitle]="'当前班次'"></nz-statistic> |
||||||
|
</nz-col> |
||||||
|
<nz-col [nzSpan]="4"> |
||||||
|
<nz-statistic [nzValue]="currentClassGroupCountData['refuelPrice']" [nzTitle]="'加油总金额'" [nzSuffix]="'元'"></nz-statistic> |
||||||
|
</nz-col> |
||||||
|
<nz-col [nzSpan]="4"> |
||||||
|
<nz-statistic [nzValue]="currentClassGroupCountData['refuelNum']" [nzTitle]="'加油总笔数'" [nzSuffix]="'笔'"></nz-statistic> |
||||||
|
</nz-col> |
||||||
|
<nz-col [nzSpan]="4"> |
||||||
|
<nz-statistic [nzValue]="currentClassGroupCountData['refuelLiters']" [nzTitle]="'加油总升数'" [nzSuffix]="'升'"></nz-statistic> |
||||||
|
</nz-col> |
||||||
|
<nz-col [nzSpan]="4"> |
||||||
|
<nz-statistic [nzValue]="currentClassGroupCountData['refundPrice']" [nzTitle]="'退款总金额'" [nzSuffix]="'元'"></nz-statistic> |
||||||
|
</nz-col> |
||||||
|
<nz-col [nzSpan]="4"> |
||||||
|
<nz-statistic [nzValue]="currentClassGroupCountData['refundNum']" [nzTitle]="'退款总笔数'" [nzSuffix]="'笔'"></nz-statistic> |
||||||
|
</nz-col> |
||||||
|
</nz-row> |
||||||
|
|
||||||
|
<div class="gas-count-btn"> |
||||||
|
<button nz-button nzType="primary" *ngIf="currentClassGroupCountData.status == 0" (click)="showStartClassGroupModal()"><i nz-icon nzType="plus" nzTheme="outline"></i>开启班次</button> |
||||||
|
<button nz-button nzType="primary" *ngIf="currentClassGroupCountData.status == 1" (click)="getCurrentClassGroupCountData()"><i nz-icon nzType="sync" nzTheme="outline"></i>刷新数据</button> |
||||||
|
<button nz-button nzType="primary" *ngIf="currentClassGroupCountData.status == 1" (click)="showSwapClassGroupModal()"><i nz-icon nzType="swap" nzTheme="outline"></i>交接班组</button> |
||||||
|
<button nz-button nzType="primary" *ngIf="currentClassGroupCountData.status == 1" (click)="showEndClassGroupConfirm()"><i nz-icon nzType="poweroff" nzTheme="outline"></i>结束班次</button> |
||||||
|
</div> |
||||||
|
<nz-divider></nz-divider> |
||||||
|
|
||||||
|
|
||||||
|
<span>历史班次,共计 {{dataObject.total?dataObject.total:0}} 条数据</span> |
||||||
|
<div class="operating-button"> |
||||||
|
<!-- <button nz-button nzType="primary" class="right-btn" (click)="showEditClassGroup(null)"><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: '1150px'}"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th nzWidth="80px">班次</th> |
||||||
|
<th nzWidth="100px">班组名称</th> |
||||||
|
<th nzWidth="100px">开始时间</th> |
||||||
|
<th nzWidth="100px">结束时间</th> |
||||||
|
<th nzWidth="100px">状态</th> |
||||||
|
<th nzWidth="100px" nzRight="0px">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data;let i = index"> |
||||||
|
<td>{{data.classNum + ' 班'}}</td> |
||||||
|
<td>{{data.gasClassGroupName}}</td> |
||||||
|
<td>{{data.startTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<td> |
||||||
|
<span *ngIf="data.endTime != null">{{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}}</span> |
||||||
|
<span *ngIf="data.endTime == null">未结束</span> |
||||||
|
</td> |
||||||
|
<td>{{data.status | merClassGroupTaskStatus}}</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 nzDisabled *ngIf="data.status == 1">暂无操作</li> |
||||||
|
<li nz-menu-item *ngIf="data.status == 2"><a (click)="showClassGroupTaskDataModal(data)">查看汇总</a></li> |
||||||
|
</ul> |
||||||
|
</nz-dropdown-menu> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</div> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="classGroupCountDataModal" nzTitle="班次汇总" (nzOnCancel)="closeClassGroupTaskDataModal()" nzWidth="350px" [nzFooter]="null"> |
||||||
|
<ng-container *nzModalContent> |
||||||
|
<nz-descriptions [nzColumn]="{ xxl: 1, xl: 1, lg: 1, md: 1, sm: 1, xs: 1 }"> |
||||||
|
<nz-descriptions-item nzTitle="开始时间">{{classGroupCountData['startTime'] | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item> |
||||||
|
<nz-descriptions-item nzTitle="结束时间">{{classGroupCountData['endTime'] | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item> |
||||||
|
<nz-descriptions-item nzTitle="加油金额汇总">{{classGroupCountData['refuelPrice']}} 元</nz-descriptions-item> |
||||||
|
<nz-descriptions-item nzTitle="加油笔数汇总">{{classGroupCountData['refuelNum']}} 笔</nz-descriptions-item> |
||||||
|
<nz-descriptions-item nzTitle="加油升数汇总">{{classGroupCountData['refuelLiters']}} 升</nz-descriptions-item> |
||||||
|
<nz-descriptions-item nzTitle="退款金额汇总">{{classGroupCountData['refundPrice']}} 元</nz-descriptions-item> |
||||||
|
<nz-descriptions-item nzTitle="退款笔数汇总">{{classGroupCountData['refundNum']}} 笔</nz-descriptions-item> |
||||||
|
<nz-descriptions-item nzTitle="退款升数汇总">{{classGroupCountData['refundLiters']}} 升</nz-descriptions-item> |
||||||
|
</nz-descriptions> |
||||||
|
|
||||||
|
<nz-table #oilCountTable [nzData]="classGroupCountData['groupTaskOilCountList']" [nzShowPagination]="false"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>油号</th> |
||||||
|
<th>金额</th> |
||||||
|
<th>升数</th> |
||||||
|
<th>笔数</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let item of oilCountTable.data"> |
||||||
|
<td>{{ item.oilNo }}#</td> |
||||||
|
<td>{{ item.refuelPrice }}元</td> |
||||||
|
<td>{{ item.refuelLiters }}升</td> |
||||||
|
<td>{{ item.refuelNum }}笔</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
<div style="width: 100%;text-align: center;margin-top: 10px;"> |
||||||
|
<button nz-button nzType="primary" (click)="cloudPrint()">打印小票</button> |
||||||
|
<!-- <button nz-button nzType="primary" (click)="showPrintModal(classGroupCountData)">打印小票</button>--> |
||||||
|
</div> |
||||||
|
</ng-container> |
||||||
|
</nz-modal> |
||||||
|
|
||||||
|
<!--<nz-modal [(nzVisible)]="printModal" nzTitle="选择打印方式" nzWidth="350px" (nzOnCancel)="printModal = false" [nzFooter]="null"> |
||||||
|
<ng-container *nzModalContent> |
||||||
|
<form nz-form> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-control> |
||||||
|
<button nz-button nzType="primary" nzBlock (click)="cloudPrint()">云打印机</button> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</form> |
||||||
|
</ng-container> < |
||||||
|
</nz-modal>--> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="startClassGroupModal" nzTitle="开启班次" (nzOnCancel)="closeStartClassGroupModal()" nzWidth="500px" [nzFooter]="null"> |
||||||
|
<ng-container *nzModalContent> |
||||||
|
<form nz-form [formGroup]="startClassGroupModalForm"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6" nzRequired>班组</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-select ngModel="lucy" [nzPlaceHolder]="'请选择班组'" formControlName="gasClassGroupId"> |
||||||
|
<nz-option *ngFor="let item of classGroupArray" nzValue="{{item.id}}" nzLabel="{{item.name}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
<div style="text-align: center;"> |
||||||
|
<button nz-button nzType="primary" style="width: 150px;" (click)="submitStartClassGroup()">开启</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</ng-container> |
||||||
|
</nz-modal> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="swapClassGroupModal" nzTitle="交换班次" (nzOnCancel)="closeSwapClassGroupModal()" nzWidth="500px" [nzFooter]="null"> |
||||||
|
<ng-container *nzModalContent> |
||||||
|
<form nz-form [formGroup]="swapClassGroupModalForm"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6" nzRequired>班组</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-select ngModel="lucy" [nzPlaceHolder]="'请选择班组'" formControlName="gasClassGroupId"> |
||||||
|
<nz-option *ngFor="let item of classGroupArray" nzValue="{{item.id}}" nzLabel="{{item.name}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
<div style="text-align: center;"> |
||||||
|
<button nz-button nzType="primary" style="width: 150px;" (click)="submitSwapClassGroupConfirm()">交换</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</ng-container> |
||||||
|
</nz-modal> |
@ -0,0 +1,8 @@ |
|||||||
|
.gas-count-btn { |
||||||
|
text-align: center; |
||||||
|
margin-top: 15px; |
||||||
|
} |
||||||
|
.gas-count-btn button { |
||||||
|
margin-bottom: 15px; |
||||||
|
margin-left: 10px; |
||||||
|
} |
@ -0,0 +1,415 @@ |
|||||||
|
import { Component } from '@angular/core'; |
||||||
|
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||||
|
import {FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||||
|
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||||
|
import { |
||||||
|
NzCellFixedDirective, |
||||||
|
NzTableCellDirective, |
||||||
|
NzTableComponent, NzTableModule, |
||||||
|
NzTbodyComponent, NzTheadComponent, |
||||||
|
NzThMeasureDirective, NzTrDirective |
||||||
|
} from "ng-zorro-antd/table"; |
||||||
|
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||||
|
import {NzDescriptionsComponent, NzDescriptionsItemComponent, NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||||
|
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||||
|
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||||
|
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||||
|
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||||
|
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||||
|
import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||||
|
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||||
|
import {NzStatisticComponent, NzStatisticModule} from "ng-zorro-antd/statistic"; |
||||||
|
import {NzWaveDirective} from "ng-zorro-antd/core/wave"; |
||||||
|
import {NzMessageService} from "ng-zorro-antd/message"; |
||||||
|
import {MerClassGroupService} from "../../../services/merchant/mer-class-group.service"; |
||||||
|
import {MerClassGroupTaskService} from "../../../services/merchant/mer-class-group-task.service"; |
||||||
|
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||||
|
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||||
|
import {MerClassGroupTaskStatusPipe} from "../../../pipes/mer-class-group-task/mer-class-group-task-status.pipe"; |
||||||
|
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||||
|
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||||
|
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||||
|
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||||
|
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||||
|
import {NzImageModule} from "ng-zorro-antd/image"; |
||||||
|
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||||
|
import {NzDatePickerComponent, NzRangePickerComponent} from "ng-zorro-antd/date-picker"; |
||||||
|
import {NzRadioButtonDirective, NzRadioComponent, NzRadioGroupComponent} from "ng-zorro-antd/radio"; |
||||||
|
import {NzToolTipModule} from "ng-zorro-antd/tooltip"; |
||||||
|
import {NzTabsModule} from "ng-zorro-antd/tabs"; |
||||||
|
import {NzTagModule} from "ng-zorro-antd/tag"; |
||||||
|
import {NzCardModule} from "ng-zorro-antd/card"; |
||||||
|
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||||
|
import {NzQRCodeModule} from "ng-zorro-antd/qr-code"; |
||||||
|
import {RouterLink} from "@angular/router"; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-mer-class-group-task', |
||||||
|
standalone: true, |
||||||
|
imports: [ |
||||||
|
DatePipe, |
||||||
|
DictionaryPipe, |
||||||
|
FormsModule, |
||||||
|
NgForOf, |
||||||
|
NgIf, |
||||||
|
NzButtonComponent, |
||||||
|
NzCellFixedDirective, |
||||||
|
NzColDirective, |
||||||
|
NzDividerComponent, |
||||||
|
NzDropDownADirective, |
||||||
|
NzDropDownDirective, |
||||||
|
NzDropdownMenuComponent, |
||||||
|
NzFormControlComponent, |
||||||
|
NzFormDirective, |
||||||
|
NzFormItemComponent, |
||||||
|
NzFormLabelComponent, |
||||||
|
NzIconDirective, |
||||||
|
NzInputDirective, |
||||||
|
NzMenuDirective, |
||||||
|
NzMenuItemComponent, |
||||||
|
NzOptionComponent, |
||||||
|
NzRowDirective, |
||||||
|
NzSelectComponent, |
||||||
|
NzTableCellDirective, |
||||||
|
NzTableComponent, |
||||||
|
NzTbodyComponent, |
||||||
|
NzThMeasureDirective, |
||||||
|
NzTheadComponent, |
||||||
|
NzTrDirective, |
||||||
|
ReactiveFormsModule, |
||||||
|
NzTableModule, |
||||||
|
NzModalModule, |
||||||
|
NzFlexDirective, |
||||||
|
NzDescriptionsModule, |
||||||
|
NzUploadComponent, |
||||||
|
NzAvatarModule, |
||||||
|
NzImageModule, |
||||||
|
NzSwitchComponent, |
||||||
|
NzDatePickerComponent, |
||||||
|
NzRadioButtonDirective, |
||||||
|
NzRadioComponent, |
||||||
|
NzRadioGroupComponent, |
||||||
|
NzRangePickerComponent, |
||||||
|
NzToolTipModule, |
||||||
|
NzTabsModule, |
||||||
|
NzTagModule, |
||||||
|
NzCardModule, |
||||||
|
NzInputNumberModule, |
||||||
|
NzQRCodeModule, |
||||||
|
RouterLink, |
||||||
|
NzStatisticModule, |
||||||
|
MerClassGroupTaskStatusPipe |
||||||
|
], |
||||||
|
templateUrl: './mer-class-group-task.component.html', |
||||||
|
styleUrl: './mer-class-group-task.component.less' |
||||||
|
}) |
||||||
|
export class MerClassGroupTaskComponent { |
||||||
|
userInfoObject: any; |
||||||
|
|
||||||
|
dataObject: any = {}; |
||||||
|
tableLoading = true; |
||||||
|
searchForm: FormGroup; |
||||||
|
pageNum: number = 1; |
||||||
|
whereObject: any = {}; |
||||||
|
|
||||||
|
classGroupArray: any = []; |
||||||
|
|
||||||
|
startClassGroupModal = false; |
||||||
|
startClassGroupModalForm: FormGroup; |
||||||
|
|
||||||
|
swapClassGroupModal = false; |
||||||
|
swapClassGroupModalForm: FormGroup; |
||||||
|
|
||||||
|
currentClassGroupCountData: any = { |
||||||
|
classNum: '无', |
||||||
|
refuelPrice: '0', |
||||||
|
refuelNum: '0', |
||||||
|
refuelLiters: '0', |
||||||
|
refundPrice: '0', |
||||||
|
refundNum: '0', |
||||||
|
status: null, |
||||||
|
}; |
||||||
|
|
||||||
|
classGroupCountDataModal = false; |
||||||
|
classGroupCountData: any = {}; |
||||||
|
|
||||||
|
printModal = false; |
||||||
|
printData = {}; |
||||||
|
printTaskId: number = 0; |
||||||
|
|
||||||
|
constructor(private modal: NzModalService, |
||||||
|
private storage: BrowserStorageService, |
||||||
|
private message: NzMessageService, |
||||||
|
private gasClassGroupService: MerClassGroupService, |
||||||
|
private gasClassGroupTaskService: MerClassGroupTaskService, |
||||||
|
private form: FormBuilder) { |
||||||
|
this.userInfoObject = this.storage.get(DATA); |
||||||
|
|
||||||
|
this.searchForm = this.form.group({ |
||||||
|
name: [null], |
||||||
|
principalName: [null], |
||||||
|
principalPhone: [null], |
||||||
|
}); |
||||||
|
|
||||||
|
this.startClassGroupModalForm = this.form.group({ |
||||||
|
gasId: [null], |
||||||
|
gasClassGroupId: [null, [Validators.required]], |
||||||
|
}); |
||||||
|
|
||||||
|
this.swapClassGroupModalForm = this.form.group({ |
||||||
|
gasId: [null], |
||||||
|
gasClassGroupId: [null, [Validators.required]], |
||||||
|
}); |
||||||
|
|
||||||
|
this.gasClassGroupService.getClassGroupList({pageNum: 1, pageSize: 9999}, (data: any) => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.classGroupArray = data['return_data']['list']; |
||||||
|
} |
||||||
|
}); |
||||||
|
this.getCurrentClassGroupCountData(); |
||||||
|
this.requestData(1); |
||||||
|
|
||||||
|
} |
||||||
|
/** |
||||||
|
* 请求数据 |
||||||
|
*/ |
||||||
|
requestData(pageNum: number) { |
||||||
|
if (pageNum != null) { |
||||||
|
this.tableLoading = true; |
||||||
|
this.whereObject['pageNum'] = pageNum; |
||||||
|
this.whereObject['pageSize'] = 10; |
||||||
|
this.whereObject['time'] = new Date().getTime(); |
||||||
|
this.gasClassGroupTaskService.getClassGroupTaskList(this.whereObject, (data: any) => { |
||||||
|
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(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询当前班组数据 |
||||||
|
*/ |
||||||
|
getCurrentClassGroupCountData() { |
||||||
|
this.gasClassGroupTaskService.getCurrentClassGroupTask(this.userInfoObject['account']['objectId'], (data: any) => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.currentClassGroupCountData = data['return_data']; |
||||||
|
} else { |
||||||
|
this.modal.warning({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: data['return_msg'], |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
this.requestData(this.whereObject['pageNum']); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 打开 开始班组模态框 |
||||||
|
*/ |
||||||
|
showStartClassGroupModal() { |
||||||
|
this.startClassGroupModal = true; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* 关闭 开始班组模态框 |
||||||
|
*/ |
||||||
|
closeStartClassGroupModal() { |
||||||
|
this.startClassGroupModalForm.reset(); |
||||||
|
this.startClassGroupModal = false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 提交 开始班组数据 |
||||||
|
*/ |
||||||
|
submitStartClassGroup(){ |
||||||
|
for (const i in this.startClassGroupModalForm.controls) { |
||||||
|
this.startClassGroupModalForm.controls[i].markAsDirty(); |
||||||
|
this.startClassGroupModalForm.controls[i].updateValueAndValidity(); |
||||||
|
} |
||||||
|
if (this.startClassGroupModalForm.status == null || this.startClassGroupModalForm.status !== 'VALID') { |
||||||
|
this.modal.warning({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '请填写所有必填项', |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.startClassGroupModalForm.value.gasId = this.userInfoObject['account']['objectId']; |
||||||
|
|
||||||
|
// 提交数据
|
||||||
|
this.gasClassGroupTaskService.startGroupTask(this.startClassGroupModalForm.value, (data:any) => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.modal.success({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '操作成功', |
||||||
|
}); |
||||||
|
this.getCurrentClassGroupCountData(); |
||||||
|
this.requestData(this.whereObject['pageNum']); |
||||||
|
this.closeStartClassGroupModal(); |
||||||
|
} else { |
||||||
|
this.modal.warning({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: data['return_msg'], |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 打开 交换班组模态框 |
||||||
|
*/ |
||||||
|
showSwapClassGroupModal() { |
||||||
|
this.swapClassGroupModal = true; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 关闭 交换班组模态框 |
||||||
|
*/ |
||||||
|
closeSwapClassGroupModal() { |
||||||
|
this.swapClassGroupModalForm.reset(); |
||||||
|
this.swapClassGroupModal = false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 提交 交换班组提醒框 |
||||||
|
*/ |
||||||
|
submitSwapClassGroupConfirm() { |
||||||
|
this.modal.confirm({ |
||||||
|
nzTitle: '警告', |
||||||
|
nzContent: '确定交换班次吗?', |
||||||
|
nzOkText: '是', |
||||||
|
nzCancelText: '否', |
||||||
|
nzOnOk: () => this.submitSwapClassGroup() |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 提交 交换班组数据 |
||||||
|
*/ |
||||||
|
submitSwapClassGroup() { |
||||||
|
for (const i in this.swapClassGroupModalForm.controls) { |
||||||
|
this.swapClassGroupModalForm.controls[i].markAsDirty(); |
||||||
|
this.swapClassGroupModalForm.controls[i].updateValueAndValidity(); |
||||||
|
} |
||||||
|
if (this.swapClassGroupModalForm.status == null || this.swapClassGroupModalForm.status !== 'VALID') { |
||||||
|
this.modal.warning({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '请填写所有必填项', |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.swapClassGroupModalForm.value.gasId = this.userInfoObject['account']['objectId']; |
||||||
|
|
||||||
|
// 提交数据
|
||||||
|
this.gasClassGroupTaskService.swapGroupTask(this.swapClassGroupModalForm.value, (data:any) => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.modal.success({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '操作成功', |
||||||
|
}); |
||||||
|
this.getCurrentClassGroupCountData(); |
||||||
|
this.requestData(this.whereObject['pageNum']); |
||||||
|
this.closeSwapClassGroupModal(); |
||||||
|
} else { |
||||||
|
this.modal.warning({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: data['return_msg'], |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 弹出结束对话框 |
||||||
|
*/ |
||||||
|
showEndClassGroupConfirm(): void { |
||||||
|
this.modal.confirm({ |
||||||
|
nzTitle: '警告', |
||||||
|
nzContent: '确定结束本次班次吗?', |
||||||
|
nzOkText: '是', |
||||||
|
nzCancelText: '否', |
||||||
|
nzOnOk: () => this.endClassGroupData() |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 提交结束班次数据 |
||||||
|
* |
||||||
|
*/ |
||||||
|
endClassGroupData() { |
||||||
|
this.gasClassGroupTaskService.endGroupTask( { gasId: this.userInfoObject['account']['objectId'], }, (data:any) => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.requestData(this.whereObject['pageNum']); |
||||||
|
this.getCurrentClassGroupCountData(); |
||||||
|
} else { |
||||||
|
this.modal.error({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: data['return_msg'] |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 展示班次数据统计 |
||||||
|
*/ |
||||||
|
showClassGroupTaskDataModal(data: any) { |
||||||
|
this.classGroupCountData = JSON.parse(data['dataCount']); |
||||||
|
this.printTaskId = data['id']; |
||||||
|
this.classGroupCountDataModal = true; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 关闭班次数据统计 |
||||||
|
*/ |
||||||
|
closeClassGroupTaskDataModal() { |
||||||
|
this.classGroupCountDataModal = false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 展示打印模态框 |
||||||
|
* @param data |
||||||
|
*/ |
||||||
|
showPrintModal(data: object) { |
||||||
|
this.printData = data; |
||||||
|
this.printModal = true; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 云打印 |
||||||
|
*/ |
||||||
|
cloudPrint() { |
||||||
|
this.gasClassGroupTaskService.print(this.printTaskId, (data: any) => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.modal.success({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '操作成功', |
||||||
|
}); |
||||||
|
this.printModal = false; |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -1 +1,240 @@ |
|||||||
<p>oil-discount works!</p> |
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||||
|
<div nz-row [nzGutter]="24"> |
||||||
|
<div nz-col [nzSpan]="6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label>所在省级</nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<nz-select formControlName="provinceCode" nzAllowClear [nzPlaceHolder]="'请选择'" nzShowSearch> |
||||||
|
<nz-option *ngFor="let item of regionData" nzValue="{{item.regionId}}" nzLabel="{{item.regionName}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col [nzSpan]="6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label>来源渠道</nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<nz-select formControlName="sourceType" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||||
|
<nz-option *ngFor="let item of merSourceTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col [nzSpan]="6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label>油站编号</nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<input nz-input formControlName="merNo" placeholder="请输入" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col [nzSpan]="6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label>油站名称</nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<input nz-input formControlName="merName" placeholder="请输入" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col [nzSpan]="24" class="search-area"> |
||||||
|
<button nz-button [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||||
|
<button nz-button (click)="searchFormReset()">重置</button> |
||||||
|
<button nz-button [nzType]="'primary'" (click)="showBatchUpdateDiscount()">批量调整优惠</button> |
||||||
|
<!-- <a class="collapse" (click)="isCollapse = !isCollapse"> |
||||||
|
更多查询条件 |
||||||
|
<i nz-icon [nzType]="!isCollapse ? 'down' : 'up'"></i> |
||||||
|
</a>--> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
<div class="send-request"> |
||||||
|
<span nz-typography>已选择{{setOfCheckedId.size}}家油站</span> |
||||||
|
</div> |
||||||
|
<nz-table #basicTable |
||||||
|
[nzScroll]="{ x: '1200px' }" |
||||||
|
[nzBordered]="true" |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzShowQuickJumper]="true" |
||||||
|
[nzShowTotal]="totalTemplate" |
||||||
|
[(nzPageIndex)]="tablePageNum" |
||||||
|
(nzPageIndexChange)="queryData()" |
||||||
|
nzShowSizeChanger |
||||||
|
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||||
|
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||||
|
[nzTotal]="tableData.total" |
||||||
|
[nzData]="tableData.list" > |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th nzWidth="50px" [nzChecked]="checked" (nzCheckedChange)="onAllChecked($event)"></th> |
||||||
|
<th nzWidth="120px">来源渠道</th> |
||||||
|
<th nzWidth="100px">连锁名称</th> |
||||||
|
<th nzWidth="110px">油站编号</th> |
||||||
|
<th nzWidth="230px">油站名称</th> |
||||||
|
<th nzWidth="180px">油站地区</th> |
||||||
|
<th nzWidth="80px">油站状态</th> |
||||||
|
<th nzRight nzWidth="90px">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data"> |
||||||
|
<td [nzChecked]="setOfCheckedId.has(data.merNo)" (nzCheckedChange)="onItemChecked(data.merNo, $event)" ></td> |
||||||
|
<td>{{data.sourceType | dictionary: "MER_SOURCE_TYPE"}}</td> |
||||||
|
<td>{{data.chainBrandName?data.chainBrandName:'无'}}</td> |
||||||
|
<td>{{data.merNo}}</td> |
||||||
|
<td>{{data.merName}}</td> |
||||||
|
<td>{{data.provinceName+"/"+data.cityName+"/"+data.areaName}}</td> |
||||||
|
<td>{{data.status | dictionary: "MERCHANT_STATUS"}}</td> |
||||||
|
<td nzRight> |
||||||
|
<a (click)="showDiscountDetail(data.merNo)">调整优惠</a> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||||
|
</nz-table> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="discountDetailModal" |
||||||
|
[nzWidth]="500" |
||||||
|
[nzTitle]="'调整优惠'" |
||||||
|
[nzFooter]="null" |
||||||
|
(nzOnCancel)="closeDiscountDetail()"> |
||||||
|
<ng-container *nzModalContent> |
||||||
|
<nz-table #basicTable |
||||||
|
[nzData]="discountDetailObj" |
||||||
|
[nzShowPagination]="false" |
||||||
|
[nzBordered]="true" |
||||||
|
[nzSize]="'small'" |
||||||
|
> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>油站</th> |
||||||
|
<th>油号</th> |
||||||
|
<th>折扣</th> |
||||||
|
<th>服务费</th> |
||||||
|
<th>操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data"> |
||||||
|
<td>{{data.merName}}</td> |
||||||
|
<td>{{data.oilNoName}}</td> |
||||||
|
<td>{{data.priceRate}}%</td> |
||||||
|
<td>{{data.serviceFeeRate}}%</td> |
||||||
|
<td> |
||||||
|
<a>调整</a> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</ng-container> |
||||||
|
</nz-modal> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="batchUpdateDiscountModal" |
||||||
|
[nzWidth]="500" |
||||||
|
[nzTitle]="'调整优惠(已选择'+setOfCheckedId.size+'家油站)'" |
||||||
|
[nzFooter]="null" |
||||||
|
(nzOnCancel)="closeBatchUpdateDiscount()"> |
||||||
|
<ng-container *nzModalContent> |
||||||
|
<form nz-form [formGroup]="updateDiscountForm"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>油号</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-select formControlName="oilNo" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||||
|
<nz-option *ngFor="let item of oilNoArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>折扣</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-input-number formControlName="priceRate" [nzMin]="0" [nzMax]="200" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'执行价格'"></nz-input-number> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>服务费</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-input-number formControlName="serviceFeeRate" [nzMin]="0" [nzMax]="200" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'执行价格'"></nz-input-number> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||||
|
<button nz-button nzType="primary" (click)="submitBatchUpdateDiscount()" class="submit-btn">确定</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</ng-container> |
||||||
|
</nz-modal> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="discountDetailModal" |
||||||
|
[nzWidth]="500" |
||||||
|
[nzTitle]="'调整优惠'" |
||||||
|
[nzFooter]="null" |
||||||
|
(nzOnCancel)="closeDiscountDetail()"> |
||||||
|
<ng-container *nzModalContent> |
||||||
|
<nz-table #basicTable |
||||||
|
[nzData]="discountDetailObj" |
||||||
|
[nzShowPagination]="false" |
||||||
|
[nzBordered]="true" |
||||||
|
[nzSize]="'small'" |
||||||
|
> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>油站</th> |
||||||
|
<th>油号</th> |
||||||
|
<th>折扣</th> |
||||||
|
<th>服务费</th> |
||||||
|
<th>操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data"> |
||||||
|
<td>{{data.merName}}</td> |
||||||
|
<td>{{data.oilNoName}}</td> |
||||||
|
<td>{{data.priceRate}}%</td> |
||||||
|
<td>{{data.serviceFeeRate}}%</td> |
||||||
|
<td> |
||||||
|
<a (click)="showUpdateDiscount(data)">调整</a> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</ng-container> |
||||||
|
</nz-modal> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="updateDiscountModal" |
||||||
|
[nzWidth]="500" |
||||||
|
nzTitle="调整优惠" |
||||||
|
[nzFooter]="null" |
||||||
|
(nzOnCancel)="closeUpdateDiscount()"> |
||||||
|
<ng-container *nzModalContent> |
||||||
|
<form nz-form [formGroup]="updateDiscountForm"> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>油号</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-select formControlName="oilNo" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||||
|
<nz-option *ngFor="let item of oilNoArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>折扣</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-input-number formControlName="priceRate" [nzMin]="0" [nzMax]="200" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'执行价格'"></nz-input-number> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>服务费</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-input-number formControlName="serviceFeeRate" [nzMin]="0" [nzMax]="200" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'执行价格'"></nz-input-number> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||||
|
<button nz-button nzType="primary" (click)="submitUpdateDiscount()" class="submit-btn">确定</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</ng-container> |
||||||
|
</nz-modal> |
||||||
|
@ -0,0 +1,15 @@ |
|||||||
|
.search-area { |
||||||
|
margin-bottom: 10px; |
||||||
|
} |
||||||
|
.search-area button { |
||||||
|
margin-right: 8px; |
||||||
|
} |
||||||
|
nz-input-number { |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
.submit-btn { |
||||||
|
width: 150px; |
||||||
|
} |
||||||
|
.send-request { |
||||||
|
margin-bottom: 16px; |
||||||
|
} |
@ -1,12 +1,349 @@ |
|||||||
import {Component} from '@angular/core'; |
import {Component} from '@angular/core'; |
||||||
|
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||||
|
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||||
|
import {MerService} from "../../../services/merchant/mer.service"; |
||||||
|
import {NzMessageService} from "ng-zorro-antd/message"; |
||||||
|
import {CommonService} from "../../../services/common/common.service"; |
||||||
|
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||||
|
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||||
|
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||||
|
import { |
||||||
|
NzCellFixedDirective, |
||||||
|
NzTableCellDirective, |
||||||
|
NzTableComponent, NzTableModule, |
||||||
|
NzTbodyComponent, NzTheadComponent, |
||||||
|
NzThMeasureDirective, NzTrDirective |
||||||
|
} from "ng-zorro-antd/table"; |
||||||
|
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||||
|
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||||
|
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||||
|
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||||
|
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||||
|
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||||
|
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||||
|
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||||
|
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||||
|
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||||
|
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||||
|
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||||
|
import {NzImageModule} from "ng-zorro-antd/image"; |
||||||
|
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||||
|
import {NzDatePickerComponent, NzRangePickerComponent} from "ng-zorro-antd/date-picker"; |
||||||
|
import {NzRadioButtonDirective, NzRadioComponent, NzRadioGroupComponent} from "ng-zorro-antd/radio"; |
||||||
|
import {NzToolTipModule} from "ng-zorro-antd/tooltip"; |
||||||
|
import {NzTabsModule} from "ng-zorro-antd/tabs"; |
||||||
|
import {NzTagModule} from "ng-zorro-antd/tag"; |
||||||
|
import {NzCardModule} from "ng-zorro-antd/card"; |
||||||
|
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||||
|
import {NzQRCodeModule} from "ng-zorro-antd/qr-code"; |
||||||
|
import {RouterLink} from "@angular/router"; |
||||||
|
import {AgentPriceService} from "../../../services/agent/agent-price.service"; |
||||||
|
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
||||||
|
|
||||||
@Component({ |
@Component({ |
||||||
selector: 'app-oil-discount', |
selector: 'app-oil-discount', |
||||||
standalone: true, |
standalone: true, |
||||||
imports: [], |
imports: [ |
||||||
|
DatePipe, |
||||||
|
DictionaryPipe, |
||||||
|
FormsModule, |
||||||
|
NgForOf, |
||||||
|
NgIf, |
||||||
|
NzButtonComponent, |
||||||
|
NzCellFixedDirective, |
||||||
|
NzColDirective, |
||||||
|
NzDividerComponent, |
||||||
|
NzDropDownADirective, |
||||||
|
NzDropDownDirective, |
||||||
|
NzDropdownMenuComponent, |
||||||
|
NzFormControlComponent, |
||||||
|
NzFormDirective, |
||||||
|
NzFormItemComponent, |
||||||
|
NzFormLabelComponent, |
||||||
|
NzIconDirective, |
||||||
|
NzInputDirective, |
||||||
|
NzMenuDirective, |
||||||
|
NzMenuItemComponent, |
||||||
|
NzOptionComponent, |
||||||
|
NzRowDirective, |
||||||
|
NzSelectComponent, |
||||||
|
NzTableCellDirective, |
||||||
|
NzTableComponent, |
||||||
|
NzTbodyComponent, |
||||||
|
NzThMeasureDirective, |
||||||
|
NzTheadComponent, |
||||||
|
NzTrDirective, |
||||||
|
ReactiveFormsModule, |
||||||
|
NzTableModule, |
||||||
|
NzModalModule, |
||||||
|
NzFlexDirective, |
||||||
|
NzDescriptionsModule, |
||||||
|
NzUploadComponent, |
||||||
|
NzAvatarModule, |
||||||
|
NzImageModule, |
||||||
|
NzSwitchComponent, |
||||||
|
NzDatePickerComponent, |
||||||
|
NzRadioButtonDirective, |
||||||
|
NzRadioComponent, |
||||||
|
NzRadioGroupComponent, |
||||||
|
NzRangePickerComponent, |
||||||
|
NzToolTipModule, |
||||||
|
NzTabsModule, |
||||||
|
NzTagModule, |
||||||
|
NzCardModule, |
||||||
|
NzInputNumberModule, |
||||||
|
NzQRCodeModule, |
||||||
|
RouterLink, |
||||||
|
NzTypographyComponent |
||||||
|
], |
||||||
templateUrl: './oil-discount.component.html', |
templateUrl: './oil-discount.component.html', |
||||||
styleUrl: './oil-discount.component.less' |
styleUrl: './oil-discount.component.less' |
||||||
}) |
}) |
||||||
export class OilDiscountComponent { |
export class OilDiscountComponent { |
||||||
|
// 表单页数
|
||||||
|
tablePageNum = 1; |
||||||
|
// 每页数量
|
||||||
|
tablePageSize = 10; |
||||||
|
// 表单数据
|
||||||
|
tableData: any = { |
||||||
|
total: 0, |
||||||
|
list: [], |
||||||
|
}; |
||||||
|
// 搜索表单
|
||||||
|
searchForm: FormGroup; |
||||||
|
// 油站来源
|
||||||
|
merSourceTypeArray = new DictionaryPipe().getDictionaryList('MER_SOURCE_TYPE'); |
||||||
|
// 油号
|
||||||
|
oilNoArray = new DictionaryPipe().getDictionaryList('OIL_NO'); |
||||||
|
// 地区数据
|
||||||
|
regionData: any = []; |
||||||
|
// 优惠详情模态框
|
||||||
|
discountDetailModal = false; |
||||||
|
// 优惠详情数据
|
||||||
|
discountDetailObj: any = []; |
||||||
|
// 修改优惠模态框
|
||||||
|
updateDiscountModal = false; |
||||||
|
updateDiscountForm: FormGroup; |
||||||
|
// 批量修改优惠模态框
|
||||||
|
batchUpdateDiscountModal = false; |
||||||
|
// 列表中全选状态
|
||||||
|
checked = false; |
||||||
|
// 已选择的数据
|
||||||
|
setOfCheckedId = new Set<string>(); |
||||||
|
constructor(private fb: NonNullableFormBuilder, |
||||||
|
private merService: MerService, |
||||||
|
private message: NzMessageService, |
||||||
|
private agentPriceService: AgentPriceService, |
||||||
|
private commonService: CommonService, |
||||||
|
private modal: NzModalService) { |
||||||
|
// 初始化搜索框
|
||||||
|
this.searchForm = this.fb.group({ |
||||||
|
sourceType: [''], |
||||||
|
provinceCode: [''], |
||||||
|
merNo: [''], |
||||||
|
merName: [''], |
||||||
|
status: [''], |
||||||
|
}); |
||||||
|
|
||||||
|
this.updateDiscountForm = this.fb.group({ |
||||||
|
merNo: [''], |
||||||
|
oilNo: ['', [Validators.required]], |
||||||
|
priceRate: ['', [Validators.required]], |
||||||
|
serviceFeeRate: ['', [Validators.required]], |
||||||
|
}); |
||||||
|
// 获取地区
|
||||||
|
this.commonService.getRegion("", (data: any) => { |
||||||
|
this.regionData = data['return_data']; |
||||||
|
}); |
||||||
|
|
||||||
|
this.queryData(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取数据 |
||||||
|
*/ |
||||||
|
queryData() { |
||||||
|
this.searchForm.value.pageNum = this.tablePageNum; |
||||||
|
this.searchForm.value.pageSize = this.tablePageSize; |
||||||
|
this.searchForm.value.time = new Date().getTime(); |
||||||
|
this.merService.queryMerList(this.searchForm.value, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
this.tableData = data['return_data']; |
||||||
|
this.refreshCheckedStatus(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
updateCheckedSet(merNo: string, checked: boolean): void { |
||||||
|
if (checked) { |
||||||
|
this.setOfCheckedId.add(merNo); |
||||||
|
} else { |
||||||
|
this.setOfCheckedId.delete(merNo); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 单选 |
||||||
|
* @param merNo |
||||||
|
* @param checked |
||||||
|
*/ |
||||||
|
onItemChecked(merNo: string, checked: boolean): void { |
||||||
|
this.updateCheckedSet(merNo, checked); |
||||||
|
this.refreshCheckedStatus(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 全选 |
||||||
|
* @param checked |
||||||
|
*/ |
||||||
|
onAllChecked(checked: boolean): void { |
||||||
|
// @ts-ignore
|
||||||
|
this.tableData.list.forEach(({ merNo }) => this.updateCheckedSet(merNo, checked)); |
||||||
|
this.refreshCheckedStatus(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 刷新数据 |
||||||
|
*/ |
||||||
|
refreshCheckedStatus(): void { |
||||||
|
// @ts-ignore
|
||||||
|
this.checked = this.tableData.list.every(({ merNo }) => this.setOfCheckedId.has(merNo)); |
||||||
|
console.log(this.setOfCheckedId); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 搜索表单提交 |
||||||
|
*/ |
||||||
|
searchFormSubmit(): void { |
||||||
|
this.tablePageNum = 1; |
||||||
|
this.queryData(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 搜索表单重置 |
||||||
|
*/ |
||||||
|
searchFormReset(): void { |
||||||
|
this.searchForm.reset(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 打开批量调整弹出框 |
||||||
|
*/ |
||||||
|
showBatchUpdateDiscount() { |
||||||
|
this.batchUpdateDiscountModal = true; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 提交批量修改 |
||||||
|
*/ |
||||||
|
submitBatchUpdateDiscount() { |
||||||
|
if (this.setOfCheckedId.size == 0) { |
||||||
|
this.modal.warning({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '请再列中勾选需要调整油站' |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (this.updateDiscountForm.valid) { |
||||||
|
let param = this.updateDiscountForm.value; |
||||||
|
let merNoList = []; |
||||||
|
for (let merNo of this.setOfCheckedId) { |
||||||
|
merNoList.push({merNo: merNo}); |
||||||
|
} |
||||||
|
param['merNoList'] = merNoList; |
||||||
|
param['oilNo'] = this.updateDiscountForm.controls['oilNo'].value; |
||||||
|
this.agentPriceService.batchConfigPrice(param, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
this.message.create('success', '操作成功'); |
||||||
|
// 关闭弹窗
|
||||||
|
this.closeBatchUpdateDiscount(); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} else { |
||||||
|
Object.values(this.updateDiscountForm.controls).forEach(control => { |
||||||
|
if (control.invalid) { |
||||||
|
control.markAsDirty(); |
||||||
|
control.updateValueAndValidity({ onlySelf: true }); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 关闭批量调整弹出框 |
||||||
|
*/ |
||||||
|
closeBatchUpdateDiscount() { |
||||||
|
this.batchUpdateDiscountModal = false; |
||||||
|
} |
||||||
|
/** |
||||||
|
* 打开优惠详情 |
||||||
|
*/ |
||||||
|
showDiscountDetail(merNo: string) { |
||||||
|
this.agentPriceService.getOilNoPrice({merNo: merNo}, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
this.discountDetailObj = data['return_data']; |
||||||
|
} |
||||||
|
}); |
||||||
|
this.discountDetailModal = true; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 关闭优惠详情 |
||||||
|
*/ |
||||||
|
closeDiscountDetail() { |
||||||
|
this.discountDetailModal = false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 打开修改优惠模态框 |
||||||
|
* @param data |
||||||
|
*/ |
||||||
|
showUpdateDiscount(data: any) { |
||||||
|
this.updateDiscountForm.patchValue(data); |
||||||
|
this.updateDiscountForm.controls['oilNo'].disable(); |
||||||
|
this.updateDiscountModal = true; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 提交修改优惠 |
||||||
|
*/ |
||||||
|
submitUpdateDiscount() { |
||||||
|
if (this.updateDiscountForm.valid) { |
||||||
|
this.updateDiscountForm.value; |
||||||
|
let paramArr = []; |
||||||
|
let param = this.updateDiscountForm.value; |
||||||
|
param['oilNo'] = this.updateDiscountForm.controls['oilNo'].value; |
||||||
|
paramArr.push(param); |
||||||
|
this.agentPriceService.editPrice(paramArr, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
this.message.create('success', '操作成功'); |
||||||
|
// 关闭弹窗
|
||||||
|
this.closeUpdateDiscount(); |
||||||
|
// 刷新数据
|
||||||
|
this.showDiscountDetail(param['merNo']); |
||||||
|
// 表单重置
|
||||||
|
this.updateDiscountForm.reset(); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} else { |
||||||
|
Object.values(this.updateDiscountForm.controls).forEach(control => { |
||||||
|
if (control.invalid) { |
||||||
|
control.markAsDirty(); |
||||||
|
control.updateValueAndValidity({ onlySelf: true }); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
/** |
||||||
|
* 关闭修改优惠模态框 |
||||||
|
*/ |
||||||
|
closeUpdateDiscount() { |
||||||
|
this.updateDiscountForm.reset(); |
||||||
|
this.updateDiscountModal = false; |
||||||
|
} |
||||||
|
|
||||||
} |
} |
||||||
|
@ -0,0 +1,120 @@ |
|||||||
|
<form nz-form [formGroup]="searchForm" class="search_form"> |
||||||
|
<div nz-row [nzGutter]="24"> |
||||||
|
<div nz-col [nzSpan]="6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label>油号</nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<nz-select formControlName="oilNo" [nzPlaceHolder]="'请选择'"> |
||||||
|
<nz-option *ngFor="let item of oilNoArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col [nzSpan]="6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzNoColon]="true"></nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
|
||||||
|
<nz-table #basicTable |
||||||
|
[nzScroll]="{ x: '1200' }" |
||||||
|
[nzBordered]="true" |
||||||
|
[nzShowPagination]="false" |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzShowQuickJumper]="false" |
||||||
|
[nzShowTotal]="totalTemplate" |
||||||
|
[nzTotal]="tableData.length" |
||||||
|
[nzData]="tableData" > |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<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 nzRight nzWidth="50px">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data"> |
||||||
|
<td style="{{today == data.weeks?'color: red':''}}"> |
||||||
|
{{data.weeks | week}} {{today == data.weeks?'(今日)':''}} |
||||||
|
</td> |
||||||
|
<td>{{data.oilNoName}}</td> |
||||||
|
<td>{{data.priceOfficial}}</td> |
||||||
|
<td>{{data.priceGun}}</td> |
||||||
|
<td>{{data.priceVip}}</td> |
||||||
|
<td>{{data.updateTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<td nzRight> |
||||||
|
<button nz-button nzType="link" (click)="showEditModal(data)" [nzSize]="'small'" >修改</button> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||||
|
</nz-table> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="editDataModal" |
||||||
|
[nzWidth]="500" |
||||||
|
nzTitle="修改价格" |
||||||
|
[nzFooter]="null" |
||||||
|
(nzOnCancel)="closeEditModal()"> |
||||||
|
<ng-container *nzModalContent> |
||||||
|
<form nz-form [formGroup]="editDataForm"> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24">日期</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-select formControlName="week" [nzPlaceHolder]="'请选择'"> |
||||||
|
<nz-option nzValue="1" nzLabel="星期一"></nz-option> |
||||||
|
<nz-option nzValue="2" nzLabel="星期二"></nz-option> |
||||||
|
<nz-option nzValue="3" nzLabel="星期三"></nz-option> |
||||||
|
<nz-option nzValue="4" nzLabel="星期四"></nz-option> |
||||||
|
<nz-option nzValue="5" nzLabel="星期五"></nz-option> |
||||||
|
<nz-option nzValue="6" nzLabel="星期六"></nz-option> |
||||||
|
<nz-option nzValue="7" nzLabel="星期日"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24">油品</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-select formControlName="oilNo" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||||
|
<nz-option *ngFor="let item of oilNoArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>国标价</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-input-number formControlName="priceOfficial" [nzMin]="0" [nzMax]="99" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'国标价'"></nz-input-number> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>油枪价</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-input-number formControlName="priceGun" [nzMin]="0" [nzMax]="99" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'油枪价'"></nz-input-number> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠价</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-input-number formControlName="priceVip" [nzMin]="0" [nzMax]="99" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'优惠价'"></nz-input-number> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||||
|
<button nz-button nzType="primary" (click)="submitData()" class="submit-btn">保存</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</ng-container> |
||||||
|
</nz-modal> |
@ -0,0 +1,3 @@ |
|||||||
|
nz-input-number { |
||||||
|
width: 100%; |
||||||
|
} |
@ -0,0 +1,199 @@ |
|||||||
|
import { Component } from '@angular/core'; |
||||||
|
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||||
|
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||||
|
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||||
|
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||||
|
import { |
||||||
|
NzCellFixedDirective, |
||||||
|
NzTableCellDirective, |
||||||
|
NzTableComponent, NzTableModule, |
||||||
|
NzTbodyComponent, NzTheadComponent, |
||||||
|
NzThMeasureDirective, NzTrDirective |
||||||
|
} from "ng-zorro-antd/table"; |
||||||
|
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||||
|
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||||
|
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||||
|
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||||
|
import {NzInputNumberComponent, NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||||
|
import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||||
|
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||||
|
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||||
|
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||||
|
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||||
|
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||||
|
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||||
|
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||||
|
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||||
|
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||||
|
import {NzImageModule} from "ng-zorro-antd/image"; |
||||||
|
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||||
|
import {NzMessageService} from "ng-zorro-antd/message"; |
||||||
|
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||||
|
import {OilTaskService} from "../../../services/mer-oil-price/oil-task.service"; |
||||||
|
import {CommonService} from "../../../services/common/common.service"; |
||||||
|
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||||
|
import {GasOilPriceWeekService} from "../../../services/mer-oil-price/gas-oil-price-week.service"; |
||||||
|
import {WeekPipe} from "../../../pipes/common/week.pipe"; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-oil-config', |
||||||
|
standalone: true, |
||||||
|
imports: [ |
||||||
|
DatePipe, |
||||||
|
DictionaryPipe, |
||||||
|
FormsModule, |
||||||
|
NgForOf, |
||||||
|
NgIf, |
||||||
|
NzButtonComponent, |
||||||
|
NzCellFixedDirective, |
||||||
|
NzColDirective, |
||||||
|
NzDividerComponent, |
||||||
|
NzDropDownADirective, |
||||||
|
NzDropDownDirective, |
||||||
|
NzDropdownMenuComponent, |
||||||
|
NzFormControlComponent, |
||||||
|
NzFormDirective, |
||||||
|
NzFormItemComponent, |
||||||
|
NzFormLabelComponent, |
||||||
|
NzIconDirective, |
||||||
|
NzInputDirective, |
||||||
|
NzMenuDirective, |
||||||
|
NzMenuItemComponent, |
||||||
|
NzOptionComponent, |
||||||
|
NzRowDirective, |
||||||
|
NzSelectComponent, |
||||||
|
NzTableCellDirective, |
||||||
|
NzTableComponent, |
||||||
|
NzTbodyComponent, |
||||||
|
NzThMeasureDirective, |
||||||
|
NzTheadComponent, |
||||||
|
NzTrDirective, |
||||||
|
ReactiveFormsModule, |
||||||
|
NzTableModule, |
||||||
|
NzModalModule, |
||||||
|
NzFlexDirective, |
||||||
|
NzDescriptionsModule, |
||||||
|
NzUploadComponent, |
||||||
|
NzAvatarModule, |
||||||
|
NzImageModule, |
||||||
|
NzSwitchComponent, |
||||||
|
NzDatePickerComponent, |
||||||
|
NzInputNumberModule, |
||||||
|
WeekPipe |
||||||
|
], |
||||||
|
templateUrl: './oil-config.component.html', |
||||||
|
styleUrl: './oil-config.component.less' |
||||||
|
}) |
||||||
|
export class OilConfigComponent { |
||||||
|
// 表单数据
|
||||||
|
tableData: any = []; |
||||||
|
// 搜索表单
|
||||||
|
searchForm: FormGroup; |
||||||
|
// 油号
|
||||||
|
oilNoArray = new DictionaryPipe().getDictionaryList('OIL_NO'); |
||||||
|
// 商户号
|
||||||
|
merNo = null; |
||||||
|
// 编辑数据表单
|
||||||
|
editDataForm: FormGroup; |
||||||
|
editDataModal = false; |
||||||
|
|
||||||
|
// 当前日期
|
||||||
|
today:number = new Date().getDay(); |
||||||
|
constructor(private fb: NonNullableFormBuilder, |
||||||
|
private message: NzMessageService, |
||||||
|
private storage: BrowserStorageService, |
||||||
|
private gasOilPriceWeekService: GasOilPriceWeekService, |
||||||
|
private commonService: CommonService, |
||||||
|
private modal: NzModalService) { |
||||||
|
this.merNo = this.storage.get(DATA)['merchant']['merNo']; |
||||||
|
|
||||||
|
// 初始化搜索框
|
||||||
|
this.searchForm = this.fb.group({ |
||||||
|
merNo: [this.merNo], |
||||||
|
oilNo: [this.oilNoArray[0].codeValue], |
||||||
|
}); |
||||||
|
|
||||||
|
this.editDataForm = this.fb.group({ |
||||||
|
id: [null, [Validators.required]], |
||||||
|
week: [null], |
||||||
|
oilNo: [null], |
||||||
|
priceOfficial: [null, [Validators.required]], |
||||||
|
priceGun: [null, [Validators.required]], |
||||||
|
priceVip: [null, [Validators.required]], |
||||||
|
}); |
||||||
|
// 查询数据
|
||||||
|
this.queryData(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取数据 |
||||||
|
*/ |
||||||
|
queryData() { |
||||||
|
this.searchForm.value.time = new Date().getTime(); |
||||||
|
this.gasOilPriceWeekService.getPriceList(this.searchForm.value, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
this.tableData = data['return_data']; |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 搜索表单提交 |
||||||
|
*/ |
||||||
|
searchFormSubmit(): void { |
||||||
|
this.queryData(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 搜索表单重置 |
||||||
|
*/ |
||||||
|
searchFormReset(): void { |
||||||
|
this.searchForm.reset(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 打开编辑模态框 |
||||||
|
*/ |
||||||
|
showEditModal(data: any) { |
||||||
|
data['week'] = String(data['weeks']); |
||||||
|
this.editDataForm.patchValue(data); |
||||||
|
this.editDataForm.controls['week'].disable(); |
||||||
|
this.editDataForm.controls['oilNo'].disable(); |
||||||
|
this.editDataModal = true; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 提交数据 |
||||||
|
*/ |
||||||
|
submitData() { |
||||||
|
if (this.editDataForm.valid) { |
||||||
|
this.gasOilPriceWeekService.updatePrice(this.editDataForm.value, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
this.message.create('success', '操作成功'); |
||||||
|
// 刷新数据
|
||||||
|
this.queryData(); |
||||||
|
// 关闭弹窗
|
||||||
|
this.closeEditModal(); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} else { |
||||||
|
Object.values(this.editDataForm.controls).forEach(control => { |
||||||
|
if (control.invalid) { |
||||||
|
control.markAsDirty(); |
||||||
|
control.updateValueAndValidity({ onlySelf: true }); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 关闭编辑任务模态框 |
||||||
|
*/ |
||||||
|
closeEditModal() { |
||||||
|
this.editDataForm.reset(); |
||||||
|
this.editDataModal = false; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
<nz-tabset style="padding: 0px 12px 12px 12px;" nzType="card"> |
||||||
|
<nz-tab *ngFor="let item of merQrCodeData" nzTitle="{{item.codeType | dictionary:'MERCHANT_QR_CODE_TYPE'}}"> |
||||||
|
<div nz-row style="margin-bottom: 10px;" [nzGutter]="16"> |
||||||
|
<div nz-col [nzSpan]="6"> |
||||||
|
<nz-card id="downloadH5" nzHoverable nzTitle="H5端" [nzExtra]="extraTemplateH5"> |
||||||
|
<nz-qrcode [nzPadding]="20" nzValue="{{item.codeContent}}"></nz-qrcode> |
||||||
|
</nz-card> |
||||||
|
<ng-template #extraTemplateH5> |
||||||
|
<a #download></a> |
||||||
|
<a (click)="downloadMerQrCode(1)">点击下载</a> |
||||||
|
</ng-template> |
||||||
|
</div> |
||||||
|
<div nz-col [nzSpan]="6"> |
||||||
|
<nz-card id="downloadWx" nzHoverable nzTitle="微信小程序" [nzExtra]="extraTemplateWx"> |
||||||
|
<nz-qrcode [nzPadding]="20" nzValue="{{'https://oil.dctpay.com/gas?merNo='+item.merchantNo}}"></nz-qrcode> |
||||||
|
</nz-card> |
||||||
|
<ng-template #extraTemplateWx> |
||||||
|
<a #download></a> |
||||||
|
<a (click)="downloadMerQrCode(2)">点击下载</a> |
||||||
|
</ng-template> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</nz-tab> |
||||||
|
</nz-tabset> |
@ -0,0 +1,132 @@ |
|||||||
|
import {Component, ElementRef, ViewChild} from '@angular/core'; |
||||||
|
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||||
|
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||||
|
import {FormsModule, NonNullableFormBuilder, ReactiveFormsModule} from "@angular/forms"; |
||||||
|
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||||
|
import { |
||||||
|
NzCellFixedDirective, |
||||||
|
NzTableCellDirective, |
||||||
|
NzTableComponent, NzTableModule, |
||||||
|
NzTbodyComponent, NzTheadComponent, |
||||||
|
NzThMeasureDirective, NzTrDirective |
||||||
|
} from "ng-zorro-antd/table"; |
||||||
|
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||||
|
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||||
|
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||||
|
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||||
|
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||||
|
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||||
|
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||||
|
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||||
|
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||||
|
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||||
|
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||||
|
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||||
|
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||||
|
import {NzImageModule} from "ng-zorro-antd/image"; |
||||||
|
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||||
|
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||||
|
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||||
|
import {WeekPipe} from "../../../pipes/common/week.pipe"; |
||||||
|
import {NzMessageService} from "ng-zorro-antd/message"; |
||||||
|
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||||
|
import {CommonService} from "../../../services/common/common.service"; |
||||||
|
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||||
|
import {MerService} from "../../../services/merchant/mer.service"; |
||||||
|
import {NzTabComponent, NzTabSetComponent} from "ng-zorro-antd/tabs"; |
||||||
|
import {NzCardComponent} from "ng-zorro-antd/card"; |
||||||
|
import {NzQRCodeComponent} from "ng-zorro-antd/qr-code"; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-qr-code-list', |
||||||
|
standalone: true, |
||||||
|
imports: [ |
||||||
|
DatePipe, |
||||||
|
DictionaryPipe, |
||||||
|
FormsModule, |
||||||
|
NgForOf, |
||||||
|
NgIf, |
||||||
|
NzButtonComponent, |
||||||
|
NzCellFixedDirective, |
||||||
|
NzColDirective, |
||||||
|
NzDividerComponent, |
||||||
|
NzDropDownADirective, |
||||||
|
NzDropDownDirective, |
||||||
|
NzDropdownMenuComponent, |
||||||
|
NzFormControlComponent, |
||||||
|
NzFormDirective, |
||||||
|
NzFormItemComponent, |
||||||
|
NzFormLabelComponent, |
||||||
|
NzIconDirective, |
||||||
|
NzInputDirective, |
||||||
|
NzMenuDirective, |
||||||
|
NzMenuItemComponent, |
||||||
|
NzOptionComponent, |
||||||
|
NzRowDirective, |
||||||
|
NzSelectComponent, |
||||||
|
NzTableCellDirective, |
||||||
|
NzTableComponent, |
||||||
|
NzTbodyComponent, |
||||||
|
NzThMeasureDirective, |
||||||
|
NzTheadComponent, |
||||||
|
NzTrDirective, |
||||||
|
ReactiveFormsModule, |
||||||
|
NzTableModule, |
||||||
|
NzModalModule, |
||||||
|
NzFlexDirective, |
||||||
|
NzDescriptionsModule, |
||||||
|
NzUploadComponent, |
||||||
|
NzAvatarModule, |
||||||
|
NzImageModule, |
||||||
|
NzSwitchComponent, |
||||||
|
NzDatePickerComponent, |
||||||
|
NzInputNumberModule, |
||||||
|
WeekPipe, |
||||||
|
NzTabSetComponent, |
||||||
|
NzTabComponent, |
||||||
|
NzCardComponent, |
||||||
|
NzQRCodeComponent |
||||||
|
], |
||||||
|
templateUrl: './qr-code-list.component.html', |
||||||
|
styleUrl: './qr-code-list.component.less' |
||||||
|
}) |
||||||
|
export class QrCodeListComponent { |
||||||
|
// 表单数据
|
||||||
|
tableData: any = []; |
||||||
|
// 商户号
|
||||||
|
merNo = null; |
||||||
|
|
||||||
|
merQrCodeData: any = []; |
||||||
|
constructor(private fb: NonNullableFormBuilder, |
||||||
|
private message: NzMessageService, |
||||||
|
private storage: BrowserStorageService, |
||||||
|
private merService: MerService, |
||||||
|
private commonService: CommonService, |
||||||
|
private modal: NzModalService) { |
||||||
|
this.merNo = this.storage.get(DATA)['merchant']['merNo']; |
||||||
|
this.merService.queryQrCodeList(this.merNo, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
this.merQrCodeData = data['return_data']; |
||||||
|
} else { |
||||||
|
this.message.error(data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 下载二维码 |
||||||
|
* @param type |
||||||
|
*/ |
||||||
|
@ViewChild('download', { static: false }) download!: ElementRef; |
||||||
|
downloadMerQrCode(type: number) { |
||||||
|
const canvas = document.getElementById('download'+(type==1?'H5':'Wx'))?.querySelector<HTMLCanvasElement>('canvas'); |
||||||
|
if (canvas) { |
||||||
|
this.download.nativeElement.href = canvas.toDataURL('image/png'); |
||||||
|
this.download.nativeElement.download = new Date().getTime(); |
||||||
|
const event = new MouseEvent('click'); |
||||||
|
this.download.nativeElement.dispatchEvent(event); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,6 +1,8 @@ |
|||||||
import { Routes } from '@angular/router'; |
import { Routes } from '@angular/router'; |
||||||
import {MenuComponent} from "./menu/menu.component"; |
import {MenuComponent} from "./menu/menu.component"; |
||||||
|
import {CmsListComponent} from "../cms/cms-list/cms-list.component"; |
||||||
|
|
||||||
export const SYSTEM_ROUTES: Routes = [ |
export const SYSTEM_ROUTES: Routes = [ |
||||||
{ path: 'menu', component: MenuComponent} |
{ path: 'menu', component: MenuComponent}, |
||||||
|
{ path: 'cms-list', component: CmsListComponent} |
||||||
]; |
]; |
||||||
|
@ -0,0 +1,28 @@ |
|||||||
|
import { Pipe, PipeTransform } from '@angular/core'; |
||||||
|
|
||||||
|
@Pipe({ |
||||||
|
name: 'week', |
||||||
|
standalone: true |
||||||
|
}) |
||||||
|
export class WeekPipe implements PipeTransform { |
||||||
|
|
||||||
|
transform(weekNum: number): string { |
||||||
|
if (weekNum === 1) { |
||||||
|
return '星期一'; |
||||||
|
} else if (weekNum === 2) { |
||||||
|
return '星期二'; |
||||||
|
} else if (weekNum === 3) { |
||||||
|
return '星期三'; |
||||||
|
} else if (weekNum === 4) { |
||||||
|
return '星期四'; |
||||||
|
} else if (weekNum === 5) { |
||||||
|
return '星期五'; |
||||||
|
} else if (weekNum === 6) { |
||||||
|
return '星期六'; |
||||||
|
} else if (weekNum === 7) { |
||||||
|
return '星期日'; |
||||||
|
} |
||||||
|
return '未知' |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
import { Pipe, PipeTransform } from '@angular/core'; |
||||||
|
|
||||||
|
@Pipe({ |
||||||
|
name: 'merClassGroupTaskStatus', |
||||||
|
standalone: true |
||||||
|
}) |
||||||
|
export class MerClassGroupTaskStatusPipe implements PipeTransform { |
||||||
|
|
||||||
|
transform(value: number): any { |
||||||
|
switch (value) { |
||||||
|
case 1: |
||||||
|
return '进行中'; |
||||||
|
case 2: |
||||||
|
return '已结束'; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,48 @@ |
|||||||
|
import { Injectable } from '@angular/core'; |
||||||
|
import {HttpClient} from "@angular/common/http"; |
||||||
|
import {environment} from "../../../environments/environment"; |
||||||
|
import {ObjectData} from "../../utils/objectData.service"; |
||||||
|
|
||||||
|
@Injectable({ |
||||||
|
providedIn: 'root' |
||||||
|
}) |
||||||
|
export class AgentPriceService { |
||||||
|
|
||||||
|
constructor(private http: HttpClient) { } |
||||||
|
|
||||||
|
/** |
||||||
|
* 编辑价格 |
||||||
|
* @param param |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public editPrice(param: any, callBack:any) { |
||||||
|
param.tm = new Date().getTime(); |
||||||
|
this.http.post(environment.baseUrl + 'agentPrice/editPrice', param).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 批量配置价格 |
||||||
|
* @param param |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public batchConfigPrice(param: any, callBack:any) { |
||||||
|
param.tm = new Date().getTime(); |
||||||
|
this.http.post(environment.baseUrl + 'agentPrice/batchConfigPrice', param).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 油站价格 |
||||||
|
* @param param |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public getOilNoPrice(param: any, callBack:any) { |
||||||
|
param.tm = new Date().getTime(); |
||||||
|
this.http.get(environment.baseUrl + 'agentPrice/getOilNoPrice?'+ObjectData.objectByString(param)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,72 @@ |
|||||||
|
import { Injectable } from '@angular/core'; |
||||||
|
import {HttpClient} from "@angular/common/http"; |
||||||
|
import {environment} from "../../../environments/environment"; |
||||||
|
import {ObjectData} from "../../utils/objectData.service"; |
||||||
|
|
||||||
|
@Injectable({ |
||||||
|
providedIn: 'root' |
||||||
|
}) |
||||||
|
export class CmsService { |
||||||
|
|
||||||
|
constructor(private http: HttpClient) { } |
||||||
|
|
||||||
|
/** |
||||||
|
* 编辑 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public edit(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.post(environment.baseUrl + 'cms/edit',params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 上线 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public online(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.post(environment.baseUrl + 'cms/online',params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 下线 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public offline(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.post(environment.baseUrl + 'cms/offline',params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public delete(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.post(environment.baseUrl + 'cms/delete',params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询列表 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public queryList(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.get(environment.baseUrl + 'cms/queryList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
import { Injectable } from '@angular/core'; |
||||||
|
import {HttpClient} from "@angular/common/http"; |
||||||
|
import {environment} from "../../../environments/environment"; |
||||||
|
import {ObjectData} from "../../utils/objectData.service"; |
||||||
|
|
||||||
|
@Injectable({ |
||||||
|
providedIn: 'root' |
||||||
|
}) |
||||||
|
export class GasOilPriceWeekService { |
||||||
|
|
||||||
|
constructor(private http: HttpClient) { } |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改价格 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public updatePrice(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.post(environment.baseUrl + 'gasOilPriceWeek/updatePrice', params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询价格 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public getPriceList(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.get(environment.baseUrl + 'gasOilPriceWeek/getPriceList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,98 @@ |
|||||||
|
import { Injectable } from '@angular/core'; |
||||||
|
import {HttpClient} from '@angular/common/http'; |
||||||
|
import {ObjectData} from "../../utils/objectData.service"; |
||||||
|
import {environment} from "../../../environments/environment"; |
||||||
|
@Injectable({ |
||||||
|
providedIn: 'root' |
||||||
|
}) |
||||||
|
export class MerClassGroupTaskService { |
||||||
|
|
||||||
|
constructor( |
||||||
|
private http: HttpClient |
||||||
|
) { } |
||||||
|
|
||||||
|
/** |
||||||
|
* 开启班组任务 |
||||||
|
* |
||||||
|
* @param param 参数对象 |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public startGroupTask(param: object, callBack: any) { |
||||||
|
this.http.post(environment.baseUrl + 'gasClassGroupTask/startGroupTask', param).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 结束班组任务 |
||||||
|
* |
||||||
|
* @param param 参数对象 |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public endGroupTask(param: object, callBack: any) { |
||||||
|
this.http.post(environment.baseUrl + 'gasClassGroupTask/endGroupTask', param).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 交换班组任务 |
||||||
|
* |
||||||
|
* @param param 参数对象 |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public swapGroupTask(param: object, callBack: any) { |
||||||
|
this.http.post(environment.baseUrl + 'gasClassGroupTask/swapGroupTask', param).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 交换班组任务 |
||||||
|
* |
||||||
|
* @param param 参数对象 |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public getClassGroupTaskById(id: number, callBack: any) { |
||||||
|
this.http.get(environment.baseUrl + 'gasClassGroupTask/getClassGroupTaskById?gasClassGroupTaskId=' + id).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 交换班组任务 |
||||||
|
* |
||||||
|
* @param param 参数对象 |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public getCurrentClassGroupTask(gasId: number, callBack: any) { |
||||||
|
this.http.get(environment.baseUrl + 'gasClassGroupTask/getCurrentClassGroupTask?time='+new Date().getTime()+'&gasId=' + gasId).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 交换班组任务 |
||||||
|
* |
||||||
|
* @param param 参数对象 |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public getClassGroupTaskList(param: object, callBack: any) { |
||||||
|
this.http.get(environment.baseUrl + 'gasClassGroupTask/getClassGroupTaskList?' + ObjectData.objectByString(param)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 打印小票 |
||||||
|
* |
||||||
|
* @param param 参数对象 |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public print(gasClassGroupTaskId: number, callBack: any) { |
||||||
|
this.http.get(environment.baseUrl + 'gasClassGroupTask/print?time='+new Date().getTime()+'&gasClassGroupTaskId=' + gasClassGroupTaskId).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,62 @@ |
|||||||
|
import { Injectable } from '@angular/core'; |
||||||
|
import {HttpClient} from '@angular/common/http'; |
||||||
|
import {environment} from "../../../environments/environment"; |
||||||
|
import {ObjectData} from "../../utils/objectData.service"; |
||||||
|
|
||||||
|
@Injectable({ |
||||||
|
providedIn: 'root' |
||||||
|
}) |
||||||
|
export class MerClassGroupService { |
||||||
|
|
||||||
|
constructor( |
||||||
|
private http: HttpClient |
||||||
|
) { } |
||||||
|
|
||||||
|
/** |
||||||
|
* 编辑班组 |
||||||
|
* |
||||||
|
* @param param 参数对象 |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public editClassGroup(param: object, callBack: any) { |
||||||
|
this.http.post(environment.baseUrl + 'gasClassGroup/editClassGroup', param).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除班组 |
||||||
|
* |
||||||
|
* @param param 参数对象 |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public delClassGroup(groupId: number, callBack: any) { |
||||||
|
this.http.post(environment.baseUrl + 'gasClassGroup/delClassGroup', { id: groupId}).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据id查询详情 |
||||||
|
* |
||||||
|
* @param groupId 班组id |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public getClassGroupById(groupId: number, callBack: any) { |
||||||
|
this.http.get(environment.baseUrl + 'gasClassGroup/getClassGroupById?groupId=' + groupId).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询班组列表 |
||||||
|
* |
||||||
|
* @param param 参数对象 |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public getClassGroupList(param: Object, callBack: any) { |
||||||
|
this.http.get(environment.baseUrl + 'gasClassGroup/getClassGroupList?'+ObjectData.objectByString(param)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
import { Injectable } from '@angular/core'; |
||||||
|
import {environment} from "../../../environments/environment"; |
||||||
|
import {ObjectData} from "../../utils/objectData.service"; |
||||||
|
import {HttpClient} from "@angular/common/http"; |
||||||
|
|
||||||
|
@Injectable({ |
||||||
|
providedIn: 'root' |
||||||
|
}) |
||||||
|
export class MerQrCodeService { |
||||||
|
|
||||||
|
constructor(private http: HttpClient) { } |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询商户列表 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public queryQrCodeList(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.get(environment.baseUrl + 'merchantQrCode/queryQrCodeList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue