From fe3d6b6f921f68d2e5861024b199802d65083756 Mon Sep 17 00:00:00 2001 From: Taric Xin Date: Thu, 13 Jan 2022 17:13:24 +0800 Subject: [PATCH] edit --- .../components/notify/notify.component.html | 14 +- .../components/widget/widget.component.html | 4 + .../components/list/list.component.html | 13 ++ .../components/list/list.component.ts | 136 ++++++++++++++++++ .../download/download-routing.module.ts | 14 ++ src/app/routes/download/download.module.ts | 12 ++ .../download/services/download.service.ts | 18 +++ .../freight-account.component.ts | 1 + src/app/routes/routes-routing.module.ts | 31 +++- .../components/driver/driver.component.ts | 16 +++ .../components/freight/list/list.component.ts | 16 +++ .../account-detail.component.html | 16 +++ .../account-detail.component.ts | 18 +-- src/style-icons-auto.ts | 6 +- 14 files changed, 288 insertions(+), 27 deletions(-) create mode 100644 src/app/routes/download/components/list/list.component.html create mode 100644 src/app/routes/download/components/list/list.component.ts create mode 100644 src/app/routes/download/download-routing.module.ts create mode 100644 src/app/routes/download/download.module.ts create mode 100644 src/app/routes/download/services/download.service.ts diff --git a/src/app/layout/pro/components/notify/notify.component.html b/src/app/layout/pro/components/notify/notify.component.html index a38da23a..ddd01574 100644 --- a/src/app/layout/pro/components/notify/notify.component.html +++ b/src/app/layout/pro/components/notify/notify.component.html @@ -1,10 +1,4 @@ - + + + diff --git a/src/app/layout/pro/components/widget/widget.component.html b/src/app/layout/pro/components/widget/widget.component.html index 52de221e..f16d7571 100644 --- a/src/app/layout/pro/components/widget/widget.component.html +++ b/src/app/layout/pro/components/widget/widget.component.html @@ -9,6 +9,10 @@ + diff --git a/src/app/routes/download/components/list/list.component.html b/src/app/routes/download/components/list/list.component.html new file mode 100644 index 00000000..40d662a6 --- /dev/null +++ b/src/app/routes/download/components/list/list.component.html @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/app/routes/download/components/list/list.component.ts b/src/app/routes/download/components/list/list.component.ts new file mode 100644 index 00000000..91643098 --- /dev/null +++ b/src/app/routes/download/components/list/list.component.ts @@ -0,0 +1,136 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { STChange, STColumn, STComponent, STData } from '@delon/abc/st'; +import { SFComponent, SFDateWidgetSchema, SFSchema, SFUISchema } from '@delon/form'; +import { _HttpClient } from '@delon/theme'; +import { NzModalService } from 'ng-zorro-antd/modal'; +import { DownloadService } from '../../services/download.service'; + +@Component({ + selector: 'app-download-center-components-list', + templateUrl: './list.component.html', +}) +export class DownloadComponentsListComponent implements OnInit { + ui: SFUISchema = {}; + schema: SFSchema = {}; + columns: STColumn[] = []; + @ViewChild('st', { static: false }) st!: STComponent; + @ViewChild('sf', { static: false }) sf!: SFComponent; + constructor(public service: DownloadService, private modal: NzModalService, private router: Router, private ar: ActivatedRoute) {} + + /** + * 查询参数 + */ + get reqParams() { + const params = Object.assign({}, this.sf?.value || {}); + delete params._$expand; + return { ...params }; + } + + /** + * 重置表单 + */ + resetSF() { + this.sf.reset(); + } + /** + * 程序初始化入口 + */ + ngOnInit() { + this.initSF(); + this.initST(); + } + + /** + * 初始化查询表单 + */ + initSF() { + this.schema = { + properties: { + _$expand: { + type: 'boolean', + ui: { hidden: true }, + }, + applyStartTime: { + type: 'string', + title: '创建时间', + ui: { + widget: 'date', + format: 'yyyy-MM-dd', + end: 'applyEndTime', + } as SFDateWidgetSchema, + }, + applyEndTime: { + type: 'string', + title: '', + ui: { widget: 'date', end: 'end' } as SFDateWidgetSchema, + }, + }, + }; + this.ui = { '*': { spanLabelFixed: 80, grid: { span: 8, gutter: 4 } } }; + } + + /** + * 初始化数据列表 + */ + initST() { + this.columns = [ + { title: '文件名称', index: 'dataSourcesDetail', className: 'text-center' }, + { title: '文件来源', index: 'dataSources', className: 'text-center' }, + { title: '文件大小', index: 'dataSize', width: '120px', className: 'text-center' }, + { + title: '生成状态', + index: 'status', + width: '120px', + className: 'text-center', + type: 'enum', + enum: { + 0: '生成中', + 1: '已完成', + 2: '失败', + }, + }, + { title: '下载次数', index: 'downloadCount', width: '120px', className: 'text-center' }, + { title: '创建时间', index: 'createTime', width: '120px', className: 'text-center' }, + { title: '生成时间', index: 'completeTime', width: '180px', className: 'text-center' }, + { + title: '操作', + fixed: 'right', + width: '170px', + className: 'text-center', + buttons: [ + { text: '下载', click: (_record) => this.download(_record), iif: (item) => item.status === 1 }, + { text: '删除', click: (_record) => this.delOne(_record), iif: (item) => item.status !== 0 }, + ], + }, + ]; + } + + /** + * 删除单个实例 + * @param record 记录实例 + */ + delOne(record: STData) { + const headers = [{ key: 'Content-Type', value: 'application/json' }]; + this.modal.confirm({ + nzTitle: '删除确认', + nzContent: `即将删除 当前行数据,请仔细核对,避免误操作!
是否删除?
`, + nzOnOk: () => + this.service.request(this.service.encodeUrlHeader(this.service.$api_del_many, headers), { fileKey: record.id }).subscribe((res) => { + if (res) { + this.service.msgSrv.success('数据删除成功!'); + this.st?.reload(); + } + }), + }); + } + download(record: STData) { + const headers = [{ key: 'Content-Type', value: 'application/json' }]; + this.service.downloadFile( + this.service.encodeUrlHeader(this.service.$api_download_file, headers), + {}, + { fileKey: record.fileUniqueKey }, + 'POST', + ); + } +} diff --git a/src/app/routes/download/download-routing.module.ts b/src/app/routes/download/download-routing.module.ts new file mode 100644 index 00000000..6cd311bb --- /dev/null +++ b/src/app/routes/download/download-routing.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { DownloadComponentsListComponent } from './components/list/list.component'; + +const routes: Routes = [ + { path: '', redirectTo: 'list', pathMatch: 'full' }, + { path: 'list', component: DownloadComponentsListComponent, data: { reuse: true } }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class DownloadRoutingModule {} diff --git a/src/app/routes/download/download.module.ts b/src/app/routes/download/download.module.ts new file mode 100644 index 00000000..a6b86c99 --- /dev/null +++ b/src/app/routes/download/download.module.ts @@ -0,0 +1,12 @@ +import { NgModule, Type } from '@angular/core'; +import { SharedModule } from '@shared'; +import { DownloadComponentsListComponent } from './components/list/list.component'; +import { DownloadRoutingModule } from './download-routing.module'; + +const COMPONENTS: Type[] = [DownloadComponentsListComponent]; + +@NgModule({ + imports: [SharedModule, DownloadRoutingModule], + declarations: COMPONENTS, +}) +export class DownloadModule {} diff --git a/src/app/routes/download/services/download.service.ts b/src/app/routes/download/services/download.service.ts new file mode 100644 index 00000000..12fcb323 --- /dev/null +++ b/src/app/routes/download/services/download.service.ts @@ -0,0 +1,18 @@ +import { Injectable, Injector } from '@angular/core'; +import { BaseService } from '@shared'; + +@Injectable({ + providedIn: 'root', +}) +export class DownloadService extends BaseService { + // 删除多个实例接口地址 + $api_del_many = '/scm/cms/cms/deleteRecordInfo/file'; + // 获取实例分页数据接口地址 + $api_get_page = '/api/mdc/pbc/asynExportInfo/getAsynExportInfoListPage'; + // 下载文件 + $api_download_file = '/api/mdc/pbc/download/file'; + + constructor(public injector: Injector) { + super(injector); + } +} diff --git a/src/app/routes/financial-management/components/freight-account/freight-account.component.ts b/src/app/routes/financial-management/components/freight-account/freight-account.component.ts index 49017bda..b80f4f32 100644 --- a/src/app/routes/financial-management/components/freight-account/freight-account.component.ts +++ b/src/app/routes/financial-management/components/freight-account/freight-account.component.ts @@ -50,6 +50,7 @@ export class FreightAccountComponent implements OnInit { this.modal.create({ nzTitle: '账户明细', nzContent: AccountDetailComponent, + nzNoAnimation: true, nzWidth: 600, nzComponentParams: {}, nzFooter: null diff --git a/src/app/routes/routes-routing.module.ts b/src/app/routes/routes-routing.module.ts index 4482f6e1..b9c1af34 100644 --- a/src/app/routes/routes-routing.module.ts +++ b/src/app/routes/routes-routing.module.ts @@ -38,12 +38,31 @@ const routes: Routes = [ { path: 'ticket', loadChildren: () => import('./ticket-management/ticket-management.module').then(m => m.TicketManagementModule) }, { path: 'supplygoods', loadChildren: () => import('./supply-goods/supply-goods.module').then(m => m.SupplyGoodsModule) }, { path: 'vehicle', loadChildren: () => import('./vehicle/vehicle.module').then(m => m.VehicleModule) }, - { path: 'supply-management', loadChildren: () => import('./supply-management/supply-management.module').then((m) => m.SupplyManagementModule) }, - { path: 'order-management', loadChildren: () => import('./order-management/order-management.module').then((m) => m.OrderManagementModule) }, - { path: 'waybill-management', loadChildren: () => import('./waybill-management/waybill-management.module').then((m) => m.WaybillManagementModule) }, - { path: 'financial-management', loadChildren: () => import('./financial-management/financial-management.module').then((m) => m.FinancialManagementModule) }, - { path: 'contract-management', loadChildren: () => import('./contract-management/contract-management.module').then((m) => m.ContractManagementManagementModule) }, - { path: 'menu-management', loadChildren: () => import('./menu-manager/menu-manager.module').then((m) => m.MenuManagerModule) }, + { + path: 'supply-management', + loadChildren: () => import('./supply-management/supply-management.module').then(m => m.SupplyManagementModule) + }, + { + path: 'order-management', + loadChildren: () => import('./order-management/order-management.module').then(m => m.OrderManagementModule) + }, + { + path: 'waybill-management', + loadChildren: () => import('./waybill-management/waybill-management.module').then(m => m.WaybillManagementModule) + }, + { + path: 'financial-management', + loadChildren: () => import('./financial-management/financial-management.module').then(m => m.FinancialManagementModule) + }, + { + path: 'contract-management', + loadChildren: () => import('./contract-management/contract-management.module').then(m => m.ContractManagementManagementModule) + }, + { path: 'menu-management', loadChildren: () => import('./menu-manager/menu-manager.module').then(m => m.MenuManagerModule) }, + { + path: 'download', + loadChildren: () => import('./download/download.module').then(m => m.DownloadModule) + } ] }, // passport diff --git a/src/app/routes/usercenter/components/driver/driver.component.ts b/src/app/routes/usercenter/components/driver/driver.component.ts index 48ef1590..1a4cf535 100644 --- a/src/app/routes/usercenter/components/driver/driver.component.ts +++ b/src/app/routes/usercenter/components/driver/driver.component.ts @@ -4,6 +4,7 @@ import { STColumn, STColumnBadge, STComponent, STData } from '@delon/abc/st'; import { SFComponent, SFDateWidgetSchema, SFSchema, SFUISchema } from '@delon/form'; import { DynamicSettingModalComponent } from '@shared'; import { NzModalService } from 'ng-zorro-antd/modal'; +import { AccountDetailComponent } from 'src/app/shared/components/account-detail/account-detail.component'; import { UsermanageService } from '../../services/usercenter.service'; @Component({ selector: 'app-usercenter-components-driver', @@ -100,6 +101,17 @@ export class UserCenterComponentsDriverComponent implements OnInit { }); } + showAccountDetail(item: any) { + this.modal.create({ + nzTitle: '资金账户', + nzContent: AccountDetailComponent, + nzNoAnimation: true, + nzWidth: 600, + nzComponentParams: { isCanCreate: true }, + nzFooter: null + }); + } + expandToggle() { this._$expand = !this._$expand; this.sf?.setValue('/expand', this._$expand); @@ -291,6 +303,10 @@ export class UserCenterComponentsDriverComponent implements OnInit { { text: '基础设置', click: item => this.settingAction(item) + }, + { + text: '资金账户', + click: item => this.showAccountDetail(item) } ] } diff --git a/src/app/routes/usercenter/components/freight/list/list.component.ts b/src/app/routes/usercenter/components/freight/list/list.component.ts index caf9cef8..e42efa59 100644 --- a/src/app/routes/usercenter/components/freight/list/list.component.ts +++ b/src/app/routes/usercenter/components/freight/list/list.component.ts @@ -4,6 +4,7 @@ import { STColumn, STColumnBadge, STComponent, STData } from '@delon/abc/st'; import { SFComponent, SFSchema, SFUISchema } from '@delon/form'; import { DynamicSettingModalComponent } from '@shared'; import { NzModalService } from 'ng-zorro-antd/modal'; +import { AccountDetailComponent } from 'src/app/shared/components/account-detail/account-detail.component'; import { UsermanageService } from '../../../services/usercenter.service'; @Component({ selector: 'app-Freight-components-list', @@ -67,6 +68,17 @@ export class FreightComponentsListComponent implements OnInit { }); } + showAccountDetail(item: any) { + this.modal.create({ + nzTitle: '资金账户', + nzContent: AccountDetailComponent, + nzNoAnimation: true, + nzWidth: 600, + nzComponentParams: { isCanCreate: true }, + nzFooter: null + }); + } + initSF() { this.schema = { properties: { @@ -199,6 +211,10 @@ export class FreightComponentsListComponent implements OnInit { { text: '基础设置', click: item => this.settingAction(item) + }, + { + text: '资金账户', + click: item => this.showAccountDetail(item) } ] } diff --git a/src/app/shared/components/account-detail/account-detail.component.html b/src/app/shared/components/account-detail/account-detail.component.html index 35a0ba7f..14db892e 100644 --- a/src/app/shared/components/account-detail/account-detail.component.html +++ b/src/app/shared/components/account-detail/account-detail.component.html @@ -3,4 +3,20 @@ [res]="{ reName: { list: 'data.records', total: 'data.total' } }" [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" [loading]="service.http.loading" [scroll]="{ y: '370px' }"> + + + {{ item.promotersTelephone || '添加' }} + + + {{ item.promotersTelephone }} + + + + + {{ item.promotersTelephone || '添加' }} + + + {{ item.promotersTelephone }} + + \ No newline at end of file diff --git a/src/app/shared/components/account-detail/account-detail.component.ts b/src/app/shared/components/account-detail/account-detail.component.ts index 5841fdd5..eeb43548 100644 --- a/src/app/shared/components/account-detail/account-detail.component.ts +++ b/src/app/shared/components/account-detail/account-detail.component.ts @@ -6,7 +6,7 @@ import { BaseService } from '../../services'; @Component({ selector: 'app-account-detail', templateUrl: './account-detail.component.html', - providers:[CurrencyPipe] + providers: [CurrencyPipe] }) export class AccountDetailComponent implements OnInit { @ViewChild('st', { static: true }) @@ -16,14 +16,14 @@ export class AccountDetailComponent implements OnInit { url = ''; isCanCreate = false; - constructor(public service: BaseService, private currencyPipe: CurrencyPipe) {} - - ngOnInit(): void { - setTimeout(() => { - this.initST(); - }, 200); + constructor(public service: BaseService, private currencyPipe: CurrencyPipe) { + this.initST(); } + ngOnInit(): void {} + createPA(item: any) {} + createPF(item: any) {} + beforeReq = (requestOptions: STRequestOptions) => { return requestOptions; }; @@ -33,13 +33,13 @@ export class AccountDetailComponent implements OnInit { { title: '网络货运人', index: 'phone', className: 'text-center' }, { title: '平安账户余额', - index: 'ltdName', + render: 'ltdName', type: 'currency', format: item => `${this.currencyPipe.transform(item.availableBalance)}` }, { title: '浦发账户余额', - index: 'bankTypeLabel', + render: 'bankTypeLabel', type: 'currency', format: item => `${this.currencyPipe.transform(item.availableBalance)}` } diff --git a/src/style-icons-auto.ts b/src/style-icons-auto.ts index b901aea8..9bdd27f7 100644 --- a/src/style-icons-auto.ts +++ b/src/style-icons-auto.ts @@ -60,7 +60,8 @@ import { EyeInvisibleFill, SolutionOutline, MinusCircleOutline, - FileTwoTone + FileTwoTone, + CloudDownloadOutline } from '@ant-design/icons-angular/icons'; export const ICONS_AUTO = [ @@ -120,5 +121,6 @@ export const ICONS_AUTO = [ SwapOutline, SolutionOutline, MinusCircleOutline, - FileTwoTone + FileTwoTone, + CloudDownloadOutline ];