浏览代码

报表中心差 问卷

mo 3 年之前
父节点
当前提交
38e74a1e11
共有 5 个文件被更改,包括 818 次插入490 次删除
  1. 10 0
      src/components/Export-chiose/api.js
  2. 154 0
      src/components/Export-chiose/index.vue
  3. 7 1
      src/utils/downLoadFile.js
  4. 645 487
      src/views/reportForm/index.vue
  5. 2 2
      vue.config.js

+ 10 - 0
src/components/Export-chiose/api.js

@@ -0,0 +1,10 @@
+import request2 from '@/utils/request2'
+import qs from 'qs'
+let api = '/api-web'
+
+export const getFields = data => request2({
+  url: '/api-web/export/getFields',
+  data,
+  params: data,
+  method: 'post',
+})

+ 154 - 0
src/components/Export-chiose/index.vue

@@ -0,0 +1,154 @@
+<template>
+  <div>
+    <el-button @click="startExport" type="primary">{{ name }}</el-button>
+    <el-dialog
+      title="请选择导出字段"
+      :visible.sync="chioseVisiable"
+      width="850px"
+    >
+      <div class="chioseWrap">
+        <el-checkbox
+          :indeterminate="isIndeterminate"
+          v-model="checkAll"
+          @change="handleCheckAllChange"
+          >全选</el-checkbox
+        >
+        <div style="margin: 15px 0"></div>
+        <el-checkbox-group v-model="checked" @change="handleCheckedChange">
+          <el-checkbox
+            v-for="city in chioseList"
+            :label="city"
+            :key="city"
+            style="min-width: 125px; margin-bottom: 10px"
+            >{{ city }}</el-checkbox
+          >
+        </el-checkbox-group>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="chioseVisiable = false">取 消</el-button>
+        <el-button type="primary" @click="exportDataStart">确 定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import cleanDeep from "clean-deep";
+import qs from "qs";
+import { getFields } from "./api";
+import { Export } from "@/utils/downLoadFile";
+export default {
+  props: {
+    name: {
+      type: String,
+      default: "导出",
+    },
+    fileName: {
+      type: String,
+      default: "导出文件.xls",
+    },
+    message: {
+      type: String,
+      default: "您确定导出",
+    },
+    errorMsg: {
+      type: String,
+      default: "参数错误",
+    },
+    flag: {
+      type: Boolean,
+      default: false,
+    },
+    isDownList: {
+      type: Boolean,
+      default: false,
+    },
+    ExportEnum: {
+      type: String,
+    },
+    exportData: {
+      type: Object,
+    },
+  },
+  data() {
+    return {
+      chioseVisiable: false,
+      isIndeterminate: true,
+      checkAll: false,
+      checked: [],
+      chioseList: [],
+    };
+  },
+  mounted() {},
+  methods: {
+    async startExport() {
+      if (this.flag) {
+        this.$message.error(this.errorMsg);
+        return;
+      }
+      if (!this.ExportEnum) {
+        this.$message.error("导出参数异常");
+        return;
+      }
+      try {
+        const res = await getFields({
+          exportEnum: this.ExportEnum,
+        });
+        this.chioseList = res.data;
+        this.checked = res.data;
+        this.checkAll = true;
+        this.isIndeterminate = false;
+        this.chioseVisiable = true;
+      } catch (e) {
+        console.log(e);
+      }
+    },
+    handleCheckedChange(value) {
+      let checkedCount = value.length;
+      this.checkAll = checkedCount === this.chioseList.length;
+      this.isIndeterminate =
+        checkedCount > 0 && checkedCount < this.chioseList.length;
+    },
+    handleCheckAllChange(val) {
+      this.checked = val ? this.chioseList : [];
+      this.isIndeterminate = false;
+    },
+    exportDataStart() {
+      console.log(this.exportData);
+      if (this.isDownList) {
+        Export(
+          this,
+          {
+            url: "/api-web/export/managerDownload",
+            fileName: this.fileName,
+            method: "post",
+            params: qs.stringify(this.exportData),
+          },
+          this.message
+        );
+      } else {
+        Export(
+          this,
+          {
+            url: "/api-web/export/now",
+            fileName: this.fileName,
+            method: "post",
+            params: {
+              queryInfo: this.exportData,
+              exportEnum: this.ExportEnum,
+              headColumns: this.checked,
+            },
+          },
+          this.message,
+          () => {
+            this.chioseVisiable = false;
+          }
+        );
+      }
+
+      // 导出
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+</style>

+ 7 - 1
src/utils/downLoadFile.js

@@ -16,7 +16,7 @@ import cleanDeep from 'clean-deep'
  *      fileName: xxx.xls
  * }
  */
-export const Export = (that, params, message) => {
+export const Export = (that, params, message,func) => {
     // 报表导出
     let url = params.url
     const options = {
@@ -70,6 +70,10 @@ export const Export = (that, params, message) => {
                     link.setAttribute("download", fname);
                     document.body.appendChild(link);
                     link.click();
+                    if(func){
+                      func()
+                    }
+
                 }
                 })
 
@@ -82,3 +86,5 @@ export const Export = (that, params, message) => {
         })
         .catch(() => {});
 }
+
+

文件差异内容过多而无法显示
+ 645 - 487
src/views/reportForm/index.vue


+ 2 - 2
vue.config.js

@@ -19,8 +19,8 @@ const name = defaultSettings.title || '管乐迷后台管理系统' // page titl
 // let target = 'http://192.168.3.251:8000' // 何国威
 // let target = 'http://192.168.3.250:8000' //邹璇
 // let target = 'http://192.168.3.119:8000' //勇哥
-// let target = 'http://dev.dayaedu.com' // 开发环境
-let target = 'https://test.dayaedu.com' //测试环境
+let target = 'http://dev.dayaedu.com' // 开发环境
+// let target = 'https://test.dayaedu.com' //测试环境
 // All configuration item explanations can be find in https://cli.vuejs.org/config/
 module.exports = {
   /**

部分文件因为文件数量过多而无法显示