货源修改
This commit is contained in:
@ -0,0 +1,14 @@
|
||||
<nz-spin *ngIf="!i" class="modal-spin"></nz-spin>
|
||||
<div style="width: 60%;margin: 0 auto;">
|
||||
<div class="">
|
||||
<h2>公司名称:{{i.companyName}}</h2>
|
||||
<qr [value]="i.id" #qr></qr>
|
||||
<div>卸货地:{{i.adddress}}</div>
|
||||
<div>装货地:{{i.adddress}}</div>
|
||||
<div>截止时间:{{i.createdAt}}</div>
|
||||
<div>Tips:二维码用于司机扫码抢单</div>
|
||||
</div>
|
||||
<div class="modal-footer text-center">
|
||||
<button nz-button type="submit" nzType="primary" (click)="downLoadQrcode('二维码')">下载二维码</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,24 @@
|
||||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { SupplyManagementQrcodePageComponent } from './qrcode-page.component';
|
||||
|
||||
describe('SupplyManagementQrcodePageComponent', () => {
|
||||
let component: SupplyManagementQrcodePageComponent;
|
||||
let fixture: ComponentFixture<SupplyManagementQrcodePageComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SupplyManagementQrcodePageComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SupplyManagementQrcodePageComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,85 @@
|
||||
import { THIS_EXPR } from '@angular/compiler/src/output/output_ast';
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { QRComponent } from '@delon/abc/qr';
|
||||
import { SFSchema, SFUISchema } from '@delon/form';
|
||||
import { _HttpClient } from '@delon/theme';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalRef } from 'ng-zorro-antd/modal';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-supply-management-qrcode-page',
|
||||
templateUrl: './qrcode-page.component.html',
|
||||
})
|
||||
export class SupplyManagementQrcodePageComponent implements OnInit {
|
||||
@ViewChild('qr') qr!: QRComponent;
|
||||
record: any = {};
|
||||
i: any;
|
||||
schema: SFSchema = {
|
||||
properties: {
|
||||
no: { type: 'string', title: '编号' },
|
||||
owner: { type: 'string', title: '姓名', maxLength: 15 },
|
||||
callNo: { type: 'number', title: '调用次数' },
|
||||
href: { type: 'string', title: '链接', format: 'uri' },
|
||||
description: { type: 'string', title: '描述', maxLength: 140 },
|
||||
},
|
||||
required: ['owner', 'callNo', 'href', 'description'],
|
||||
};
|
||||
ui: SFUISchema = {
|
||||
'*': {
|
||||
spanLabelFixed: 100,
|
||||
grid: { span: 12 },
|
||||
},
|
||||
$no: {
|
||||
widget: 'text'
|
||||
},
|
||||
$href: {
|
||||
widget: 'string',
|
||||
},
|
||||
$description: {
|
||||
widget: 'textarea',
|
||||
grid: { span: 24 },
|
||||
},
|
||||
};
|
||||
|
||||
constructor(
|
||||
private modal: NzModalRef,
|
||||
private msgSrv: NzMessageService,
|
||||
public http: _HttpClient,
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.record.id > 0)
|
||||
this.http.get(`/user/${this.record.id}`).subscribe(res => (this.i = res));
|
||||
}
|
||||
|
||||
downLoadQrcode(downloadName: any): void {
|
||||
let aLink = document.createElement('a');
|
||||
const content = this.qr.dataURL;
|
||||
let blob = this.base64ToBlob(content); //new Blob([content]);
|
||||
let evt = document.createEvent("HTMLEvents");
|
||||
evt.initEvent("click", true, true);//initEvent 不加后两个参数在IE下会报错 事件类型,是否冒泡,是否阻止浏览器的默认行为
|
||||
aLink.download = downloadName;
|
||||
aLink.href = URL.createObjectURL(blob);
|
||||
// aLink.dispatchEvent(evt);
|
||||
aLink.click()
|
||||
|
||||
}
|
||||
|
||||
//base64转blob
|
||||
base64ToBlob(code: any) {
|
||||
let parts = code.split(';base64,');
|
||||
let contentType = parts[0].split(':')[1];
|
||||
let raw = window.atob(parts[1]);
|
||||
let rawLength = raw.length;
|
||||
let uInt8Array = new Uint8Array(rawLength);
|
||||
for (let i = 0; i < rawLength; ++i) {
|
||||
uInt8Array[i] = raw.charCodeAt(i);
|
||||
}
|
||||
return new Blob([uInt8Array], { type: contentType });
|
||||
}
|
||||
|
||||
close(): void {
|
||||
this.modal.destroy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user