招生
This commit is contained in:
147
src/views/recruit/recruitstudentsignup/contanctByDeptStatic.vue
Normal file
147
src/views/recruit/recruitstudentsignup/contanctByDeptStatic.vue
Normal file
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<basic-container>
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="init()" ref="searchForm">
|
||||
<el-form-item label="招生计划" prop="groupId">
|
||||
<el-select v-model="dataForm.groupId" filterable placeholder="请选择招生计划" size="small" >
|
||||
<el-option
|
||||
v-for="item in planList"
|
||||
:key="item.id"
|
||||
:label="item.groupName"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button icon="el-icon-search" type="primary" size="small"
|
||||
@click="handleFilter()">查询
|
||||
</el-button>
|
||||
<el-button icon="el-icon-delete" type="normal" plain size="small"
|
||||
@click="resetForm('searchForm')">清空
|
||||
</el-button>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form>
|
||||
<el-form-item>
|
||||
<el-button icon="el-icon-download" type="warning" size="small" @click="dataExportHandle()">导出</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="avue-crud">
|
||||
<el-table :data="list" border stripe v-loading="dataListLoading"
|
||||
:summary-method="getSummaries" show-summary
|
||||
>
|
||||
<el-table-column align="center" header-align="center" prop="deptName" label="部门" />
|
||||
<el-table-column align="center" header-align="center" prop="allNum" label="合计" />
|
||||
<el-table-column align="center" header-align="center" prop="schoolNum" label="学校推荐" />
|
||||
<el-table-column align="center" header-align="center" prop="contantNum" label="联系人" />
|
||||
</el-table>
|
||||
</div>
|
||||
</basic-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getContantByDeptStatic} from "@/api/recruit/recruitstudentsignup";
|
||||
import {list} from "@/api/recruit/recruitstudentplangroup";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dataForm: {groupId:""},
|
||||
list: [],
|
||||
planList:[],
|
||||
dataListLoading: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
created () {
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
let _this = this;
|
||||
list().then(data =>{
|
||||
_this.planList = data.data.data
|
||||
_this.dataForm.groupId=_this.planList[0].id;
|
||||
this.getDataList();
|
||||
});
|
||||
},
|
||||
getDataList(){
|
||||
this.list = [];
|
||||
this.indexArray=[];
|
||||
getContantByDeptStatic(this.dataForm).then(response =>{
|
||||
this.list = response.data.data;
|
||||
})
|
||||
},
|
||||
exportExcel: function(form,url) {
|
||||
return axios({ // 用axios发送post请求
|
||||
method: 'post',
|
||||
url: url, // 请求地址
|
||||
data: form, // 参数
|
||||
responseType: 'blob', // 表明返回服务器返回的数据类型
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 导出表格
|
||||
*/
|
||||
dataExportHandle() {
|
||||
this.exportLoading = true
|
||||
this.exportExcel(this.dataForm,'/recruit/recruitstudentsignup/getContantByDeptStaticExport').then(res => { // 处理返回的文件流
|
||||
console.log(res)
|
||||
const blob = new Blob([res.data]);
|
||||
const fileName = '按部门导出.xls';
|
||||
const elink = document.createElement('a');
|
||||
elink.download = fileName;
|
||||
elink.style.display = 'none';
|
||||
elink.href = URL.createObjectURL(blob);
|
||||
document.body.appendChild(elink);
|
||||
elink.click();
|
||||
URL.revokeObjectURL(elink.href); // 释放URL 对象
|
||||
document.body.removeChild(elink);
|
||||
})
|
||||
},
|
||||
getSummaries(param) {
|
||||
const { columns, data } = param
|
||||
const sums = []
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '总计'
|
||||
} else if (index != 0) {
|
||||
const values = data.map(item => Number(item[column.property]))
|
||||
if (!values.every(value => isNaN(value))) {
|
||||
sums[index] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr)
|
||||
if (!isNaN(value) ) {
|
||||
let value = prev + curr;
|
||||
return value
|
||||
} else {
|
||||
return prev
|
||||
}
|
||||
}, 0);
|
||||
} else {
|
||||
sums[index] = '--'
|
||||
}
|
||||
} else {
|
||||
sums[index] = '--'
|
||||
}
|
||||
})
|
||||
return sums
|
||||
},
|
||||
|
||||
|
||||
handleFilter(){
|
||||
this.getDataList();
|
||||
},
|
||||
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user