This commit is contained in:
Taric Xin
2022-03-30 14:55:49 +08:00
parent 3348e72b58
commit abf59f38e7
9 changed files with 42 additions and 41 deletions

View File

@ -8,7 +8,7 @@ import { DownloadService } from '../../services/download.service';
@Component({
selector: 'app-download-center-components-list',
templateUrl: './list.component.html',
templateUrl: './list.component.html'
})
export class DownloadComponentsListComponent implements OnInit {
ui: SFUISchema = {};
@ -24,7 +24,7 @@ export class DownloadComponentsListComponent implements OnInit {
get reqParams() {
const params = Object.assign({}, this.sf?.value || {});
delete params._$expand;
return { ...params };
return { ...params, createTime: params?.createTime?.start, applyEndTime: params?.createTime?.end };
}
/**
@ -49,23 +49,18 @@ export class DownloadComponentsListComponent implements OnInit {
properties: {
_$expand: {
type: 'boolean',
ui: { hidden: true },
ui: { hidden: true }
},
applyStartTime: {
createTime: {
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,
},
},
widget: 'sl-from-to',
type: 'date',
format: 'yyyy-MM-dd'
} as SFDateWidgetSchema
}
}
};
this.ui = { '*': { spanLabelFixed: 80, grid: { span: 8, gutter: 4 } } };
}
@ -87,8 +82,8 @@ export class DownloadComponentsListComponent implements OnInit {
enum: {
0: '生成中',
1: '已完成',
2: '失败',
},
2: '失败'
}
},
{ title: '下载次数', index: 'downloadCount', width: '120px', className: 'text-center' },
{ title: '创建时间', index: 'createTime', width: '120px', className: 'text-center' },
@ -98,10 +93,8 @@ export class DownloadComponentsListComponent implements OnInit {
fixed: 'right',
width: '170px',
className: 'text-center',
buttons: [
{ text: '下载', click: (_record) => this.download(_record)},
],
},
buttons: [{ text: '下载', click: _record => this.download(_record) }]
}
];
}
@ -115,12 +108,12 @@ export class DownloadComponentsListComponent implements OnInit {
nzTitle: '<i>删除确认</i>',
nzContent: `<b>即将删除 当前行数据,请仔细核对,避免误操作!<br>是否删除?</br>`,
nzOnOk: () =>
this.service.request(this.service.encodeUrlHeader(this.service.$api_del_many, headers), { fileKey: record.id }).subscribe((res) => {
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) {
@ -129,7 +122,7 @@ export class DownloadComponentsListComponent implements OnInit {
this.service.encodeUrlHeader(this.service.$api_download_file, headers),
{},
{ fileKey: record.fileUniqueKey },
'POST',
'POST'
);
}
}