Browse Source

Merge branch 'dev-mata-ldz' of xiongzhu/raex_back into master

lidongze 3 years ago
parent
commit
9f8ecc7df8

+ 4 - 0
src/main/java/com/izouma/nineth/config/MetaConstants.java

@@ -12,6 +12,10 @@ public interface MetaConstants {
 
     String META_LUCKY_DRAW_ID = "META_LUCKY_DRAW_ID";
 
+    String META_GOLD_TOP_END_TIME = "META_GOLD_TOP_END_TIME";
+
+    String META_GOLD_TOP_BEGIN_TIME = "META_GOLD_TOP_BEGIN_TIME";
+
     String COMMA = ",";
 
     String BLANK = " ";

+ 28 - 0
src/main/java/com/izouma/nineth/domain/MetaTop.java

@@ -0,0 +1,28 @@
+package com.izouma.nineth.domain;
+
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Entity;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Entity
+@ApiModel("元宇宙排行榜管理")
+public class MetaTop extends BaseEntity{
+
+    @ApiModelProperty("排行榜名称")
+    private String name;
+
+    @ApiModelProperty("排行榜用途")
+    private String rule;
+
+    @ApiModelProperty("配置图片")
+    private String pic;
+
+}

+ 29 - 0
src/main/java/com/izouma/nineth/dto/MetaGoldTopDTO.java

@@ -0,0 +1,29 @@
+package com.izouma.nineth.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class MetaGoldTopDTO {
+
+    @ApiModelProperty("用户Id")
+    @ExcelProperty("用户ID")
+    private Long userId;
+
+    @ApiModelProperty("用户头像")
+    @ExcelProperty("头像")
+    private String head;
+
+    @ApiModelProperty("用户昵称")
+    @ExcelProperty("昵称")
+    private String nickName;
+
+    @ApiModelProperty("用户金币数量")
+    @ExcelProperty("金币数量")
+    private Long num;
+}

+ 16 - 0
src/main/java/com/izouma/nineth/repo/MetaTopRepo.java

@@ -0,0 +1,16 @@
+package com.izouma.nineth.repo;
+
+import com.izouma.nineth.domain.MetaTop;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+
+import javax.transaction.Transactional;
+
+public interface MetaTopRepo extends JpaRepository<MetaTop, Long>, JpaSpecificationExecutor<MetaTop> {
+    @Query("update MetaTop t set t.del = true where t.id = ?1")
+    @Modifying
+    @Transactional
+    void softDelete(Long id);
+}

+ 7 - 0
src/main/java/com/izouma/nineth/repo/MetaUserGoldRecordRepo.java

@@ -1,16 +1,23 @@
 package com.izouma.nineth.repo;
 
 import com.izouma.nineth.domain.MetaUserGoldRecord;
+import com.izouma.nineth.dto.MetaGoldTopDTO;
+import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
 
 import javax.transaction.Transactional;
+import java.util.List;
+import java.util.Map;
 
 public interface MetaUserGoldRecordRepo extends JpaRepository<MetaUserGoldRecord, Long>, JpaSpecificationExecutor<MetaUserGoldRecord> {
     @Query("update MetaUserGoldRecord t set t.del = true where t.id = ?1")
     @Modifying
     @Transactional
     void softDelete(Long id);
+
+    @Query(value = "select user_id userId,sum(operation_num) num,nickname nickName,avatar head from meta_user_gold_record inner join user u on meta_user_gold_record.user_id = u.id where meta_user_gold_record.created_at between ?1 and ?2 group by user_id order by sum(operation_num) desc",nativeQuery = true)
+    List<Map<String,String>> top(String beginTime, String endTime);
 }

+ 20 - 0
src/main/java/com/izouma/nineth/service/MetaTopService.java

@@ -0,0 +1,20 @@
+package com.izouma.nineth.service;
+
+import com.izouma.nineth.domain.MetaTop;
+import com.izouma.nineth.dto.PageQuery;
+import com.izouma.nineth.repo.MetaTopRepo;
+import com.izouma.nineth.utils.JpaUtils;
+import lombok.AllArgsConstructor;
+import org.springframework.data.domain.Page;
+import org.springframework.stereotype.Service;
+
+@Service
+@AllArgsConstructor
+public class MetaTopService {
+
+    private MetaTopRepo metaTopRepo;
+
+    public Page<MetaTop> all(PageQuery pageQuery) {
+        return metaTopRepo.findAll(JpaUtils.toSpecification(pageQuery, MetaTop.class), JpaUtils.toPageRequest(pageQuery));
+    }
+}

+ 2 - 0
src/main/java/com/izouma/nineth/service/MetaUserGoldRecordService.java

@@ -2,6 +2,8 @@ package com.izouma.nineth.service;
 
 import com.izouma.nineth.domain.MetaUserGoldRecord;
 import com.izouma.nineth.dto.PageQuery;
+import com.izouma.nineth.dto.PageWrapper;
+import com.izouma.nineth.dto.UserHoldDTO;
 import com.izouma.nineth.repo.MetaUserGoldRecordRepo;
 import com.izouma.nineth.utils.JpaUtils;
 import lombok.AllArgsConstructor;

+ 3 - 0
src/main/java/com/izouma/nineth/service/UserHoldCountService.java

@@ -22,8 +22,11 @@ public class UserHoldCountService {
         if (Boolean.FALSE.equals(redisTemplate.hasKey(Constants.USER_HOLD_CACHE_KEY))) {
             throw new BusinessException("key失效,请刷新!如果已经刷新,请等待!");
         }
+        // 当前页
         int page = pageQuery.getPage();
+        // pageSize 每页查询多少条数据
         int size = pageQuery.getSize();
+        // limit 开始偏移量
         int start = page * size;
         List<UserHoldDTO> userHoldDTOS = (List<UserHoldDTO>) redisTemplate.opsForValue().get(Constants.USER_HOLD_CACHE_KEY);
         int totalElements;

+ 60 - 0
src/main/java/com/izouma/nineth/web/MetaTopController.java

@@ -0,0 +1,60 @@
+package com.izouma.nineth.web;
+import com.izouma.nineth.domain.MetaTop;
+import com.izouma.nineth.service.MetaTopService;
+import com.izouma.nineth.dto.PageQuery;
+import com.izouma.nineth.exception.BusinessException;
+import com.izouma.nineth.repo.MetaTopRepo;
+import com.izouma.nineth.utils.ObjUtils;
+import com.izouma.nineth.utils.excel.ExcelUtils;
+import lombok.AllArgsConstructor;
+import org.springframework.data.domain.Page;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+@RestController
+@RequestMapping("/metaTop")
+@AllArgsConstructor
+public class MetaTopController extends BaseController {
+    private MetaTopService metaTopService;
+    private MetaTopRepo metaTopRepo;
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/save")
+    public MetaTop save(@RequestBody MetaTop record) {
+        if (record.getId() != null) {
+            MetaTop orig = metaTopRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
+            ObjUtils.merge(orig, record);
+            return metaTopRepo.save(orig);
+        }
+        return metaTopRepo.save(record);
+    }
+
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/all")
+    public Page<MetaTop> all(@RequestBody PageQuery pageQuery) {
+        return metaTopService.all(pageQuery);
+    }
+
+    @GetMapping("/get/{id}")
+    public MetaTop get(@PathVariable Long id) {
+        return metaTopRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+    }
+
+    @PostMapping("/del/{id}")
+    public void del(@PathVariable Long id) {
+        metaTopRepo.softDelete(id);
+    }
+
+    @GetMapping("/excel")
+    @ResponseBody
+    public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
+        List<MetaTop> data = all(pageQuery).getContent();
+        ExcelUtils.export(response, data);
+    }
+}
+

+ 52 - 1
src/main/java/com/izouma/nineth/web/MetaUserGoldRecordController.java

@@ -1,19 +1,29 @@
 package com.izouma.nineth.web;
 
+import cn.hutool.core.collection.CollectionUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.izouma.nineth.config.MetaConstants;
+import com.izouma.nineth.domain.MetaGameBoxPoints;
+import com.izouma.nineth.domain.MetaParamsConfig;
 import com.izouma.nineth.domain.MetaUserGoldRecord;
-import com.izouma.nineth.dto.PageQuery;
+import com.izouma.nineth.dto.*;
 import com.izouma.nineth.exception.BusinessException;
+import com.izouma.nineth.repo.MetaParamsConfigRepo;
 import com.izouma.nineth.repo.MetaUserGoldRecordRepo;
+import com.izouma.nineth.service.MetaParamsConfigService;
 import com.izouma.nineth.service.MetaUserGoldRecordService;
 import com.izouma.nineth.utils.ObjUtils;
 import com.izouma.nineth.utils.excel.ExcelUtils;
 import lombok.AllArgsConstructor;
+import org.apache.commons.collections.CollectionUtils;
 import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 @RestController
 @RequestMapping("/metaUserGoldRecord")
@@ -21,6 +31,7 @@ import java.util.List;
 public class MetaUserGoldRecordController extends BaseController {
     private MetaUserGoldRecordService metaUserGoldRecordService;
     private MetaUserGoldRecordRepo metaUserGoldRecordRepo;
+    private MetaParamsConfigService metaParamsConfigService;
 
     //@PreAuthorize("hasRole('ADMIN')")
     @PostMapping("/save")
@@ -56,5 +67,45 @@ public class MetaUserGoldRecordController extends BaseController {
         List<MetaUserGoldRecord> data = all(pageQuery).getContent();
         ExcelUtils.export(response, data);
     }
+
+    @GetMapping("/excel/top")
+    @ResponseBody
+    public void excelTop(HttpServletResponse response, PageQuery pageQuery) throws IOException {
+        List<MetaGoldTopDTO> data = top(pageQuery).getContent();
+        ExcelUtils.export(response, data);
+    }
+
+    @PostMapping("/goldTop")
+    public Page<MetaGoldTopDTO> top(@RequestBody PageQuery pageQuery) {
+        String beginTime = metaParamsConfigService.getString(MetaConstants.META_GOLD_TOP_BEGIN_TIME);
+        String endTime = metaParamsConfigService.getString(MetaConstants.META_GOLD_TOP_END_TIME);
+        List<Map<String, String>> map = metaUserGoldRecordRepo.top(beginTime, endTime);
+        JSONArray jsonArray = new JSONArray();
+        jsonArray.addAll(map);
+        List<MetaGoldTopDTO> metaGoldTopDTOS = jsonArray.toJavaList(MetaGoldTopDTO.class);
+        // 当前页
+        int page = pageQuery.getPage();
+        // pageSize 每页查询多少条数据
+        int size = pageQuery.getSize();
+        // limit 开始偏移量
+        int start = page * size;
+        int totalElements = 0;
+        if (CollectionUtils.isEmpty(metaGoldTopDTOS)) {
+            totalElements = 0;
+            return new PageWrapper<>(new ArrayList<MetaGoldTopDTO>(), page,
+                    size, totalElements).toPage();
+        }
+        totalElements = metaGoldTopDTOS.size();
+        List<MetaGoldTopDTO> newMetaGoldTopDTOS;
+        if (metaGoldTopDTOS.size() < start + size) {
+            newMetaGoldTopDTOS = metaGoldTopDTOS.subList(start, metaGoldTopDTOS.size());
+            return new PageWrapper<>(newMetaGoldTopDTOS, page,
+                    size, totalElements).toPage();
+        }
+        newMetaGoldTopDTOS = metaGoldTopDTOS.subList(start, start + size);
+        return new PageWrapper<>(newMetaGoldTopDTOS, page,
+                size, totalElements).toPage();
+
+    }
 }
 

+ 24 - 0
src/main/vue/src/router.js

@@ -2014,6 +2014,30 @@ const router = new Router({
                         title: '商店购买记录',
                     },
                 },
+                {
+                    path: '/metaTopEdit',
+                    name: 'MetaTopEdit',
+                    component: () => import(/* webpackChunkName: "metaTopEdit" */ '@/views/MetaTopEdit.vue'),
+                    meta: {
+                       title: '元宇宙排行榜管理编辑',
+                    },
+                },
+                {
+                    path: '/metaTopList',
+                    name: 'MetaTopList',
+                    component: () => import(/* webpackChunkName: "metaTopList" */ '@/views/MetaTopList.vue'),
+                    meta: {
+                       title: '元宇宙排行榜管理',
+                    },
+                },
+                {
+                    path: '/MetaTopDetailList',
+                    name: 'MetaTopDetailList',
+                    component: () => import(/* webpackChunkName: "metaTopList" */ '@/views/MetaTopDetailList.vue'),
+                    meta: {
+                       title: '元宇宙排行榜',
+                    },
+                },
                 {
                     path: '/metaUserTaskAwardReceivedRecordNewList',
                     name: 'MetaUserTaskAwardReceivedRecordNewList',

+ 132 - 0
src/main/vue/src/views/MetaTopDetailList.vue

@@ -0,0 +1,132 @@
+<template>
+    <div class="list-view">
+        <page-title>
+            <el-button
+                @click="download"
+                icon="el-icon-upload2"
+                :loading="downloading"
+                :disabled="fetchingData"
+                class="filter-item"
+            >
+                导出
+            </el-button>
+        </page-title>
+        <div class="filters-container">
+            <el-input
+                placeholder="搜索..."
+                v-model="search"
+                clearable
+                class="filter-item search"
+                @keyup.enter.native="getData"
+            >
+                <el-button @click="getData" slot="append" icon="el-icon-search"> </el-button>
+            </el-input>
+        </div>
+        <el-table
+            :data="tableData"
+            row-key="id"
+            ref="table"
+            header-row-class-name="table-header-row"
+            header-cell-class-name="table-header-cell"
+            row-class-name="table-row"
+            cell-class-name="table-cell"
+            :height="tableHeight"
+            v-loading="fetchingData"
+        >
+            <el-table-column v-if="multipleMode" align="center" type="selection" width="50"> </el-table-column>
+            <el-table-column prop="userId" label="用户Id" width="100"> </el-table-column>
+            <el-table-column prop="head" label="用户头像"> </el-table-column>
+            <el-table-column prop="nickName" label="用户昵称"> </el-table-column>
+            <el-table-column prop="num" label="金币数量"> </el-table-column>
+        </el-table>
+        <div class="pagination-wrapper">
+            <!-- <div class="multiple-mode-wrapper">
+                <el-button v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
+                <el-button-group v-else>
+                    <el-button @click="operation1">批量操作1</el-button>
+                    <el-button @click="operation2">批量操作2</el-button>
+                    <el-button @click="toggleMultipleMode(false)">取消</el-button>
+                </el-button-group>
+            </div> -->
+            <el-pagination
+                background
+                @size-change="onSizeChange"
+                @current-change="onCurrentChange"
+                :current-page="page"
+                :page-sizes="[10, 20, 30, 40, 50]"
+                :page-size="pageSize"
+                layout="total, sizes, prev, pager, next, jumper"
+                :total="totalElements"
+            >
+            </el-pagination>
+        </div>
+    </div>
+</template>
+<script>
+import { mapState } from 'vuex';
+import pageableTable from '@/mixins/pageableTable';
+
+export default {
+    name: 'MetaTopDetailList',
+    mixins: [pageableTable],
+    data() {
+        return {
+            multipleMode: false,
+            search: '',
+            url: '/metaUserGoldRecord/goldTop',
+            downloading: false
+        };
+    },
+    computed: {
+        selection() {
+            return this.$refs.table.selection.map(i => i.id);
+        }
+    },
+    methods: {
+        beforeGetData() {
+            return { search: this.search, query: { del: false } };
+        },
+        toggleMultipleMode(multipleMode) {
+            this.multipleMode = multipleMode;
+            if (!multipleMode) {
+                this.$refs.table.clearSelection();
+            }
+        },
+        download() {
+            this.downloading = true;
+            this.$axios
+                .get('/metaUserGoldRecord/excel/top', {
+                    responseType: 'blob',
+                    params: { size: 10000 }
+                })
+                .then(res => {
+                    console.log(res);
+                    this.downloading = false;
+                    const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
+                    const link = document.createElement('a');
+                    link.href = downloadUrl;
+                    link.setAttribute('download', res.headers['content-disposition'].split('filename=')[1]);
+                    document.body.appendChild(link);
+                    link.click();
+                    link.remove();
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.downloading = false;
+                    this.$message.error(e.error);
+                });
+        },
+        operation1() {
+            this.$notify({
+                title: '提示',
+                message: this.selection
+            });
+        },
+        operation2() {
+            this.$message('操作2');
+        }
+    }
+};
+</script>
+<style lang="less" scoped>
+</style>

+ 106 - 0
src/main/vue/src/views/MetaTopEdit.vue

@@ -0,0 +1,106 @@
+<template>
+    <div class="edit-view">
+        <page-title>
+            <el-button @click="$router.go(-1)" :disabled="saving">取消</el-button>
+            <el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id">
+                删除
+            </el-button>
+            <el-button @click="onSave" :loading="saving" type="primary">保存</el-button>
+        </page-title>
+        <div class="edit-view__content-wrapper">
+            <div class="edit-view__content-section">
+                <el-form :model="formData" :rules="rules" ref="form" label-width="94px" label-position="right"
+                         size="small"
+                         style="max-width: 500px;">
+                        <el-form-item prop="name" label="排行榜名称">
+                                    <el-input v-model="formData.name"></el-input>
+                        </el-form-item>
+                        <el-form-item prop="rule" label="排行榜用途">
+                                    <el-input v-model="formData.rule"></el-input>
+                        </el-form-item>
+                        <el-form-item prop="pic" label="配置图片">
+                                    <single-upload v-model="formData.pic"></single-upload>
+                        </el-form-item>
+                    <el-form-item class="form-submit">
+                        <el-button @click="onSave" :loading="saving" type="primary">
+                            保存
+                        </el-button>
+                        <el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id">
+                            删除
+                        </el-button>
+                        <el-button @click="$router.go(-1)" :disabled="saving">取消</el-button>
+                    </el-form-item>
+                </el-form>
+            </div>
+        </div>
+    </div>
+</template>
+<script>
+    export default {
+        name: 'MetaTopEdit',
+        created() {
+            if (this.$route.query.id) {
+                this.$http
+                    .get('metaTop/get/' + this.$route.query.id)
+                    .then(res => {
+                        this.formData = res;
+                    })
+                    .catch(e => {
+                        console.log(e);
+                        this.$message.error(e.error);
+                    });
+            }
+        },
+        data() {
+            return {
+                saving: false,
+                formData: {
+                },
+                rules: {
+                },
+            }
+        },
+        methods: {
+            onSave() {
+                this.$refs.form.validate((valid) => {
+                    if (valid) {
+                        this.submit();
+                    } else {
+                        return false;
+                    }
+                });
+            },
+            submit() {
+                let data = {...this.formData};
+
+                this.saving = true;
+                this.$http
+                    .post('/metaTop/save', data, {body: 'json'})
+                    .then(res => {
+                        this.saving = false;
+                        this.$message.success('成功');
+                        this.$router.go(-1);
+                    })
+                    .catch(e => {
+                        console.log(e);
+                        this.saving = false;
+                        this.$message.error(e.error);
+                    });
+            },
+            onDelete() {
+                this.$confirm('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
+                    return this.$http.post(`/metaTop/del/${this.formData.id}`)
+                }).then(() => {
+                    this.$message.success('删除成功');
+                    this.$router.go(-1);
+                }).catch(e => {
+                    if (e !== 'cancel') {
+                        console.log(e);
+                        this.$message.error((e || {}).error || '删除失败');
+                    }
+                })
+            },
+        }
+    }
+</script>
+<style lang="less" scoped></style>

+ 185 - 0
src/main/vue/src/views/MetaTopList.vue

@@ -0,0 +1,185 @@
+<template>
+    <div class="list-view">
+        <page-title>
+            <el-button
+                @click="addRow"
+                type="primary"
+                icon="el-icon-plus"
+                :disabled="fetchingData || downloading"
+                class="filter-item"
+            >
+                新增
+            </el-button>
+        </page-title>
+        <div class="filters-container">
+            <el-input
+                placeholder="搜索..."
+                v-model="search"
+                clearable
+                class="filter-item search"
+                @keyup.enter.native="getData"
+            >
+                <el-button @click="getData" slot="append" icon="el-icon-search"> </el-button>
+            </el-input>
+        </div>
+        <el-table
+            :data="tableData"
+            row-key="id"
+            ref="table"
+            header-row-class-name="table-header-row"
+            header-cell-class-name="table-header-cell"
+            row-class-name="table-row"
+            cell-class-name="table-cell"
+            :height="tableHeight"
+            v-loading="fetchingData"
+        >
+            <el-table-column v-if="multipleMode" align="center" type="selection" width="50"> </el-table-column>
+            <el-table-column prop="id" label="ID" width="100"> </el-table-column>
+            <el-table-column prop="name" label="排行榜名称"> </el-table-column>
+            <el-table-column prop="rule" label="排行榜用途"> </el-table-column>
+            <el-table-column prop="pic" label="配置图片">
+                <template slot-scope="{ row }">
+                    <el-image
+                        style="width: 30px; height: 30px"
+                        :src="row.pic"
+                        fit="cover"
+                        :preview-src-list="[row.pic]"
+                    ></el-image>
+                </template>
+            </el-table-column>
+            <el-table-column label="操作" align="center" fixed="right" width="150">
+                <template slot-scope="{ row }">
+                    <el-button @click="MetaTopDetailList(row)" type="primary" size="mini" plain>查看</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+        <div class="pagination-wrapper">
+            <!-- <div class="multiple-mode-wrapper">
+                <el-button v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
+                <el-button-group v-else>
+                    <el-button @click="operation1">批量操作1</el-button>
+                    <el-button @click="operation2">批量操作2</el-button>
+                    <el-button @click="toggleMultipleMode(false)">取消</el-button>
+                </el-button-group>
+            </div> -->
+            <el-pagination
+                background
+                @size-change="onSizeChange"
+                @current-change="onCurrentChange"
+                :current-page="page"
+                :page-sizes="[10, 20, 30, 40, 50]"
+                :page-size="pageSize"
+                layout="total, sizes, prev, pager, next, jumper"
+                :total="totalElements"
+            >
+            </el-pagination>
+        </div>
+    </div>
+</template>
+<script>
+import { mapState } from 'vuex';
+import pageableTable from '@/mixins/pageableTable';
+
+export default {
+    name: 'MetaTopList',
+    mixins: [pageableTable],
+    data() {
+        return {
+            multipleMode: false,
+            search: '',
+            url: '/metaTop/all',
+            downloading: false
+        };
+    },
+    computed: {
+        selection() {
+            return this.$refs.table.selection.map(i => i.id);
+        }
+    },
+    methods: {
+        beforeGetData() {
+            return { search: this.search, query: { del: false } };
+        },
+        toggleMultipleMode(multipleMode) {
+            this.multipleMode = multipleMode;
+            if (!multipleMode) {
+                this.$refs.table.clearSelection();
+            }
+        },
+        addRow() {
+            this.$router.push({
+                path: '/metaTopEdit',
+                query: {
+                    ...this.$route.query
+                }
+            });
+        },
+        MetaTopDetailList() {
+            this.$router.push({
+                path: '/MetaTopDetailList',
+                query: {
+                    
+                }
+            });
+        },
+        editRow(row) {
+            this.$router.push({
+                path: '/metaTopEdit',
+                query: {
+                    id: row.id
+                }
+            });
+        },
+        download() {
+            this.downloading = true;
+            this.$axios
+                .get('/metaTop/excel', {
+                    responseType: 'blob',
+                    params: { size: 10000 }
+                })
+                .then(res => {
+                    console.log(res);
+                    this.downloading = false;
+                    const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
+                    const link = document.createElement('a');
+                    link.href = downloadUrl;
+                    link.setAttribute('download', res.headers['content-disposition'].split('filename=')[1]);
+                    document.body.appendChild(link);
+                    link.click();
+                    link.remove();
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.downloading = false;
+                    this.$message.error(e.error);
+                });
+        },
+        operation1() {
+            this.$notify({
+                title: '提示',
+                message: this.selection
+            });
+        },
+        operation2() {
+            this.$message('操作2');
+        },
+        deleteRow(row) {
+            this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
+                .then(() => {
+                    return this.$http.post(`/metaTop/del/${row.id}`);
+                })
+                .then(() => {
+                    this.$message.success('删除成功');
+                    this.getData();
+                })
+                .catch(e => {
+                    if (e !== 'cancel') {
+                        this.$message.error(e.error);
+                    }
+                });
+        }
+    }
+};
+</script>
+<style lang="less" scoped>
+</style>