<template> <div class="app-container"> <!--筛选条件--> <el-dialog :title="title" :visible.sync="dialogFormVisible" append-to-body> <el-form ref="selectForm" :inline="true" :model="listQuery" class="form-container"> <el-row> <el-form-item class="selectForm-container-item" prop="deptId" > <el-select v-model="listQuery.deptId" placeholder="考核部门" clearable @change="changeDept"> <el-option v-for="item in deptList" :key="item.id" :label="item.simplename" :value="item.id"/> </el-select> </el-form-item> <el-form-item class="selectForm-container-item" prop="subDeptId" > <el-select v-model="listQuery.subDeptId" :disabled="!listQuery.deptId" placeholder="下属部门" clearable> <el-option v-for="item in subDeptList" :key="item.id" :label="item.simplename" :value="item.id"/> </el-select> </el-form-item> <el-form-item class="selectForm-container-item" prop="indexType" > <el-select v-model="listQuery.indexType" placeholder="指标类型" clearable> <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.name"/> </el-select> </el-form-item> <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">查询</el-button> </el-row> </el-form> <!--查询结果Table显示--> <div> <el-row class="table-title"> <el-col :span="6"><div class="title-header"><i class="el-icon-menu"/>数据列表</div></el-col> </el-row> <el-table v-loading="listLoading" :data="list" class="table" border> <!--<el-table-column align="center" type="selection" width="55"/>--> <el-table-column :index="indexMethod" label="序号" align="center" type="index" width="55"/> <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> </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> <div slot="footer" class="dialog-footer"> <el-button @click="cancel">确定</el-button> </div> </el-dialog> </div></template> <script> import { getDeptResultDetail } from '@/api/assessResult' import { getDeptList } from '@/api/assessRules' export default { name: 'ResultDetail', data() { return { listQuery: { checkId: '', deptId: '', subDeptId: '', indexType: '', offset: 1, limit: 20, sort: '', order: '' }, // 筛选条件 columns: [ { text: '指标名称', value: 'indexMenu', align: 'center' }, { text: '指标类型', value: 'indexType', align: 'center' }, { text: '所属部门', value: 'deptName', align: 'center' }, { text: '下属部门', value: 'subDeptName', align: 'center', width: 140 }, { text: '指标描述', value: 'indexdesc', align: 'center' }, { text: '当前现状', value: 'currentindex', align: 'center', width: 80 }, { text: '调节因子', value: 'facotor', align: 'center', width: 80 }, { text: '指标得分', value: 'indexscore', align: 'center', width: 80 } ], // 显示列 multipleSelection: [], // 多选选中项 list: [], // 列表数据 total: 0, // 数据总数 subDeptList: [], deptList: [], listLoading: false, title: '', dialogFormVisible: false, typeList: [ { name: '部门职能' }, { name: '专题专项' }, { name: '经济发展' }, { name: '行政综合' } ] } }, activated() { // 要是路由里有参数 if (this.$route.query.checkId) { this.listQuery.checkId = this.$route.query.checkId this.fetchData() } }, mounted() { this.fetchDeptList() }, methods: { // 初始化对话框 initDialog: function(dialogFormVisible, row) { this.dialogFormVisible = dialogFormVisible this.title = row.deptName + ' - 指标详情呈现' this.listQuery.checkId = row.id this.fetchData() }, fetchData() { getDeptResultDetail(this.listQuery).then(response => { this.list = response.data.rows }) }, // 重置表单 resetForm() { }, search() { this.fetchData() }, fetchDeptList() { getDeptList('24').then(response => { this.deptList = response.data if (this.deptList) { this.listQuery.dept = this.deptList[0].id getDeptList(this.listQuery.dept).then(response => { this.subDeptList = response.data }) } }) }, changeDept() { if (this.listQuery.dept) { getDeptList(this.listQuery.dept).then(response => { this.subDeptList = response.data }) } }, typeChanged() { this.deviceForm.networkType = '' this.deviceForm.deviceModel = '' this.$nextTick(() => { this.$refs['dataForm'].clearValidate() }) }, cancel: function() { this.dialogFormVisible = false }, 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() } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> .el-select{ width: 100%; } .el-date-editor{ width: 100%; } </style>