提交 8fa6b719 编写于 作者: wenxuan.liang's avatar wenxuan.liang

下载列表页

上级 3807ac1c
......@@ -433,7 +433,7 @@
label="变更前内容">
</el-table-column>
</el-table>
<!--<br/>
<!-- 与产品确认,不需要分页功能<br/>
<el-row :gutter="0" type="flex" justify="end" align="center">
<el-pagination
class="log-info-pagin"
......
......@@ -6,15 +6,13 @@
style="width: 100%"
v-loading="loading"
>
<el-table-column
v-for="item in tableColumn"
:key="item.prop"
:prop="item.prop"
:label="item.label"
:show-overflow-tooltip="item.showtooltip"
min-width="170"
align="center"
></el-table-column>
<el-table-column key="fileName" prop="fileName" label="名称" min-width="170" align="center" ></el-table-column>
<el-table-column key="createdTime" prop="createdTime" label="创建时间" min-width="170" align="center" ></el-table-column>
<el-table-column key="status" prop="status" label="状态" min-width="170" align="center" >
<template slot-scope="scope">
<div class="status_base"><div :class="'status-circle status-' + scope.row.status"></div><div>{{ getStatusDesc(scope.row.status) }}</div></div>
</template>
</el-table-column>
<el-table-column
label="操作"
fixed="right"
......@@ -22,13 +20,10 @@
min-width="400"
>
<template slot-scope="scope">
<el-button
type="primary"
size="small"
@click="download(scope.row)"
style="margin-top: 10px"
>下载</el-button
>
<div
@click="download(scope.row.path)"
class="download-btn"
>下载</div>
</template>
</el-table-column>
</el-table>
......@@ -43,7 +38,7 @@
:page-sizes="[15, 30, 50, 100, 200]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalRows"
:total="totalCount"
>
</el-pagination>
</div>
......@@ -51,70 +46,85 @@
</template>
<script>
const STATUS_DESC_MAP = {
1: '处理中',
2: '完成',
3: '失败'
}
export default {
data() {
return {
pageSize: 15,
pageNo: 1,
totalRows: 0,
totalCount: 0,
loading: false,
tableData: [],
tableColumn: [
{
prop: "名称",
label: "名称",
showtooltip: false,
},
{
prop: "时间",
label: "时间",
showtooltip: false,
},
{
prop: "状态",
label: "状态",
showtooltip: false,
},
],
};
}
},
created () {
this.queryList()
},
methods: {
// 导出
download() {
let url = `/diagnose/admin/diagnose/export`;
let params = this.searchParam;
params.bizType = 2;
this.POST(url, params)
.then((res) => {
if (res.code == "000000") {
this.downloadFile(
res.data.attachments.base64,
res.data.attachments.name
);
}
})
.catch((err) => {
console.log("网络出现点儿问题,稍后重试");
});
queryList () {
this.POST(`/diagnose/admin/diagnose/export/list`, {
pageSize: this.pageSize,
pageNo: this.pageNo
}).then(res => {
if (res && res.code === '000000') {
this.totalCount = res.data.allSize
this.tableData = res.data.list
}
})
},
getStatusDesc (status) {
return STATUS_DESC_MAP[status]
},
/* 文件下载*/
downloadFile(base64, name) {
let a = document.createElement("a");
let href = "data:application/xls;base64," + base64;
a.setAttribute("href", href);
a.setAttribute("download", name);
a.click();
this.$message.success("导出成功");
download(link) {
window.location.href = link
},
handleSizeChange(value) {
this.pageSize = value;
this.pageNo = 1
this.pageSize = value
this.queryList()
},
handleCurrentChange(value) {
this.pageNo = value;
this.pageNo = value
this.queryList()
},
},
};
</script>
<style>
<style lang="less" scoped>
.status_base {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
.status-circle {
content: '';
display: block;
width: 8px;
height: 8px;
border-radius: 4px;
margin-right: 5px;
}
.status-1 {
background-color: rgb(219, 223, 12);;
}
.status-2 {
background-color: rgb(87, 238, 82);;
}
.status-3 {
background-color: rgb(238, 68, 16);;
}
}
.download-btn {
color: rgb(7, 180, 59);
cursor: pointer;
}
.download-btn:hover {
color: rgb(5, 145, 59);
}
</style>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册