车辆对接
This commit is contained in:
@ -0,0 +1,48 @@
|
||||
<div class="modal-header">
|
||||
<div class="modal-title">新增</div>
|
||||
</div>
|
||||
<!-- <nz-spin *ngIf="!i" class="modal-spin"></nz-spin> -->
|
||||
<div>
|
||||
<!-- 搜索表单 -->
|
||||
<div nz-row nzGutter="8">
|
||||
<!-- 查询字段小于或等于3个时,不显示伸缩按钮 -->
|
||||
<div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
|
||||
<sf #sf [schema]="schema" [ui]="ui" [mode]="'search'" [disabled]="!sf?.valid" [loading]="service.http.loading" (formSubmit)="initData(true)" (formReset)="resetSF()"></sf>
|
||||
</div>
|
||||
|
||||
<!-- 查询字段大于3个时,根据展开状态调整布局 -->
|
||||
<ng-container *ngIf="queryFieldCount > 4">
|
||||
<div nz-col [nzSpan]="_$expand ? 24 : 18">
|
||||
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
|
||||
<button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="service.http.loading" (click)="initData(true)">查询</button>
|
||||
<button nz-button (click)="resetSF()">重置</button>
|
||||
<button nz-button nzType="link" (click)="expandToggle()">
|
||||
{{ !_$expand ? '展开' : '收起' }}
|
||||
<i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
|
||||
</button>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
<!-- 数据列表 -->
|
||||
<!-- [data]="service.$api_getCarCaptainByMobile" -->
|
||||
<div *ngIf="sf?.value?.mobile && tableData?.length > 0">
|
||||
<st #st multiSort bordered [columns]="columns" [ps]="20" [req]="{ method: 'POST', allInBody: true, reName: { pi: '', ps: '' }, params: reqParams }" [res]="{ reName: { list: 'data', total: 'data.total' } }" [page]="{ show: true, showSize: true, pageSizes: [20, 50, 100] }"
|
||||
[loading]="service.http.loading" [data]="tableData">
|
||||
|
||||
<ng-template st-row="carModel" let-item let-index="index">
|
||||
<span>{{item.carModel}};{{item.carLength}};{{item.carLoad}};</span>
|
||||
</ng-template>
|
||||
</st>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="noContent" *ngIf="sf?.value?.mobile && tableData?.length === 0 && flag">
|
||||
抱歉,该手机号还未注册,仍然需要添加请点击 <span (click)="addModal()">继续添加
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button nz-button type="button" (click)="close()">关闭</button>
|
||||
</div>
|
||||
@ -0,0 +1,38 @@
|
||||
|
||||
:host{
|
||||
::ng-deep{
|
||||
.ant-card-meta-title{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.nameBox {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
.name{
|
||||
margin: 0 10px 0 0;
|
||||
}
|
||||
}
|
||||
.ant-badge-status{
|
||||
color: #666
|
||||
}
|
||||
|
||||
}
|
||||
.title{
|
||||
clear: both;
|
||||
margin: 10px 0;
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
}
|
||||
.noContent{
|
||||
width: 100%;
|
||||
min-height: 300px;
|
||||
font-size: 16px;
|
||||
line-height: 300px;
|
||||
text-align: center;
|
||||
span {
|
||||
color: #1890ff;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { CarAddmodalComponent } from './addmodal.component';
|
||||
|
||||
describe('CarAddmodalComponent', () => {
|
||||
let component: CarAddmodalComponent;
|
||||
let fixture: ComponentFixture<CarAddmodalComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CarAddmodalComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CarAddmodalComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,179 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { cacheConf } from '@conf/cache.conf';
|
||||
import { STColumn, STComponent, STChange, STData } from '@delon/abc/st';
|
||||
import { SFUISchema, SFSchema, SFComponent } from '@delon/form';
|
||||
import { ModalHelper, _HttpClient } from '@delon/theme';
|
||||
import { EACacheService } from '@shared';
|
||||
import { NzModalRef } from 'ng-zorro-antd/modal';
|
||||
import { SupplyManagementService } from '../../services/supply-management.service';
|
||||
import { CarAddDriverComponent } from '../add-driver/add-driver.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-car-addmodal',
|
||||
templateUrl: './addmodal.component.html',
|
||||
styleUrls: ['./addmodal.component.less']
|
||||
})
|
||||
export class CarAddmodalComponent implements OnInit {
|
||||
@ViewChild('st', { static: false }) st!: STComponent;
|
||||
@ViewChild('sf', { static: false }) sf!: SFComponent;
|
||||
_$expand = false;
|
||||
ui!: SFUISchema;
|
||||
schema!: SFSchema;
|
||||
columns!: STColumn[];
|
||||
tableData: any = [];
|
||||
companyData: any = {};
|
||||
flag = false
|
||||
constructor(
|
||||
private modal: NzModalRef,
|
||||
private eaCacheSrv: EACacheService,
|
||||
public service: SupplyManagementService, private router: Router, private ar: ActivatedRoute,
|
||||
private modalHelper: ModalHelper
|
||||
) { }
|
||||
|
||||
/**
|
||||
* 查询字段个数
|
||||
*/
|
||||
get queryFieldCount(): number {
|
||||
return Object.keys(this.schema?.properties || {}).length;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询参数
|
||||
*/
|
||||
get reqParams() {
|
||||
const params = Object.assign({}, this.sf?.value || {});
|
||||
delete params._$expand;
|
||||
return { ...params };
|
||||
}
|
||||
|
||||
/**
|
||||
* 选中行
|
||||
*/
|
||||
get selectedRows() {
|
||||
return this.st?.list.filter((item: any) => item.checked) || [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 伸缩查询条件
|
||||
*/
|
||||
expandToggle() {
|
||||
this._$expand = !this._$expand;
|
||||
this.sf?.setValue('/_$expand', this._$expand);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置表单
|
||||
*/
|
||||
resetSF() {
|
||||
this.sf.reset();
|
||||
this._$expand = false;
|
||||
}
|
||||
/**
|
||||
* 程序初始化入口
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.companyData = this.eaCacheSrv.get(cacheConf.env)
|
||||
this.initSF();
|
||||
this.initST()
|
||||
this.initData()
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化查询表单
|
||||
*/
|
||||
initSF() {
|
||||
this.schema = {
|
||||
properties: {
|
||||
_$expand: { type: 'boolean', ui: { hidden: true } },
|
||||
mobile: { title: '司机手机号', type: 'string', maxLength: 11, ui: { showRequired: false, placeholder: '请输入司机手机号', } },
|
||||
},
|
||||
};
|
||||
this.ui = {
|
||||
'*': { spanLabelFixed: 120, grid: { span: 8, gutter: 4 }, enter: () => this.st?.load(1) },
|
||||
$time: { grid: { span: 24 } },
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化数据列表
|
||||
*/
|
||||
initST() {
|
||||
this.columns = [
|
||||
{ title: '司机头像', type: 'img', index: 'avatar', className: 'text-center' },
|
||||
{ title: '司机姓名', index: 'name', className: 'text-center' },
|
||||
{ title: '当前车辆', index: 'carNo', className: 'text-center' },
|
||||
{ title: '车辆信息', render: 'carModel', className: 'text-center' },
|
||||
{
|
||||
title: '个人认证状态',
|
||||
index: 'identityStatus',
|
||||
className: 'text-center',
|
||||
type: 'enum',
|
||||
enum: {
|
||||
10: '待审核',
|
||||
20: '已成功',
|
||||
30: '已驳回',
|
||||
40: '证件过期',
|
||||
}
|
||||
},
|
||||
{ title: '驾驶证类型', index: 'createTime', className: 'text-center' },
|
||||
{
|
||||
title: '操作',
|
||||
width: '180px',
|
||||
className: 'text-center',
|
||||
buttons: [
|
||||
{ text: '添加', click: (_record: any) => this.add(_record) },
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
initData(flag?: any) {
|
||||
if (this.sf?.value.mobile) {
|
||||
this.flag = flag
|
||||
// this.service.request(this.service.$api_getCarCaptainByMobile, { mobile: this.sf?.value.mobile }).subscribe(res => {
|
||||
// if (res.userId) {
|
||||
// this.tableData = [res];
|
||||
// } else {
|
||||
// this.tableData = []
|
||||
// }
|
||||
// this.st.reload()
|
||||
// })
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 数据列表状态变化事件
|
||||
*/
|
||||
change(change: STChange) {
|
||||
// console.log(change);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
add(item: any) {
|
||||
const params: any = {
|
||||
enterpriseId: this.companyData.enterpriseId,
|
||||
enterpriseProjectId: this.companyData.projectId,
|
||||
source: 1,
|
||||
appUserId: item.appUserId ? item.appUserId : '',
|
||||
mobile: item.mobile
|
||||
}
|
||||
// this.service.request(this.service.$api_enterpriseVehicleSave, params).subscribe(res => {
|
||||
// if (res.data) {
|
||||
// this.service.msgSrv.success('添加成功')
|
||||
// }
|
||||
// })
|
||||
}
|
||||
addModal() {
|
||||
this.modalHelper.create(CarAddDriverComponent, {mobile: this.sf?.value.mobile}, { size: 900 }).subscribe((res) => {
|
||||
this.initData()
|
||||
});
|
||||
//this.router.navigate(['/car/add'])
|
||||
}
|
||||
goBack() {
|
||||
window.history.go(-1);
|
||||
}
|
||||
close(): void {
|
||||
this.modal.destroy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user