소스 검색

bug 修复

lilei 3 년 전
부모
커밋
dc800b7738
3개의 변경된 파일176개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      src/api/stockOut.js
  2. 25 0
      src/config/router.config.js
  3. 140 0
      src/views/dataExport/exportSales/list.vue

+ 11 - 0
src/api/stockOut.js

@@ -48,3 +48,14 @@ export const stockOutDetailCount = (params) => {
     method: 'post'
   })
 }
+
+// 导出销售
+export const exportSalesOutProduct = (params) => {
+  const url = `/stockOutDetail/exportSalesOutProduct`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 25 - 0
src/config/router.config.js

@@ -1463,6 +1463,31 @@ export const asyncRouterMap = [
           permission: 'M_dataExport'
         },
         children: [
+          {
+            path: '/dataExport/exportSales',
+            redirect: '/dataExport/exportSales/list',
+            name: 'exportSales',
+            component: BlankLayout,
+            meta: {
+              title: '导出销售',
+              icon: 'gold',
+              // permission: 'M_exportSales'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'exportSalesList',
+                component: () => import(/* webpackChunkName: "dataExport" */ '@/views/dataExport/exportSales/list.vue'),
+                meta: {
+                  title: '导出销售',
+                  icon: 'gold',
+                  hidden: true,
+                  // permission: 'M_exportSales'
+                }
+              }
+            ]
+          },
           {
             path: '/dataExport/exportCheck',
             redirect: '/dataExport/exportCheck/list',

+ 140 - 0
src/views/dataExport/exportSales/list.vue

@@ -0,0 +1,140 @@
+<template>
+  <a-card size="small" :bordered="false" class="exportCheckList-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 搜索条件 -->
+      <div ref="tableSearch" class="table-page-search-wrapper">
+        <a-form-model
+          id="exportCheckList-form"
+          ref="ruleForm"
+          class="form-model-con"
+          layout="inline"
+          :model="queryParam"
+          :rules="rules"
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          @keyup.enter.native="handleSearch" >
+          <a-row :gutter="15">
+            <a-col :md="10" :sm="24">
+              <a-form-model-item label="选择时间范围" prop="dateArr">
+                <a-select id="exportCheckList-print" v-model="queryParam.dateArr" placeholder="请选择时间范围" allowClear>
+                  <a-select-option v-for="item in checkList" :value="item" :key="item">
+                    <span>{{ item }}</span>
+                  </a-select-option>
+                </a-select>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-button
+                type="primary"
+                class="button-warning"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                id="exportCheckList-export">导出</a-button>
+            </a-col>
+          </a-row>
+        </a-form-model>
+      </div>
+    </a-spin>
+  </a-card>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import { checkWarehouseExcelList } from '@/api/checkWarehouse'
+import { exportSalesOutProduct } from '@/api/stockOut.js'
+import { hdExportExcel } from '@/libs/exportExcel'
+export default {
+  components: { STable, VSelect },
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0,
+      labelCol: { span: 8 },
+      wrapperCol: { span: 16 },
+      queryParam: { //  查询条件
+        dateArr: undefined
+      },
+      rules: {
+        'dateArr': [{ required: true, message: '请选择时间范围', trigger: 'change' }]
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false,
+      checkList: []
+    }
+  },
+  methods: {
+    getList () {
+      checkWarehouseExcelList().then(res => {
+        if (res.status == 200) {
+          const arr = res.data.reverse()
+          for (let i = arr.length - 1; i > 0; i--) {
+            this.checkList.push([arr[i - 1].financeAuditTime, arr[i].financeAuditTime].join(' 至 '))
+          }
+        } else {
+          this.checkList = []
+        }
+      })
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const params = _this.queryParam.dateArr.split(' 至 ')
+          _this.exportLoading = true
+          _this.spinning = true
+          hdExportExcel(exportSalesOutProduct, { 'beginDate': params[0], 'endDate': params[1] }, '导出销售', function () {
+            _this.exportLoading = false
+            _this.spinning = false
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+      this.queryParam.dateArr = undefined
+      this.$refs.ruleForm.resetFields()
+      this.getList()
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 238
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+    }
+    // 仅刷新列表,不重置页面
+    if (this.$store.state.app.updateList) {
+      this.pageInit()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+<style lang="less">
+  .exportCheckList-wrap{
+    height: 99%;
+  }
+</style>