This commit is contained in:
heqinghang
2022-02-24 14:11:57 +08:00
parent c27874bb3f
commit d198a69eef
12 changed files with 680 additions and 2 deletions

View File

@ -0,0 +1,7 @@
<sf #sf [ui]="ui" [schema]="schema" [button]="'none'" [formData]="i">
</sf>
<div *nzModalFooter>
<button nz-button nzType="default" (click)="close()">取消</button>
<button nz-button nzType="primary" (click)="save()">确认</button>
</div>

View File

@ -0,0 +1,114 @@
import { AfterViewInit, ChangeDetectorRef, Component, OnChanges, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { SFComponent, SFRadioWidgetSchema, SFSchema, SFSchemaEnumType, SFSelectWidgetSchema, SFTextareaWidgetSchema, SFUISchema } from '@delon/form';
import { _HttpClient } from '@delon/theme';
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
import { map } from 'rxjs/operators';
import { AmapPoiPickerComponent } from 'src/app/shared/components/amap';
import { ChannelSalesService } from '../../services/channel-sales.service';
@Component({
selector: 'app-parter-channel-sales-edit',
templateUrl: './edit.component.html'
})
export class ParterChannelSalesEditComponent implements OnInit {
@ViewChild('sf', { static: false }) sf!: SFComponent;
schema!: SFSchema;
ui!: SFUISchema;
i: any;
type: any;
constructor(
public http: _HttpClient,
private cdr: ChangeDetectorRef,
private route: ActivatedRoute,
private modalService: NzModalService,
public service: ChannelSalesService,
private modalRef: NzModalRef
) {}
ngOnInit(): void {
this.initSF();
}
initSF() {
this.schema = {
properties: {
id: {
type: 'string',
title: '',
ui: { hidden: true }
},
name1: {
title: '业务员选择',
type: 'string',
enum: [
{ label: '王武', value: '1'},
],
ui: {
widget: 'select',
placeholder:'请选择'
} as SFSelectWidgetSchema,
},
name2: {
type: 'string',
title: '授权登录运营后台',
enum: [
{ label: '否', value: '0' },
{ label: '是', value: '1' }
],
ui: {
widget: 'radio',
} as SFRadioWidgetSchema,
default: 'A',
},
name: {
title: '',
type: 'string',
enum: [
{ label: '管理员', value: '1'},
],
ui: {
widget: 'select',
placeholder:'授权角色',
visibleIf: { name2: (value: string) => value === '1' }
} as SFSelectWidgetSchema,
},
name3: {
type: 'string',
title: '备注',
maxLength: 50,
ui: {
widget: 'textarea',
autosize: { minRows: 3, maxRows: 6 },
placeholder:'请输入50字符'
} as SFTextareaWidgetSchema,
},
},
required: ['name1', 'name2']
};
this.ui = {
'*': {
spanLabelFixed: 150,
grid: { span: 24 }
},
$name:{ spanLabelFixed: 10, grid: { span: 12 }},
$name2:{ grid: { span: 12 }},
};
}
close() {
this.modalRef.destroy();
}
save() {
this.sf.validator({ emitError: true });
if(!this.sf.valid) return;
// this.service.request('', { ...this.sf.value }).subscribe(res => {
// if (res) {
// this.modalRef.destroy(true);
// } else {
// this.service.msgSrv.error(res.msg);
// }
// });
}
}

View File

@ -0,0 +1,28 @@
<nz-card>
<!-- 搜索区 -->
<sf
#sf
[ui]="ui"
[schema]="schema"
[mode]="'search'"
(formSubmit)="st?.load(1)"
(formReset)="resetSF()"
></sf>
</nz-card>
<nz-card>
<button nz-button nzType="primary" style="margin-bottom: 24px" (click)="add()"><i nz-icon nzType="plus"></i>新增</button>
<!-- 数据列表 -->
<st
#st
[bordered]="true"
[data]="data"
[columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loadingDelay]="500"
[loading]="service.http.loading"
>
</st>
</nz-card>

View File

@ -0,0 +1,175 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
import { processSingleSort } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal';
import { ChannelSalesService } from '../../services/channel-sales.service';
import { ParterChannelSalesEditComponent } from '../edit/edit.component';
@Component({
selector: 'app-parter-channel-sales-list',
templateUrl: './list.component.html'
})
export class ParterChannelSalesListComponent implements OnInit {
schema: SFSchema = {};
columns!: STColumn[];
ui!: SFUISchema;
@ViewChild('st', { static: false })
st!: STComponent;
@ViewChild('sf', { static: false })
sf!: SFComponent;
spuStatus = '1';
data=[{name1:1111}]
constructor(
public router: Router,
public ar: ActivatedRoute,
public service: ChannelSalesService,
private modalService: NzModalService
) {}
/**
* 查询参数
*/
get reqParams() {
return { ...this.sf?.value };
}
ngOnInit() {
this.initSF();
this.initST();
}
initSF() {
this.schema = {
properties: {
name: {
type: 'string',
title: '销售渠道姓名'
},
phone: {
type: 'string',
title: '手机号'
},
}
};
this.ui = {
'*': {
grid: { span: 8, gutter: 4 }
}
};
}
initST() {
this.columns = [
{
title: '销售渠道姓名',
index: 'name1'
},
{
title: '手机号',
index: 'name1'
},
{
title: '所属组织',
index: 'name1'
},
{
title: '职级',
index: 'name1'
},
{
title: '等级',
index: 'name1'
},
{
title: '省市',
index: 'name1'
},
{
title: '邀请码',
index: 'name1'
},
{
title: '操作',
className: 'text-center',
buttons: [
{
text: '编辑',
click: (_record, _modal, _instance) => this.edit(_record),
},
{
text: '查看',
click: (_record, _modal, _instance) => this.view(_record),
},
{
text: '冻结',
click: (_record, _modal, _instance) => this.stop(_record.id),
}
]
}
];
}
add() {
const modalRef = this.modalService.create({
nzWidth:600,
nzTitle: '新增',
nzContent: ParterChannelSalesEditComponent,
nzComponentParams: { type: this.spuStatus }
});
modalRef.afterClose.subscribe(res => {
if (res) {
this.st.reload();
}
});
}
// 编辑
edit(record: STData) {
const modalRef = this.modalService.create({
nzWidth:600,
nzTitle: '编辑',
nzContent: ParterChannelSalesEditComponent,
nzComponentParams: { i: record, type: this.spuStatus }
});
modalRef.afterClose.subscribe(res => {
if (res) {
this.st.reload();
}
});
}
// 编辑
view(record: STData) {
const modalRef = this.modalService.create({
nzTitle: '查看',
nzContent: ParterChannelSalesEditComponent,
nzComponentParams: { i: record }
});
}
stop(id: any) {
this.modalService.confirm({
nzTitle: '<i>冻结确认</i>',
nzContent: `<b>确定冻结该账号吗?</br>`,
// nzOnOk: () =>
// this.service.request('', '').subscribe(res => {
// if (res) {
// this.service.msgSrv.success('冻结成功!');
// this.st.reload();
// }
// })
});
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
this.st.load(1);
}
}

View File

@ -0,0 +1,12 @@
import { Injectable, Injector } from '@angular/core';
import { BaseService } from '@shared';
@Injectable({
providedIn: 'root',
})
export class ChannelSalesService extends BaseService {
constructor(public injector: Injector) {
super(injector);
}
}

View File

@ -0,0 +1,7 @@
<sf #sf [ui]="ui" [schema]="schema" [button]="'none'" [formData]="i">
</sf>
<div *nzModalFooter>
<button nz-button nzType="default" (click)="close()">取消</button>
<button nz-button nzType="primary" (click)="save()">确认</button>
</div>

View File

@ -0,0 +1,88 @@
import { AfterViewInit, ChangeDetectorRef, Component, OnChanges, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { SFComponent, SFRadioWidgetSchema, SFSchema, SFSchemaEnumType, SFSelectWidgetSchema, SFTextareaWidgetSchema, SFUISchema } from '@delon/form';
import { _HttpClient } from '@delon/theme';
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
import { map } from 'rxjs/operators';
import { AmapPoiPickerComponent } from 'src/app/shared/components/amap';
import { ChannelSalesService } from '../../services/level-config.service';
@Component({
selector: 'app-parter-LevelConfig-edit',
templateUrl: './edit.component.html'
})
export class ParterLevelConfigEditComponent implements OnInit {
@ViewChild('sf', { static: false }) sf!: SFComponent;
schema!: SFSchema;
ui!: SFUISchema;
i: any;
type: any;
constructor(
public http: _HttpClient,
private cdr: ChangeDetectorRef,
private route: ActivatedRoute,
private modalService: NzModalService,
public service: ChannelSalesService,
private modalRef: NzModalRef
) {}
ngOnInit(): void {
this.initSF();
}
initSF() {
this.schema = {
properties: {
id: {
type: 'string',
title: '',
ui: { hidden: true }
},
name: {
title: '合伙人等级',
type: 'string',
enum: [
{ label: '管理员', value: '1'},
],
ui: {
widget: 'select',
placeholder:'请选择',
visibleIf: { name2: (value: string) => value === '1' }
} as SFSelectWidgetSchema,
},
name3: {
type: 'string',
title: '备注',
maxLength: 50,
ui: {
widget: 'textarea',
autosize: { minRows: 3, maxRows: 6 },
placeholder:'请输入50字符'
} as SFTextareaWidgetSchema,
},
},
required: ['name1', 'name2']
};
this.ui = {
'*': {
spanLabelFixed: 120,
grid: { span: 24 }
},
};
}
close() {
this.modalRef.destroy();
}
save() {
this.sf.validator({ emitError: true });
if(!this.sf.valid) return;
// this.service.request('', { ...this.sf.value }).subscribe(res => {
// if (res) {
// this.modalRef.destroy(true);
// } else {
// this.service.msgSrv.error(res.msg);
// }
// });
}
}

View File

@ -0,0 +1,28 @@
<nz-card>
<!-- 搜索区 -->
<sf
#sf
[ui]="ui"
[schema]="schema"
[mode]="'search'"
(formSubmit)="st?.load(1)"
(formReset)="resetSF()"
></sf>
</nz-card>
<nz-card>
<button nz-button nzType="primary" style="margin-bottom: 24px" (click)="add()"><i nz-icon nzType="plus"></i>新增</button>
<!-- 数据列表 -->
<st
#st
[bordered]="true"
[data]="data"
[columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loadingDelay]="500"
[loading]="service.http.loading"
>
</st>
</nz-card>

View File

@ -0,0 +1,180 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
import { processSingleSort } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal';
import { ChannelSalesService } from '../../services/level-config.service';
import { ParterLevelConfigEditComponent } from '../edit/edit.component';
@Component({
selector: 'app-parter-LevelConfig-list',
templateUrl: './list.component.html'
})
export class ParterLevelConfigListComponent implements OnInit {
schema: SFSchema = {};
columns!: STColumn[];
ui!: SFUISchema;
@ViewChild('st', { static: false })
st!: STComponent;
@ViewChild('sf', { static: false })
sf!: SFComponent;
spuStatus = '1';
data=[{name1:1111}]
constructor(
public router: Router,
public ar: ActivatedRoute,
public service: ChannelSalesService,
private modalService: NzModalService
) {}
/**
* 查询参数
*/
get reqParams() {
return { ...this.sf?.value };
}
ngOnInit() {
this.initSF();
this.initST();
}
initSF() {
this.schema = {
properties: {
name: {
type: 'string',
title: '等级姓名'
},
phone: {
type: 'string',
title: '状态'
},
}
};
this.ui = {
'*': {
grid: { span: 8, gutter: 4 }
}
};
}
initST() {
this.columns = [
{
title: '等级姓名',
index: 'name1'
},
{
title: '备注',
index: 'name1'
},
{
title: '创建时间',
index: 'name1'
},
{
title: '启用时间',
index: 'name1'
},
{
title: '状态',
index: 'name1'
},
{
title: '操作',
className: 'text-center',
buttons: [
{
text: '编辑',
click: (_record, _modal, _instance) => this.edit(_record),
},
{
text: '禁用',
click: (_record, _modal, _instance) => this.stop(_record),
},
{
text: '启用',
click: (_record, _modal, _instance) => this.restart(_record),
}
]
}
];
}
add() {
const modalRef = this.modalService.create({
nzWidth:500,
nzTitle: '新增',
nzContent: ParterLevelConfigEditComponent,
nzComponentParams: { type: this.spuStatus }
});
modalRef.afterClose.subscribe(res => {
if (res) {
this.st.reload();
}
});
}
// 编辑
edit(record: STData) {
const modalRef = this.modalService.create({
nzWidth:500,
nzTitle: '编辑',
nzContent: ParterLevelConfigEditComponent,
nzComponentParams: { i: record, type: this.spuStatus }
});
modalRef.afterClose.subscribe(res => {
if (res) {
this.st.reload();
}
});
}
// 编辑
view(record: STData) {
const modalRef = this.modalService.create({
nzTitle: '查看',
nzContent: ParterLevelConfigEditComponent,
nzComponentParams: { i: record }
});
}
restart(id: any) {
this.modalService.confirm({
nzTitle: '<i>冻结确认</i>',
nzContent: `<b>确定启用该账号吗?</br>`,
// nzOnOk: () =>
// this.service.request('', '').subscribe(res => {
// if (res) {
// this.service.msgSrv.success('冻结成功!');
// this.st.reload();
// }
// })
});
}
stop(id: any) {
this.modalService.confirm({
nzTitle: '<i>冻结确认</i>',
nzContent: `<b>确定禁用该账号吗?</br>`,
// nzOnOk: () =>
// this.service.request('', '').subscribe(res => {
// if (res) {
// this.service.msgSrv.success('冻结成功!');
// this.st.reload();
// }
// })
});
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
this.st.load(1);
}
}

View File

@ -0,0 +1,12 @@
import { Injectable, Injector } from '@angular/core';
import { BaseService } from '@shared';
@Injectable({
providedIn: 'root',
})
export class ChannelSalesService extends BaseService {
constructor(public injector: Injector) {
super(injector);
}
}

View File

@ -1,9 +1,27 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { PartnerBusinessStatisticsIndexComponent } from './business-statistics/components/index/index.component';
import { ParterChannelSalesEditComponent } from './channel-sales/components/edit/edit.component';
import { ParterChannelSalesListComponent } from './channel-sales/components/list/list.component';
import { ParterLevelConfigEditComponent } from './level-config/components/edit/edit.component';
import { ParterLevelConfigListComponent } from './level-config/components/list/list.component';
const routes: Routes = [
{ path: 'index', component: PartnerBusinessStatisticsIndexComponent }];
{ path: 'index', component: PartnerBusinessStatisticsIndexComponent },
{ path: 'channel-sales',
children:[
{path: 'list', component: ParterChannelSalesListComponent},
{path: 'edit', component: ParterChannelSalesEditComponent},
]
},
{ path: 'level-config',
children:[
{path: 'list', component: ParterLevelConfigListComponent},
{path: 'edit', component: ParterLevelConfigEditComponent},
]
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],

View File

@ -3,9 +3,18 @@ import { CommonModule } from '@angular/common';
import { SharedModule } from '@shared';
import { PartnerRoutingModule } from './partner-routing.module';
import { PartnerBusinessStatisticsIndexComponent } from './business-statistics/components/index/index.component';
import { ParterChannelSalesListComponent } from './channel-sales/components/list/list.component';
import { ParterChannelSalesEditComponent } from './channel-sales/components/edit/edit.component';
import { ParterLevelConfigEditComponent } from './level-config/components/edit/edit.component';
import { ParterLevelConfigListComponent } from './level-config/components/list/list.component';
const COMPONENTS: any[] = [
PartnerBusinessStatisticsIndexComponent];
PartnerBusinessStatisticsIndexComponent,
ParterChannelSalesListComponent,
ParterChannelSalesEditComponent,
ParterLevelConfigListComponent,
ParterLevelConfigEditComponent
];
@NgModule({
declarations: [...COMPONENTS],
imports: [CommonModule, PartnerRoutingModule, SharedModule]