You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
121 lines
3.4 KiB
Vue
121 lines
3.4 KiB
Vue
<template>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-table :height=myHeight highlight-current-row="true" v-loading="loading" :data="tableData" border
|
|
style="width: 100%;">
|
|
<el-table-column :resizable="false" fixed align="center" type="index" width="80" label="序号" />
|
|
<el-table-column v-if="props.checkList.includes('分公司')" :resizable="false" align="center" prop="subComName" label="分公司" />
|
|
<el-table-column v-if="props.checkList.includes('收费站')" :resizable="false" align="center" prop="staName" label="收费站" />
|
|
<el-table-column v-if="props.checkList.includes('岗位')" :resizable="false" align="center" prop="positionName" label="岗位" />
|
|
<el-table-column v-if="true" :resizable="false" align="center" prop="totalCount" label="统计数" />
|
|
|
|
</el-table>
|
|
|
|
<el-config-provider :locale="locale">
|
|
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
|
:current-page="tablePageData.pageNum" :page-sizes="[20, 30, 50]" :page-size="tablePageData.pageSize"
|
|
layout="total, sizes, prev, pager, next, jumper" :total="tablePageData.total">
|
|
</el-pagination>
|
|
</el-config-provider>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
|
import pro from '../../../util/tool.js';
|
|
|
|
import { onMounted, reactive, ref, toRefs, warn } from 'vue';
|
|
|
|
import { getOperatorsCollectionData } from '@/util/api/api.js';
|
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
|
//定义从父组件传入的参数
|
|
const props = defineProps(['checkList']);
|
|
//定义从父组件传入的方法
|
|
const emit = defineEmits(['getTableData']);
|
|
|
|
|
|
|
|
//定义加载下拉数据
|
|
const loading = ref(false);
|
|
|
|
//表格查询条件
|
|
const tablePageData = reactive({
|
|
total: 0,
|
|
pageNum: 1,
|
|
pageSize: 20
|
|
});
|
|
|
|
//表格固定高度
|
|
const myHeight = ref(500);
|
|
|
|
//定义表格数据
|
|
const tableData = ref([]);
|
|
|
|
|
|
onMounted(() => {
|
|
loading.value = true;
|
|
getData();
|
|
});
|
|
|
|
|
|
|
|
function getData() {
|
|
|
|
//构造接口参数
|
|
if(props.checkList.includes('分公司')){
|
|
tablePageData.subComCheck = "subComCollection";
|
|
}
|
|
if(props.checkList.includes('收费站')){
|
|
tablePageData.staNoCheck = "staCollection";
|
|
}
|
|
|
|
if(props.checkList.includes('岗位')){
|
|
tablePageData.positionCheck = "positionCollection";
|
|
}
|
|
|
|
getOperatorsCollectionData(tablePageData).then(res =>{
|
|
if (res.records != null) {
|
|
tableData.value = res.records;
|
|
tablePageData.total = res.total;
|
|
tablePageData.pageNum = res.current;
|
|
tablePageData.pageSize = res.size;
|
|
} else {
|
|
ElMessage.error('查询失败!')
|
|
}
|
|
loading.value = false;
|
|
|
|
//计算表格固定高度
|
|
// myHeight.value = (document.documentElement.clientHeight) * 0.84;
|
|
|
|
});
|
|
}
|
|
|
|
|
|
|
|
//把子组件方法或变量暴露出去,供父组件使用
|
|
defineExpose({});
|
|
|
|
|
|
//修改分页大小函数
|
|
function handleSizeChange(pageSize) {
|
|
//开启表格加载
|
|
loading.value = true;
|
|
tablePageData.pageSize = pageSize;
|
|
getData();
|
|
}
|
|
|
|
//当前页改变
|
|
function handleCurrentChange(pageNum) {
|
|
//开启表格加载
|
|
loading.value = true;
|
|
tablePageData.pageNum = pageNum;
|
|
getData()
|
|
}
|
|
</script>
|
|
|
|
<style scoped></style> |