edit
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { STComponent, STColumn, STChange } from '@delon/abc/st';
|
||||
import { SFComponent, SFRadioWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
|
||||
import { DynamicSettingModalComponent } from '@shared';
|
||||
import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { SystemService } from '../../services/system.service';
|
||||
|
||||
@ -19,7 +20,7 @@ export class NetworkFreightComponent implements OnInit {
|
||||
schema: SFSchema = {};
|
||||
addSchema: SFSchema = {};
|
||||
_$expand = false;
|
||||
formData :any;
|
||||
formData: any;
|
||||
isVisible = false;
|
||||
edit = false;
|
||||
editId = false;
|
||||
@ -33,7 +34,13 @@ export class NetworkFreightComponent implements OnInit {
|
||||
{ title: '电子合同账号', index: 'electronicContractAccount' },
|
||||
{ title: '开户行', index: 'bankName' },
|
||||
{ title: '虚拟账户', index: 'virtualAccount' },
|
||||
{ title: '附加费比例', index: 'surchargeRate', format: (item: any) => {return item.surchargeRate + '%'} },
|
||||
{
|
||||
title: '附加费比例',
|
||||
index: 'surchargeRate',
|
||||
format: (item: any) => {
|
||||
return item.surchargeRate + '%';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
buttons: [
|
||||
@ -45,22 +52,27 @@ export class NetworkFreightComponent implements OnInit {
|
||||
text: '合同设置',
|
||||
click: item => this.roleAction(item, 2)
|
||||
},
|
||||
{
|
||||
text: '基础设置',
|
||||
click: item => this.settingAction(item)
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
selectedRows: any[] = [];
|
||||
|
||||
get reqParams (){
|
||||
get reqParams() {
|
||||
return {
|
||||
...this.sf?.value,
|
||||
}};
|
||||
...this.sf?.value
|
||||
};
|
||||
}
|
||||
|
||||
constructor(public service: SystemService, private nzModalService: NzModalService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.initSF()
|
||||
this.initSFFre()
|
||||
this.initSF();
|
||||
this.initSFFre();
|
||||
}
|
||||
|
||||
stChange(e: STChange): void {
|
||||
@ -73,83 +85,80 @@ export class NetworkFreightComponent implements OnInit {
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 伸缩查询条件
|
||||
*/
|
||||
expandToggle(): void {
|
||||
this._$expand = !this._$expand;
|
||||
this.sf?.setValue('/_$expand', this._$expand);
|
||||
}
|
||||
/**
|
||||
/**
|
||||
* 伸缩查询条件
|
||||
*/
|
||||
expandToggle(): void {
|
||||
this._$expand = !this._$expand;
|
||||
this.sf?.setValue('/_$expand', this._$expand);
|
||||
}
|
||||
/**
|
||||
* 查询字段个数
|
||||
*/
|
||||
get queryFieldCount(): number {
|
||||
return Object.keys(this.schema?.properties || {}).length;
|
||||
}
|
||||
initSF(){
|
||||
this.schema = {
|
||||
properties: {
|
||||
_$expand: { type: 'boolean', ui: { hidden: true } },
|
||||
enterpriseName: {
|
||||
type: 'string',
|
||||
title: '公司名称',
|
||||
ui: { placeholder: '请输入' }
|
||||
},
|
||||
taxCode: {
|
||||
type: 'string',
|
||||
title: '纳税人识别号',
|
||||
ui: { placeholder: '请输入' }
|
||||
},
|
||||
}
|
||||
|
||||
};
|
||||
this.ui = { '*': { spanLabelFixed: 110, grid: { span: 8, gutter: 4 } } };
|
||||
get queryFieldCount(): number {
|
||||
return Object.keys(this.schema?.properties || {}).length;
|
||||
}
|
||||
initSF() {
|
||||
this.schema = {
|
||||
properties: {
|
||||
_$expand: { type: 'boolean', ui: { hidden: true } },
|
||||
enterpriseName: {
|
||||
type: 'string',
|
||||
title: '公司名称',
|
||||
ui: { placeholder: '请输入' }
|
||||
},
|
||||
taxCode: {
|
||||
type: 'string',
|
||||
title: '纳税人识别号',
|
||||
ui: { placeholder: '请输入' }
|
||||
}
|
||||
}
|
||||
};
|
||||
this.ui = { '*': { spanLabelFixed: 110, grid: { span: 8, gutter: 4 } } };
|
||||
}
|
||||
initSFFre() {
|
||||
this.addSchema = {
|
||||
properties: {
|
||||
enterpriseName: {
|
||||
type: 'string',
|
||||
title: '公司名称',
|
||||
ui: { placeholder: '请输入' }
|
||||
},
|
||||
taxCode: {
|
||||
type: 'string',
|
||||
title: '纳税人识别号',
|
||||
ui: { placeholder: '请输入' }
|
||||
},
|
||||
customerCode: {
|
||||
type: 'string',
|
||||
title: '税收分类编码',
|
||||
ui: { placeholder: '请输入' }
|
||||
},
|
||||
invoiceTaxRate: {
|
||||
type: 'string',
|
||||
title: '发票税率',
|
||||
ui: { placeholder: '请输入' }
|
||||
},
|
||||
surchargeRate: {
|
||||
type: 'string',
|
||||
title: '附加费比例',
|
||||
ui: { placeholder: '请输入' }
|
||||
},
|
||||
|
||||
},
|
||||
required: ['enterpriseName', 'taxCode', 'customerType', 'invoiceTaxRate', 'surchargeRate']
|
||||
};
|
||||
this.ui2 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
|
||||
}
|
||||
roleAction(value: any,item?: any) {
|
||||
|
||||
this.service.request(this.service.$api_get_crmCustomer, {id: value.id}).subscribe((res: any) => {
|
||||
console.log(res)
|
||||
if(res) {
|
||||
this.formData = res;
|
||||
this.addSchema = {
|
||||
properties: {
|
||||
enterpriseName: {
|
||||
type: 'string',
|
||||
title: '公司名称',
|
||||
ui: { placeholder: '请输入' }
|
||||
},
|
||||
taxCode: {
|
||||
type: 'string',
|
||||
title: '纳税人识别号',
|
||||
ui: { placeholder: '请输入' }
|
||||
},
|
||||
customerCode: {
|
||||
type: 'string',
|
||||
title: '税收分类编码',
|
||||
ui: { placeholder: '请输入' }
|
||||
},
|
||||
invoiceTaxRate: {
|
||||
type: 'string',
|
||||
title: '发票税率',
|
||||
ui: { placeholder: '请输入' }
|
||||
},
|
||||
surchargeRate: {
|
||||
type: 'string',
|
||||
title: '附加费比例',
|
||||
ui: { placeholder: '请输入' }
|
||||
}
|
||||
})
|
||||
this.edit = true;
|
||||
this.editId = value.id;
|
||||
this.isVisible = true;
|
||||
},
|
||||
required: ['enterpriseName', 'taxCode', 'customerType', 'invoiceTaxRate', 'surchargeRate']
|
||||
};
|
||||
this.ui2 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
|
||||
}
|
||||
roleAction(value: any, item?: any) {
|
||||
this.service.request(this.service.$api_get_crmCustomer, { id: value.id }).subscribe((res: any) => {
|
||||
console.log(res);
|
||||
if (res) {
|
||||
this.formData = res;
|
||||
}
|
||||
});
|
||||
this.edit = true;
|
||||
this.editId = value.id;
|
||||
this.isVisible = true;
|
||||
}
|
||||
|
||||
deleteAction(item?: any) {
|
||||
@ -161,6 +170,19 @@ this.ui2 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
|
||||
});
|
||||
}
|
||||
|
||||
settingAction(item?: any) {
|
||||
this.nzModalService.create({
|
||||
nzTitle: '基础设置',
|
||||
nzContent: DynamicSettingModalComponent,
|
||||
nzWidth: 900,
|
||||
nzComponentParams: {
|
||||
extendType: '1',
|
||||
businessId: item.id
|
||||
},
|
||||
nzFooter: null
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置表单
|
||||
*/
|
||||
@ -168,30 +190,29 @@ this.ui2 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
|
||||
this.sf.reset();
|
||||
}
|
||||
handleCancel() {
|
||||
this.isVisible = false
|
||||
this.isVisible = false;
|
||||
}
|
||||
|
||||
handleOK() {
|
||||
console.log(this.sfFre.value)
|
||||
if(!this.sfFre.valid) {
|
||||
this.service.msgSrv.warning('请正确填写完整!')
|
||||
return
|
||||
console.log(this.sfFre.value);
|
||||
if (!this.sfFre.valid) {
|
||||
this.service.msgSrv.warning('请正确填写完整!');
|
||||
return;
|
||||
}
|
||||
const params ={
|
||||
const params = {
|
||||
...this.sfFre.value
|
||||
};
|
||||
if (this.editId) {
|
||||
params.id = this.editId;
|
||||
}
|
||||
if(this.editId) {
|
||||
params.id = this.editId
|
||||
}
|
||||
this.service.request(this.service.$api_save_crmCustomer, params).subscribe((res:any) => {
|
||||
if(res) {
|
||||
this.service.msgSrv.success('保存成功!')
|
||||
this.isVisible = false
|
||||
this.st.reload();
|
||||
this.service.request(this.service.$api_save_crmCustomer, params).subscribe((res: any) => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success('保存成功!');
|
||||
this.isVisible = false;
|
||||
this.st.reload();
|
||||
} else {
|
||||
this.service.msgSrv.warning(res?.msg)
|
||||
|
||||
this.service.msgSrv.warning(res?.msg);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user