ソースを参照

添加包依赖

silent 4 年 前
コミット
31a36ff436

+ 5 - 0
package-lock.json

@@ -7608,6 +7608,11 @@
         "commander": "*"
       }
     },
+    "moment": {
+      "version": "2.29.1",
+      "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
+      "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
+    },
     "move-concurrently": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",

+ 1 - 0
package.json

@@ -21,6 +21,7 @@
     "js-cookie": "^2.2.0",
     "js-md5": "^0.7.3",
     "mockjs": "^1.0.1-beta3",
+    "moment": "^2.29.1",
     "node-gyp": "^5.0.6",
     "nprogress": "^0.2.0",
     "pako": "^2.0.4",

+ 13 - 0
src/api/sing_active/activeproductrecord.js

@@ -12,6 +12,19 @@ export const getList = (current, size, params) => {
   })
 }
 
+export const generateList = (current, size, params) => {
+  return request({
+    url: '/api/sing_active/activeproductrecord/generateList',
+    method: 'post',
+    responseType:"blob",
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
 export const getDetail = (id) => {
   return request({
     url: '/api/sing_active/activeproductrecord/detail',

+ 36 - 0
src/util/fileUtil.js

@@ -0,0 +1,36 @@
+import FileUtil from './fileUtil'
+
+export default {
+  /**
+   * 创建下载
+   * @param data 数据
+   * @param options 选项
+   * @returns {string}
+   */
+  createDownloadUrl(data, options) {
+    let blob = new Blob([data], options);
+    return FileUtil.createObjectURL(blob);
+  },
+  /**
+   * 创建下载链接
+   * @param obj
+   * @returns {string}
+   */
+  createObjectURL(obj){
+    return window.URL.createObjectURL(obj);
+  },
+  /**
+   * 下载文件
+   * @param data
+   * @param options
+   * @param filename
+   */
+  download(data, options, filename){
+    const url = FileUtil.createDownloadUrl(data,options);
+    const a = document.createElement("a");
+    a.target = "_black";
+    a.download = filename;
+    a.href = url;
+    a.click();
+  }
+}

+ 73 - 0
src/views/base/iconfont.vue

@@ -0,0 +1,73 @@
+<template>
+  <el-row style="width: 100%">
+    <el-col :span="option.span" v-for="(data,index) in option.data" :key="index">
+      <div :style="{height: `${height}px`,
+            minWidth:'200px',
+            backgroundColor: 'rgb(245, 247, 249)',
+            borderRadius: '5px',
+            margin: '4px 5px',
+            // boxShadow: '2px 2px 2px 2px rgba(0, 0, 0,0.3)'
+        }">
+        <!-- 图标内容 -->
+        <div :style="{
+            height: '100%',
+            width:'50%',
+            display: 'inline-block',
+            float: 'left'
+         }">
+          <div :style="{
+            width: `${height/3}px`,
+            height: `${height/3}px`,
+            margin: `${height/2 - height/3/2 - height/2/5}px`,
+            lineHeight: `${height/3+height/2/5}px`,
+            boxShadow: `0px 0px 5px 5px rgba(${data.color?data.color:'0,0,0'},0.3)`,
+            textAlign: 'center',
+            border:`${height/2/5}px solid rgb(${data.color?data.color:'0,0,0'})`,
+            borderRadius: '50%',
+            backgroundColor: `rgb(${data.color?data.color:'0,0,0'})`
+          }">
+            <i :class="data.icon" :style="{
+              fontSize: `${height/3}px`,
+              color: 'white',
+            }"></i>
+          </div>
+        </div>
+        <!-- 描述内容 -->
+        <div :style="{
+            height: '100%',
+            width:'50%',
+            display: 'inline-block',
+         }">
+          <h4 :style="{
+            marginTop: `${(height/2-10)/2}px`,
+            marginBottom: '10px',
+          }">{{data.title}}</h4>
+          <p :style="{
+            color:'gary',
+            margin: '10px 0',
+          }">{{data.decimals?parseFloat(data.count).toFixed(2):data.count}}</p>
+        </div>
+      </div>
+    </el-col>
+  </el-row>
+</template>
+
+<script>
+export default {
+  name: "iconfont",
+  props:{
+    option:{
+      type: "Object",
+      default: {}
+    },
+    height:{
+      type:"Number",
+      default: 80
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 472 - 297
src/views/sing_active/activeproductrecord.vue

@@ -18,6 +18,45 @@
                @size-change="sizeChange"
                @refresh-change="refreshChange"
                @on-load="onLoad">
+      <template slot-scope="{type,size}" slot="createTimeSearch">
+        <el-radio-group v-model="query.createTime" :size="size" style="float: left">
+          <el-radio-button @click="searchStateChange" :label="-1">全部</el-radio-button>
+          <el-radio-button @click="searchStateChange" :label="1">今天</el-radio-button>
+          <el-radio-button @click="searchStateChange" :label="2">昨天</el-radio-button>
+          <el-radio-button @click="searchStateChange" :label="3">最近七天</el-radio-button>
+          <el-radio-button @click="searchStateChange" :label="4">最近30天</el-radio-button>
+          <el-radio-button @click="searchStateChange" :label="5">本月</el-radio-button>
+          <el-radio-button @click="searchStateChange" :label="6">本年</el-radio-button>
+        </el-radio-group>
+        <avue-date v-model="query.createTimeRange" type="datetimerange" format="yyyy年MM月dd日 hh:mm:ss"
+                   value-format="yyyy-MM-dd hh:mm:ss" placeholder="请选择日期"
+                   :size="size"
+                   @change="searchStateChange"
+                   style="width: 280px;margin-left:5px;float: left"
+                   range-separator="-"
+                   start-placeholder="开始日期"
+                   end-placeholder="结束日期"></avue-date>
+      </template>
+      <template slot-scope="{type,size}" slot="statusSearch">
+        <el-radio-group v-model="query.status" :size="size" @change="searchStateChange">
+          <el-radio-button :label="select.value" v-for="(select,index) in [{
+            label:'全部',
+            value:-1
+          }].concat(option.column.find(ele=>{
+            return ele.prop==='status';
+          }).dicData)" :key="index">{{ select.label }}
+          </el-radio-button>
+        </el-radio-group>
+      </template>
+      <template slot-scope="{type,size}" slot="keySearch">
+        <el-input type="text" placeholder="订单ID" v-model="query.key" :size="size"
+                  style="width: 300px;margin: 1px 5px 1px 0;">
+          <el-button type="primary" :size="size" icon="el-icon-search" slot="append"
+                     @click="searchStateChange"></el-button>
+        </el-input>
+        <el-button type="primary" :size="size" icon="el-icon-top" @click="generateListAndDownload">生成列表</el-button>
+        <!--        <el-button type="primary" :size="size">导出已生成列表</el-button>-->
+      </template>
       <template slot="menuLeft">
         <el-button type="danger"
                    size="small"
@@ -32,331 +71,467 @@
 </template>
 
 <script>
-import {add, getDetail, getList, remove, update} from "@/api/sing_active/activeproductrecord";
+import {add, getDetail, getList, remove, update, generateList} from "@/api/sing_active/activeproductrecord";
 import {mapGetters} from "vuex";
+import moment from "moment";
+import IconFontComp from "@/views/base/iconfont";
+import FileUtil from "@/util/fileUtil";
 
 export default {
-    data() {
-      return {
-        form: {},
-        query: {},
-        loading: true,
-        page: {
-          pageSize: 10,
-          currentPage: 1,
-          total: 0
-        },
-        selectionList: [],
-        option: {
-          height:'auto',
-          calcHeight: 30,
-          tip: false,
-          searchShow: true,
-          searchMenuSpan: 6,
-          border: true,
-          index: true,
-          viewBtn: true,
-          labelWidth: 120,
-          selection: true,
-          dialogClickModal: false,
-          column: [
-            {
-              label: "用户手机",
-              prop: "phone",
-              // type: "select",
-              // dicUrl:"/api/sing_user/loginuser/list?current=1&size=999",
-              // props: {
-              //   label: 'nickName',
-              //   value: 'phone',
-              //   desc: 'phone',
-              //   res: "data.records"
-              // },
-              // dicMethod:'get',
-              search: true,
-              rules: [{
-                required: true,
-                message: "请输入手机号码",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "活动",
-              prop: "activeId",
-              type: "select",
-              dicUrl:"/api/sing_active/activerecord/list?current=1&size=999",
-              props: {
-                label: 'title',
-                value: 'id',
-                desc: 'id',
-                res: "data.records"
-              },
-              dicMethod:'get',
-              rules: [{
-                required: true,
-                message: "请输入活动Id",
-                trigger: "blur"
-              }]
-            },
-            // {
-            //   label: "作品编号",
-            //   prop: "productNo",
-            //   editDisplay: false,
-            //   addDisplay: false,
-            //   search: true,
-            //   rules: [{
-            //     required: true,
-            //     message: "请输入作品编号",
-            //     trigger: "blur"
-            //   }]
+  components: {IconFontComp},
+  data() {
+    return {
+      form: {},
+      query: {
+        createTime: -1,
+        createTimeRange: [],
+        status: -1,
+      },
+      loading: true,
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
+      selectionList: [],
+      option: {
+        height: 'auto',
+        calcHeight: 30,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        border: true,
+        index: true,
+        searchBtn: false,
+        emptyBtn: false,
+        viewBtn: true,
+        labelWidth: 120,
+        selection: true,
+        dialogClickModal: false,
+        column: [
+          {
+            label: "用户手机",
+            prop: "phone",
+            // type: "select",
+            // dicUrl:"/api/sing_user/loginuser/list?current=1&size=999",
+            // props: {
+            //   label: 'nickName',
+            //   value: 'phone',
+            //   desc: 'phone',
+            //   res: "data.records"
             // },
-            {
-              label: "标题",
-              prop: "title",
-              search: true,
-              rules: [{
-                required: true,
-                message: "请输入标题",
-                trigger: "blur"
-              }]
+            // dicMethod:'get',
+            rules: [{
+              required: true,
+              message: "请输入手机号码",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "活动",
+            prop: "activeId",
+            type: "select",
+            dicUrl: "/api/sing_active/activerecord/list?current=1&size=999",
+            props: {
+              label: 'title',
+              value: 'id',
+              desc: 'id',
+              res: "data.records"
             },
-            {
-              label: "活动图片地址",
-              prop: "imgUrl",
-              type: 'upload',
-              listType: 'picture-img',
-              dataType: 'string',
-              span: 12,
-              propsHttp: {
-                res: 'data',
-                url: 'link'
-              },
-              action: '/api/blade-resource/oss/endpoint/put-file',
-              rules: [{
-                required: true,
-                message: "请输入活动图片地址",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "活动视频地址",
-              prop: "videoUrl",
-              type: 'upload',
-              listType: 'picture-img',
-              dataType: 'string',
-              accept:"video/mp4",
-              span: 12,
-              propsHttp: {
-                res: 'data',
-                url: 'link'
-              },
-              action: '/api/blade-resource/oss/endpoint/put-file',
-              rules: [{
-                required: true,
-                message: "请输入活动视频地址",
-                trigger: "blur"
-              }]
+            dicMethod: 'get',
+            rules: [{
+              required: true,
+              message: "请输入活动Id",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "作品编号",
+            prop: "productNo",
+            editDisplay: false,
+            addDisplay: false,
+            search: true,
+            rules: [{
+              required: true,
+              message: "请输入作品编号",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "标题",
+            prop: "title",
+            rules: [{
+              required: true,
+              message: "请输入标题",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "活动图片地址",
+            prop: "imgUrl",
+            type: 'upload',
+            listType: 'picture-img',
+            dataType: 'string',
+            span: 12,
+            propsHttp: {
+              res: 'data',
+              url: 'link'
             },
-            {
-              label: "票数",
-              prop: "voteCount",
-              type: "number",
-              value: 0,
-              rules: [{
-                required: true,
-                message: "请输入票数",
-                trigger: "blur"
-              }]
+            action: '/api/blade-resource/oss/endpoint/put-file',
+            rules: [{
+              required: true,
+              message: "请输入活动图片地址",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "活动视频地址",
+            prop: "videoUrl",
+            type: 'upload',
+            listType: 'picture-img',
+            dataType: 'string',
+            accept: "video/mp4",
+            span: 12,
+            propsHttp: {
+              res: 'data',
+              url: 'link'
             },
-            {
-              label: "热力值",
-              prop: "heatValue",
-              type: "number",
-              value: 0,
-              rules: [{
-                required: true,
-                message: "请输入热力值",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "作品状态",
-              prop: "status",
-              type: "switch",
-              dicData:[
-                {
-                  label:"禁用",
-                  value:0
-                },
-                {
-                  label:"启用",
-                  value:1,
-                }
-              ],
-              value: 1,
-              rules: [{
-                required: true,
-                message: "请开启或关闭状态",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "作品内容",
-              prop: "content",
-              component: 'AvueUeditor',
-              options: {
-                action: '/api/blade-resource/oss/endpoint/put-file',
-                props: {
-                  res: "data",
-                  url: "link",
-                }
+            action: '/api/blade-resource/oss/endpoint/put-file',
+            rules: [{
+              required: true,
+              message: "请输入活动视频地址",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "票数",
+            prop: "voteCount",
+            type: "number",
+            value: 0,
+            rules: [{
+              required: true,
+              message: "请输入票数",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "热力值",
+            prop: "heatValue",
+            type: "number",
+            value: 0,
+            rules: [{
+              required: true,
+              message: "请输入热力值",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "作品状态",
+            prop: "status",
+            search: true,
+            searchSpan: 24,
+            searchslot: true,
+            searchOrder: 2,
+            type: "switch",
+            dicData: [
+              {
+                label: "禁用",
+                value: 0
               },
-              hide: true,
-              minRows: 6,
-              span: 24,
-              rules: [{
-                required: true,
-                message: "请输入活动内容",
-                trigger: "blur"
-              }]
+              {
+                label: "启用",
+                value: 1,
+              }
+            ],
+            value: 1,
+            rules: [{
+              required: true,
+              message: "请开启或关闭状态",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "作品内容",
+            prop: "content",
+            component: 'AvueUeditor',
+            options: {
+              action: '/api/blade-resource/oss/endpoint/put-file',
+              props: {
+                res: "data",
+                url: "link",
+              }
             },
-          ]
-        },
-        data: []
+            hide: true,
+            minRows: 6,
+            span: 24,
+            rules: [{
+              required: true,
+              message: "请输入活动内容",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "创建时间",
+            prop: "createTime",
+            type: "datetime",
+            format: "yyyy-MM-dd hh:mm:ss",
+            valueFormat: "yyyy-MM-dd hh:mm:ss",
+            searchRange: true,
+            addDisplay: false,
+            editDisplay: false,
+            search: true,
+            searchSpan: 24,
+            searchOrder: 0,
+            searchslot: true,
+            rules: [{
+              required: true,
+              message: "请输入通知时间",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "关键字",
+            prop: "key",
+            hide: true,
+            search: true,
+            searchslot: true,
+            searchOrder: 5,
+            searchSpan: 24,
+            editDisplay: false,
+            addDisplay: false,
+          },
+        ]
+      },
+      data: []
+    };
+  },
+  watch: {
+    //监听创建时间变化
+    "query.createTime": {
+      handler(value) {
+        //防止重复调用
+        if (value !== undefined) {
+          this.query.createTimeRange = [];
+          switch (value) {
+            case -1:
+              this.query.createTimeStart = undefined;
+              this.query.createTimeEnd = undefined;
+              break;
+            case 1: //今天
+              this.query.createTimeStart = moment().format("yyyy-MM-DD 00:00:00");
+              this.query.createTimeEnd = moment().format("yyyy-MM-DD HH:mm:ss");
+              break;
+            case 2: //昨天
+              this.query.createTimeStart = moment().subtract(1, 'days').format("yyyy-MM-DD 00:00:00");
+              this.query.createTimeEnd = moment().subtract(1, 'days').format("yyyy-MM-DD 23:59:59");
+              break;
+            case 3: //近7天
+              this.query.createTimeStart = moment().subtract(7, 'days').format("yyyy-MM-DD HH:mm:ss");
+              this.query.createTimeEnd = moment().format("yyyy-MM-DD HH:mm:ss");
+              break;
+            case 4: //近30天
+              this.query.createTimeStart = moment().subtract(30, 'days').format("yyyy-MM-DD HH:mm:ss");
+              this.query.createTimeEnd = moment().format("yyyy-MM-DD HH:mm:ss");
+              break;
+            case 5: //本月
+              this.query.createTimeStart = moment().format("yyyy-MM-01 00:00:00");
+              this.query.createTimeEnd = moment().format(`yyyy-MM-DD HH:mm:ss`);
+              break;
+            case 6: //本年
+              this.query.createTimeStart = moment().format("yyyy-01-01 00:00:00");
+              this.query.createTimeEnd = moment().format(`yyyy-MM-DD HH:mm:ss`);
+              break;
+            default:
+              break;
+          }
+        }
+      }
+    },
+    //监听创建时间变化
+    "query.createTimeRange": {
+      handler(value) {
+        //防止重复调用
+        if (value.length === 2) {
+          this.query.createTimeStart = value[0];
+          this.query.createTimeEnd = value[1];
+          this.query.createTime = undefined;
+        }
+      }
+    },
+  },
+  computed: {
+    ...mapGetters(["permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission.activeproductrecord_add, false),
+        viewBtn: this.vaildData(this.permission.activeproductrecord_view, false),
+        delBtn: this.vaildData(this.permission.activeproductrecord_delete, false),
+        editBtn: this.vaildData(this.permission.activeproductrecord_edit, false)
       };
     },
-    computed: {
-      ...mapGetters(["permission"]),
-      permissionList() {
-        return {
-          addBtn: this.vaildData(this.permission.activeproductrecord_add, false),
-          viewBtn: this.vaildData(this.permission.activeproductrecord_view, false),
-          delBtn: this.vaildData(this.permission.activeproductrecord_delete, false),
-          editBtn: this.vaildData(this.permission.activeproductrecord_edit, false)
-        };
-      },
-      ids() {
-        let ids = [];
-        this.selectionList.forEach(ele => {
-          ids.push(ele.id);
+    ids() {
+      let ids = [];
+      this.selectionList.forEach(ele => {
+        ids.push(ele.id);
+      });
+      return ids.join(",");
+    }
+  },
+  methods: {
+    rowSave(row, done, loading) {
+      row.content = encodeURIComponent(row.content);
+      add(row).then(() => {
+        this.onLoad(this.page);
+        this.$message({
+          type: "success",
+          message: "操作成功!"
         });
-        return ids.join(",");
-      }
+        done();
+      }, error => {
+        loading();
+        window.console.log(error);
+      });
+    },
+    rowUpdate(row, index, done, loading) {
+      row.content = encodeURIComponent(row.content);
+      update(row).then(() => {
+        this.onLoad(this.page);
+        this.$message({
+          type: "success",
+          message: "操作成功!"
+        });
+        done();
+      }, error => {
+        loading();
+        console.log(error);
+      });
     },
-    methods: {
-      rowSave(row, done, loading) {
-        row.content = encodeURIComponent(row.content);
-        add(row).then(() => {
+    rowDel(row) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          return remove(row.id);
+        })
+        .then(() => {
           this.onLoad(this.page);
           this.$message({
             type: "success",
             message: "操作成功!"
           });
-          done();
-        }, error => {
-          loading();
-          window.console.log(error);
         });
-      },
-      rowUpdate(row, index, done, loading) {
-        row.content = encodeURIComponent(row.content);
-        update(row).then(() => {
+    },
+    handleDelete() {
+      if (this.selectionList.length === 0) {
+        this.$message.warning("请选择至少一条数据");
+        return;
+      }
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          return remove(this.ids);
+        })
+        .then(() => {
           this.onLoad(this.page);
           this.$message({
             type: "success",
             message: "操作成功!"
           });
-          done();
-        }, error => {
-          loading();
-          console.log(error);
+          this.$refs.crud.toggleSelection();
         });
-      },
-      rowDel(row) {
-        this.$confirm("确定将选择数据删除?", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        })
-          .then(() => {
-            return remove(row.id);
-          })
-          .then(() => {
-            this.onLoad(this.page);
-            this.$message({
-              type: "success",
-              message: "操作成功!"
-            });
-          });
-      },
-      handleDelete() {
-        if (this.selectionList.length === 0) {
-          this.$message.warning("请选择至少一条数据");
-          return;
-        }
-        this.$confirm("确定将选择数据删除?", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        })
-          .then(() => {
-            return remove(this.ids);
-          })
-          .then(() => {
-            this.onLoad(this.page);
-            this.$message({
-              type: "success",
-              message: "操作成功!"
-            });
-            this.$refs.crud.toggleSelection();
-          });
-      },
-      beforeOpen(done, type) {
-        if (["edit", "view"].includes(type)) {
-          getDetail(this.form.id).then(res => {
-            res.data.data.content = decodeURIComponent(res.data.data.content);
-            this.form = res.data.data;
-          });
+    },
+    beforeOpen(done, type) {
+      if (["edit", "view"].includes(type)) {
+        getDetail(this.form.id).then(res => {
+          res.data.data.content = decodeURIComponent(res.data.data.content);
+          this.form = res.data.data;
+        });
+      }
+      done();
+    },
+    searchReset() {
+      this.query = {};
+      this.onLoad(this.page);
+    },
+    searchChange(params, done) {
+      this.query = params;
+      this.page.currentPage = 1;
+      this.onLoad(this.page, params);
+      done();
+    },
+    selectionChange(list) {
+      this.selectionList = list;
+    },
+    selectionClear() {
+      this.selectionList = [];
+      this.$refs.crud.toggleSelection();
+    },
+    currentChange(currentPage) {
+      this.page.currentPage = currentPage;
+    },
+    sizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+    },
+    refreshChange() {
+      this.onLoad(this.page, this.query);
+    },
+    onLoad(page, params = {}) {
+      let values = {};
+      for (const item in params) {
+        if (params[item] !== undefined && params[item] !== -1) {
+          values[item] = params[item];
         }
-        done();
-      },
-      searchReset() {
-        this.query = {};
-        this.onLoad(this.page);
-      },
-      searchChange(params, done) {
-        this.query = params;
-        this.page.currentPage = 1;
-        this.onLoad(this.page, params);
-        done();
-      },
-      selectionChange(list) {
-        this.selectionList = list;
-      },
-      selectionClear() {
-        this.selectionList = [];
-        this.$refs.crud.toggleSelection();
-      },
-      currentChange(currentPage){
-        this.page.currentPage = currentPage;
-      },
-      sizeChange(pageSize){
-        this.page.pageSize = pageSize;
-      },
-      refreshChange() {
+      }
+      values.createTime = null;
+      values.createTimeRange = null;
+      this.loading = true;
+      getList(page.currentPage, page.pageSize, values).then(res => {
+        const data = res.data.data;
+        this.page.total = data.total;
+        this.data = data.records;
+        this.loading = false;
+        this.selectionClear();
+      });
+    },
+    //搜索状态改变
+    searchStateChange() {
+      setTimeout(() => {
         this.onLoad(this.page, this.query);
-      },
-      onLoad(page, params = {}) {
-        this.loading = true;
-        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
-          const data = res.data.data;
-          this.page.total = data.total;
-          this.data = data.records;
-          this.loading = false;
-          this.selectionClear();
-        });
+      }, 100);
+    },
+    //生成列表并到处
+    generateListAndDownload() {
+      const newQuery = {};
+      for (const item in this.query) {
+        if (this.query[item] !== undefined && this.query[item] !== -1) {
+          newQuery[item] = this.query[item];
+        }
       }
-    }
-  };
+      newQuery.createTime = null;
+      newQuery.createTimeRange = null;
+      //获取列表键值对
+      newQuery.keyValue = {};
+      this.option.column.forEach(ele => {
+        newQuery.keyValue[ele.prop] = ele.label;
+      });
+      newQuery.keyValue = JSON.stringify(newQuery.keyValue);
+      this.loading = true;
+      //生成列表
+      generateList(this.page.currentPage, this.page.pageSize, newQuery).then(res => {
+        FileUtil.download(res.data, {
+          type: "application/vnd.ms-excel"
+        }, `生成活动作品-${moment().format("yyyy-MM-DD HH:mm:ss")}.xls`);
+      }).finally(() => {
+        this.loading = false;
+      });
+    },
+  }
+};
 </script>
 
 <style>