This commit is contained in:
wangshiming
2022-03-02 10:30:11 +08:00
parent 8344c23453
commit b060c0e53c
4 changed files with 28 additions and 39 deletions

View File

@ -78,9 +78,9 @@ export class SupplyManagementImportSupplyComponent implements OnInit {
type: 'string',
title: '网络货运人',
ui: {
widget: 'text'
},
default: '确认货主后带出'
widget: 'select',
placeholder: '请选择'
} as SFSelectWidgetSchema
},
enterpriseProjectId: {
type: 'string',
@ -131,6 +131,23 @@ export class SupplyManagementImportSupplyComponent implements OnInit {
this.sf.getProperty('/enterpriseProjectId')!.widget.reset(res);
});
}
getRegionCode2(regionCode: any) {
console.log(regionCode);
return this.service
.request(this.service.$api_get_enterprise_project, { id: regionCode })
.pipe(
map(res =>
res.map((item: any) => ({
label: item.projectName,
value: item.id
}))
)
)
.subscribe(res => {
this.sf.getProperty('/enterpriseProjectId')!.schema.enum = res;
this.sf.getProperty('/enterpriseProjectId')!.widget.reset(res);
});
}
save(): void {
console.log(this.files)
// this.service.request(this.service.$api_update_price, { id, freightType, freightPrice, resourceCode, rule, resourceId }).subscribe(res => {
@ -184,36 +201,6 @@ export class SupplyManagementImportSupplyComponent implements OnInit {
});
};
downFile() {
console.log('78')
// this.service.request(this.service.$api_exportGoodsResourceOperateTemplate).subscribe((res: any)=> {
// console.log('66')
// console.log(res)
// let aLink = document.createElement('a');
// const content = res;
// let blob = this.base64ToBlob(content); //new Blob([content]);
// let evt = document.createEvent("HTMLEvents");
// evt.initEvent("click", true, true);//initEvent 不加后两个参数在IE下会报错 事件类型,是否冒泡,是否阻止浏览器的默认行为
// aLink.download = '模板';
// aLink.href = URL.createObjectURL(blob);
// // aLink.dispatchEvent(evt);
// aLink.click();
// this.status = false
// })
this.service.downloadFile(this.service.$api_exportGoodsResourceOperateTemplate);
// window.location.href('')
}
//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 });
}
}