Merge branch 'develop' of https://gitlab.eascs.com/tms-ui/tms-obc-web into develop

This commit is contained in:
wangshiming
2022-01-13 16:31:33 +08:00
4 changed files with 101 additions and 70 deletions

View File

@ -1,13 +1,13 @@
<page-header-wrapper title="基础配置"> <page-header-wrapper title="快递信息">
</page-header-wrapper> </page-header-wrapper>
<nz-card class="search-box"> <nz-card class="search-box">
<div nz-row nzGutter="8"> <div nz-row nzGutter="8">
<div nz-col [nzSpan]="6"> <div nz-col [nzSpan]="18">
<sf #sf [schema]="searchSchema" [ui]="{ '*': { spanLabelFixed: 90,grid: { span: 24 } }}" [compact]="true" <sf #sf [schema]="searchSchema" [ui]="{ '*': { spanLabelFixed: 90,grid: { span: 12 } }}" [compact]="true"
[button]="'none'"></sf> [button]="'none'"></sf>
</div> </div>
<div nz-col [nzSpan]="8" nzOffset="1"> <div nz-col [nzSpan]="6" class="text-right">
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">查询</button> <button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">查询</button>
<button nz-button (click)="resetSF()">重置</button> <button nz-button (click)="resetSF()">重置</button>
</div> </div>
@ -16,13 +16,11 @@
<nz-card class="content-box"> <nz-card class="content-box">
<div class="d-flex justify-content-end mb-sm"> <div class="mt-md mb-sm">
<div> <button nz-button nzType="primary" (click)="printOrder()">打印面单</button>
<button nz-button nzType="primary" (click)="printOrder()" >打印面单</button>
</div>
</div> </div>
<st #st [data]="url" [columns]="columns" <st #st [data]="url" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }" [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, process:beforeReq }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }" [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loading]="service.http.loading" [scroll]="{ y: '370px' }" (change)="stChange($event)"></st> [loading]="service.http.loading" [scroll]="{ y: '370px' }" (change)="stChange($event)"></st>

View File

