This commit is contained in:
Taric Xin
2022-03-28 09:38:54 +08:00
parent 3de3f4dd35
commit 3308386da5

View File

@ -1,7 +1,15 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { STComponent, STColumn, STChange } from '@delon/abc/st'; import { STComponent, STColumn, STChange } from '@delon/abc/st';
import { SFCascaderWidgetSchema, SFComponent, SFRadioWidgetSchema, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, SFUISchema } from '@delon/form'; import {
SFCascaderWidgetSchema,
SFComponent,
SFRadioWidgetSchema,
SFSchema,
SFSchemaEnum,
SFSelectWidgetSchema,
SFUISchema
} from '@delon/form';
import { DynamicSettingModalComponent, SinglepageSettingModalComponent } from '@shared'; import { DynamicSettingModalComponent, SinglepageSettingModalComponent } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal'; import { NzModalService } from 'ng-zorro-antd/modal';
import { of } from 'rxjs'; import { of } from 'rxjs';
@ -32,10 +40,10 @@ export class NetworkFreightComponent implements OnInit {
ticketSchema: SFSchema = {}; ticketSchema: SFSchema = {};
TaxSchema: SFSchema = {}; TaxSchema: SFSchema = {};
NCSchema: SFSchema = {}; NCSchema: SFSchema = {};
_$expand :boolean= false; _$expand: boolean = false;
taxStatus :boolean= false; taxStatus: boolean = false;
TicketStatus :boolean= true; TicketStatus: boolean = true;
NCStatus :boolean = false; NCStatus: boolean = false;
formData: any; formData: any;
ticketId: any; ticketId: any;
ticketItem: any; ticketItem: any;
@ -117,29 +125,28 @@ export class NetworkFreightComponent implements OnInit {
fixed: 'right', fixed: 'right',
className: 'text-center', className: 'text-center',
buttons: [ buttons: [
{ type: 'divider' },
{ {
text: '基础设置', text: '基础设置<br>',
click: item => this.creat(item) click: item => this.creat(item)
}, },
{ {
text: '财务设置', text: '财务设置<br>',
click: item => this.ticket(item) click: item => this.ticket(item)
}, },
{ {
text: '充值账户', text: '充值账户<br>',
click: item => this.settingPay(item) click: item => this.settingPay(item)
}, },
{ {
text: '应用设置', text: '应用设置<br>',
click: item => this.settingApp(item) click: item => this.settingApp(item)
}, },
{ {
text: '系统配置', text: '系统配置<br>',
click: item => this.settingAction(item) click: item => this.settingAction(item)
}, },
{ type: 'divider' },
// { // {
// text: '合同设置', // text: '合同设置',
// click: item => this.roleAction(item, 2) // click: item => this.roleAction(item, 2)
@ -337,9 +344,9 @@ export class NetworkFreightComponent implements OnInit {
'drawer' 'drawer'
] ]
}; };
this.ui3 = { this.ui3 = {
'*': { spanLabelFixed: 150, grid: { span: 24 } }, '*': { spanLabelFixed: 150, grid: { span: 24 } },
'$taxClassificationVersion': { spanLabelFixed: 150, grid: { span: 24 } }, $taxClassificationVersion: { spanLabelFixed: 150, grid: { span: 24 } }
}; };
} }
initSFTax() { initSFTax() {
@ -377,7 +384,7 @@ export class NetworkFreightComponent implements OnInit {
let str = q.replace(/^\s+|\s+$/g, ''); let str = q.replace(/^\s+|\s+$/g, '');
if (str) { if (str) {
console.log(str); console.log(str);
return this.service return this.service
.request(this.service.$api_get_crmCustomer_page, { customerName: str }) .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)))) .pipe(map((res: any) => (res.records as any[]).map(i => ({ label: i.customerName, value: i.id } as SFSchemaEnum))))
@ -387,12 +394,11 @@ export class NetworkFreightComponent implements OnInit {
} }
} }
} as SFSelectWidgetSchema } as SFSelectWidgetSchema
}, }
}, },
required: ['crmCustomerId'] required: ['crmCustomerId']
}; };
this.ui5 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } }; this.ui5 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
} }
initSFFre() { initSFFre() {
this.addSchema = { this.addSchema = {
@ -444,16 +450,16 @@ export class NetworkFreightComponent implements OnInit {
this.formDataNC = []; this.formDataNC = [];
this.formDataTax = []; this.formDataTax = [];
this.ticketItem = value; this.ticketItem = value;
this.taxStatus = false this.taxStatus = false;
this.TicketStatus = true this.TicketStatus = true;
this.NCStatus = false this.NCStatus = false;
this.initSFTax(); this.initSFTax();
this.initSFNC(); this.initSFNC();
this.initSFTicket(); this.initSFTicket();
this.NCID = value.id; this.NCID = value.id;
if(this.TicketStatus) { if (this.TicketStatus) {
console.log('9999999'); console.log('9999999');
this.service.request(this.service.$api_getTicketByNetworkTransporterId, { id: value.id }).subscribe((res: any) => { this.service.request(this.service.$api_getTicketByNetworkTransporterId, { id: value.id }).subscribe((res: any) => {
console.log(res); console.log(res);
if (res) { if (res) {
@ -466,8 +472,8 @@ export class NetworkFreightComponent implements OnInit {
} }
}); });
} }
if(this.NCStatus) { if (this.NCStatus) {
this.getNcSetData() this.getNcSetData();
} }
this.isVisibleTicket = true; this.isVisibleTicket = true;
} }
@ -477,12 +483,12 @@ export class NetworkFreightComponent implements OnInit {
this.service.request(this.service.$api_get_crmCustomer, { id: this.ticketItem.crmCustomerId }).subscribe((res: any) => { this.service.request(this.service.$api_get_crmCustomer, { id: this.ticketItem.crmCustomerId }).subscribe((res: any) => {
console.log(res); console.log(res);
if (res) { if (res) {
List.push({ label: res.customerName, value: res.id }); List.push({ label: res.customerName, value: res.id });
console.log(List); console.log(List);
this.sfNC.getProperty('/crmCustomerId')!.schema.enum = List; this.sfNC.getProperty('/crmCustomerId')!.schema.enum = List;
this.sfNC.getProperty('/crmCustomerId')!.widget.reset(List); this.sfNC.getProperty('/crmCustomerId')!.widget.reset(List);
this.sfNC.setValue('/crmCustomerId', res?.id); this.sfNC.setValue('/crmCustomerId', res?.id);
} }
}); });
} }
@ -493,7 +499,7 @@ export class NetworkFreightComponent implements OnInit {
regioin?.forEach((element: any) => { regioin?.forEach((element: any) => {
enterpriseAddressCode.push(Number(element)); enterpriseAddressCode.push(Number(element));
}); });
if(this.TicketStatus) { if (this.TicketStatus) {
this.sfTicket.setValue('/senderRegionCode', enterpriseAddressCode); this.sfTicket.setValue('/senderRegionCode', enterpriseAddressCode);
return enterpriseAddressCode; return enterpriseAddressCode;
} }
@ -587,11 +593,11 @@ export class NetworkFreightComponent implements OnInit {
this.isVisibleTicket = false; this.isVisibleTicket = false;
} }
handleOKTicket() { handleOKTicket() {
console.log( this.taxStatus, this.TicketStatus,this.NCStatus); console.log(this.taxStatus, this.TicketStatus, this.NCStatus);
if(this.TicketStatus) { if (this.TicketStatus) {
console.log(this.sfTicket); console.log(this.sfTicket);
console.log(this.sfTicket.value); console.log(this.sfTicket.value);
if (!this.sfTicket.valid) { if (!this.sfTicket.valid) {
this.service.msgSrv.warning('请正确填写完整!'); this.service.msgSrv.warning('请正确填写完整!');
return; return;
@ -611,11 +617,11 @@ export class NetworkFreightComponent implements OnInit {
this.st.reload(1); this.st.reload(1);
} }
}); });
} else if(this.NCStatus){ } else if (this.NCStatus) {
console.log(this.sfNC); console.log(this.sfNC);
console.log(this.formDataNC); console.log(this.formDataNC);
console.log(this.sfNC?.value); console.log(this.sfNC?.value);
if (!this.sfNC.valid) { if (!this.sfNC.valid) {
this.service.msgSrv.warning('请正确填写完整!'); this.service.msgSrv.warning('请正确填写完整!');
return; return;
@ -636,7 +642,6 @@ export class NetworkFreightComponent implements OnInit {
}); });
// api_setCrmCustomer // api_setCrmCustomer
} }
} }
handleOK() { handleOK() {
@ -674,12 +679,12 @@ export class NetworkFreightComponent implements OnInit {
this.taxStatus = true; this.taxStatus = true;
this.TicketStatus = false; this.TicketStatus = false;
this.NCStatus = false; this.NCStatus = false;
} else if (value.name === '开票设置'){ } else if (value.name === '开票设置') {
this.TicketStatus = true; this.TicketStatus = true;
this.NCStatus = false; this.NCStatus = false;
this.taxStatus = false; this.taxStatus = false;
} else if (value.name === 'NC设置'){ } else if (value.name === 'NC设置') {
this.getNcSetData() this.getNcSetData();
this.NCStatus = true; this.NCStatus = true;
this.TicketStatus = false; this.TicketStatus = false;
this.taxStatus = false; this.taxStatus = false;