fix bug
This commit is contained in:
@ -689,7 +689,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
|
||||
}
|
||||
};
|
||||
}
|
||||
// 获取城市列表
|
||||
getRegionCode(regionCode: any) {
|
||||
console.log(regionCode);
|
||||
return this.service
|
||||
|
||||
@ -8,9 +8,9 @@ import { map } from 'rxjs/operators';
|
||||
import { SupplyManagementService } from '../../services/supply-management.service';
|
||||
import { SupplyManagementVehicleAssignedCarComponent } from '../assigned-car/assigned-car.component';
|
||||
import { SupplyManagementUpdateExternalSnComponent } from '../update-external-sn/update-external-sn.component';
|
||||
import { SupplyManagementUpdateFreightComponent } from '../update-freight/update-freight.component';
|
||||
import { of } from 'rxjs';
|
||||
import { ShipperBaseService } from '@shared';
|
||||
import { SupplyManagementImportSupplyComponent } from '../../model/import-supply/import-supply.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-supply-management-vehicle',
|
||||
@ -148,49 +148,23 @@ export class SupplyManagementVehicleComponent implements OnInit {
|
||||
}, 500);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑外部货源号
|
||||
* @param item st当前行对象
|
||||
*/
|
||||
editEnternalSn(item: any) {
|
||||
const modalRef = this.modal.create({
|
||||
nzWidth: '400px',
|
||||
nzContent: SupplyManagementUpdateExternalSnComponent,
|
||||
nzComponentParams: {
|
||||
orderObject: item
|
||||
},
|
||||
nzFooter: null,
|
||||
nzClosable: false
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入货源
|
||||
*/
|
||||
importGoodsSource() {
|
||||
const modalRef = this.modal.create({
|
||||
nzTitle: '修改运费',
|
||||
nzWidth: '40%',
|
||||
nzContent: SupplyManagementUpdateFreightComponent,
|
||||
nzTitle: '货源导入',
|
||||
nzWidth: 600,
|
||||
nzContent: SupplyManagementImportSupplyComponent,
|
||||
nzComponentParams: {
|
||||
// i: item
|
||||
},
|
||||
nzFooter: null
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改运费
|
||||
*/
|
||||
updateFreight(item: any) {
|
||||
const modalRef = this.modal.create({
|
||||
nzTitle: '修改运费',
|
||||
nzWidth: '40%',
|
||||
nzContent: SupplyManagementUpdateFreightComponent,
|
||||
nzComponentParams: {
|
||||
i: item
|
||||
},
|
||||
nzFooter: null
|
||||
modalRef.afterClose.subscribe(result => {
|
||||
if (result) {
|
||||
this.st.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
<!--
|
||||
* @Description :
|
||||
* @Version : 1.0
|
||||
* @Author : Shiming
|
||||
* @Date : 2021-12-03 11:10:14
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-03-01 16:16:29
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\model\\import-supply\\import-supply.component.html
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
-->
|
||||
<div>
|
||||
<sf #sf mode="edit" [schema]="schema" [ui]="ui" button="none">
|
||||
<ng-template sf-template="resourceCode2" let-me let-ui="ui" let-schema="schema">
|
||||
<input readonly nz-input placeholder="请选择上传文件" [(ngModel)]="files2" />
|
||||
<nz-upload
|
||||
[nzAction]="service.$api_upload_url"
|
||||
[nzName]="'multipartFile'"
|
||||
[nzHeaders]="{ authorization: 'authorization-text' }"
|
||||
[(nzFileList)]="files"
|
||||
(nzChange)="handleChange($event)"
|
||||
[nzShowUploadList]="false"
|
||||
[nzBeforeUpload]="beforeUpload"
|
||||
>
|
||||
<div>
|
||||
<button nz-button style="color: #ff4d4f; margin-top: 5px">
|
||||
<i nz-icon nzType="upload"></i>
|
||||
上传文件
|
||||
</button>
|
||||
</div>
|
||||
</nz-upload>
|
||||
<span style="color: #ff4d4f; font-size: 12px;margin-left: 10px;" (click)="downFile()">下载导入模板</span>
|
||||
<div style="color: #ff4d4f; font-size: 12px; margin-top: 5px; width: 400px">仅支持XLX / XLSX文件格式,最多不能超过100行数据</div>
|
||||
</ng-template>
|
||||
</sf>
|
||||
<sv-container col="1" >
|
||||
<sv style="height: 20px;">注意:</sv>
|
||||
<sv style="height: 20px;">1、第一次上传请点击下载模板</sv>
|
||||
<sv style="height: 20px;">2、请不要调整模板顺序</sv>
|
||||
<sv style="height: 20px;">3、必填字段请务必填写</sv>
|
||||
<sv style="height: 20px;">4、如果不清楚字段值,请参考货源发布功能</sv>
|
||||
<sv style="height: 20px;">5、发布成功后,可在货源列表-待接单查看</sv>
|
||||
</sv-container>
|
||||
</div>
|
||||
<div class="modal-footer text-right">
|
||||
<button nz-button type="button" (click)="close()">取消</button>
|
||||
<button nz-button type="submit" nzType="primary" (click)="save()">确定</button>
|
||||
</div>
|
||||
@ -0,0 +1,24 @@
|
||||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { SupplyManagementImportSupplyComponent } from './import-supply.component';
|
||||
|
||||
describe('SupplyManagementImportSupplyComponent', () => {
|
||||
let component: SupplyManagementImportSupplyComponent;
|
||||
let fixture: ComponentFixture<SupplyManagementImportSupplyComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SupplyManagementImportSupplyComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SupplyManagementImportSupplyComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,192 @@
|
||||
/*
|
||||
* @Description :
|
||||
* @Version : 1.0
|
||||
* @Author : Shiming
|
||||
* @Date : 2022-03-01 15:13:03
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-03-01 16:15:26
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\model\\import-supply\\import-supply.component.ts
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
*/
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { STColumn } from '@delon/abc/st';
|
||||
import { SFComponent, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
|
||||
import { _HttpClient } from '@delon/theme';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalRef } from 'ng-zorro-antd/modal';
|
||||
import { NzUploadChangeParam, NzUploadFile } from 'ng-zorro-antd/upload';
|
||||
import { Observable, Observer, of } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { SupplyManagementService } from '../../services/supply-management.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-supply-management-import-supply',
|
||||
templateUrl: './import-supply.component.html',
|
||||
})
|
||||
export class SupplyManagementImportSupplyComponent implements OnInit {
|
||||
record: any = {};
|
||||
files: any;
|
||||
files2: any;
|
||||
schema: SFSchema = {};
|
||||
ui: SFUISchema = {};
|
||||
@ViewChild('sf', { static: false }) sf!: SFComponent;
|
||||
constructor(
|
||||
private modal: NzModalRef,
|
||||
private msgSrv: NzMessageService,
|
||||
public service: SupplyManagementService
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.initSF();
|
||||
console.log(this.record)
|
||||
}
|
||||
|
||||
initSF() {
|
||||
this.schema = {
|
||||
properties: {
|
||||
shipperAppUserId: {
|
||||
title: '货主',
|
||||
type: 'string',
|
||||
maxLength: 30,
|
||||
ui: {
|
||||
widget: 'select',
|
||||
// serverSearch: true,
|
||||
searchDebounceTime: 300,
|
||||
searchLoadingText: '搜索中...',
|
||||
onSearch: (q: any) => {
|
||||
console.log(q === ' ')
|
||||
let str =q.replace(/^\s+|\s+$/g,"");
|
||||
if (str) {
|
||||
return this.service
|
||||
.request(this.service.$api_enterpriceList, { enterpriseName: str })
|
||||
.pipe(map(res => (res as any[]).map(i => ({ label: i.enterpriseName, value: i.id } as SFSchemaEnum))))
|
||||
.toPromise();
|
||||
} else {
|
||||
return of([]);
|
||||
}
|
||||
},
|
||||
change: (q: any) => {
|
||||
let str =q.replace(/^\s+|\s+$/g,"");
|
||||
if (str) {
|
||||
this.getRegionCode(str);
|
||||
}
|
||||
}
|
||||
} as SFSelectWidgetSchema
|
||||
},
|
||||
resourceCode: {
|
||||
type: 'string',
|
||||
title: '网络货运人',
|
||||
ui: {
|
||||
widget: 'text'
|
||||
},
|
||||
default: '确认货主后带出'
|
||||
},
|
||||
enterpriseProjectId: {
|
||||
type: 'string',
|
||||
title: '项目',
|
||||
ui: {
|
||||
widget: 'select',
|
||||
placeholder: '请选择'
|
||||
} as SFSelectWidgetSchema
|
||||
},
|
||||
resourceCode2: {
|
||||
type: 'string',
|
||||
title: '导入货源信息',
|
||||
ui: {
|
||||
widget: 'custom'
|
||||
}
|
||||
},
|
||||
},
|
||||
required: ['shipperAppUserId', 'enterpriseProjectId','resourceCode2',],
|
||||
};
|
||||
this.ui = {
|
||||
'*': {
|
||||
grid: { span: 20 },
|
||||
},
|
||||
'$resourceCode2': {
|
||||
spanLabelFixed: 130,
|
||||
grid: { span: 20 },
|
||||
},
|
||||
'$resourceCode': {
|
||||
spanLabelFixed: 130,
|
||||
grid: { span: 20 },
|
||||
},
|
||||
};
|
||||
}
|
||||
getRegionCode(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 => {
|
||||
// if (res) {
|
||||
// this.msgSrv.success('保存成功');
|
||||
// this.modal.close(true);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
close(): void {
|
||||
this.modal.destroy();
|
||||
}
|
||||
handleChange(info: NzUploadChangeParam): void {
|
||||
switch (info.file.status) {
|
||||
case 'uploading':
|
||||
break;
|
||||
case 'done':
|
||||
let fileList = [...info.fileList];
|
||||
// 2. Read from response and show file link
|
||||
fileList = fileList.map((file: any) => {
|
||||
if (file.response) {
|
||||
file.url = file.response.data.fullFilePath;
|
||||
}
|
||||
return file;
|
||||
});
|
||||
this.files2 = fileList[0].name
|
||||
break;
|
||||
case 'error':
|
||||
this.service.msgSrv.error('网络错误');
|
||||
break;
|
||||
}
|
||||
}
|
||||
beforeUpload = (file: NzUploadFile, _fileList: NzUploadFile[]) => {
|
||||
return new Observable((observer: Observer<boolean>) => {
|
||||
const isJpgOrPng = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
|
||||
if (!isJpgOrPng) {
|
||||
this.service.msgSrv.error('仅支持XLX / XLSX文件格式');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
// tslint:disable-next-line: no-non-null-assertion
|
||||
const isLt2M = file.size! / 1024 / 1024 < 3;
|
||||
if (!isLt2M) {
|
||||
this.service.msgSrv.warning('图片大小超过3兆!');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
observer.next(isJpgOrPng && isLt2M);
|
||||
observer.complete();
|
||||
});
|
||||
};
|
||||
downFile() {
|
||||
this.service.request(this.service.$api_exportGoodsResourceOperateTemplate).subscribe((res: any)=> {
|
||||
console.log(res)
|
||||
|
||||
})
|
||||
// window.location.href('')
|
||||
}
|
||||
}
|
||||
@ -157,4 +157,6 @@ export class SupplyManagementService extends BaseService {
|
||||
public $api_findItemValueByItemKeys = '/api/mdc/pbc/sysConfigItem/findItemValueByItemKeys';
|
||||
// 获取保价费信息
|
||||
public $api_getWholeInsuranceInfo = '/api/sdc/goodsResourceShipper/getWholeInsuranceInfo';
|
||||
// 下载导入货源模板-运营后台
|
||||
public $api_exportGoodsResourceOperateTemplate = '/api/sdc/uploadGoodsResource/exportGoodsResourceOperateTemplate';
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* @Author : Shiming
|
||||
* @Date : 2021-12-20 10:13:02
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-01-18 17:26:40
|
||||
* @LastEditTime : 2022-03-01 15:38:17
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\supply-management.module.ts
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
*/
|
||||
@ -35,6 +35,7 @@ import { SupplyManagementUpdateFreightComponent } from './components/update-frei
|
||||
import { SupplyManagementUpdatePriceComponent } from './components/update-price/update-price.component';
|
||||
import { SupplyManagementVehicleDetailComponent } from './components/vehicle-detail/vehicle-detail.component';
|
||||
import { SupplyManagementVehicleComponent } from './components/vehicle/vehicle.component';
|
||||
import { SupplyManagementImportSupplyComponent } from './model/import-supply/import-supply.component';
|
||||
import { SupplyManagementRoutingModule } from './supply-management-routing.module';
|
||||
|
||||
const COMPONENTS: Type<void>[] = [
|
||||
@ -61,7 +62,8 @@ const COMPONENTS: Type<void>[] = [
|
||||
SupplyManagementReleasePublishComponent,
|
||||
SupplyManagementBulkReleasePublishComponent,
|
||||
TranAgreementComponent,
|
||||
SupplyManagementBulkAssignedCarComponent
|
||||
SupplyManagementBulkAssignedCarComponent,
|
||||
SupplyManagementImportSupplyComponent
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* @Author : Shiming
|
||||
* @Date : 2022-01-25 16:03:45
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-02-22 13:26:13
|
||||
* @LastEditTime : 2022-03-01 15:31:23
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\dynamic-setting\\dynamic-setting-h5\\dynamic-setting-h5.component.html
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
-->
|
||||
|
||||
Reference in New Issue
Block a user