This commit is contained in:
Taric Xin
2022-02-22 20:20:05 +08:00
parent 4160cf8f52
commit 09c054a8d3
7 changed files with 67 additions and 35 deletions

View File

@ -7,5 +7,5 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button nz-button type="button" (click)="close()">取消</button> <button nz-button type="button" (click)="close()">取消</button>
<button nz-button type="button" nzType="primary" (click)="sure()" [disabled]="!sf.valid">保存</button> <button nz-button type="button" nzType="primary" (click)="configType===3?configAction():sure()" [disabled]="!sf.valid">保存</button>
</div> </div>

View File

@ -114,6 +114,29 @@ export class CartConfigActionModalComponent implements OnInit {
} }
} }
configAction() {
if (this.i.id === 0) {
const params: any = {
configFullKey: 'ban.goods.name',
name: this.sf.value.itemValue
};
this.service.request(this.service.$api_add_config_item, params).subscribe(res => {
if (res) {
this.service.msgSrv.success('保存成功!');
this.modal.close(true);
}
});
} else {
const params: any = { ...this.sf.value, ...this.i, configFullKey: 'ban.goods.name', name: this.sf.value.itemValue };
this.service.request(this.service.$api_update_config_item, params).subscribe(res => {
if (res) {
this.service.msgSrv.success('保存成功!');
this.modal.close(true);
}
});
}
}
close() { close() {
this.modal.destroy(); this.modal.destroy();
} }

View File

@ -13,7 +13,7 @@
[button]="'none'"></sf> [button]="'none'"></sf>
</div> </div>
<div nz-col [nzSpan]="8" nzOffset="1"> <div nz-col [nzSpan]="8" nzOffset="1">
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">查询</button> <button nz-button nzType="primary" [nzLoading]="loading" (click)="st?.load(1)">查询</button>
<button nz-button (click)="resetSF()">重置</button> <button nz-button (click)="resetSF()">重置</button>
</div> </div>
</div> </div>
@ -25,6 +25,7 @@
<button nz-button nzType="primary" (click)="configAction()">新增</button> <button nz-button nzType="primary" (click)="configAction()">新增</button>
</div> </div>
</div> </div>
<st #st [data]="service.$api_get_dict_page" [columns]="columns" [req]="{ params: reqParams }" <st #st [data]="tabType === 3?service.$api_get_config_item_page:service.$api_get_dict_page" [columns]="columns"
[loading]="service.http.loading" [scroll]="{ y: '370px' }"></st> [req]="{process: beforeReq }" [res]="{ process: afterRes }" [loading]="loading"
[scroll]="{ y: '370px' }"></st>
</nz-card> </nz-card>

View File

