Files
bbq/src/app/routes/partner/rebate-management/components/rebate-setting/rebate-setting.component.ts
wangshiming ac7eb6e3db fix bug
2022-03-28 20:29:22 +08:00

179 lines
4.2 KiB
TypeScript

import { ModalHelper } from '@delon/theme';
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFDateWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
import { processSingleSort, ShipperBaseService } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal';
import { RebateManagementService } from '../../services/rebate-management.service';
import { ParterRebateManageMenRecordDetailComponent } from '../../model/record-detail/record-detail.component';
import { ParterRebateManageMenAbnormalFeedbackComponent } from '../../model/abnormal-feedback/abnormal-feedback.component';
@Component({
selector: 'app-parter-channel-rebate-management-setting',
templateUrl: './rebate-setting.component.html'
})
export class ParterRebateManageMentSettingComponent implements OnInit {
schema: SFSchema = {};
columns!: STColumn[];
ui!: SFUISchema;
@ViewChild('st', { static: false })
st!: STComponent;
@ViewChild('sf', { static: false })
sf!: SFComponent;
spuStatus = '1';
_$expand = false;
data = [{ name1: 1111 }];
constructor(
public router: Router,
public ar: ActivatedRoute,
public service: RebateManagementService,
private modal: NzModalService,
public shipperservice: ShipperBaseService,
) {}
/**
* 查询字段个数
*/
get queryFieldCount(): number {
return Object.keys(this.schema?.properties || {}).length;
}
/**
* 伸缩查询条件
*/
expandToggle(): void {
this._$expand = !this._$expand;
this.sf?.setValue('/_$expand', this._$expand);
}
/**
* 查询参数
*/
get reqParams() {
const params: any = Object.assign({}, this.sf?.value || {});
delete params._$expand;
return {
...params,
deadlineTime: {
start: this.sf?.value?.deadlineTime?.[0] || '',
end: this.sf?.value?.deadlineTime?.[1] || '',
},
};
}
ngOnInit() {
this.initSF();
this.initST();
}
initSF() {
this.schema = {
properties: {
_$expand: { type: 'boolean', ui: { hidden: true } },
month: {
type: 'string',
title: '时间月份',
format: 'month',
},
partnerId: {
type: 'string',
title: '合伙人名称'
},
}
};
this.ui = {
'*': {
spanLabelFixed: 140,
grid: { span: 8, gutter: 4 }
}
};
}
initST() {
this.columns = [
{
title: '月份',
index: '配置名称'
},
{
title: '配置类型',
index: 'configType'
},
{
title: '备注',
index: 'remark'
},
{
title: '关联合伙人范围',
index: 'partnerType'
},
{
title: '创建时间',
index: 'enableTime'
},
{
title: '启用时间',
index: 'enableTime'
},
{
title: '优先级',
index: 'priority'
},
{
title: '状态',
index: 'stateLocked'
},
{
title: '操作',
fixed: 'right',
width: '90px',
className: 'text-left',
buttons: [
{
text: '查看',
click: _record => this.viewEvaluate(_record),
},
{
text: '禁用',
click: _record => this.viewEvaluate(_record),
},
]
}
];
}
/**
*禁用
*/
viewEvaluate(item: any) {
this.modal.confirm({
nzTitle: '是否禁用该配置?',
nzOnOk: () => {
}
});
}
/**
*查看
*/
feedback(item?: any) {
const modal = this.modal.create({
nzTitle: '查看',
nzWidth: 580,
nzContent: ParterRebateManageMenAbnormalFeedbackComponent,
nzComponentParams: { i: item },
nzFooter: null
});
modal.afterClose.subscribe((res: any) => {
if (res) {
}
});
}
configAction() {
this.router.navigate(['/partner/rebate/setting/add/', 1])
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
this.st.load(1);
}
}