老产品前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

180 lines
4.5 KiB

<template>
<div class="resi-container">
<el-card class="resi-card-table">
<el-table
:data="tableData"
border
style="width: 100%"
:height="maxTableHeight"
class="resi-table"
>
<el-table-column label="序号" type="index" align="center" width="50" />
<el-table-column prop="originFileName" label="文件名">
</el-table-column>
<el-table-column prop="startTime" label="导入时间"> </el-table-column>
<el-table-column label="导入状态" align="center" width="180">
<template slot-scope="scope">
<span
v-if="scope.row.processStatus == 'processing'"
>导入中</span
>
<span
v-else-if="scope.row.processStatus == 'finished_success'"
>已完成</span
>
<a target="_blank"
:href="scope.row.resultDescFile"
style="color: #00a7a9;cursor:pointer;"
v-else-if="scope.row.processStatus == 'finished_fail' && scope.row.resultDescFile"
>下载失败说明</a
>
<span
v-else-if="scope.row.processStatus == 'finished_fail' && !scope.row.resultDescFile"
>导入失败未知错误</span
>
</template>
</el-table-column>
</el-table>
<div>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="pageNo"
:page-sizes="[20, 50, 100, 200]"
:page-size="parseInt(pageSize)"
layout="sizes, prev, pager, next, total"
:total="total"
>
</el-pagination>
</div>
</el-card>
</div>
</template>
<script>
import { requestPost } from "@/js/dai/request2";
import nextTick from "dai-js/tools/nextTick";
import { mapGetters } from "vuex";
import axios from "axios";
export default {
components: {},
data() {
return {
openSearch: false,
formShow: false,
formTitle: "",
pageNo: 1,
pageSize: window.localStorage.getItem("pageSize") || 20,
total: 1,
tableData: [
// {
// originFileName: '某某某.xls',
// processStatus: 'finished_fail',
// startTime: '2022-02-22',
// resultDescFile: 'http://www.baidu.com',
// }
],
};
},
computed: {
maxTableHeight() {
return this.clientHeight - 280;
},
...mapGetters(["clientHeight"]),
},
watch: {},
mounted() {
this.getTableData();
},
methods: {
handleSizeChange(val) {
console.log(`每页 ${val}`);
this.pageSize = val;
window.localStorage.setItem("pageSize", val);
this.getTableData();
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
this.pageNo = val;
this.getTableData();
},
handleClose() {
this.formShow = false;
},
handleSearch(val) {
console.log(this.fmData);
this.pageNo = 1;
this.getTableData();
},
async handleAdd() {
this.formShow = true;
await nextTick();
console.log(this.$refs);
this.$refs.eleEditForm.initForm("add");
},
async handleDel(rowData, rowIndex) {
console.log(rowData, rowIndex);
const url = "/heart/societyorg/del";
const { tableData } = this;
const { data, code, msg } = await requestPost(url, {
societyId: tableData[rowIndex].societyId,
});
if (code === 0) {
this.$message.success("删除成功!");
this.getTableData();
} else {
this.$message.success("操作失败!");
}
},
async getTableData() {
const url = "/commonservice/import-task/page";
const { pageSize, pageNo, fmData } = this;
const { data, code, msg } = await requestPost(url, {
pageSize,
pageNo,
...fmData,
});
if (code === 0) {
console.log("列表请求成功!!!!!!!!!!!!!!");
this.total = data.total || 0;
this.tableData = data.list
? data.list.map((item) => {
return item;
})
: [];
} else {
}
},
},
};
</script>
<style lang="scss" scoped>
.resi-container .resi-card-table {
::v-deep .el-table th {
color: #fff;
background-color: rgba(33, 149, 254, 1);
// border-right: 1px solid rgba(33, 149, 254, 1);
}
}
.resi-btns {
margin-top: 20px;
text-align: center;
}
</style>