| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <template>
- <div v-loading="loading">
- <div class="white-box">
- <div class="filter-box">
- <filter-user ref="filterUser" :filter-types="filterTypes" @select-value="handleFilterUser"></filter-user>
- </div>
- <el-table :data="tableData" stripe style="width: 100%;" @selection-change="handleSelectionChange"
- :height="tool.getTableHeight(true)">
- <el-table-column v-for="(tableHeader, key) in tableHeaders" :key="key" :label="tableHeader.header" :width="tableHeader.other.width ? tableHeader.other.width : ''" :prop="tableHeader.other.prop ? tableHeader.other.prop : null">
- <template slot-scope="scope">
- <template v-if="scope.row[tableHeader.index].other.tag" >
- <el-tag :type="scope.row[tableHeader.index].other.tag.type ? scope.row[tableHeader.index].other.tag.type : null" :size="scope.row[tableHeader.index].other.tag.size ? scope.row[tableHeader.index].other.tag.size : null" :class="scope.row[tableHeader.index].other.tag.class ? scope.row[tableHeader.index].other.tag.class : null" >{{scope.row[tableHeader.index].value}}</el-tag>
- </template>
- <template v-else>
- <div v-html="scope.row[tableHeader.index].value"></div>
- </template>
- </template>
- </el-table-column>
- </el-table>
- <div class="white-box-footer">
- <el-button type="success" size="small" @click="handleExport" v-show="permission.hasPermission(`bonus/perf-month-export`)">Export Excel</el-button>
- <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
- </div>
- </div>
- </div>
- </template>
- <script>
- import network from '@/utils/network'
- import tool from '@/utils/tool'
- import baseInfo from '@/utils/baseInfo'
- import FilterUser from '@/components/FilterUser'
- import permission from '@/utils/permission'
- import Pagination from '@/components/Pagination'
- import filterHelper from '@/utils/filterHelper'
- export default {
- name: 'leo-perf-standard-table',
- components: {FilterUser,Pagination},
- mounted () {
- this.getData()
- },
- data () {
- return {
- tableHeaders: null,
- tableData: null,
- loading: true,
- multipleSelection: [],
- currentPage: 1,
- totalPages: 1,
- totalCount: 1,
- pageSize: 20,
- tool: tool,
- permission: permission,
- baseDecLevels: baseInfo.decLevels(),
- baseEmpLevels: baseInfo.empLevels(),
- filterTypes: null,
- filterModel: {},
- filterStatus: 'ALL',
- }
- },
- methods: {
- handleSelectionChange(val) {
- this.multipleSelection = val
- },
- handleCurrentChange(page) {
- this.getData(page, this.pageSize)
- },
- handleSizeChange(pageSize) {
- this.getData(this.currentPage, pageSize)
- },
- handleFilterUser(filterData){
- filterHelper.handleFilterUser(this, filterData)
- },
- getData (page, pageSize) {
- let filterData = this.filterModel
- if(window.location.href.indexOf('filter') === -1){
- filterData.filterType = this.filterStatus !== 'ALL' ? `=,${this.filterStatus}` : ''
- }
- network.getPageData(this, 'bonus/perf-standard', page, pageSize, filterData, response=>{
- this.filterTypes = response.filterTypes
- })
- },
- handleExport () {
- let filterData = this.filterModel
- if(window.location.href.indexOf('filter') === -1){
- filterData.filterType = this.filterStatus !== 'ALL' ? `=,${this.filterStatus}` : ''
- }
- this.$confirm('确定要导出当前表格中的数据吗?', 'Notice', {
- confirmButtonText: 'confirm', // 确定
- cancelButtonText: 'cancel', // 取消
- type: 'warning'
- }).then(() => {
- return network.getData('bonus/perf-standard-export', filterData)
- }).then(response => {
- this.$message({
- message: response,
- type: 'success'
- })
- }).catch(response => {
- })
- },
- }
- }
- </script>
- <style>
- .leo-withdrawTable .el-form-item__label {
- width: 100px;
- color: #99a9bf;
- }
- .leo-withdrawTable .el-form-item {
- width: 40%;
- margin-right: 0;
- margin-bottom: 0;
- }
- </style>
|