Browse Source

导出

shibei_master
13176889840 3 years ago
parent
commit
aa312b68a3
  1. 88
      src/views/modules/base/collect.vue

88
src/views/modules/base/collect.vue

@ -2,15 +2,22 @@
<div class="resi-container"> <div class="resi-container">
<el-card ref="searchCard" class="search-card"> <el-card ref="searchCard" class="search-card">
<el-form ref="searchForm" :inline="true" :model="fmData" class="demo-form-inline"> <el-form ref="searchForm" :inline="true" :model="fmData" class="demo-form-inline">
<el-form-item label="所在社区" prop="organizationName"> <el-form-item label="所在社区" prop="orgId">
<el-input <el-select
v-model="fmData.organizationName" v-model.trim="fmData.orgId"
class="resi-cell-input" placeholder="所在社区"
size="small" size="small"
clearable clearable
placeholder="请输入" class="resi-cell-input"
> >
</el-input> <el-option
v-for="item in communityList"
:key="item.orgId"
:label="item.orgName"
:value="item.orgId"
>
</el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="居住地址" prop="address"> <el-form-item label="居住地址" prop="address">
<el-input <el-input
@ -27,6 +34,7 @@
v-model="timeRange" v-model="timeRange"
type="daterange" type="daterange"
clearable clearable
size="small"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
@ -42,7 +50,12 @@
</el-card> </el-card>
<el-card class="resi-card-table"> <el-card class="resi-card-table">
<div class="resi-row-btn">
<el-button @click="handleChu" class="diy-button--reset" size="small"
>导出</el-button
>
</div>
<el-table <el-table
:data="tableData" :data="tableData"
border border
@ -164,10 +177,12 @@ export default {
tableData: [], tableData: [],
timeRange: '', timeRange: '',
fmData: { fmData: {
orgId: '',
startTime: "", startTime: "",
endTime: "", endTime: "",
address: '' address: ''
}, },
communityList: [],
spanIndex: [], // spanIndex: [], //
importBtnTitle: "导入", importBtnTitle: "导入",
importLoading: false, importLoading: false,
@ -175,7 +190,7 @@ export default {
}, },
computed: { computed: {
maxTableHeight() { maxTableHeight() {
return this.clientHeight - 320; return this.clientHeight - 360;
}, },
...mapGetters(["clientHeight"]), ...mapGetters(["clientHeight"]),
}, },
@ -191,13 +206,14 @@ export default {
}, },
}, },
mounted() { mounted() {
this.getcommunityList()
this.getTableData(); this.getTableData();
}, },
methods: { methods: {
arraySpanMethod({ row, column, rowIndex, columnIndex }) { arraySpanMethod({ row, column, rowIndex, columnIndex }) {
// console.log('row-----r', row) // console.log('row-----r', row)
// console.log('column-----c', column) // console.log('column-----c', column)
if (columnIndex === 0 || columnIndex === 1) { if (columnIndex === 0 || columnIndex === 1 || columnIndex === 2 || columnIndex === 3 || columnIndex === 4) {
let index = this.spanIndex.findIndex(item => item.firstIndex === rowIndex) let index = this.spanIndex.findIndex(item => item.firstIndex === rowIndex)
if (index > -1) { if (index > -1) {
return { return {
@ -212,7 +228,41 @@ export default {
} }
} }
}, },
async handleChu() {
const url =
"/epmetuser/icresicollect/export";
const { pageSize, pageNo, fmData } = this;
axios({
url: window.SITE_CONFIG["apiURL"] + url,
method: "post",
data: {
pageSize,
pageNo,
...fmData,
},
responseType: "blob",
})
.then((res) => {
let fileName = window.decodeURI(
res.headers["content-disposition"].split(";")[1].split("=")[1]
);
console.log("filename", fileName);
let blob = new Blob([res.data], { type: "application/vnd.ms-excel" });
var url = window.URL.createObjectURL(blob);
var aLink = document.createElement("a");
aLink.style.display = "none";
aLink.href = url;
aLink.setAttribute("download", fileName);
document.body.appendChild(aLink);
aLink.click();
document.body.removeChild(aLink); //
window.URL.revokeObjectURL(url); //blob
})
.catch((err) => {
console.log("获取导出情失败", err);
return this.$message.error("网络错误");
});
},
handleSizeChange(val) { handleSizeChange(val) {
console.log(`每页 ${val}`); console.log(`每页 ${val}`);
this.pageSize = val; this.pageSize = val;
@ -272,7 +322,16 @@ export default {
this.$message.success("操作失败!"); this.$message.success("操作失败!");
} }
}, },
async getcommunityList() {
const url =
"/gov/org/agency/community-list";
const { data, code, msg } = await requestPost(url);
if (code === 0) {
console.log("列表请求成功!!!!!!!!!!!!!!");
this.communityList = data
} else {
}
},
async getTableData() { async getTableData() {
const url = const url =
"/epmetuser/icresicollect/list"; "/epmetuser/icresicollect/list";
@ -286,7 +345,6 @@ export default {
console.log("列表请求成功!!!!!!!!!!!!!!"); console.log("列表请求成功!!!!!!!!!!!!!!");
this.total = data.total || 0; this.total = data.total || 0;
let _i = 0 let _i = 0
let firstIndex = 0
let arr = [] let arr = []
this.spanIndex = data.list && data.list.map((item, index) => { this.spanIndex = data.list && data.list.map((item, index) => {
if (index == 0) _i = 0 if (index == 0) _i = 0

Loading…
Cancel
Save