<template>
|
<div>
|
<el-form ref="ruleFormRef" :model="ruleForm" status-icon label-width="20px" class="topTitle">
|
<el-row>
|
<el-col :span="4">
|
<el-form-item size="default">
|
<el-input v-model="ruleForm.searchParams.year" placeholder="年度" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="4" >
|
<el-form-item size="default">
|
<el-tree-select v-model="ruleForm.searchParams.departmentId" :data="data" class="w100" placeholder="请选择" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="4">
|
<el-form-item>
|
<el-button size="default" type="primary" @click="listApi">查询</el-button>
|
<el-button size="default" @click="resetForm">重置</el-button>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<div class="minCenter">
|
<div class="btns">
|
<p>汇总日期:2022-07-04 23:00:07</p>
|
<div>
|
<el-button type="primary" size="default" :icon="Download" @click="exportExcel('tab1', '会员明细.xlsx')">导出</el-button>
|
</div>
|
</div>
|
<el-table :data="tableData" style="width: 100%" id="tab1">
|
<el-table-column label="责任部门" align="center">
|
<template #default="scope">{{ scope.row.departmentId }}</template>
|
</el-table-column>
|
<el-table-column property="targetValue" align="center" label="安全目标指标" />
|
<el-table-column property="examineValue" label="考核指标" align="center" show-overflow-tooltip />
|
<el-table-column property="yiYue" label="1月" align="center" show-overflow-tooltip />
|
<el-table-column property="february" label="2月" align="center" show-overflow-tooltip />
|
<el-table-column property="erYue" label="3月" align="center" show-overflow-tooltip />
|
<el-table-column property="sanYue" label="4月" align="center" show-overflow-tooltip />
|
<el-table-column property="siYue" label="5月" align="center" show-overflow-tooltip />
|
<el-table-column property="wuYue" label="6月" align="center" show-overflow-tooltip />
|
<el-table-column property="liuYue" label="7月" align="center" show-overflow-tooltip />
|
<el-table-column property="qiYue" label="8月" align="center" show-overflow-tooltip />
|
<el-table-column property="baYue" label="9月" align="center" show-overflow-tooltip />
|
<el-table-column property="jiuYue" label="10月" align="center" show-overflow-tooltip />
|
<el-table-column property="shiYue" label="11月" align="center" show-overflow-tooltip />
|
<el-table-column property="shiyiYue" label="12月" align="center" show-overflow-tooltip />
|
<el-table-column label="考核结果" align="center">
|
<template #default="scope">{{ scope.row.examineResult }}</template>
|
</el-table-column>
|
</el-table>
|
<div class="pages">
|
<el-pagination
|
v-model:currentPage="currentPage4"
|
v-model:page-size="pageSize4"
|
:page-sizes="[10, 20, 30, 40]"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="total"
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
/>
|
</div>
|
</div>
|
</div>
|
</template>
|
<script lang="ts">
|
import { ref, toRefs, reactive, onMounted, defineComponent } from 'vue';
|
import { ElMessageBox, ElMessage, ElButton, ElInput, TabsPaneContext, FormInstance } from 'element-plus';
|
import { Plus, Delete, Upload, Download, Refresh, View } from '@element-plus/icons-vue';
|
import { goalManagementApi } from '/@/api/goalManagement';
|
|
import * as XLSX from 'xlsx';
|
|
export default defineComponent({
|
components: { ElButton, ElInput },
|
setup() {
|
// 搜索条件
|
const ruleForm = reactive({
|
pageSize: 10,
|
pageIndex: 1,
|
searchParams: {
|
year: '', //年度
|
departmentId: '', //责任部门
|
},
|
});
|
// 下方导航与表格
|
const tableData = ref([]);
|
const currentPage4 = ref();
|
const pageSize4 = ref();
|
const total = ref();
|
const resetForm = () => {
|
ruleForm.searchParams.year = '';
|
ruleForm.searchParams.departmentId = '';
|
};
|
const listApi = () => {
|
goalManagementApi()
|
.gettargetDutySummaryList(ruleForm)
|
.then((res) => {
|
if (res.data.code == 200) {
|
tableData.value = res.data.data;
|
currentPage4.value = res.data.pageIndex;
|
pageSize4.value = res.data.pageSize;
|
total.value = res.data.total;
|
} else {
|
ElMessage.error(res.data.msg);
|
}
|
});
|
};
|
onMounted(() => {
|
listApi();
|
});
|
|
const handleSizeChange = (val: number) => {
|
// console.log(`${val} items per page`);
|
ruleForm.pageSize = val;
|
listApi();
|
};
|
const handleCurrentChange = (val: number) => {
|
// console.log(`current page: ${val}`);
|
ruleForm.pageIndex = val;
|
listApi();
|
};
|
const data = [
|
{
|
value: '1',
|
label: '广汇能源综合物流发展有限责任公司',
|
children: [
|
{
|
value: '11',
|
label: '经营班子',
|
children: [],
|
},
|
],
|
},
|
{
|
value: '2',
|
label: '生产运行部',
|
children: [
|
{
|
value: '21',
|
label: '灌装一班',
|
children: [],
|
},
|
{
|
value: '22',
|
label: '工艺四班',
|
children: [],
|
},
|
],
|
},
|
{
|
value: '3',
|
label: '设备部',
|
children: [
|
{
|
value: '31',
|
label: '仪表班',
|
children: [],
|
},
|
{
|
value: '32',
|
label: '机修班',
|
children: [],
|
},
|
],
|
},
|
];
|
|
const exportExcel = (id:string,name:string) => {
|
let workbook = XLSX.utils.table_to_book(document.getElementById(id)); //需要在table上定义一个id
|
try {
|
XLSX.writeFile(workbook, name);
|
console.log('导出成功!');
|
} catch (e) {
|
console.log('导出失败!');
|
}
|
}
|
return {
|
ruleForm,
|
tableData,
|
currentPage4,
|
pageSize4,
|
total,
|
data,
|
resetForm,
|
listApi,
|
handleSizeChange,
|
handleCurrentChange,
|
Plus,
|
Delete,
|
Upload,
|
Download,
|
Refresh,
|
View,
|
exportExcel
|
};
|
},
|
});
|
</script>
|
<style scoped>
|
.topTitle {
|
background-color: #fff;
|
padding: 20px 0px 20px 0px;
|
margin-bottom: 10px;
|
}
|
.minCenter {
|
width: 100%;
|
background-color: #fff;
|
margin-top: 10px;
|
padding: 0 20px;
|
}
|
.btns {
|
padding: 10px 0px 10px 0px;
|
display: flex;
|
justify-content: left;
|
}
|
.btns p {
|
font-size: 18px;
|
line-height: 40px;
|
margin-right: 20px;
|
}
|
.pages {
|
padding: 20px 0;
|
display: flex;
|
justify-content: right;
|
}
|
</style>
|