fix bug
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { STComponent, STColumn, STChange } from '@delon/abc/st';
|
||||
import { SFCascaderWidgetSchema, SFComponent, SFRadioWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
|
||||
import { SFCascaderWidgetSchema, SFComponent, SFRadioWidgetSchema, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
|
||||
import { DynamicSettingModalComponent, SinglepageSettingModalComponent } from '@shared';
|
||||
import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { takeLast } from 'rxjs/operators';
|
||||
import { of } from 'rxjs';
|
||||
import { map, takeLast } from 'rxjs/operators';
|
||||
import { AccountDetailComponent } from 'src/app/shared/components/account-detail/account-detail.component';
|
||||
import { SystemService } from '../../services/system.service';
|
||||
|
||||
@ -20,26 +21,33 @@ export class NetworkFreightComponent implements OnInit {
|
||||
@ViewChild('sfFre', { static: false }) sfFre!: SFComponent;
|
||||
@ViewChild('sfTicket', { static: false }) sfTicket!: SFComponent;
|
||||
@ViewChild('sfTax', { static: false }) sfTax!: SFComponent;
|
||||
@ViewChild('sfNC', { static: false }) sfNC!: SFComponent;
|
||||
ui: SFUISchema = {};
|
||||
ui2: SFUISchema = {};
|
||||
ui3: SFUISchema = {};
|
||||
ui4: SFUISchema = {};
|
||||
ui5: SFUISchema = {};
|
||||
schema: SFSchema = {};
|
||||
addSchema: SFSchema = {};
|
||||
ticketSchema: SFSchema = {};
|
||||
TaxSchema: SFSchema = {};
|
||||
_$expand = false;
|
||||
taxStatus = false;
|
||||
NCSchema: SFSchema = {};
|
||||
_$expand :boolean= false;
|
||||
taxStatus :boolean= false;
|
||||
TicketStatus :boolean= true;
|
||||
NCStatus :boolean = false;
|
||||
formData: any;
|
||||
ticketId: any;
|
||||
ticketItem: any;
|
||||
formDataTicket: any;
|
||||
formDataNC: any;
|
||||
formDataTax: any;
|
||||
NCID: string = '';
|
||||
isVisible = false;
|
||||
isVisibleTicket = false;
|
||||
edit = false;
|
||||
editId = false;
|
||||
tabs: any[] = [{ name: '开票设置' }, { name: '税务设置' }];
|
||||
tabs: any[] = [{ name: '开票设置' }, { name: '税务设置' }, { name: 'NC设置' }];
|
||||
|
||||
columns: STColumn[] = [
|
||||
{
|
||||
@ -350,6 +358,42 @@ export class NetworkFreightComponent implements OnInit {
|
||||
};
|
||||
this.ui4 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
|
||||
}
|
||||
initSFNC() {
|
||||
this.NCSchema = {
|
||||
properties: {
|
||||
crmCustomerId: {
|
||||
type: 'string',
|
||||
title: 'CRM客户编码',
|
||||
ui: {
|
||||
widget: 'select',
|
||||
serverSearch: true,
|
||||
searchDebounceTime: 300,
|
||||
searchLoadingText: '搜索中...',
|
||||
visibleIf: {
|
||||
_$expand: (value: boolean) => value
|
||||
},
|
||||
allowClear: true,
|
||||
onSearch: (q: any) => {
|
||||
let str = q.replace(/^\s+|\s+$/g, '');
|
||||
if (str) {
|
||||
console.log(str);
|
||||
|
||||
return this.service
|
||||
.request(this.service.$api_get_crmCustomer_page, { customerName: str })
|
||||
.pipe(map((res: any) => (res.records as any[]).map(i => ({ label: i.customerName, value: i.id } as SFSchemaEnum))))
|
||||
.toPromise();
|
||||
} else {
|
||||
return of([]);
|
||||
}
|
||||
}
|
||||
} as SFSelectWidgetSchema
|
||||
},
|
||||
},
|
||||
required: ['crmCustomerId']
|
||||
};
|
||||
this.ui5 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
|
||||
|
||||
}
|
||||
initSFFre() {
|
||||
this.addSchema = {
|
||||
properties: {
|
||||
@ -397,36 +441,44 @@ export class NetworkFreightComponent implements OnInit {
|
||||
// 财务设置
|
||||
ticket(value: any) {
|
||||
this.formDataTicket = [];
|
||||
this.formDataNC = [];
|
||||
this.formDataTax = [];
|
||||
this.ticketItem = value;
|
||||
this.taxStatus = false
|
||||
this.TicketStatus = true
|
||||
this.NCStatus = false
|
||||
this.initSFTax();
|
||||
this.initSFNC();
|
||||
this.initSFTicket();
|
||||
this.service.request(this.service.$api_getTicketByNetworkTransporterId, { id: value.id }).subscribe((res: any) => {
|
||||
console.log(res);
|
||||
if (res) {
|
||||
let List = {
|
||||
...res
|
||||
};
|
||||
delete List.senderRegionCode;
|
||||
(List.senderRegionCode = this.getProvinceData(res?.senderRegionCode)), (this.formDataTicket = List);
|
||||
this.ticketId = res.id;
|
||||
}
|
||||
});
|
||||
this.NCID = value.id;
|
||||
if(this.TicketStatus) {
|
||||
console.log('9999999');
|
||||
|
||||
this.service.request(this.service.$api_getTicketByNetworkTransporterId, { id: value.id }).subscribe((res: any) => {
|
||||
console.log(res);
|
||||
if (res) {
|
||||
let List = {
|
||||
...res
|
||||
};
|
||||
delete List.senderRegionCode;
|
||||
(List.senderRegionCode = this.getProvinceData(res?.senderRegionCode)), (this.formDataTicket = List);
|
||||
this.ticketId = res.id;
|
||||
}
|
||||
});
|
||||
}
|
||||
this.isVisibleTicket = true;
|
||||
}
|
||||
getProvinceData(value: any) {
|
||||
this.service.http.post(this.service.$api_getRegionDetailByCode, { regionCode: value }).subscribe(res => {
|
||||
console.log(res.data);
|
||||
console.log(this.formDataTicket);
|
||||
let enterpriseAddressCode: any = [];
|
||||
let regioin = res?.data?.regionFullCodes.split(',');
|
||||
console.log(regioin);
|
||||
regioin?.forEach((element: any) => {
|
||||
enterpriseAddressCode.push(Number(element));
|
||||
});
|
||||
console.log(enterpriseAddressCode);
|
||||
this.sfTicket.setValue('/senderRegionCode', enterpriseAddressCode);
|
||||
return enterpriseAddressCode;
|
||||
if(this.TicketStatus) {
|
||||
this.sfTicket.setValue('/senderRegionCode', enterpriseAddressCode);
|
||||
return enterpriseAddressCode;
|
||||
}
|
||||
});
|
||||
}
|
||||
deleteAction(item?: any) {
|
||||
@ -517,27 +569,56 @@ export class NetworkFreightComponent implements OnInit {
|
||||
this.isVisibleTicket = false;
|
||||
}
|
||||
handleOKTicket() {
|
||||
console.log(this.sfTicket.valid);
|
||||
console.log(this.sfTicket.value);
|
||||
if (!this.sfTicket.valid) {
|
||||
this.service.msgSrv.warning('请正确填写完整!');
|
||||
return;
|
||||
}
|
||||
const params = {
|
||||
...this.sfTicket.value
|
||||
};
|
||||
if (this.ticketId) {
|
||||
params.id = this.ticketId;
|
||||
}
|
||||
params.senderRegionCode = this.sfTicket.value.senderRegionCode[2];
|
||||
console.log(params);
|
||||
this.service.request(this.service.$api_networkTransporterTicket_save, params).subscribe((res: any) => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success('保存成功!');
|
||||
this.isVisibleTicket = false;
|
||||
this.st.reload(1);
|
||||
console.log( this.taxStatus, this.TicketStatus,this.NCStatus);
|
||||
if(this.TicketStatus) {
|
||||
console.log(this.sfTicket);
|
||||
console.log(this.sfTicket.value);
|
||||
|
||||
if (!this.sfTicket.valid) {
|
||||
this.service.msgSrv.warning('请正确填写完整!');
|
||||
return;
|
||||
}
|
||||
});
|
||||
const params = {
|
||||
...this.sfTicket.value
|
||||
};
|
||||
if (this.ticketId) {
|
||||
params.id = this.ticketId;
|
||||
}
|
||||
params.senderRegionCode = this.sfTicket.value.senderRegionCode[2];
|
||||
console.log(params);
|
||||
this.service.request(this.service.$api_networkTransporterTicket_save, params).subscribe((res: any) => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success('保存成功!');
|
||||
this.isVisibleTicket = false;
|
||||
this.st.reload(1);
|
||||
}
|
||||
});
|
||||
} else if(this.NCStatus){
|
||||
console.log(this.sfNC);
|
||||
console.log(this.formDataNC);
|
||||
console.log(this.sfNC?.value);
|
||||
|
||||
if (!this.sfNC.valid) {
|
||||
this.service.msgSrv.warning('请正确填写完整!');
|
||||
return;
|
||||
}
|
||||
const params = {
|
||||
...this.sfNC.value
|
||||
};
|
||||
if (this.NCID) {
|
||||
params.id = this.NCID;
|
||||
}
|
||||
console.log(params);
|
||||
this.service.request(this.service.$api_setCrmCustomer, params).subscribe((res: any) => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success('保存成功!');
|
||||
this.isVisibleTicket = false;
|
||||
this.st.reload(1);
|
||||
}
|
||||
});
|
||||
// api_setCrmCustomer
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
handleOK() {
|
||||
@ -571,11 +652,19 @@ export class NetworkFreightComponent implements OnInit {
|
||||
return this.service.request(this.service.$api_get_region_by_code, { regionCode });
|
||||
}
|
||||
changeType(value: any) {
|
||||
console.log(value);
|
||||
if (value.name === '税务设置') {
|
||||
this.taxStatus = true;
|
||||
} else {
|
||||
this.TicketStatus = false;
|
||||
this.NCStatus = false;
|
||||
} else if (value.name === '开票设置'){
|
||||
this.TicketStatus = true;
|
||||
this.NCStatus = false;
|
||||
this.taxStatus = false;
|
||||
} else if (value.name === 'NC设置'){
|
||||
this.NCStatus = true;
|
||||
this.TicketStatus = false;
|
||||
this.taxStatus = false;
|
||||
|
||||
}
|
||||
}
|
||||
// 新增
|
||||
|
||||
Reference in New Issue
Block a user