<!--监督员考核--> <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="beginDate"> <el-date-picker v-model="timeRange" :picker-options="pickerOptions" type="daterange" range-separator="至" value-format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期"/> </el-form-item> <el-button class="filter-item" type="primary" icon="el-icon-data-analysis" @click="search">统计</el-button> <el-button class="filter-item" icon="el-icon-document" @click="search">报表</el-button> </el-row> </el-form> </div> <!--查询结果Table显示--> <div class="table-container"> <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 class="edit_btn" size="small" @click="setRule">考核规则</el-button> </el-col> </el-row> <el-table v-loading="listLoading" :data="list" class="table" border @selection-change="handleSelectionChange"> <el-table-column :index="indexMethod" align="center" type="index"/> <el-table-column v-for="column in columns" :key="column.name" :label="column.text" :width="column.width" align="center" show-overflow-tooltip> <template slot-scope="scope"> <span v-if="column.type!='Button'" :class="column.class">{{ scope.row[column.value] }}</span> <el-button v-if="column.type=='Button'" type="text" @click="showCaseList(scope.row,column.text)">{{ scope.row[column.value] }}</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> <el-dialog :visible.sync="dialogVisible" :append-to-body="true" :close-on-click-modal="false" title="考核规则" width="70%" > <assess-rule-supervisor/> </el-dialog> </div> </template> <script> import AssessRuleSupervisor from './components/assessRuleSupervisor' import { getDayTime } from '@/utils/dateutils' import { assessSupervisor } from '@/api/assess/assessPost' // import SearchDiv from './components/searchDiv' export default { name: 'SupervisorAssess', components: { AssessRuleSupervisor }, data() { return { props: [], // 存储列表页传递的row list: [], // 数据列表 pickerOptions: { shortcuts: [{ text: '最近一周', onClick(picker) { const end = new Date() const start = new Date() start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) picker.$emit('pick', [start, end]) } }, { text: '最近一个月', onClick(picker) { const end = new Date() const start = new Date() start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) picker.$emit('pick', [start, end]) } }, { text: '最近三个月', onClick(picker) { const end = new Date() const start = new Date() start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) picker.$emit('pick', [start, end]) } }] }, columns: [ { text: '姓名', value: 'name' }, { text: '应上报数', value: 'value', width: 60, type: 'Button' }, { text: '实上报数', value: 'value', width: 60, type: 'Button' }, { text: '不予立案数', value: 'value', width: 60, type: 'Button' }, { text: '立案数', value: 'value', width: 60, type: 'Button' }, { text: '立案率', value: 'percent' }, { text: '应核实数', value: 'value', width: 60, type: 'Button' }, { text: '核实数', value: 'value', width: 60, type: 'Button' }, { text: '核实率', value: 'percent', width: 60 }, { text: '按时核实数', value: 'value', width: 60, type: 'Button' }, { text: '按时核实率', value: 'percent', width: 60 }, { text: '应核查数', value: 'value', width: 60, type: 'Button' }, { text: '核查数', value: 'value', width: 60, type: 'Button' }, { text: '核查率', value: 'percent', width: 60 }, { text: '按时核查数', value: 'value', width: 60, type: 'Button' }, { text: '按时核查率', value: 'percent', width: 60 }, { text: '综合指标', value: 'value', width: 60 }, { text: '等级', value: 'level', width: 60 } ], listQuery: { beginDate: '', endDate: '', offset: 1, limit: 10, sort: '', order: '' }, // 筛选条件 timeRange: [], total: 0, dialogVisible: false, // 考核规则的显示 listLoading: true // 加载动画 } }, watch: { timeRange(val) { if (val && val.length > 0) { this.listQuery.beginDate = val[0] this.listQuery.endDate = val[1] } else { this.listQuery.beginDate = '' this.listQuery.endDate = '' } } }, mounted() { this.fetchData() }, methods: { fetchData(isNowPage = true) { this.listLoading = true if (!isNowPage) { // 是否显示当前页,否则跳转第一页 this.listQuery.offset = 1 } if (this.listQuery.beginDate === '') { const defaultBeginTime = getDayTime(new Date().getTime() - 24 * 7 * 60 * 60 * 1000).Format('yyyy-MM-dd') const defaultEndTime = new Date().Format('yyyy-MM-dd') if (this.timeRange.length === 0) { this.timeRange = [defaultBeginTime, defaultEndTime] } this.listQuery.beginDate = this.timeRange[0] this.listQuery.endDate = this.timeRange[1] } assessSupervisor(this.listQuery).then(res => { this.caseList = res.data.rows this.total = parseInt(res.data.total) this.listLoading = false }) this.list = [ { name: '张三', value: '0', percent: '100%', level: 'A' }, { name: '张三', value: '0', percent: '100%', level: 'A' }, { name: '张三', value: '0', percent: '100%', level: 'A' }, { name: '张三', value: '0', percent: '100%', level: 'A' }, { name: '张三', value: '0', percent: '100%', level: 'A' }, { name: '张三', value: '0', percent: '100%', level: 'A' } ] this.listLoading = false }, export() { }, // 来自业务查询条件更改后的查询 search() { this.fetchData(false) }, // 点击告警规则 setRule() { this.dialogVisible = true }, // 计算行号 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> $tableTitleHeight:46px; .app-container { .table-container { margin-bottom: 30px; .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 } } } } </style>