@ -1,13 +1,13 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { STComponent, STColumn, STChange } from '@delon/abc/st'; import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema } from '@delon/form'; import { SFComponent, SFDateWidgetSchema, SFSchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal'; import { NzModalService } from 'ng-zorro-antd/modal';
import { TicketService } from '../../services/ticket.service'; import { TicketService } from '../../services/ticket.service';
@Component({ @Component({
selector: 'app-express-info', selector: 'app-express-info',
templateUrl: './express-info.component.html', templateUrl: './express-info.component.html',
styleUrls: ['./express-info.component.less'] styleUrls: ['../../../commom/less/box.less']
}) })
export class ExpressInfoComponent implements OnInit { export class ExpressInfoComponent implements OnInit {
@ViewChild('st', { static: true }) @ViewChild('st', { static: true })
@ -15,54 +15,55 @@ export class ExpressInfoComponent implements OnInit {
@ViewChild('sf', { static: false }) @ViewChild('sf', { static: false })
sf!: SFComponent; sf!: SFComponent;
url = `/rule?_allow_anonymous=true`; url = `/api/fcc/ficoExpressH/getListPage`;
searchSchema: SFSchema = { searchSchema: SFSchema = {
properties: { properties: {
receiveName: { expressCode: {
title: '配置类型', title: '快递单号',
type: 'string', type: 'string',
ui: { ui: {
widget: 'select', placeholder: '请输入'
placeholder: '请选择',
// asyncData: () => {
// return this.service.request(this.service.$api_getAppRoleList).pipe(
// map((res: any) => {
// this.roleList = res;
// return res.map((item: any) => {
// return { label: item.roleName, value: item.id };
// });
// }),
// );
// },
change: (i: any) => {
this.sf.value.receiveName = i;
this.sf?.setValue('/receiveName', i);
}
} }
},
createTime: {
title: '创建时间',
type: 'string',
ui: {
widget: 'sl-from-to-search',
format: 'yyyy-MM-dd'
} as SFDateWidgetSchema
} }
} }
}; };
columns: STColumn[] = [ columns: STColumn[] = [
{ title: '配置类型', index: 'no' }, { title: '', index: 'key', type: 'checkbox', width: 50 },
{ title: '配置项', index: 'description' }, { title: '快递单号', index: 'expressCode', width: 150 },
{ title: '快递公司', index: 'expresscompany', width: 120 },
{ title: '快递费用', index: 'description', width: 120 },
{ title: '发票数量', index: 'quantity', width: 120 },
{ title: '寄件人姓名', index: 'sname', width: 150 },
{ title: '寄件人电话', index: 'stel', width: 150 },
{ {
title: '启用状态', title: '寄件人地址',
className: 'text-center', index: 'saddress',
index: 'status', width: 150,
type: 'badge', format: item => `${item.sprovince}${item.scity}${item.scounty || ''}${item.saddress}`
badge: { },
0: { text: '启用', color: 'success' }, { title: '收件人姓名', index: 'rname', width: 150 },
2: { text: '停用', color: 'error' }, { title: '收件人电话', index: 'rtel', width: 150 },
3: { text: '停用', color: 'error' }, {
1: { text: '停用', color: 'error' } title: '收件人地址',
} index: 'raddress',
width: 150,
format: item => `${item.rprovince}${item.rcity}${item.rcounty || ''}${item.raddress}`
}, },
{ {
title: '创建时间', title: '下单时间',
index: 'updatedAt', index: 'createTime',
type: 'date' type: 'date',
width: 180
} }
]; ];
@ -74,6 +75,19 @@ export class ExpressInfoComponent implements OnInit {
ngOnInit(): void {} ngOnInit(): void {}
beforeReq = (requestOptions: STRequestOptions) => {
if (this.sf) {
Object.assign(requestOptions.body, {
...this.sf.value,
createtime: {
start: this.sf.value.createtime?.[0] || null,
end: this.sf.value.createtime?.[1] || null
}
});
}
return requestOptions;
};
stChange(e: STChange): void { stChange(e: STChange): void {
switch (e.type) { switch (e.type) {
case 'checkbox': case 'checkbox':
@ -86,11 +100,28 @@ export class ExpressInfoComponent implements OnInit {
} }
printOrder() { printOrder() {
if (this.selectedRows?.length <= 0) {
this.service.msgSrv.warning('请选择快递单');
return;
}
this.nzModalService.warning({ this.nzModalService.warning({
nzTitle: '确认打印面单所选快递单?', nzTitle: '确认打印面单所选快递单?',
nzClosable: false, nzClosable: false,
nzCancelText: '取消', nzCancelText: '取消',
nzOnOk: () => {} nzOnOk: () => {
this.service
.request(
this.service.$api_get_print_pdf,
this.selectedRows.map(item => item.expressCode)
)
.subscribe(res => {
if (res) {
this.service.reviewPDF(res.pdfUrl);
} else {
this.service.msgSrv.warning('下载失败');
}
});
}
}); });
} }
/** /**

View File

@ -64,7 +64,7 @@ export class PrintOrderModalComponent implements OnInit {
delete this.data.scontactInfo.id; delete this.data.scontactInfo.id;
this.service.request(this.service.$api_get_order_summary, params).subscribe(res => { this.service.request(this.service.$api_get_order_summary, params).subscribe(res => {
if (res?.length > 0) { if (res?.length > 0) {
this.reviewPDF(res); this.service.reviewPDF(res);
} else { } else {
this.service.msgSrv.warning('请到快递信息页面打印'); this.service.msgSrv.warning('请到快递信息页面打印');
this.modal.destroy(true); this.modal.destroy(true);
@ -78,7 +78,7 @@ export class PrintOrderModalComponent implements OnInit {
if (res?.pdfUrl) { if (res?.pdfUrl) {
this.service.msgSrv.success('操作成功'); this.service.msgSrv.success('操作成功');
this.modal.destroy(true); this.modal.destroy(true);
this.reviewPDF(res.pdfUrl); this.service.reviewPDF(res.pdfUrl);
} else { } else {
this.service.msgSrv.warning('下载失败'); this.service.msgSrv.warning('下载失败');
this.modal.destroy(true); this.modal.destroy(true);
@ -86,27 +86,7 @@ export class PrintOrderModalComponent implements OnInit {
}); });
} }
reviewPDF(url: string) {
if (!url) {
return;
}
const uA = window.navigator.userAgent; // 判断浏览器内核
const isIE =
/msie\s|trident\/|edge\//i.test(uA) &&
!!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window);
const objectUrl = url;
const a = document.createElement('a');
document.body.appendChild(a);
a.href = objectUrl;
a.download = '面单.pdf';
if (isIE) {
// 兼容IE11无法触发下载的问题
(navigator as any).msSaveBlob(url, a.download);
} else {
a.click();
}
a.remove();
}
close() { close() {
this.modal.destroy(); this.modal.destroy();

View File

@ -91,4 +91,26 @@ export class TicketService extends ShipperBaseService {
constructor(public injector: Injector, public eaCacheSrv: EACacheService) { constructor(public injector: Injector, public eaCacheSrv: EACacheService) {
super(injector, eaCacheSrv); super(injector, eaCacheSrv);
} }
reviewPDF(url: string) {
if (!url) {
return;
}
const uA = window.navigator.userAgent; // 判断浏览器内核
const isIE =
/msie\s|trident\/|edge\//i.test(uA) &&
!!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window);
const objectUrl = url;
const a = document.createElement('a');
document.body.appendChild(a);
a.href = objectUrl;
a.download = '面单.pdf';
if (isIE) {
// 兼容IE11无法触发下载的问题
(navigator as any).msSaveBlob(url, a.download);
} else {
a.click();
}
a.remove();
}
} }