diff --git a/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.html b/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.html index a52ee53..aeecae5 100644 --- a/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.html +++ b/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.html @@ -1,8 +1,7 @@ - -<!– end 面包屑 –> -<!–条件搜索–> + +
@@ -45,10 +44,10 @@
共计 {{dataObject.total?dataObject.total:0}} 条数据
- +
- <!–数组表格 –> + - 序号 + 序号 班组名称 - 负责人名称 + 负责人名称 负责人电话 创建时间 操作 @@ -78,7 +77,7 @@ 操作列表 @@ -88,29 +87,28 @@
- - + + - 卡号 + 班组名称 - + - 回收余额 + 负责人名称 - + - 支付密码 + 负责人电话 - +
- +
---> diff --git a/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.ts b/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.ts index 174516f..225a96d 100644 --- a/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.ts +++ b/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import {FormBuilder, FormGroup} from '@angular/forms'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {NzMessageService, NzModalService} from 'ng-zorro-antd'; import {GasClassGroupService} from '../../../services/gas-class-group.service'; @@ -16,6 +16,9 @@ export class GasClassGroupListComponent implements OnInit { pageNum: number; whereObject: any = {}; + classGroupModal = false; + classGroupForm: FormGroup; + constructor(private modal: NzModalService, private message: NzMessageService, private gasClassGroupService: GasClassGroupService, @@ -27,6 +30,13 @@ export class GasClassGroupListComponent implements OnInit { 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); } @@ -69,7 +79,7 @@ export class GasClassGroupListComponent implements OnInit { showDeleteConfirm(groupId: number): void { this.modal.confirm({ nzTitle: '警告', - nzContent: '是否删除该代理商', + nzContent: '是否删除班组', nzOkText: '是', nzCancelText: '否', nzOkType: 'danger', @@ -94,4 +104,56 @@ export class GasClassGroupListComponent implements OnInit { }); } + /** + * 打开编辑班组模态框 + */ + showEditClassGroup(data: object) { + 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 => { + 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'], + }); + } + }); + } + } diff --git a/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.html b/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.html index 28fb20f..4d6c9e9 100644 --- a/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.html +++ b/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.html @@ -1 +1,188 @@ -

gas-class-group-task works!

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + 历史班次,共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ +
+ + + + + + 班次 + 班组名称 + 开始时间 + 结束时间 + 状态 + 操作 + + + + + {{data.classNum + ' 班'}} + {{data.gasClassGroupName}} + {{data.startTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + {{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}} + 未结束 + + {{data.status | gasClassGroupTaskStatus}} + + 操作列表 + + + + + + + +
+ + + + {{classGroupCountData['startTime'] | date: 'yyyy-MM-dd HH:mm:ss'}} + {{classGroupCountData['endTime'] | date: 'yyyy-MM-dd HH:mm:ss'}} + {{classGroupCountData['refuelPrice']}} 元 + {{classGroupCountData['refuelNum']}} 笔 + {{classGroupCountData['refuelLiters']}} 升 + {{classGroupCountData['refundPrice']}} 元 + {{classGroupCountData['refundNum']}} 笔 + {{classGroupCountData['refundLiters']}} 升 + + + + + + 油号 + 金额 + 升数 + 笔数 + + + + + {{ item.oilNo }}# + {{ item.refuelPrice }}元 + {{ item.refuelLiters }}升 + {{ item.refuelNum }}笔 + + + +
+ +
+
+ + +
+ + + + + + + + + + + +
+
+ + +
+ + 班组 + + + + + + +
+ +
+
+
+ + +
+ + 班组 + + + + + + +
+ +
+
+
diff --git a/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.scss b/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.scss index e69de29..2755744 100644 --- a/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.scss +++ b/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.scss @@ -0,0 +1,8 @@ +.gas-count-btn { + text-align: center; + margin-top: 15px; +} +.gas-count-btn button { + margin-bottom: 15px; + margin-left: 10px; +} diff --git a/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.ts b/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.ts index eca8cb6..e0b4779 100644 --- a/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.ts +++ b/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.ts @@ -1,4 +1,10 @@ import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {NzMessageService, NzModalService} from 'ng-zorro-antd'; +import {GasClassGroupService} from '../../../services/gas-class-group.service'; +import {GasClassGroupTaskService} from '../../../services/gas-class-group-task.service'; +import {LocalStorageService} from '../../../services/local-storage.service'; +import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; @Component({ selector: 'app-gas-class-group-task', @@ -6,10 +12,377 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./gas-class-group-task.component.scss'] }) export class GasClassGroupTaskComponent implements OnInit { + userInfoObject: object; - constructor() { } + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + classGroupArray = []; + + startClassGroupModal = false; + startClassGroupModalForm: FormGroup; + + swapClassGroupModal = false; + swapClassGroupModalForm: FormGroup; + + currentClassGroupCountData = { + classNum: '无', + refuelPrice: '0', + refuelNum: '0', + refuelLiters: '0', + refundPrice: '0', + refundNum: '0', + status: null, + }; + + classGroupCountDataModal = false; + classGroupCountData = {}; + + printModal = false; + printData = {}; + printTaskId: number; + + constructor(private modal: NzModalService, + private localStorageService: LocalStorageService, // 数据缓存 + private message: NzMessageService, + private gasClassGroupService: GasClassGroupService, + private gasClassGroupTaskService: GasClassGroupTaskService, + private form: FormBuilder) { + this.userInfoObject = this.localStorageService.get(ADMIN_INFO_OBJECT); + } ngOnInit(): void { + + 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 => { + if (data['return_code'] === '000000') { + this.classGroupArray = data['return_data']['list']; + } + }); + this.getCurrentClassGroupCountData(); + this.requestData(1); } + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.gasClassGroupTaskService.getClassGroupTaskList(this.whereObject, data => { + if (data['return_code'] === '000000') { + this.dataObject = data['return_data']; + } else { + this.modal.error(data['return_msg']); + } + this.tableLoading = false; + }); + } + + /** + * 搜索 + * @param whereObject 条件 + */ + search(whereObject: object) { + this.whereObject = whereObject; + this.requestData(1); + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + + /** + * 查询当前班组数据 + */ + getCurrentClassGroupCountData() { + this.gasClassGroupTaskService.getCurrentClassGroupTask(this.userInfoObject['merchantStore']['id'], data => { + if (data['return_code'] === '000000') { + this.currentClassGroupCountData = data['return_data']; + } else { + this.modal.warning({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } + + /** + * 打开 开始班组模态框 + */ + 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['merchantStore']['id']; + + // 提交数据 + this.gasClassGroupTaskService.startGroupTask(this.startClassGroupModalForm.value, data => { + 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: '否', + nzOkType: 'danger', + 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['merchantStore']['id']; + + // 提交数据 + this.gasClassGroupTaskService.swapGroupTask(this.swapClassGroupModalForm.value, data => { + 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: '否', + nzOkType: 'danger', + nzOnOk: () => this.endClassGroupData() + }); + } + + /** + * 提交结束班次数据 + * + */ + endClassGroupData() { + this.gasClassGroupTaskService.endGroupTask( { gasId: this.userInfoObject['merchantStore']['id'] }, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + this.getCurrentClassGroupCountData(); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } + + /** + * 展示班次数据统计 + */ + showClassGroupTaskDataModal(data: object) { + 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, dataBack => { + if (dataBack['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '操作成功', + }); + } + }); + } + + /** + * 热敏打印机 + */ + showPrintDiv() { + this.printDiv(this.printData); + } + + printDiv(data: object) { + const headstr = '打印小票'; + const footstr = ''; + let newstr = '
\n' + + '
\n' + + '
\n' + + ' '+data['classNum']+'班结流水\n' + + '
\n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' ' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + '
\n' + + ' ' + + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' ' + + + ' \n' + + ' \n'; + for (let item of data['groupTaskOilCountList']) { + newstr += '\n'; + + } + + newstr += '\n' + + ' \n' + + ' \n' + + '
===========================================
开始时间:' + new Date(data['startTime']).toLocaleString() + '
结束时间:' + new Date(data['endTime']).toLocaleString() + '
加油金额汇总:' + data['refuelPrice'] + '元
加油笔数汇总:' + data['refuelNum'] + '笔
加油升数汇总:' + data['refuelLiters'] + '升
退款金额汇总:' + data['refundPrice'] + '元
退款笔数汇总:' + data['refundNum'] + '笔
退款升数汇总:' + data['refundLiters'] + '升
---------------------收款-------------------
油号        金额        升数        笔数
' + item['oilNo'] +'#       '+ item['refuelPrice'] +'元       '+ item['refuelLiters'] +'升       '+ item['refuelNum'] +'笔
===========================================
' + new Date().toLocaleString() +'
\n' + + '
\n' + + '
'; + const newWindow = window.open('', ''); + newWindow.document.write(headstr + newstr + footstr); + newWindow.print(); + newWindow.close(); + return false; + } } diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts index c089a56..9085c4a 100644 --- a/src/app/app-common.module.ts +++ b/src/app/app-common.module.ts @@ -48,7 +48,7 @@ import { GasStaffStatusPipe, PayStatusPipe, ChlidRechargeStatusPipe, - SourceTypePipe + SourceTypePipe, GasClassGroupTaskStatusPipe } from './pipes'; import {OilCardStatusPipe} from './pipes'; import {OilTypePipe} from './pipes/store/oil-type.pipe'; @@ -102,6 +102,7 @@ const PIPES = [ PayStatusPipe, ChlidRechargeStatusPipe, SourceTypePipe, + GasClassGroupTaskStatusPipe, ]; diff --git a/src/app/pipes/gas-class-group-task/gas-class-group-task-status.pipe.ts b/src/app/pipes/gas-class-group-task/gas-class-group-task-status.pipe.ts new file mode 100644 index 0000000..bb70fac --- /dev/null +++ b/src/app/pipes/gas-class-group-task/gas-class-group-task-status.pipe.ts @@ -0,0 +1,17 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'gasClassGroupTaskStatus' +}) +export class GasClassGroupTaskStatusPipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '进行中'; + case 2: + return '已结束'; + } + } + +} diff --git a/src/app/pipes/index.ts b/src/app/pipes/index.ts index f07ed70..7aac75a 100644 --- a/src/app/pipes/index.ts +++ b/src/app/pipes/index.ts @@ -38,3 +38,4 @@ export * from './recharge-price/price-status.pipe'; export * from './pay-status.pipe'; export * from './chlid-recharge-status.pipe'; export * from './apiMerchant/source-type.pipe'; +export * from './gas-class-group-task/gas-class-group-task-status.pipe'; diff --git a/src/app/services/gas-class-group-task.service.ts b/src/app/services/gas-class-group-task.service.ts index 92ee582..3f42f95 100644 --- a/src/app/services/gas-class-group-task.service.ts +++ b/src/app/services/gas-class-group-task.service.ts @@ -61,6 +61,18 @@ export class GasClassGroupTaskService { }); } + /** + * 交换班组任务 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getCurrentClassGroupTask(gasId: number, callBack) { + this.http.get(environment.baseUrl + 'gasClassGroupTask/getCurrentClassGroupTask?gasId=' + gasId).subscribe(data => { + callBack(data); + }); + } + /** * 交换班组任务 * @@ -68,7 +80,19 @@ export class GasClassGroupTaskService { * @param callBack 回调 */ public getClassGroupTaskList(param: object, callBack) { - this.http.get(environment.baseUrl + 'gasClassGroupTask/getClassGroupTaskList' + this.common.getWhereCondition(param)).subscribe(data => { + this.http.get(environment.baseUrl + 'gasClassGroupTask/getClassGroupTaskList?' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } + + /** + * 打印小票 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public print(gasClassGroupTaskId: number, callBack) { + this.http.get(environment.baseUrl + 'gasClassGroupTask/print?gasClassGroupTaskId=' + gasClassGroupTaskId).subscribe(data => { callBack(data); }); }