#2 导出

Merged
dct merged 2 commits from HHPW/branch-sunwenliang into HHPW/master 2 weeks ago

+ 77 - 59
README.md

@@ -1,122 +1,137 @@
 # 开发环境配置
-* 中行支付对接需调用32位系统的插件。所以需要使用`32位`的node版本。[关于windows安装多版本nodejs](https://raythunder.cn/multiple-versions-node-on-windows/)
 
-* 编译windows原生模块,一键安装所需构建工具。[安装windows-build-tools](https://www.npmjs.com/package/windows-build-tools)
-* 安装原生依赖模块后(如node-ffi),需要把该模块编译成对应electron版本的原生模块。默认情况下会自动编译。
+- 中行支付对接需调用 32 位系统的插件。所以需要使用`32位`的 node 版本。[关于 windows 安装多版本 nodejs](https://raythunder.cn/multiple-versions-node-on-windows/)
 
-    如果有什么报错继续执行`npm run rebuild`
-* 配置vue.config.js
-    ```
-    ....
-    pluginOptions: {
-        electronBuilder: {
-        externals: ['ffi'],  // 这里填入原生模块
-        // If you are using Yarn Workspaces, you may have multiple node_modules folders
-        // List them all here so that VCP Electron Builder can find them
-        nodeModulesPath: ['../../node_modules', './node_modules'],
-        ...
-    ```
+- 编译 windows 原生模块,一键安装所需构建工具。[安装 windows-build-tools](https://www.npmjs.com/package/windows-build-tools)
+- 安装原生依赖模块后(如 node-ffi),需要把该模块编译成对应 electron 版本的原生模块。默认情况下会自动编译。
 
+  如果有什么报错继续执行`npm run rebuild`
+
+- 配置 vue.config.js
+  ```
+  ....
+  pluginOptions: {
+      electronBuilder: {
+      externals: ['ffi'],  // 这里填入原生模块
+      // If you are using Yarn Workspaces, you may have multiple node_modules folders
+      // List them all here so that VCP Electron Builder can find them
+      nodeModulesPath: ['../../node_modules', './node_modules'],
+      ...
+  ```
 
 # 开发步骤
-> 注意先切换至32位nodejs
+
+> 注意先切换至 32 位 nodejs
 
 ## 安装项目的全部依赖
+
 ```
 yarn // 或 npm i
 ```
 
 # 项目运行
+
 ## 测试环境
+
 ```
 yarn run electron:serve  // 或 npm run electron:serve
 ```
+
 ## 打包
+
 ```
 yarn run electron:build // 或 npm run electron:build
 ```
 
-# .npmrc文件修改了相关软件包的源地址
-electron测试环境首次启动时,需要安装chrome内核的相关开发者插件,可能需要翻墙安装。否则会导致启动失败
+# .npmrc 文件修改了相关软件包的源地址
+
+electron 测试环境首次启动时,需要安装 chrome 内核的相关开发者插件,可能需要翻墙安装。否则会导致启动失败
 
 # TODO
+
 - [ ] 身份证读取数据时,有空数据先更新空数据,否则新增数据
-- [ ] IP地址获取错误
+- [ ] IP 地址获取错误
 
 # 相关文档
-* [vue-echart](https://github.com/ecomfe/vue-echarts/blob/master/README.zh_CN.md)
-* [配置原生模块](https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/guide.html#native-modules)
-* [关于在electron中调用C++动态库的经验总结](https://blog.csdn.net/wang839305939/article/details/83780789)
-* [node-ffi使用指南](https://juejin.im/post/5b58038d5188251b186bc902)
-* [process和child_process使用详解](https://www.php.cn/js-tutorial-390359.html)
-* [FileSaver.js 介绍](https://www.cnblogs.com/yunser/p/7629399.html)
-
-
 
+- [vue-echart](https://github.com/ecomfe/vue-echarts/blob/master/README.zh_CN.md)
+- [配置原生模块](https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/guide.html#native-modules)
+- [关于在 electron 中调用 C++动态库的经验总结](https://blog.csdn.net/wang839305939/article/details/83780789)
+- [node-ffi 使用指南](https://juejin.im/post/5b58038d5188251b186bc902)
+- [process 和 child_process 使用详解](https://www.php.cn/js-tutorial-390359.html)
+- [FileSaver.js 介绍](https://www.cnblogs.com/yunser/p/7629399.html)
 
 # 其他
+
 1. 二维码扫码机。注意关闭回车符设置
-2. ○窗
+2. ○ 
 
 ## yarn 安装
-https://yarnpkg.com/lang/zh-hans/docs/install/
 
+https://yarnpkg.com/lang/zh-hans/docs/install/
 
 ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/ npm install --save-dev electron
 
 ## yarn 常用命令
+
 ### 添加依赖包
+
 ```
 yarn add [package]
 yarn add [package]@[version]
 yarn add [package]@[tag]
 ```
+
 ### 将依赖项添加到不同依赖项类别
 
 分别添加到 devDependencies、peerDependencies 和 optionalDependencies:
+
 ```
 yarn add [package] --dev
 yarn add [package] --peer
 yarn add [package] --optional
 ```
+
 ### 升级依赖包
+
 ```
 yarn upgrade [package]
 yarn upgrade [package]@[version]
 yarn upgrade [package]@[tag]
 ```
+
 ### 移除依赖包
+
 ```
 yarn remove [package]
 ```
 
+# iconv-lite 关于报错\_webpack_require()的解决方法
 
+到 node_modules 中找到 iconv-lite 文件夹,lib 文件夹,打开 index.js,最下方有两个 require 的后一个参数括号去掉,如下:
 
-# iconv-lite  关于报错_webpack_require()的解决方法
-到node_modules中找到iconv-lite文件夹,lib文件夹,打开index.js,最下方有两个require的后一个参数括号去掉,如下:
-``` js
-var nodeVer = typeof process !== 'undefined' && process.versions && process.versions.node;
+```js
+var nodeVer =
+  typeof process !== "undefined" && process.versions && process.versions.node;
 if (nodeVer) {
-
-    // Load streaming support in Node v0.10+
-    var nodeVerArr = nodeVer.split(".").map(Number);
-    if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) {
-        require("./streams");//修改这个
-    }
-
-    // Load Node primitive extensions.
-    require("./extend-node");//修改这个
+  // Load streaming support in Node v0.10+
+  var nodeVerArr = nodeVer.split(".").map(Number);
+  if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) {
+    require("./streams"); //修改这个
+  }
+
+  // Load Node primitive extensions.
+  require("./extend-node"); //修改这个
 }
 ```
 
+# 修改支付测试需要修改的地方
 
+根据景点名称修改,配置文件的 mock 参数,以及:
 
-# 修改支付测试需要修改的地方
-根据景点名称修改,配置文件的mock参数,以及:
-1. @/utils/index.js  getPayResponse
+1. @/utils/index.js getPayResponse
 2. @/utils/choosePay.js
 
-
 # 涉及支付的页面
 
 /ticketSale/retail
@@ -125,46 +140,49 @@ if (nodeVer) {
 /ticketSale/preOrderGroup
 /ticketSale/discountSales
 /membership/memberSales
-/membership/memberPreSales   iccardCheckout
+/membership/memberPreSales iccardCheckout
 /membership/memberRecharge
 
-
 # 注册到全局的组件
+
 路径:src/components/GlobalComponents/
 
-- `ChannelTag` 渠道标签,传入渠道id。
-    - value: [number]
+- `ChannelTag` 渠道标签,传入渠道 id。
+  - value: [number]
 - `OrderStatusTag` 订单或票的状态标签,传入状态。
-    - value: [string]
+  - value: [string]
 - `Ellipsis` 定长文字
-    - type: 'tooltips'/'popover'
-    - content: [string]
-    - length: [number]
+  - type: 'tooltips'/'popover'
+  - content: [string]
+  - length: [number]
 - `Tip` 图标文字提示
-    - msg: [string]
+  - msg: [string]
 - `QRReader` 二维码摄像头识别组件
-    - v-model: [string]
-
+  - v-model: [string]
 
 # 日志生成工具
+
 ```
 npm install -g conventional-changelog-cli
 ```
+
 不会重写之前的日志,在前一个标签基础上生成
+
 ```
 conventional-changelog -p angular -i ./public/CHANGELOG.md -s
 -r 10 生成10个版本
 ```
 
-# 安装node 引擎报错
+# 安装 node 引擎报错
 
 ```bash
 yarn install --ignore-engines
 ```
 
 # 同步远程分支
+
 ```
 git fetch origin --prune
 ```
-# 终端配置
 
+# 终端配置

+ 1 - 2
src/pages/queryReport/checkStatistic.vue

@@ -152,7 +152,6 @@ export default {
     return {
       groupKeys: [{ value: 'tagName', label: '票种标签' }, { value: 'otaSourceName', label: '分销商' }],
       form: {
-        export: false,
         checkTimeBegin: new Date(moment().startOf('day').subtract(7, 'day').format('YYYY-MM-DD HH:mm:ss')),
         checkTimeEnd: new Date(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss')),
         ticketTypeIdList: [], //
@@ -289,7 +288,7 @@ export default {
       })
     },
     handleExport (params) {
-      getCheckerVerifyStatistics(this.form).then(() => {
+      getCheckerVerifyStatistics(params).then(() => {
         this.$message.success('导出成功。')
         this.goToDownload()
       }, () => {

+ 53 - 0
src/pages/queryReport/freeStatistic.vue

@@ -59,6 +59,10 @@
         </el-select>
       </el-form-item>
       <div class="btn-wrap">
+        <el-button
+          @click="reportExport">
+          导出
+        </el-button>
         <el-button
           @click="reset"
         >
@@ -118,6 +122,7 @@ import { getDeviceList } from '@/api/checker'
 // import ReaderInput from '@/components/ReaderInput'
 import moment from 'moment'
 
+
 export default {
   name: 'freeQuery',
   computed: {
@@ -172,6 +177,54 @@ export default {
     reset () {
       this.$refs.form.resetFields()
     },
+    setTime () {
+      if (this.form.checkTimeBegin) {
+        this.form.checkTimeBegin = moment(this.form.checkTimeBegin).format('YYYY-MM-DD HH:mm:ss')
+      } else {
+        this.form.checkTimeBegin = ''
+      }
+
+      if (this.form.checkTimeEnd) {
+        this.form.checkTimeEnd = moment(this.form.checkTimeEnd).format('YYYY-MM-DD HH:mm:ss')
+      } else {
+        this.form.checkTimeEnd = ''
+      }
+    },
+    reportExport () {
+      this.setTime()
+      if (!this.form.ticketTypeIdList) {
+        this.form.ticketTypeIdList = []
+      }
+
+      if (!this.form.otaSourceNameList) {
+        this.form.otaSourceNameList = []
+      }
+      this.$confirm(`是否要导出明细数据`, '确认提示', {
+        confirmButtonText: '是',
+        cancelButtonText: '否',
+        type: 'warning'
+      }).then(() => {
+        this.handleExport({
+          ...this.form,
+          export: true,
+          exportDetail: true
+        })
+      }).catch(() => {
+        this.handleExport({
+          ...this.form,
+          export: true,
+          exportDetail: false
+        })
+      })
+    },
+    handleExport (params) {
+      getFreeTicketStatistics(params).then(() => {
+        this.$message.success('导出成功。')
+        this.goToDownload()
+      }, () => {
+        this.$message.success('导出失败。')
+      })
+    },
     getFreeTicketList (goFirst) {
       this.loading = true
       goFirst && (this.form.pageNum = 1)

+ 1 - 3
src/pages/queryReport/ghSplitRecordStatistic.vue

@@ -150,7 +150,6 @@ import moment from 'moment'
 import { getSaleChannelList } from '@/api/order'
 // import ReaderInput from '@/components/ReaderInput'
 // import draggable from 'vuedraggable'
-// import moment from 'moment'
 
 const groupKeys = [
   { value: 'team', label: '团体' }
@@ -181,7 +180,6 @@ export default {
     return {
       groupKeys,
       form: {
-        export: false,
         timeBegin: new Date(moment().startOf('day').subtract(7, 'day').format('YYYY-MM-DD HH:mm:ss')),
         timeEnd: new Date(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss')),
         ticketTypeIdList: [], //
@@ -324,7 +322,7 @@ export default {
       })
     },
     handleExport (params) {
-      getGhSrStatistic(this.form).then(() => {
+      getGhSrStatistic(params).then(() => {
         this.$message.success('导出成功。')
         this.goToDownload()
       }, () => {

+ 2 - 2
src/pages/queryReport/osSaleStatistic/CheckStat.vue

@@ -184,7 +184,7 @@ export default {
     return {
       groupKeys,
       form: {
-        export: false,
+
         timeBegin: new Date(moment().startOf('day').subtract(7, 'day').format('YYYY-MM-DD HH:mm:ss')),
         timeEnd: new Date(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss')),
         ticketTypeIdList: [], //
@@ -330,7 +330,7 @@ export default {
       })
     },
     handleExport (params) {
-      getOsCheckStatistic(this.form).then(() => {
+      getOsCheckStatistic(params).then(() => {
         this.$message.success('导出成功。')
         this.goToDownload()
       }, () => {

+ 1 - 2
src/pages/queryReport/osSaleStatistic/SaleStat.vue

@@ -181,7 +181,6 @@ export default {
     return {
       groupKeys,
       form: {
-        export: false,
         timeBegin: new Date(moment().startOf('day').subtract(7, 'day').format('YYYY-MM-DD HH:mm:ss')),
         timeEnd: new Date(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss')),
         ticketTypeIdList: [], //
@@ -324,7 +323,7 @@ export default {
       })
     },
     handleExport (params) {
-      getOsSaleStatistic(this.form).then(() => {
+      getOsSaleStatistic(params).then(() => {
         this.$message.success('导出成功。')
         this.goToDownload()
       }, () => {

+ 0 - 1
src/pages/queryReport/refundStatistic.vue

@@ -180,7 +180,6 @@ export default {
       }
     },
     reportExport () {
-      this.form.export = true
       this.setTime()
 
       if (!this.form.ticketTypeIdList) {

+ 58 - 1
src/pages/visitor/visitorStatistic.vue

@@ -54,6 +54,10 @@
         </el-select>
       </el-form-item> -->
       <div class="btn-wrap">
+        <el-button
+          @click="reportExport">
+          导出
+        </el-button>
         <el-button
           type="primary"
           @click="getData">
@@ -77,7 +81,7 @@
         <el-tab-pane
           label="游客性别统计"
           name="gender">
-          <Sex :table-data="statisticsInfo.genderStatistics"></Sex>
+          <Sex :table-data="statisticsInfo.sexStatistics"></Sex>
         </el-tab-pane>
       </el-tabs>
     </el-card>
@@ -89,6 +93,7 @@ import Age from './Statistic/Age'
 import Sex from './Statistic/Sex'
 import AreaStatics from './Statistic/Area'
 import { getVisitorStatistics } from '@/api/visitor'
+import moment from 'moment'
 
 export default {
   name: 'visitorStatistic',
@@ -117,6 +122,58 @@ export default {
     this.getData()
   },
   methods: {
+    setTime () {
+      if (this.form.statisticsTimeBegin) {
+        this.form.statisticsTimeBegin = moment(this.form.statisticsTimeBegin).format('YYYY-MM-DD HH:mm:ss')
+      } else {
+        this.form.statisticsTimeBegin = ''
+      }
+
+      if (this.form.statisticsTimeEnd) {
+        this.form.statisticsTimeEnd = moment(this.form.statisticsTimeEnd).format('YYYY-MM-DD HH:mm:ss')
+      } else {
+        this.form.statisticsTimeEnd = ''
+      }
+    },
+
+    //导出
+
+    reportExport () {
+      this.setTime()
+
+      if (!this.form.ticketTypeIdList) {
+        this.form.ticketTypeIdList = []
+      }
+
+      if (!this.form.otaSourceNameList) {
+        this.form.otaSourceNameList = []
+      }
+      this.$confirm(`是否要导出明细数据`, '确认提示', {
+        confirmButtonText: '是',
+        cancelButtonText: '否',
+        type: 'warning'
+      }).then(() => {
+        this.handleExport({
+          ...this.form,
+          export: true,
+          exportDetail: true
+        })
+      }).catch(() => {
+        this.handleExport({
+          ...this.form,
+          export: true,
+          exportDetail: false
+        })
+      })
+    },
+    handleExport (params) {
+      getVisitorStatistics(params).then(() => {
+        this.$message.success('导出成功。')
+        this.goToDownload()
+      }, () => {
+        this.$message.success('导出失败。')
+      })
+    },
     getData () {
       getVisitorStatistics(this.form).then(res => {
         this.statisticsInfo = res.data