edit
This commit is contained in:
		| @ -1,176 +1,54 @@ | ||||
| import { Component, OnInit, ViewChild } from '@angular/core'; | ||||
| import { ActivatedRoute, Router } from '@angular/router'; | ||||
| import { STColumn, STColumnBadge, STComponent, STData } from '@delon/abc/st'; | ||||
| import { SFComponent, SFSchema, SFUISchema } from '@delon/form'; | ||||
| import { SFComponent, SFDateWidgetSchema, SFSchema, SFUISchema } from '@delon/form'; | ||||
| import { NzModalService } from 'ng-zorro-antd/modal'; | ||||
| import { UsermanageService } from '../../services/usercenter.service'; | ||||
| @Component({ | ||||
|   selector: 'app-usercenter-components-driver', | ||||
|   templateUrl: './driver.component.html', | ||||
|   styleUrls: ['./driver.component.less'], | ||||
|   templateUrl: './driver.component.html' | ||||
| }) | ||||
| export class UserCenterComponentsDriverComponent implements OnInit { | ||||
|   _$expand = false; | ||||
|   url = `/rule?_allow_anonymous=true`; | ||||
|  | ||||
|   ui!: SFUISchema; | ||||
|   schema!: SFSchema; | ||||
|   ui: SFUISchema = { '*': { spanLabelFixed: 120, grid: { lg: 8, md: 12, sm: 12, xs: 24 }, enter: () => this.st.load() } }; | ||||
|   schema: SFSchema = this.initSF(); | ||||
|   columns!: STColumn[]; | ||||
|   datalist = [ | ||||
|     { | ||||
|       storeName: '企业名称', | ||||
|       contactsName: '152746565', | ||||
|       enterpriseName: '湖南', | ||||
|       unifiedSocialCreditCode: '45454', | ||||
|       contactsPhone: '*97889461561', | ||||
|       effectiveDateStr: '废弃eww', | ||||
|       enStatusStr2: '正常', | ||||
|       enStatusStr3: '正常', | ||||
|       unifiedSocialCreditCode3: '常用服务', | ||||
|       unifiedSocialCreditCode2: '正常', | ||||
|       tenantId: 1 | ||||
|     }, | ||||
|     { | ||||
|       storeName: '企业名称', | ||||
|       contactsName: '152746565', | ||||
|       enterpriseName: '湖南', | ||||
|       unifiedSocialCreditCode: '45454', | ||||
|       contactsPhone: '*97889461561', | ||||
|       effectiveDateStr: '废弃eww', | ||||
|       enStatusStr2: '正常', | ||||
|       enStatusStr3: '正常', | ||||
|       unifiedSocialCreditCode3: '常用服务', | ||||
|       unifiedSocialCreditCode2: '正常', | ||||
|       tenantId: 2 | ||||
|     }, | ||||
|   ] | ||||
|   @ViewChild('st', { static: false }) st!: STComponent; | ||||
|   @ViewChild('sf', { static: false }) sf!: SFComponent; | ||||
|  | ||||
|   constructor(public service: UsermanageService, 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]; | ||||
|       params.effectiveDateEnd = this.sf?.value.effectiveDate[1]; | ||||
|       Object.assign(params, { | ||||
|         time: { | ||||
|           start: this.sf?.value.effectiveDate[0], | ||||
|           end: this.sf?.value.effectiveDate[1] | ||||
|         } | ||||
|       }); | ||||
|       // params.effectiveDateStart = this.sf?.value.effectiveDate[0]; | ||||
|       // params.effectiveDateEnd = this.sf?.value.effectiveDate[1]; | ||||
|     } | ||||
|     delete params.effectiveDate; | ||||
|     delete params.expand; | ||||
|     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); | ||||
|     }); | ||||
|   } | ||||
|   dataProcess(data: STData[]): STData[] { | ||||
|     return data.map((i, index) => { | ||||
|       i.showSortFlag = false; | ||||
|       return i; | ||||
|     }); | ||||
|   } | ||||
|   initSF() { | ||||
|     this.schema = { | ||||
|       properties: { | ||||
|         expand: { | ||||
|           type: 'boolean', | ||||
|           ui: { | ||||
|             hidden: true, | ||||
|           }, | ||||
|         }, | ||||
|         storeName: { title: '司机姓名', type: 'string', ui: { showRequired: false } }, | ||||
|         phone: { | ||||
|           title: '手机号', | ||||
|           type: 'string', | ||||
|           format: 'mobile', | ||||
|           maxLength: 11, | ||||
|           ui: { | ||||
|             placeholder: '请输入手机号', | ||||
|           }, | ||||
|         }, | ||||
|         enStatus: { | ||||
|           type: 'string', | ||||
|           title: '实名状态', | ||||
|           enum: [ | ||||
|             { label: '全部', value: '' }, | ||||
|             { label: '正常', value: 0 }, | ||||
|             { label: '冻结', value: 1 }, | ||||
|             { label: '废弃', value: 2 }, | ||||
|           ], | ||||
|           default: '', | ||||
|           ui: { | ||||
|             widget: 'select', | ||||
|             visibleIf: { | ||||
|               expand: (value: boolean) => value, | ||||
|             }, | ||||
|           }, | ||||
|         }, | ||||
|         enStatus2: { | ||||
|           type: 'string', | ||||
|           title: '驾驶证状态', | ||||
|           enum: [ | ||||
|             { label: '全部', value: '' }, | ||||
|             { label: '正常', value: 0 }, | ||||
|             { label: '冻结', value: 1 }, | ||||
|             { label: '废弃', value: 2 }, | ||||
|           ], | ||||
|           default: '', | ||||
|           ui: { | ||||
|             widget: 'select', | ||||
|             visibleIf: { | ||||
|               expand: (value: boolean) => value, | ||||
|             }, | ||||
|           }, | ||||
|         }, | ||||
|         enStatus23: { | ||||
|           type: 'string', | ||||
|           title: '从业资格证状态', | ||||
|           enum: [ | ||||
|             { label: '全部', value: '' }, | ||||
|             { label: '正常', value: 0 }, | ||||
|             { label: '冻结', value: 1 }, | ||||
|             { label: '废弃', value: 2 }, | ||||
|           ], | ||||
|           default: '', | ||||
|           ui: { | ||||
|             widget: 'select', | ||||
|             visibleIf: { | ||||
|               expand: (value: boolean) => value, | ||||
|             }, | ||||
|           }, | ||||
|         }, | ||||
|         phone2: { | ||||
|           title: '业务员手机号', | ||||
|           type: 'string', | ||||
|           format: 'mobile', | ||||
|           maxLength: 11, | ||||
|           ui: { | ||||
|             placeholder: '请输入手机号', | ||||
|           }, | ||||
|         }, | ||||
|    | ||||
|       }, | ||||
|     }; | ||||
|     this.ui = { '*': { spanLabelFixed: 180, grid: { span: 8, gutter: 4 }, enter: () => this.st.load() } }; | ||||
|   } | ||||
|  | ||||
|   initST() { | ||||
|     this.columns = [ | ||||
| @ -179,14 +57,17 @@ export class UserCenterComponentsDriverComponent implements OnInit { | ||||
|       { title: '手机号', className: 'text-center', index: 'contactsName' }, | ||||
|       { title: '承运总单量', className: 'text-center', render: 'enterpriseName' }, | ||||
|       { title: '当前车辆', className: 'text-center', index: 'unifiedSocialCreditCode' }, | ||||
|       { title: '实名认证状态', className: 'text-center', index: 'effectiveDateStr', | ||||
|       type: 'badge', | ||||
|       badge: { | ||||
|         正常: { text: '正常', color: 'success' }, | ||||
|         冻结: { text: '冻结', color: 'warning' }, | ||||
|         废弃: { text: '废弃', color: 'default' }, | ||||
|       { | ||||
|         title: '实名认证状态', | ||||
|         className: 'text-center', | ||||
|         index: 'effectiveDateStr', | ||||
|         type: 'badge', | ||||
|         badge: { | ||||
|           正常: { text: '正常', color: 'success' }, | ||||
|           冻结: { text: '冻结', color: 'warning' }, | ||||
|           废弃: { text: '废弃', color: 'default' } | ||||
|         } | ||||
|       }, | ||||
|      }, | ||||
|       { | ||||
|         title: '驾驶证状态', | ||||
|         className: 'text-center', | ||||
| @ -195,8 +76,8 @@ export class UserCenterComponentsDriverComponent implements OnInit { | ||||
|         badge: { | ||||
|           正常: { text: '正常', color: 'success' }, | ||||
|           冻结: { text: '冻结', color: 'warning' }, | ||||
|           废弃: { text: '废弃', color: 'default' }, | ||||
|         }, | ||||
|           废弃: { text: '废弃', color: 'default' } | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         title: '从业资格证状态', | ||||
| @ -206,8 +87,8 @@ export class UserCenterComponentsDriverComponent implements OnInit { | ||||
|         badge: { | ||||
|           正常: { text: '正常', color: 'success' }, | ||||
|           冻结: { text: '冻结', color: 'warning' }, | ||||
|           废弃: { text: '废弃', color: 'default' }, | ||||
|         }, | ||||
|           废弃: { text: '废弃', color: 'default' } | ||||
|         } | ||||
|       }, | ||||
|       { title: '推广业务员', className: 'text-center', index: 'unifiedSocialCreditCode2' }, | ||||
|       { title: '注册时间', className: 'text-center', index: 'unifiedSocialCreditCode3' }, | ||||
| @ -218,13 +99,13 @@ export class UserCenterComponentsDriverComponent implements OnInit { | ||||
|         buttons: [ | ||||
|           { | ||||
|             text: '查看', | ||||
|             click: (item) => { | ||||
|             click: item => { | ||||
|               this.router.navigate(['./detail', item.tenantId], { relativeTo: this.ar }); | ||||
|               // this.router.navigate(['./view', item.id], { relativeTo: this.ar, queryParams: { tenantId: item.tenantId } }); | ||||
|             }, | ||||
|           }, | ||||
|         ], | ||||
|       }, | ||||
|             } | ||||
|           } | ||||
|         ] | ||||
|       } | ||||
|     ]; | ||||
|   } | ||||
|   daoyun(item: any) { | ||||
| @ -235,7 +116,7 @@ export class UserCenterComponentsDriverComponent implements OnInit { | ||||
|     this.sf?.setValue('/expand', this._$expand); | ||||
|   } | ||||
|   creat() { | ||||
|     this.router.navigate(['./new',], { relativeTo: this.ar }); | ||||
|     this.router.navigate(['./new'], { relativeTo: this.ar }); | ||||
|   } | ||||
|   /** | ||||
|    * 重置表单 | ||||
| @ -244,4 +125,117 @@ export class UserCenterComponentsDriverComponent implements OnInit { | ||||
|     this.sf.reset(); | ||||
|     this._$expand = false; | ||||
|   } | ||||
|  | ||||
|   private initSF(): SFSchema { | ||||
|     return { | ||||
|       properties: { | ||||
|         expand: { | ||||
|           type: 'boolean', | ||||
|           ui: { | ||||
|             hidden: true | ||||
|           } | ||||
|         }, | ||||
|         name: { title: '司机姓名', type: 'string', ui: { placeholder: '请输入', showRequired: false } }, | ||||
|         mobile: { | ||||
|           title: '手机号', | ||||
|           type: 'string', | ||||
|           format: 'mobile', | ||||
|           maxLength: 11, | ||||
|           ui: { | ||||
|             placeholder: '请输入' | ||||
|           } | ||||
|         }, | ||||
|         identityStatus: { | ||||
|           type: 'string', | ||||
|           title: '实名状态', | ||||
|           enum: [ | ||||
|             { label: '全部', value: '' }, | ||||
|             { label: '待审核', value: 0 }, | ||||
|             { label: '通过', value: 1 }, | ||||
|             { label: '驳回', value: 2 } | ||||
|           ], | ||||
|           default: '', | ||||
|           ui: { | ||||
|             widget: 'select' | ||||
|           } | ||||
|         }, | ||||
|         driverLicenseStatus: { | ||||
|           type: 'string', | ||||
|           title: '驾驶证状态', | ||||
|           enum: [ | ||||
|             { label: '全部', value: '' }, | ||||
|             { label: '待审核', value: 10 }, | ||||
|             { label: '审核通过', value: 20 }, | ||||
|             { label: '驳回', value: 30 }, | ||||
|             { label: '证件过期', value: 40 } | ||||
|           ], | ||||
|           default: '', | ||||
|           ui: { | ||||
|             widget: 'select', | ||||
|             visibleIf: { | ||||
|               expand: (value: boolean) => value | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         practiceSenioritLicenseStatus: { | ||||
|           type: 'string', | ||||
|           title: '从业资格证状态', | ||||
|           enum: [ | ||||
|             { label: '全部', value: '' }, | ||||
|             { label: '待审核', value: 10 }, | ||||
|             { label: '审核通过', value: 20 }, | ||||
|             { label: '驳回', value: 30 }, | ||||
|             { label: '证件过期', value: 40 } | ||||
|           ], | ||||
|           default: '', | ||||
|           ui: { | ||||
|             widget: 'select', | ||||
|             visibleIf: { | ||||
|               expand: (value: boolean) => value | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         promotersTelephone: { | ||||
|           title: '推广业务员', | ||||
|           type: 'string', | ||||
|           format: 'mobile', | ||||
|           maxLength: 11, | ||||
|           ui: { | ||||
|             placeholder: '请输入手机号', | ||||
|             visibleIf: { | ||||
|               expand: (value: boolean) => value | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         source: { | ||||
|           type: 'string', | ||||
|           title: '注册渠道', | ||||
|           enum: [ | ||||
|             { label: '全部', value: '' }, | ||||
|             { label: '自己录入', value: 1 }, | ||||
|             { label: '货主录入', value: 2 } | ||||
|           ], | ||||
|           default: '', | ||||
|           ui: { | ||||
|             widget: 'select', | ||||
|             visibleIf: { | ||||
|               expand: (value: boolean) => value | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         effectiveDate: { | ||||
|           title: '申请时间', | ||||
|           type: 'string', | ||||
|           ui: { | ||||
|             widget: 'date', | ||||
|             mode: 'range', | ||||
|             format: 'yyyy-MM-dd', | ||||
|             visibleIf: { | ||||
|               expand: (value: boolean) => value | ||||
|             } | ||||
|           } as SFDateWidgetSchema | ||||
|         } | ||||
|       } | ||||
|     }; | ||||
|   } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user