<template> <div class="app-container"> <!--筛选条件--> <div class="search-div"> <el-form ref="selectForm" :inline="true" :model="listQuery" class="form-container"> <el-row> <el-form-item class="selectForm-container-item" prop="dept" > <el-select v-model="listQuery.dept" placeholder="考核部门" clearable> <el-option v-for="item in deptList" :key="item.id" :label="item.simplename" :value="item.id"/> </el-select> </el-form-item> <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button> </el-row> </el-form> </div> <!--查询结果Table显示--> <div> <el-row class="table-title"> <el-col :span="6"><div class="title-header"><i class="el-icon-menu"/>数据列表</div></el-col> <el-col :span="12" :offset="6" class="edit_btns"> <!--<el-button v-if="hasPerm('/liquiddata/export')" class="edit_btn" size="small" @click="batchExport">导出记录</el-button>--> </el-col> </el-row> <el-table v-loading="listLoading" :data="list" class="table" border @selection-change="handleSelectionChange"> <!--<el-table-column align="center" type="selection" width="55"/>--> <el-table-column :index="indexMethod" align="center" type="index"/> <el-table-column v-for="column in columns" :key="column.value" :label="column.text" :width="column.width" :align="column.align" show-overflow-tooltip> <template slot-scope="scope"> <span v-if="column.checkCell" :class="checkCell(scope.row.cell)">{{ scope.row[column.value] }}</span> <span v-else>{{ scope.row[column.value] }}</span> </template> </el-table-column> <el-table-column label="操作" align="center" width="160"> <template slot-scope="scope"> <el-button type="text" @click="data(scope.row)">查看统计数据</el-button> </template> </el-table-column> </el-table> </div> <!--分页--> <div class="pagination-container"> <el-pagination v-show="total>listQuery.limit" :current-page="listQuery.offset" :page-sizes="[20,30,50]" :page-size="listQuery.limit" :total="total" align="center" layout="total, sizes, prev, pager, next" @size-change="handleSizeChange" @current-change="handleCurrentChange"/> </div> <dept-statistics v-show="editShow" ref="deptstatistics" @watchChild="fetchData"/> </div> </template> <script> import { getOverviewList, getDeptList } from '@/api/assessRules' import DeptStatistics from '@/views/assessRules/deptStatistics' export default { name: 'ListOverview', components: { DeptStatistics }, data() { return { listQuery: { keyword1: '', dept: '', // 关键字 offset: 1, limit: 20, sort: '', order: '' }, // 筛选条件 deptList: [], // 时间范围 columns: [ { text: '考核部门', value: 'deptName', align: 'center' }, { text: '下属部门', value: 'subDeptName', align: 'center' }, { text: '考核指标', value: 'indexMenu', align: 'center' } ], // 显示列 multipleSelection: [], // 多选选中项 list: [], // 列表数据 total: 0, // 数据总数 deptTreeList: null, // 组织树列表数据 showDeptTree: 0, // 是否显示权属单位下拉 showDeviceType: true, // 是否显示设备类型下拉 listLoading: false, // 加载动画 fullscreenLoading: false, // 全屏加载动画 editShow: false, // 是否显示编辑框 detailShow: false, // 是否显示编辑框 deptShowTop: false } }, watch: { timeRange(val) { if (val && val.length > 0) { this.listQuery.beginTime = val[0] this.listQuery.endTime = val[1] } else { this.listQuery.beginTime = '' this.listQuery.endTime = '' } } }, mounted() { debugger this.fetchDeptList() this.fetchData(false) }, methods: { // 查询数据 search() { this.fetchData(false) }, data(row) { this.dialogFormVisible = true this.editShow = true this.$refs.deptstatistics.initDialog(this.dialogFormVisible, row) }, // 获取开挖配置数据 fetchData(isNowPage = true) { this.listLoading = true if (!isNowPage) { // 是否显示当前页,否则跳转第一页 this.listQuery.offset = 1 } this.listQuery.keyword1 = this.listQuery.dept getOverviewList(this.listQuery).then(response => { this.list = response.data.rows this.listLoading = false }) }, fetchDeptList() { getDeptList('24').then(response => { this.deptList = response.data }) }, indexMethod(index) { return this.listQuery.limit * (this.listQuery.offset - 1) + index + 1 }, // 改变页容量 handleSizeChange(val) { this.listQuery.limit = val this.fetchData() }, // 改变当前页 handleCurrentChange(val) { this.listQuery.offset = val this.fetchData() }, // 多选触发方法 handleSelectionChange(val) { this.multipleSelection = val } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> .app-container{ padding: 10px; } $tableTitleHeight:46px; .table{ margin-bottom: 20px; } .pagination-container{ margin-bottom: 50px; } .table-title{ background-color:rgba(243, 243, 243, 1); height: $tableTitleHeight; .title-header{ line-height:$tableTitleHeight; color: #606266; font-size: 15px; i{ margin-left: 5px; margin-right: 5px; } } } .edit_btns{ .edit_btn{ float:right; margin:7px 3px;//为了需要居中显示margin-top和bottom要用$tableTitleHeight减去按钮原高度除以2 } } .warning-state{ color:red } </style>