edoit
This commit is contained in:
@ -0,0 +1,72 @@
|
||||
<!--
|
||||
* @Author: your name
|
||||
* @Date: 2021-11-29 15:22:34
|
||||
* @LastEditTime : 2022-02-16 09:58:52
|
||||
* @LastEditors : Shiming
|
||||
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\routes\\usercenter\\components\\driver\\captain\\captain.component.html
|
||||
-->
|
||||
<!-- 页头 -->
|
||||
<page-header-wrapper></page-header-wrapper>
|
||||
<nz-card>
|
||||
<!-- 搜索区 -->
|
||||
<!-- 搜索表单 -->
|
||||
<div nz-row nzGutter="8">
|
||||
<div nz-col [nzXl]="_$expand ? 24 : 18" [nzLg]="24" [nzSm]="24" [nzXs]="24">
|
||||
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
|
||||
</div>
|
||||
<div nz-col [nzXl]="_$expand ? 24 : 6" [nzLg]="24" [nzSm]="24" [nzXs]="24" class="text-right">
|
||||
<button
|
||||
nz-button
|
||||
nzType="primary"
|
||||
[nzLoading]="service.http.loading"
|
||||
(click)="st?.load(1)"
|
||||
acl
|
||||
[acl-ability]="['USERCENTER-DRIVER-CAPTAIN-list']"
|
||||
>查询</button
|
||||
>
|
||||
<button
|
||||
nz-button
|
||||
nzType="primary"
|
||||
[disabled]="service.http.loading"
|
||||
(click)="exportList()"
|
||||
acl
|
||||
[acl-ability]="['USERCENTER-DRIVER-CAPTAIN-export']"
|
||||
>导出</button
|
||||
>
|
||||
<button nz-button (click)="resetSF()" [disabled]="service.http.loading">重置</button>
|
||||
<button nz-button nzType="link" (click)="expandToggle()">
|
||||
{{ !_$expand ? '展开' : '收起' }}
|
||||
<i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</nz-card>
|
||||
<nz-card>
|
||||
<!-- 数据列表 -->
|
||||
<st
|
||||
#st
|
||||
[columns]="columns"
|
||||
[data]="service.$api_get_user_expand"
|
||||
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
|
||||
[res]="{ reName: { list: 'data.records', total: 'data.total' }, process: dataProcess }"
|
||||
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
|
||||
[loading]="service.http.loading"
|
||||
>
|
||||
<ng-template st-row="promotersTelephone" let-item let-index="index">
|
||||
<a (click)="addPromoter(item)" acl [acl-ability]="['USERCENTER-DRIVER-CAPTAIN-promoter']">
|
||||
{{ item.promotersTelephone || '添加' }}
|
||||
</a>
|
||||
</ng-template>
|
||||
</st>
|
||||
</nz-card>
|
||||
|
||||
<ng-template #promoterModal>
|
||||
<div nz-row nzGutter="8">
|
||||
<div nz-col nzSpan="24" se-container [labelWidth]="80">
|
||||
<se [col]="1" label="手机号">
|
||||
<input nz-input [(ngModel)]="promotersTelephone" maxlength="11" required />
|
||||
</se>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
@ -0,0 +1,234 @@
|
||||
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 { ModalHelper } from '@delon/theme';
|
||||
import { DynamicSettingModalComponent } from '@shared';
|
||||
import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { UsermanageService } from '../../../services/usercenter.service';
|
||||
@Component({
|
||||
selector: 'app-usercenter-components-driver-config',
|
||||
templateUrl: './driver-config.component.html',
|
||||
styleUrls: ['./driver-config.component.less']
|
||||
})
|
||||
export class UserCenterComponentsDriverConfigComponent implements OnInit {
|
||||
_$expand = false;
|
||||
|
||||
ui: SFUISchema = { '*': { spanLabelFixed: 120, grid: { lg: 8, md: 12, sm: 12, xs: 24 } } };
|
||||
schema: SFSchema = this.initSF();
|
||||
columns: STColumn[] = this.initST();
|
||||
@ViewChild('st', { static: false }) st!: STComponent;
|
||||
@ViewChild('sf', { static: false }) sf!: SFComponent;
|
||||
|
||||
@ViewChild('promoterModal', { static: false })
|
||||
promoterModal!: any;
|
||||
promotersTelephone = '';
|
||||
|
||||
constructor(public service: UsermanageService, private modal: NzModalService, private router: Router, private ar: ActivatedRoute, private modalHelper: ModalHelper,) {}
|
||||
|
||||
/**
|
||||
* 查询参数
|
||||
*/
|
||||
get reqParams() {
|
||||
const params: any = {
|
||||
...(this.sf && this.sf.value)
|
||||
};
|
||||
if (this.sf?.value.effectiveDate) {
|
||||
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.ar.url.subscribe(params => {
|
||||
this.st?.load(1);
|
||||
});
|
||||
}
|
||||
dataProcess(data: STData[]): STData[] {
|
||||
return data.map((i, index) => {
|
||||
i.showSortFlag = false;
|
||||
return i;
|
||||
});
|
||||
}
|
||||
|
||||
addPromoter(item?: any) {
|
||||
this.promotersTelephone = item?.promotersTelephone;
|
||||
const modal = this.modal.create({
|
||||
nzTitle: '推广业务员',
|
||||
nzContent: this.promoterModal,
|
||||
nzOnOk: () => {
|
||||
if (!!!this.promotersTelephone) {
|
||||
return false;
|
||||
}
|
||||
if (typeof this.promotersTelephone === 'string' && !/(^1\d{10}$)/.test(this.promotersTelephone)) {
|
||||
this.service.msgSrv.error('手机格式错误');
|
||||
return false;
|
||||
}
|
||||
this.service
|
||||
.request(this.service.$api_add_user_salesman, { userId: item.userId, mobile: this.promotersTelephone })
|
||||
.subscribe(res => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success(item?.promotersTelephone ? '添加推广员成功' : '修改推广员成功');
|
||||
}
|
||||
this.st.load();
|
||||
});
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
settingAction(item?: any) {
|
||||
this.modal.create({
|
||||
nzTitle: '基础设置',
|
||||
nzContent: DynamicSettingModalComponent,
|
||||
nzWidth: 900,
|
||||
nzComponentParams: {
|
||||
extendType: '4',
|
||||
businessId: item.id
|
||||
},
|
||||
nzFooter: null
|
||||
});
|
||||
}
|
||||
|
||||
expandToggle() {
|
||||
this._$expand = !this._$expand;
|
||||
this.sf?.setValue('/expand', this._$expand);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置表单
|
||||
*/
|
||||
resetSF() {
|
||||
this.sf.reset();
|
||||
this._$expand = false;
|
||||
}
|
||||
|
||||
exportList() {
|
||||
const params = this.reqParams;
|
||||
this.service.downloadFile(this.service.$api_export_driver_cap, params);
|
||||
}
|
||||
|
||||
private initSF(): SFSchema {
|
||||
return {
|
||||
properties: {
|
||||
expand: {
|
||||
type: 'boolean',
|
||||
ui: {
|
||||
hidden: true
|
||||
}
|
||||
},
|
||||
name: { title: '司机姓名', type: 'string', ui: { placeholder: '请输入', showRequired: false } },
|
||||
mobile: {
|
||||
title: '手机号',
|
||||
type: 'string',
|
||||
maxLength: 11,
|
||||
ui: {
|
||||
placeholder: '请输入'
|
||||
}
|
||||
},
|
||||
identityNo: {
|
||||
title: '身份证号',
|
||||
type: 'string',
|
||||
ui: {
|
||||
placeholder: '请输入'
|
||||
}
|
||||
},
|
||||
promotersTelephone: {
|
||||
title: '业务员手机号',
|
||||
type: 'string',
|
||||
maxLength: 11,
|
||||
ui: {
|
||||
placeholder: '请输入',
|
||||
visibleIf: {
|
||||
expand: (value: boolean) => value
|
||||
}
|
||||
}
|
||||
},
|
||||
identityStatus: {
|
||||
type: 'string',
|
||||
title: '实名认证状态',
|
||||
enum: [
|
||||
{ label: '全部', value: '' },
|
||||
{ label: '待审核', value: 0 },
|
||||
{ label: '审核通过', value: 1 },
|
||||
{ label: '驳回', value: 2 }
|
||||
],
|
||||
default: '',
|
||||
ui: {
|
||||
widget: 'select',
|
||||
visibleIf: {
|
||||
expand: (value: boolean) => value
|
||||
}
|
||||
}
|
||||
},
|
||||
source: {
|
||||
type: 'string',
|
||||
title: '注册渠道',
|
||||
enum: [
|
||||
{ label: '全部', value: '' },
|
||||
{ label: '用户注册', value: 1 },
|
||||
{ label: '货主添加', value: 2 },
|
||||
{ label: '运营添加', value: 3 },
|
||||
],
|
||||
default: '',
|
||||
ui: {
|
||||
widget: 'select',
|
||||
visibleIf: {
|
||||
expand: (value: boolean) => value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private initST(): STColumn[] {
|
||||
return [
|
||||
// { title: '', type: 'checkbox', className: 'text-center' },
|
||||
{ title: '司机姓名', className: 'text-center', index: 'name' },
|
||||
{ title: '手机号', className: 'text-center', index: 'mobile' },
|
||||
{ title: '身份证号', className: 'text-center', index: 'identityNo' },
|
||||
{
|
||||
title: '实名认证状态',
|
||||
className: 'text-center',
|
||||
index: 'identityStatus',
|
||||
type: 'badge',
|
||||
badge: {
|
||||
'-1': { text: '未提交', color: 'default' },
|
||||
0: { text: '待审核', color: 'processing' },
|
||||
1: { text: '审核通过', color: 'success' },
|
||||
2: { text: '驳回', color: 'warning' }
|
||||
}
|
||||
},
|
||||
{ title: '推广业务员', className: 'text-center', render: 'promotersTelephone' },
|
||||
{ title: '注册渠道', className: 'text-center', index: 'source', type: 'enum', enum: { 1: '用户注册', 2: '货主添加' , 3: '运营添加'} },
|
||||
{ title: '注册时间', className: 'text-center', index: 'createTime' },
|
||||
{
|
||||
title: '操作',
|
||||
width: '170px',
|
||||
className: 'text-center',
|
||||
buttons: [
|
||||
{
|
||||
text: '查看',
|
||||
click: item => {
|
||||
this.router.navigate(['/usercenter/driver/captain/detail', item.appUserId]);
|
||||
},
|
||||
acl: { ability: ['USERCENTER-DRIVER-CAPTAIN-view'] }
|
||||
},
|
||||
{
|
||||
text: '基础设置',
|
||||
click: item => this.settingAction(item),
|
||||
acl: { ability: ['USERCENTER-DRIVER-CAPTAIN-basicSetting'] }
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,7 @@ import { RouterModule, Routes } from '@angular/router';
|
||||
import { CaptainDetailComponent } from './components/driver/captain/captain-detail/captain-detail.component';
|
||||
import { UserCenterComponentsDriverCaptainComponent } from './components/driver/captain/captain.component';
|
||||
import { UserCenterComponentsDriverDetailComponent } from './components/driver/detail/detail.component';
|
||||
import { UserCenterComponentsDriverConfigComponent } from './components/driver/driver-config/driver-config.component';
|
||||
import { UserCenterComponentsDriverComponent } from './components/driver/driver.component';
|
||||
import { FreightComponentsEnterpriseAuditComponent } from './components/freight/enterprise-audit/enterprise-audit.component';
|
||||
import { FreightComponentsEnterpriseAuditViewComponent } from './components/freight/enterprise-audit/view/view.component';
|
||||
@ -67,7 +68,12 @@ const routes: Routes = [
|
||||
path: 'driver/captain/detail/:id',
|
||||
component: CaptainDetailComponent,
|
||||
data: { guard: { ability: ['USERCENTER-DRIVER-CAPTAIN-DETAIL-view'] } }
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'driver/config',
|
||||
component: UserCenterComponentsDriverConfigComponent,
|
||||
data: { guard: { ability: ['USERCENTER-DRIVER-CAPTAIN-list'] } }
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
||||
@ -25,6 +25,7 @@ import { CaptainDetailComponent } from './components/driver/captain/captain-deta
|
||||
import { CarSettleAddDriverComponent } from './components/driver/add-driver/add-driver.component';
|
||||
import { CtcCaptatinAddComponent } from './components/driver/captain/add/add.component';
|
||||
import { FreightConfigComponent } from './components/freight/freight-config/freight-config.component';
|
||||
import { UserCenterComponentsDriverConfigComponent } from './components/driver/driver-config/driver-config.component';
|
||||
|
||||
const COMPONENTS = [
|
||||
FreightComponentsListComponent,
|
||||
@ -42,7 +43,8 @@ const COMPONENTS = [
|
||||
AuditAdminComponent,
|
||||
CarSettleAddDriverComponent,
|
||||
CtcCaptatinAddComponent,
|
||||
FreightConfigComponent
|
||||
FreightConfigComponent,
|
||||
UserCenterComponentsDriverConfigComponent
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
||||
Reference in New Issue
Block a user