diff --git a/src/app/routes/partner/channel-sales/components/edit/edit.component.ts b/src/app/routes/partner/channel-sales/components/edit/edit.component.ts index 5e5d6e85..143c8f4f 100644 --- a/src/app/routes/partner/channel-sales/components/edit/edit.component.ts +++ b/src/app/routes/partner/channel-sales/components/edit/edit.component.ts @@ -1,6 +1,6 @@ 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 { SFAutoCompleteWidgetSchema, 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'; @@ -38,18 +38,37 @@ export class ParterChannelSalesEditComponent implements OnInit { title: '', ui: { hidden: true } }, - name1: { - title: '业务员选择', + name: { + title: '渠道销售姓名', type: 'string', - enum: [ - { label: '王武', value: '1'}, - ], + maxLength: 12, ui: { - widget: 'select', - placeholder:'请选择' - } as SFSelectWidgetSchema, + placeholder:'请输入' + } }, - name2: { + phoneNumber: { + title: '手机号', + type: 'string', + maxLength: 11, + ui: { + placeholder:'请输入' + } + }, + employeeVO: { + title: '关联OA员工', + type: 'string', + ui: { + widget: 'autocomplete', + placeholder:'请选择', + asyncData: () => this.service.request(this.service.$api_fuzzyQuery).pipe( + map((res: any) => { + console.log('111',res) + return []; + }) + ) + } as SFAutoCompleteWidgetSchema, + }, + isAuthorization: { type: 'string', title: '授权登录运营后台', enum: [ @@ -59,9 +78,9 @@ export class ParterChannelSalesEditComponent implements OnInit { ui: { widget: 'radio', } as SFRadioWidgetSchema, - default: 'A', + default: '0', }, - name: { + roleIds: { title: '', type: 'string', enum: [ @@ -70,10 +89,10 @@ export class ParterChannelSalesEditComponent implements OnInit { ui: { widget: 'select', placeholder:'授权角色', - visibleIf: { name2: (value: string) => value === '1' } + visibleIf: { isAuthorization: (value: string) => value === '1' } } as SFSelectWidgetSchema, }, - name3: { + remark: { type: 'string', title: '备注', maxLength: 50, @@ -84,15 +103,16 @@ export class ParterChannelSalesEditComponent implements OnInit { } as SFTextareaWidgetSchema, }, }, - required: ['name1', 'name2'] + required: ['name', 'phoneNumber', 'employeeVO', 'roleIds', 'remark'] }; this.ui = { '*': { spanLabelFixed: 150, grid: { span: 24 } }, - $name:{ spanLabelFixed: 10, grid: { span: 12 }}, - $name2:{ grid: { span: 12 }}, + $isAuthorization:{ grid: { span: 12 }}, + $roleIds:{ spanLabelFixed: 10, grid: { span: 12 }}, + }; } @@ -103,12 +123,12 @@ export class ParterChannelSalesEditComponent implements OnInit { 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); - // } - // }); + this.service.request(this.service.$api_save, { ...this.sf.value }).subscribe(res => { + if (res) { + this.modalRef.destroy(true); + } else { + this.service.msgSrv.error(res.msg); + } + }); } } diff --git a/src/app/routes/partner/channel-sales/components/list/list.component.html b/src/app/routes/partner/channel-sales/components/list/list.component.html index fd0078d8..589c32e9 100644 --- a/src/app/routes/partner/channel-sales/components/list/list.component.html +++ b/src/app/routes/partner/channel-sales/components/list/list.component.html @@ -15,7 +15,7 @@