This commit is contained in:
Taric Xin
2022-04-24 17:47:48 +08:00
parent 77744a68b5
commit 594f7bee0e
15 changed files with 353 additions and 310 deletions

View File

@ -1,4 +1,4 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { STColumn, STComponent, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFDateWidgetSchema, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
import { ModalHelper, _HttpClient } from '@delon/theme';
@ -7,20 +7,20 @@ import { map } from 'rxjs/operators';
import { OrderManagementService } from '../../services/order-management.service';
import { UpdateFreightComponent } from '../../modal/bulk/update-freight/update-freight.component';
import { ConfirReceiptComponent } from '../../modal/bulk/confir-receipt/confir-receipt.component';
import { of } from 'rxjs';
import { of, Subscription } from 'rxjs';
import { ShipperBaseService } from '@shared';
import { Router, ActivatedRoute } from '@angular/router';
import { OneCarOrderCancelConfirmComponent } from '../../modal/vehicle/cancel-confirm/cancel-confirm.component';
import { SearchDrawerService } from 'src/app/shared/components/search-drawer/search-drawer.service';
import { BasicTableComponent } from 'src/app/routes/commom/components/basic-table/basic-table.component';
@Component({
selector: 'app-supply-management-bulk',
templateUrl: './bulk.component.html',
styleUrls: ['./bulk.component.less']
styleUrls: ['../../../commom/less/commom-table.less','./bulk.component.less']
})
export class OrderManagementBulkComponent implements OnInit {
ui: SFUISchema = {};
export class OrderManagementBulkComponent extends BasicTableComponent implements OnInit {
uiView: SFUISchema = {};
schema: SFSchema = {};
schemaView: SFSchema = {};
auditMany = false;
isVisibleView = false;
@ -54,13 +54,17 @@ export class OrderManagementBulkComponent implements OnInit {
GoingQuantity: 0,
totalCount: 0
};
constructor(
public service: OrderManagementService,
private modal: NzModalService,
public shipperservice: ShipperBaseService,
private router: Router,
private ar: ActivatedRoute,
) { }
public searchDrawerService: SearchDrawerService
) {
super(searchDrawerService);
}
/**
* 查询参数
@ -70,14 +74,14 @@ export class OrderManagementBulkComponent implements OnInit {
if (this.resourceStatus) {
a.billStatus = this.resourceStatus;
}
const params: any = Object.assign({}, this.sf?.value || {});
const params: any = Object.assign({}, this.sfValue || {});
delete params._$expand;
return {
...a,
...params,
createTime: {
start: this.sf?.value?.createTime?.[0] || '',
end: this.sf?.value?.createTime?.[1] || ''
start: this.sfValue?.createTime?.[0] || '',
end: this.sfValue?.createTime?.[1] || ''
}
};
}
@ -86,17 +90,17 @@ export class OrderManagementBulkComponent implements OnInit {
if (this.resourceStatus) {
a.billStatus = this.resourceStatus;
}
const params: any = Object.assign({}, this.sf?.value || {});
const params: any = Object.assign({}, this.sfValue || {});
delete params._$expand;
console.log(params);
if (this.sf) {
if (this.sfValue) {
Object.assign(requestOptions.body, {
...a,
...params,
createTime: {
start: this.sf?.value?.createTime?.[0] || '',
end: this.sf?.value?.createTime?.[1] || ''
start: this.sfValue?.createTime?.[0] || '',
end: this.sfValue?.createTime?.[1] || ''
}
});
}
@ -104,8 +108,8 @@ export class OrderManagementBulkComponent implements OnInit {
return requestOptions;
};
afterRes = (data: any[], rawData?: any) => {
console.log(data)
this.loading = false
console.log(data);
this.loading = false;
return data.map(item => ({
...item,
disabled: item.billStatus !== '4'
@ -119,6 +123,7 @@ export class OrderManagementBulkComponent implements OnInit {
id: this.changeId
};
}
search() {
this.st?.load();
this.getGoodsSourceStatistical();
@ -185,14 +190,14 @@ export class OrderManagementBulkComponent implements OnInit {
type: 'string',
title: '订单号',
ui: {
placeholder: '最多100个单号空号隔开',
placeholder: '最多100个单号空号隔开'
}
},
wayBillCode: {
type: 'string',
title: '运单号',
ui: {
placeholder: '最多100个单号空号隔开',
placeholder: '最多100个单号空号隔开'
}
},
resourceCode: {
@ -208,11 +213,8 @@ export class OrderManagementBulkComponent implements OnInit {
searchDebounceTime: 300,
searchLoadingText: '搜索中...',
allowClear: true,
visibleIf: {
_$expand: (value: boolean) => value
},
onSearch: (q: any) => {
let str = q.replace(/^\s+|\s+$/g, "");
let str = q.replace(/^\s+|\s+$/g, '');
if (str) {
return this.service
.request(this.service.$api_enterpriceList, { enterpriseName: str })
@ -233,55 +235,27 @@ export class OrderManagementBulkComponent implements OnInit {
ui: {
widget: 'select',
placeholder: '请先选择货主',
visibleIf: {
_$expand: (value: boolean) => value
},
} as SFSelectWidgetSchema
},
loadingPlace: {
type: 'string',
title: '装货地',
ui: {
visibleIf: {
_$expand: (value: boolean) => value
}
}
},
dischargePlace: {
type: 'string',
title: '卸货地',
ui: {
visibleIf: {
_$expand: (value: boolean) => value
}
}
},
driverName: {
title: '承运司机',
type: 'string',
ui: {
visibleIf: {
_$expand: (value: boolean) => value
}
}
},
carNo: {
title: '车牌号',
type: 'string',
ui: {
visibleIf: {
_$expand: (value: boolean) => value
}
}
},
carCaptainName: {
title: '车队长',
type: 'string',
ui: {
visibleIf: {
_$expand: (value: boolean) => value
}
}
},
paymentStatus: {
title: '支付状态',
@ -290,9 +264,6 @@ export class OrderManagementBulkComponent implements OnInit {
widget: 'dict-select',
params: { dictKey: 'overall:payment:status' },
containsAllLabel: true,
visibleIf: {
_$expand: (value: boolean) => value
}
} as SFSelectWidgetSchema
},
createTime: {
@ -303,9 +274,6 @@ export class OrderManagementBulkComponent implements OnInit {
mode: 'range',
format: 'yyyy-MM-dd',
allowClear: true,
visibleIf: {
_$expand: (value: boolean) => value
}
} as SFDateWidgetSchema
},
riskStatus: {
@ -319,9 +287,6 @@ export class OrderManagementBulkComponent implements OnInit {
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
_$expand: (value: boolean) => value
}
}
},
enterpriseInfoName: {
@ -331,9 +296,6 @@ export class OrderManagementBulkComponent implements OnInit {
widget: 'select',
placeholder: '请选择',
allowClear: true,
visibleIf: {
_$expand: (value: boolean) => value
},
asyncData: () => this.shipperservice.getNetworkEnterpriseName()
}
},
@ -345,9 +307,6 @@ export class OrderManagementBulkComponent implements OnInit {
widget: 'dict-select',
params: { dictKey: 'service:type' },
containsAllLabel: true,
visibleIf: {
_$expand: (value: boolean) => value
}
} as SFSelectWidgetSchema
},
settlementBasis: {
@ -358,15 +317,11 @@ export class OrderManagementBulkComponent implements OnInit {
containsAllLabel: true,
params: { dictKey: 'goodresource:settlement:type' },
containAllLable: true,
visibleIf: {
_$expand: (value: boolean) => value
}
} as SFSelectWidgetSchema
}
},
type: 'object'
};
this.ui = { '*': { spanLabelFixed: 110, grid: { span: 8, gutter: 4 } } };
}
/**
* 初始化查询表单
@ -493,7 +448,7 @@ export class OrderManagementBulkComponent implements OnInit {
title: '结算数量',
render: 'settlementWeight',
width: '170px',
className: 'text-left',
className: 'text-left'
// format: (item: any) =>
// `${item.settlementWeight || '0'}吨/
// ${item.settlementVolume || '0'}方`
@ -509,7 +464,7 @@ export class OrderManagementBulkComponent implements OnInit {
title: '车队长',
className: 'text-left',
width: '180px',
render: 'payeeName',
render: 'payeeName'
},
{
title: '装卸货时间',
@ -533,27 +488,31 @@ export class OrderManagementBulkComponent implements OnInit {
title: '操作',
fixed: 'right',
width: '130px',
className: 'text-left block-td',
className: 'text-center block-td',
buttons: [
{
text: '运费变更记录',
click: _record => this.OpenPrice(_record),
iif: item =>
item.billStatus == '4' || item.billStatus == '5' || item.billStatus == '2' || item.billStatus == '3' || item.billStatus == '6',
acl: { ability: ['ORDER-BULK-listChangeApply'] },
item.billStatus == '4' ||
item.billStatus == '5' ||
item.billStatus == '2' ||
item.billStatus == '3' ||
item.billStatus == '6',
acl: { ability: ['ORDER-BULK-listChangeApply'] }
},
{
text: '查看评价',
click: _record => this.viewEvaluate(_record),
iif: item => item.billStatus == '5',
acl: { ability: ['ORDER-BULK-evaluation'] },
acl: { ability: ['ORDER-BULK-evaluation'] }
},
{
text: '查看详情',
click: (item: any) => {
this.router.navigate(['./bulk-detail', item.id], { relativeTo: this.ar });
},
acl: { ability: ['USERCENTER-FREIGHT-USER-view'] },
acl: { ability: ['USERCENTER-FREIGHT-USER-view'] }
},
{
text: '变更运费',
@ -562,32 +521,36 @@ export class OrderManagementBulkComponent implements OnInit {
const flag = _record.mybidDetailInfo.find((item: any) => item?.expenseCode === 'TRA' && item?.paymentStatus === '4');
return _record.billStatus !== '1' && _record.billStatus !== '6' && !flag;
},
acl: { ability: ['ORDER-BULK-FreightChangeBulkDetail'] },
acl: { ability: ['ORDER-BULK-FreightChangeBulkDetail'] }
},
{
text: '确认签收',
click: _record => this.confirmReceipt(_record),
iif: item => item.billStatus == '4',
acl: { ability: ['VEHICLE-LIST-view'] },
acl: { ability: ['VEHICLE-LIST-view'] }
},
{
text: '取消订单',
click: _record => this.cancellation(_record),
iif: item =>
item.billStatus == '4' || item.billStatus == '5' || item.billStatus == '2' || item.billStatus == '3' || item.billStatus == '1',
acl: { ability: ['ORDER-BULK-signBulkOrder'] },
item.billStatus == '4' ||
item.billStatus == '5' ||
item.billStatus == '2' ||
item.billStatus == '3' ||
item.billStatus == '1',
acl: { ability: ['ORDER-BULK-signBulkOrder'] }
},
{
text: '申请退款',
click: (_record) => this.applyRefund(_record),
click: _record => this.applyRefund(_record),
iif: item => item.isApplyForRefund,
acl: { ability: ['ORDER-VEHICLE-modificationOrder'] },
acl: { ability: ['ORDER-VEHICLE-modificationOrder'] }
},
{
text: '修改订单',
click: _record => this.changeOrder(_record),
iif: item => item.billStatus == '4' || item.billStatus == '5' || item.billStatus == '2' || item.billStatus == '3',
acl: { ability: ['ORDER-BULK-BulkBillDetail'] },
acl: { ability: ['ORDER-BULK-BulkBillDetail'] }
}
]
}
@ -663,27 +626,13 @@ export class OrderManagementBulkComponent implements OnInit {
id: this.changeViewId
};
}
/**
* 伸缩查询条件
*/
expandToggle(): void {
this._$expand = !this._$expand;
this.sf?.setValue('/_$expand', this._$expand);
}
tabChange(item: any) { }
/**
* 重置表单
*/
resetSF(): void {
this.sf.reset();
this._$expand = false;
}
tabChange(item: any) {}
/**
* 导入货源
*/
importGoodsSource() { }
audit(item: any) { }
importGoodsSource() {}
audit(item: any) {}
/*
* 审核关闭弹窗
@ -704,7 +653,7 @@ export class OrderManagementBulkComponent implements OnInit {
/**
* 审核通过按钮
*/
handleOK() { }
handleOK() {}
OpenPrice(item: any) {
this.changeId = item.id;
this.isVisible = true;
@ -838,8 +787,8 @@ export class OrderManagementBulkComponent implements OnInit {
this.router.navigate(['order-management/bulk-detailChange', value.id]);
}
/**
*申请退款
*/
*申请退款
*/
applyRefund(item: any) {
const modalRef = this.modal.create({
nzTitle: '申请退款',
@ -852,7 +801,6 @@ export class OrderManagementBulkComponent implements OnInit {
});
modalRef.afterClose.subscribe((res: boolean) => {
if (res) {
this.resetSF;
this.st.load();
}
});