feat: 人员列表导出

This commit is contained in:
caoqianming 2023-04-20 10:22:52 +08:00
parent 2a109634e7
commit b8d49dd356
2 changed files with 56 additions and 4 deletions

View File

@ -53,6 +53,15 @@ export default {
req: async function(data){ req: async function(data){
return await http.post(`${config.API_URL}/hrm/employee/improve_info/`, data); return await http.post(`${config.API_URL}/hrm/employee/improve_info/`, data);
} }
},
export_excel: {
name: "导出",
req: async function(data){
return await http.get(
`${config.API_URL}/hrm/employee/export_excel/`,
data
);
}
} }
}, },

View File

@ -2,12 +2,26 @@
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<el-select
v-model="query.has_blt"
placeholder="有无定位卡"
@change="handleQuery"
clearable
style="margin-left: 2px; width: 120px"
>
<el-option
v-for="item in bltOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
<el-select <el-select
v-model="query.type" v-model="query.type"
placeholder="人员类型" placeholder="人员类型"
@change="handleQuery" @change="handleQuery"
clearable clearable
style="margin-left: 2px" style="margin-left: 2px; width: 120px"
> >
<el-option <el-option
v-for="item in typeOptions" v-for="item in typeOptions"
@ -21,7 +35,7 @@
placeholder="人员状态" placeholder="人员状态"
@change="handleQuery" @change="handleQuery"
clearable clearable
style="margin-left: 2px" style="margin-left: 2px; width: 120px"
> >
<el-option <el-option
v-for="item in jobOptions2" v-for="item in jobOptions2"
@ -38,7 +52,7 @@
@change="handleQuery" @change="handleQuery"
:show-all-levels="false" :show-all-levels="false"
:props="{ emitPath: false, checkStrictly: true }" :props="{ emitPath: false, checkStrictly: true }"
style="margin-left: 4px" style="margin-left: 4px; width: 150px"
/> />
</div> </div>
<div class="right-panel"> <div class="right-panel">
@ -54,6 +68,12 @@
icon="el-icon-search" icon="el-icon-search"
@click="handleQuery" @click="handleQuery"
></el-button> ></el-button>
<el-button
type="primary"
:loading = 'cLoading'
icon="el-icon-download"
@click="exportExcel"
>导出</el-button>
</div> </div>
</div> </div>
</el-header> </el-header>
@ -104,7 +124,7 @@
width="120" width="120"
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
label="部门" label="部门/单位"
prop="belong_dept" prop="belong_dept"
width="180" width="180"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
@ -298,6 +318,10 @@ export default {
{ label: "离职", value: 20 }, { label: "离职", value: 20 },
{ label: "退休", value: 30 }, { label: "退休", value: 30 },
], ],
bltOptions :[
{ label: "有", value: 1 },
{ label: "无", value: 0 },
]
}; };
}, },
mounted() { mounted() {
@ -472,6 +496,25 @@ export default {
that.$refs.table.refresh(); that.$refs.table.refresh();
}); });
}, },
exportExcel(){
let that = this;
that.cLoading = true;
that.ElLoading = this.$loading({
lock: true,
text: '数据请求中,请稍后...',
background: 'rgba(0, 0, 0, 0)',
})
that.$API.hrm.employee.export_excel.req(that.query)
.then(res=>{
that.cLoading = false;
that.ElLoading.close();
let urls = config.API_URL.slice(0,-4)+res.path;
window.open(urls, "_blank");
}).catch(e=>{
that.cLoading = false;
that.ElLoading.close();
})
},
}, },
}; };
</script> </script>