@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
import { STComponent, STColumn, STChange } from '@delon/abc/st'; import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema } from '@delon/form'; import { SFComponent, SFSchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal'; import { NzModalService } from 'ng-zorro-antd/modal';
import { SystemService } from '../../services/system.service'; import { SystemService } from '../../services/system.service';
@ -8,7 +8,8 @@ import { CartConfigActionModalComponent } from './cart-config-action-modal/cart-
@Component({ @Component({
selector: 'app-cart-config', selector: 'app-cart-config',
templateUrl: './cart-config.component.html', templateUrl: './cart-config.component.html',
styleUrls: ['./cart-config.component.less'] styleUrls: ['./cart-config.component.less'],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class CartConfigComponent implements OnInit { export class CartConfigComponent implements OnInit {
@ViewChild('st', { static: true }) @ViewChild('st', { static: true })
@ -109,7 +110,12 @@ export class CartConfigComponent implements OnInit {
} }
]; ];
get reqParams() { loading = true;
constructor(public service: SystemService, private nzModalService: NzModalService, private cdr: ChangeDetectorRef) {}
ngOnInit(): void {}
beforeReq = (requestOptions: STRequestOptions) => {
let params = {}; let params = {};
switch (this.tabType) { switch (this.tabType) {
case 1: case 1:
@ -119,45 +125,44 @@ export class CartConfigComponent implements OnInit {
Object.assign(params, { dictKey: 'car:length', itemValue: this.sf?.value.params2 }); Object.assign(params, { dictKey: 'car:length', itemValue: this.sf?.value.params2 });
break; break;
case 3: case 3:
Object.assign(params, { dictKey: 'ban.goods.name', itemValue: this.sf?.value.params3 }); Object.assign(params, { configFullKey: 'ban.goods.name', itemValue: this.sf?.value.params3 });
break; break;
default: default:
break; break;
} }
return { ...params }; Object.assign(requestOptions.body, params);
} this.loading = true;
return requestOptions;
};
constructor(public service: SystemService, private nzModalService: NzModalService) {} afterRes = (data: any[], rawData?: any) => {
this.loading = false;
ngOnInit(): void {} return data;
};
// 切换Tab // 切换Tab
changeTab(item: any) { changeTab(item: any) {
this.tabType = item.type; this.tabType = item.type;
this.sf?.setValue('/tabType', item.type); this.sf?.setValue('/tabType', item.type);
this.sf?.reset(); this.sf?.reset();
setTimeout(() => { // this.tabs.forEach(i => (i.isActived = false));
this.tabs.forEach(i => (i.isActived = false)); // item.isActived = !item.isActived;
item.isActived = !item.isActived;
this.st.load(1); this.st.load(1);
this.st.resetColumns(); this.st.resetColumns();
}, 500); // this.cdr.detectChanges();
} }
configAction(item?: any) { configAction(item?: any) {
console.log(item)
console.log(this.tabType)
const modal = this.nzModalService.create({ const modal = this.nzModalService.create({
nzContent: CartConfigActionModalComponent, nzContent: CartConfigActionModalComponent,
nzComponentParams: item nzComponentParams: item ? { i: { ...item }, configType: this.tabType } : { i: { id: 0 }, configType: this.tabType },
? { i: { ...item }, configType: this.tabType }
: { i: { id: 0 }, configType: this.tabType },
nzFooter: null nzFooter: null
}); });
modal.afterClose.subscribe(res => { modal.afterClose.subscribe(res => {
if (res) { if (res) {
this.st.load(); this.st.load();
this.cdr.detectChanges();
} }
}); });
} }
@ -168,10 +173,12 @@ export class CartConfigComponent implements OnInit {
nzClosable: false, nzClosable: false,
nzCancelText: '取消', nzCancelText: '取消',
nzOnOk: () => { nzOnOk: () => {
this.service.request(this.service.$api_delete_dict_by_ids, [item.id]).subscribe(res => { this.service
.request(this.tabType === 3 ? this.service.$api_remove_config_item : this.service.$api_delete_dict_by_ids, [item.id])
.subscribe(res => {
if (res) { if (res) {
this.service.msgSrv.success('删除配置成功'); this.service.msgSrv.success('删除配置成功');
this.st.load(); this.st.load(1);
} }
}); });
} }

View File

@ -127,7 +127,7 @@ export class GoodsNameConfigComponent implements OnInit {
} }
/** /**
* 货物类型操作 * 货物名称操作
* @param item * @param item
*/ */
typeItemAction(item?: any) { typeItemAction(item?: any) {

View File

@ -83,6 +83,7 @@ export class FreightComponentsListComponent implements OnInit {
roleId: item.id, roleId: item.id,
ctfId: item.unifiedSocialCreditCode, ctfId: item.unifiedSocialCreditCode,
clientName: item.enterpriseName, clientName: item.enterpriseName,
projectId: item.mainProjectId,
ltdId: item.networkTransporter ltdId: item.networkTransporter
} }
}, },

View File

@ -28,10 +28,10 @@ export class AccountDetailComponent implements OnInit {
return; return;
} }
const params = { const params = {
ltdId: item.ltdId, ltdId: item.ltdId || this.params.ltdId,
roleId: item.roleId, roleId: item.roleId,
projectId: item.projectId, projectId: item.projectId || this.params.projectId,
enterpriseId: item.enterpriseId, enterpriseId: item.enterpriseId || this.params.roleId,
ctfId: this.params.ctfId, ctfId: this.params.ctfId,
clientName: this.params.clientName, clientName: this.params.clientName,
roleName: this.params.clientName roleName: this.params.clientName