This commit is contained in:
Taric Xin
2022-01-24 19:58:38 +08:00
9 changed files with 145 additions and 216 deletions

View File

@ -9,11 +9,10 @@ import { map } from 'rxjs/operators';
import { VehicleService } from '../../../vehicle/services/vehicle.service';
@Component({
selector: 'app-Vehicle-components-list',
templateUrl: './list.component.html',
templateUrl: './list.component.html'
})
export class VehicleComponentsListComponent implements OnInit {
_$expand = false;
url = `/rule?_allow_anonymous=true`;
ui!: SFUISchema;
schema!: SFSchema;
@ -22,19 +21,13 @@ export class VehicleComponentsListComponent implements OnInit {
@ViewChild('sf', { static: false }) sf!: SFComponent;
constructor(public service: VehicleService, private modal: NzModalService, private router: Router, private ar: ActivatedRoute) {}
/**
* 查询字段个数navigate
*/
get queryFieldCount(): number {
return Object.keys(this.schema?.properties || {}).length;
}
/**
* 查询参数
*/
get reqParams() {
const params: any = {
...(this.sf && this.sf.value),
...(this.sf && this.sf.value)
};
if (this.sf?.value.effectiveDate) {
params.effectiveDateStart = this.sf?.value.effectiveDate[0];
@ -45,14 +38,10 @@ export class VehicleComponentsListComponent implements OnInit {
return params;
}
get selectedRows() {
return this.st?.list.filter((item) => item.checked) || [];
}
ngOnInit() {
this.initSF();
this.initST();
this.ar.url.subscribe((params) => {
this.ar.url.subscribe(params => {
this.st?.load(1);
});
}
@ -68,8 +57,8 @@ export class VehicleComponentsListComponent implements OnInit {
expand: {
type: 'boolean',
ui: {
hidden: true,
},
hidden: true
}
},
carNo: {
title: '车牌号',
@ -91,9 +80,6 @@ export class VehicleComponentsListComponent implements OnInit {
} else {
return of([]);
}
},
visibleIf: {
_$expand: (value: boolean) => value
}
} as SFSelectWidgetSchema
},
@ -103,20 +89,20 @@ export class VehicleComponentsListComponent implements OnInit {
ui: {
widget: 'dict-select',
containsAllLable: true,
params: { dictKey: 'car:color' },
},
params: { dictKey: 'car:color' }
}
},
carStatus: {
title: '运营状态',
type: 'string',
enum: [
{ label: '空闲', value: 0 },
{ label: '运输中', value: 1 },
{ label: '运输中', value: 1 }
],
ui: {
allowClear: true,
widget: 'select',
},
widget: 'select'
}
},
carModel: {
title: '车型',
@ -126,36 +112,36 @@ export class VehicleComponentsListComponent implements OnInit {
params: { dictKey: 'car:model' },
containsAllLable: true,
visibleIf: {
expand: (value: boolean) => value,
},
},
expand: (value: boolean) => value
}
}
},
carLength: {
title: '车长',
type: 'string',
ui: {
ui: {
widget: 'dict-select',
params: { dictKey: 'car:length' },
containsAllLable: true,
visibleIf: {
expand: (value: boolean) => value,
},
},
expand: (value: boolean) => value
}
}
},
isSelf: {
type: 'string',
title: '是否挂靠',
enum: [
{ label: '是', value: 1 },
{ label: '否', value: 0 },
{ label: '否', value: 0 }
],
ui: {
widget: 'select',
allowClear: true,
visibleIf: {
expand: (value: boolean) => value,
},
},
expand: (value: boolean) => value
}
}
},
driverLicenseStatus: {
type: 'string',
@ -163,16 +149,16 @@ export class VehicleComponentsListComponent implements OnInit {
enum: [
{ label: '正常', value: 1 },
{ label: '即将到期', value: 2 },
{ label: '已到期', value: 3},
{ label: '已到期', value: 3 }
],
default: '',
ui: {
widget: 'select',
allowClear: true,
visibleIf: {
expand: (value: boolean) => value,
},
},
expand: (value: boolean) => value
}
}
},
roadTransportStatus: {
type: 'string',
@ -180,16 +166,16 @@ export class VehicleComponentsListComponent implements OnInit {
enum: [
{ label: '正常', value: 1 },
{ label: '即将到期', value: 2 },
{ label: '已到期', value: 3},
{ label: '已到期', value: 3 }
],
ui: {
widget: 'select',
allowClear: true,
visibleIf: {
expand: (value: boolean) => value,
},
},
},
expand: (value: boolean) => value
}
}
}
// putOnRecord: {
// type: 'string',
// title: '是否已备案',
@ -204,7 +190,7 @@ export class VehicleComponentsListComponent implements OnInit {
// },
// },
// },
},
}
};
this.ui = { '*': { spanLabelFixed: 130, grid: { span: 8, gutter: 4 }, enter: () => this.st.load() } };
}
@ -212,43 +198,47 @@ export class VehicleComponentsListComponent implements OnInit {
initST() {
this.columns = [
// { title: '', type: 'checkbox', className: 'text-center' },
{ title: '车牌号', width:'150px', className: 'text-center', index: 'carNo' },
{ title: '车牌颜色', width:'150px', className: 'text-center', index: 'carNoColorLabel' },
{ title: '车型-车长-载重',width:'150px', className: 'text-center', render: 'carLength' },
{ title: '运营状态',width:'150px', className: 'text-center', index: 'carStatus',
type: 'badge',
badge: {
true: { text: '运输中', color: 'success' },
false: { text: '空闲', color: 'default' },
{ title: '车牌号', width: '150px', className: 'text-center', index: 'carNo' },
{ title: '车牌颜色', width: '150px', className: 'text-center', index: 'carNoColorLabel' },
{ title: '车型-车长-载重', width: '150px', className: 'text-center', render: 'carLength' },
{
title: '运营状态',
width: '150px',
className: 'text-center',
index: 'carStatus',
type: 'badge',
badge: {
true: { text: '运输中', color: 'success' },
false: { text: '空闲', color: 'default' }
}
},
},
{
title: '行驶证到期状态',
width:'180px',
width: '180px',
className: 'text-center',
index: 'driverLicenseStatus',
type: 'badge',
badge: {
1: { text: '正常', color: 'success' },
2: { text: '即将到期', color: 'warning' },
3: { text: '已到期', color: 'error' },
},
3: { text: '已到期', color: 'error' }
}
},
{
title: '道运证到期状态',
width:'180px',
width: '180px',
className: 'text-center',
index: 'roadTransportStatus',
type: 'badge',
badge: {
1: { text: '正常', color: 'success' },
2: { text: '即将到期', color: 'warning' },
3: { text: '已到期', color: 'error' },
},
3: { text: '已到期', color: 'error' }
}
},
{ title: '所有人',width:'150px', className: 'text-center', index: 'carOwner' },
{ title: '是否挂靠', width:'150px', className: 'text-center', render: 'isSelf', },
{ title: '挂靠协议', width:'150px', className: 'text-center', render: 'approvalAuditStatus' },
{ title: '所有人', width: '150px', className: 'text-center', index: 'carOwner' },
{ title: '是否挂靠', width: '150px', className: 'text-center', render: 'isSelf' },
{ title: '挂靠协议', width: '150px', className: 'text-center', render: 'approvalAuditStatus' },
// { title: '是否已备案', className: 'text-center', render: 'putOnRecord', },
{
@ -259,20 +249,20 @@ export class VehicleComponentsListComponent implements OnInit {
buttons: [
{
text: '查看',
click: (item) => {
this.router.navigate(['./detail', item.id], { relativeTo: this.ar,queryParams: { carId: item.carId } });
acl: 'SUPPLY-INDEX-bulkSearch',
click: item => {
this.router.navigate(['./detail', item.id], { relativeTo: this.ar, queryParams: { carId: item.carId } });
// this.router.navigate(['./view', item.id], { relativeTo: this.ar, queryParams: { tenantId: item.tenantId } });
},
},
}
}
// {
// text: '申请备案',
// click: (item) => {
// },
// },
],
},
]
}
];
}
expandToggle() {
@ -280,7 +270,7 @@ export class VehicleComponentsListComponent implements OnInit {
this.sf?.setValue('/expand', this._$expand);
}
creat() {
this.router.navigate(['./new',], { relativeTo: this.ar });
this.router.navigate(['./new'], { relativeTo: this.ar });
}
/**
* 重置表单
@ -291,6 +281,6 @@ export class VehicleComponentsListComponent implements OnInit {
}
// 导出
exportFire() {
this.service.downloadFile(this.service.$api_carLicense_export, this.reqParams );
this.service.downloadFile(this.service.$api_carLicense_export, this.reqParams);
}
}