parent
aff577603f
commit
9fb247fef1
@ -0,0 +1,167 @@ |
|||||||
|
<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="positionType" [nzPlaceHolder]="'请选择'"> |
||||||
|
<nz-option *ngFor="let item of staffPositionTypeArray" 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="name" 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="telephone" 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> |
||||||
|
<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)="showEditStaffModal(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 nzRight nzWidth="80px">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data"> |
||||||
|
<td>{{data.positionType | dictionary : 'GAS_STAFF_POSITION_TYPE'}}</td> |
||||||
|
<td>{{data.name}}</td> |
||||||
|
<td>{{data.telephone}}</td> |
||||||
|
<td> |
||||||
|
<span *ngIf="data.status == 1">正常</span> |
||||||
|
<span *ngIf="data.status == 2">禁用</span> |
||||||
|
</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><a (click)="showEditStaffModal(data)">修改</a></li> |
||||||
|
<li nz-menu-item><a (click)="showQrCode(data)">二维码</a></li> |
||||||
|
<li nz-menu-item *ngIf="data.status == 1"><a (click)="disabled(data.id)">禁用账户</a></li> |
||||||
|
<li nz-menu-item *ngIf="data.status == 2"><a (click)="recover(data.id)">启用账户</a></li> |
||||||
|
<li nz-menu-item ><a (click)="delStaff(data.id)">删除账户</a></li> |
||||||
|
</ul> |
||||||
|
</nz-dropdown-menu> </td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||||
|
</nz-table> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="editStaffModal" |
||||||
|
[nzWidth]="500" |
||||||
|
nzTitle="{{this.editStaffForm.controls['id'].value!=null?'修改':'修改'}}" |
||||||
|
[nzFooter]="null" |
||||||
|
(nzOnCancel)="closeEditStaffModal()"> |
||||||
|
<ng-container *nzModalContent> |
||||||
|
<form nz-form [formGroup]="editStaffForm"> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>类型</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||||
|
<nz-select formControlName="positionType" [nzPlaceHolder]="'请选择'"> |
||||||
|
<nz-option *ngFor="let item of staffPositionTypeArray" 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"> |
||||||
|
<input nz-input formControlName="name" placeholder="请输入" /> |
||||||
|
</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"> |
||||||
|
<input nz-input formControlName="telephone" 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> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="qrCodeVisible" |
||||||
|
[nzWidth]="700" |
||||||
|
nzTitle="二维码" |
||||||
|
[nzFooter]="null" |
||||||
|
(nzOnCancel)="closeQrCode()" |
||||||
|
[nzBodyStyle]="{ padding: '0px 10px 10px 10px'}"> |
||||||
|
<ng-container *nzModalContent> |
||||||
|
<nz-tabset> |
||||||
|
<nz-tab nzTitle="加油二维码"> |
||||||
|
<div nz-row style="margin-bottom: 10px;" [nzGutter]="16"> |
||||||
|
<div nz-col [nzSpan]="10"> |
||||||
|
<nz-card id="downloadH5" nzHoverable nzTitle="H5端" [nzExtra]="extraTemplateH5"> |
||||||
|
<nz-qrcode [nzPadding]="20" [nzValue]="'https://oil.dctpay.com/cwebh5/#/petrolStation/comfirmOrder/index?merNo='+this.merNo+'&gasStaffId='+staffData['id']"></nz-qrcode> |
||||||
|
</nz-card> |
||||||
|
<ng-template #extraTemplateH5> |
||||||
|
<a #download></a> |
||||||
|
<a (click)="downloadMerQrCode(1)">点击下载</a> |
||||||
|
</ng-template> |
||||||
|
</div> |
||||||
|
<div nz-col [nzSpan]="10"> |
||||||
|
<nz-card id="downloadWx" nzHoverable nzTitle="微信小程序" [nzExtra]="extraTemplateWx"> |
||||||
|
<nz-qrcode [nzPadding]="20" [nzValue]="'https://oil.dctpay.com/gas?merNo='+this.merNo+'&gasStaffId='+staffData['id']"></nz-qrcode> |
||||||
|
</nz-card> |
||||||
|
<ng-template #extraTemplateWx> |
||||||
|
<a #download></a> |
||||||
|
<a (click)="downloadMerQrCode(2)">点击下载</a> |
||||||
|
</ng-template> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</nz-tab> |
||||||
|
</nz-tabset> |
||||||
|
</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,334 @@ |
|||||||
|
import {Component, ElementRef, ViewChild} from '@angular/core'; |
||||||
|
import {MerStaffService} from "../../../services/merchant/mer-staff.service"; |
||||||
|
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||||
|
import {NzMessageService} from "ng-zorro-antd/message"; |
||||||
|
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||||
|
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||||
|
import {CommonService} from "../../../services/common/common.service"; |
||||||
|
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||||
|
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||||
|
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||||
|
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 {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 {NzTypographyComponent} from "ng-zorro-antd/typography"; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-mer-staff-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, |
||||||
|
NzTypographyComponent |
||||||
|
], |
||||||
|
templateUrl: './mer-staff-list.component.html', |
||||||
|
styleUrl: './mer-staff-list.component.less' |
||||||
|
}) |
||||||
|
export class MerStaffListComponent { |
||||||
|
// 表单页数
|
||||||
|
tablePageNum = 1; |
||||||
|
// 每页数量
|
||||||
|
tablePageSize = 10; |
||||||
|
// 表单数据
|
||||||
|
tableData: any = { |
||||||
|
total: 0, |
||||||
|
list: [], |
||||||
|
}; |
||||||
|
merNo = null; |
||||||
|
// 搜索表单
|
||||||
|
searchForm: FormGroup; |
||||||
|
// 地区
|
||||||
|
regionArray: any = []; |
||||||
|
// 编辑任务表单
|
||||||
|
editStaffForm: FormGroup; |
||||||
|
editStaffModal = false; |
||||||
|
// 加油员类型
|
||||||
|
staffPositionTypeArray = new DictionaryPipe().getDictionaryList('GAS_STAFF_POSITION_TYPE'); |
||||||
|
qrCodeVisible = false; |
||||||
|
staffData: any = {}; |
||||||
|
constructor(private fb: NonNullableFormBuilder, |
||||||
|
private message: NzMessageService, |
||||||
|
private storage: BrowserStorageService, |
||||||
|
private merStaffService: MerStaffService, |
||||||
|
private commonService: CommonService, |
||||||
|
private modal: NzModalService) { |
||||||
|
this.merNo = this.storage.get(DATA)['merchant']['merNo']; |
||||||
|
|
||||||
|
// 获取地区
|
||||||
|
this.commonService.getRegion('',(data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
this.regionArray = data['return_data']; |
||||||
|
} |
||||||
|
}); |
||||||
|
// 初始化搜索框
|
||||||
|
this.searchForm = this.fb.group({ |
||||||
|
positionType: [null], |
||||||
|
name: [null], |
||||||
|
telephone: [null], |
||||||
|
}); |
||||||
|
|
||||||
|
this.editStaffForm = this.fb.group({ |
||||||
|
id: [''], |
||||||
|
positionType: ['1', [Validators.required]], |
||||||
|
name: ['', [Validators.required]], |
||||||
|
telephone: ['', [Validators.required]], |
||||||
|
}); |
||||||
|
// 查询数据
|
||||||
|
this.queryData(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取数据 |
||||||
|
*/ |
||||||
|
queryData() { |
||||||
|
this.searchForm.value.pageNum = this.tablePageNum; |
||||||
|
this.searchForm.value.pageSize = this.tablePageSize; |
||||||
|
this.searchForm.value.time = new Date().getTime(); |
||||||
|
this.merStaffService.getStaffList(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(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
*/ |
||||||
|
delStaff(id: number) { |
||||||
|
this.modal.confirm({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '确定删除吗?', |
||||||
|
nzOnOk: () => |
||||||
|
this.merStaffService.delStaff({staffId: id}, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
// 刷新数据
|
||||||
|
this.queryData(); |
||||||
|
this.message.create('success', '操作成功'); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}) |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 恢复 |
||||||
|
*/ |
||||||
|
recover(id: number) { |
||||||
|
this.modal.confirm({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '确定恢复账户状态吗?', |
||||||
|
nzOnOk: () => |
||||||
|
this.merStaffService.recover({staffId: id}, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
// 刷新数据
|
||||||
|
this.queryData(); |
||||||
|
this.message.create('success', '操作成功'); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}) |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 禁用 |
||||||
|
*/ |
||||||
|
disabled(id: number) { |
||||||
|
this.modal.confirm({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '确定禁用账户吗?', |
||||||
|
nzOnOk: () => |
||||||
|
this.merStaffService.disabled({staffId: id}, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
// 刷新数据
|
||||||
|
this.queryData(); |
||||||
|
this.message.create('success', '操作成功'); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}) |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 打开编辑任务模态框 |
||||||
|
*/ |
||||||
|
showEditStaffModal(data:any) { |
||||||
|
if (data != null) { |
||||||
|
data['positionType'] = String(data['positionType']); |
||||||
|
this.editStaffForm.patchValue(data); |
||||||
|
} |
||||||
|
this.editStaffModal = true; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 提交数据 |
||||||
|
*/ |
||||||
|
submitData() { |
||||||
|
if (this.editStaffForm.valid) { |
||||||
|
if (this.editStaffForm.controls['id'].value == null) { |
||||||
|
this.merStaffService.addGasStaff(this.editStaffForm.value, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
this.message.create('success', '操作成功'); |
||||||
|
// 刷新数据
|
||||||
|
this.queryData(); |
||||||
|
// 关闭弹窗
|
||||||
|
this.closeEditStaffModal(); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} else { |
||||||
|
this.merStaffService.updateGasStaff(this.editStaffForm.value, (data: any) => { |
||||||
|
if (data['return_code'] == '000000') { |
||||||
|
this.message.create('success', '操作成功'); |
||||||
|
// 刷新数据
|
||||||
|
this.queryData(); |
||||||
|
// 关闭弹窗
|
||||||
|
this.closeEditStaffModal(); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} else { |
||||||
|
Object.values(this.editStaffForm.controls).forEach(control => { |
||||||
|
if (control.invalid) { |
||||||
|
control.markAsDirty(); |
||||||
|
control.updateValueAndValidity({ onlySelf: true }); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 关闭编辑任务模态框 |
||||||
|
*/ |
||||||
|
closeEditStaffModal() { |
||||||
|
this.editStaffForm.reset(); |
||||||
|
this.editStaffModal = false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 展示二维码 |
||||||
|
* @param merNo |
||||||
|
*/ |
||||||
|
showQrCode(data: any) { |
||||||
|
this.staffData = data; |
||||||
|
this.qrCodeVisible = true; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 关闭二维码展示 |
||||||
|
*/ |
||||||
|
closeQrCode() { |
||||||
|
this.qrCodeVisible = false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 下载二维码 |
||||||
|
* @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); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,110 @@ |
|||||||
|
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 MerStaffService { |
||||||
|
|
||||||
|
constructor(private http: HttpClient) { } |
||||||
|
|
||||||
|
/** |
||||||
|
* 增加 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public addGasStaff(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.post(environment.baseUrl + 'gasStaff/addGasStaff',params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 增加 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public updateGasStaff(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.post(environment.baseUrl + 'gasStaff/updateGasStaff',params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询二维码 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public queryQrCode(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.get(environment.baseUrl + 'gasStaff/queryQrCode?'+ObjectData.objectByString(params)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 禁用 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public disabled(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.post(environment.baseUrl + 'gasStaff/disabled', params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 恢复 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public recover(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.post(environment.baseUrl + 'gasStaff/recover', params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public delStaff(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.post(environment.baseUrl + 'gasStaff/delStaff', params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询员工详情 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public getStaffDetail(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.get(environment.baseUrl + 'gasStaff/getStaffDetail?'+ObjectData.objectByString(params)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询员工列表 |
||||||
|
* @param params |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
public getStaffList(params: any, callBack:any) { |
||||||
|
params.time = new Date().getTime(); |
||||||
|
this.http.get(environment.baseUrl + 'gasStaff/getStaffList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue