瀏覽代碼

盘点导出

chenrui 3 年之前
父節點
當前提交
d1f8f63591

+ 18 - 0
src/api/checkWarehouse.js

@@ -134,3 +134,21 @@ export const checkWarehouseDetailFinanceList = (params) => {
     method: 'post'
   })
 }
+// 数据导出  导出盘点   盘点列表
+export const checkWarehouseExcelList = (params) => {
+  return axios({
+    url: `/checkWarehouse/excelList`,
+    method: 'get'
+  })
+}
+// 数据导出  导出盘点   盘点列表  导出
+export const checkWarehouseExport = params => {
+  const url = `/checkWarehouse/excel/${params.checkWarehouseSn}`
+  delete params.checkWarehouseSn
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

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

@@ -1502,6 +1502,44 @@ export const asyncRouterMap = [
           }
         ]
       },
+      // 数据导出
+      {
+        path: '/dataExport',
+        redirect: '/dataExport/exportCheck',
+        component: PageView,
+        meta: {
+          title: '数据导出',
+          icon: 'money-collect',
+          permission: 'M_dataExport'
+        },
+        children: [
+          {
+            path: '/dataExport/exportCheck',
+            redirect: '/dataExport/exportCheck/list',
+            name: 'exportCheck',
+            component: BlankLayout,
+            meta: {
+              title: '导出盘点',
+              icon: 'gold',
+              permission: 'M_exportCheck'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'exportCheckList',
+                component: () => import(/* webpackChunkName: "dataExport" */ '@/views/dataExport/exportCheck/list.vue'),
+                meta: {
+                  title: '导出盘点',
+                  icon: 'gold',
+                  hidden: true,
+                  permission: 'M_exportCheck'
+                }
+              }
+            ]
+          }
+        ]
+      },
       // 产品管理
       {
         path: '/productManagement',

+ 136 - 0
src/views/dataExport/exportCheck/list.vue

@@ -0,0 +1,136 @@
+<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="checkWarehouseSn">
+                <a-select id="exportCheckList-print" v-model="queryParam.checkWarehouseSn" placeholder="请选择盘点单" allowClear>
+                  <a-select-option v-for="item in checkList" :value="item.checkWarehouseSn" :key="item.checkWarehouseSn">
+                    <span>{{ item.financeAuditTime }} - {{ item.checkWarehouseNo }}</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, checkWarehouseExport } from '@/api/checkWarehouse'
+import { hdExportExcel } from '@/libs/exportExcel'
+export default {
+  components: { STable, VSelect },
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0,
+      labelCol: { span: 8 },
+      wrapperCol: { span: 16 },
+      queryParam: { //  查询条件
+        checkWarehouseSn: undefined
+      },
+      rules: {
+        'checkWarehouseSn': [{ required: true, message: '请选择盘点单', trigger: 'change' }]
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false,
+      checkList: []
+    }
+  },
+  methods: {
+    getList () {
+      checkWarehouseExcelList().then(res => {
+        if (res.status == 200) {
+          this.checkList = res.data || []
+        } else {
+          this.checkList = []
+        }
+      })
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const params = _this.queryParam
+          _this.exportLoading = true
+          _this.spinning = true
+          hdExportExcel(checkWarehouseExport, params, '导出盘点', function () {
+            _this.exportLoading = false
+            _this.spinning = false
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+      this.queryParam.checkWarehouseSn = 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>

+ 9 - 6
src/views/inventoryManagement/inventoryCheck/list.vue

@@ -176,13 +176,16 @@ export default {
         this.spinning = false
         if (res.status == 200) {
           if (res.data && res.data.length > 0) {
+            // this.modalHtml = `<div style="width: 100%">
+            //   <h3 style="font-size: 15px;font-weight: bold;margin: 20px 0 5px;text-align: center;">存在以下状态的销售单,无法盘点。</h3>
+            //   <h3 style="font-size: 15px;font-weight: bold;margin-bottom: 25px;text-align: center;">请先检查并处理完以下单据再试。</h3>
+            //   ${res.data.indexOf('WAIT_AUDIT') != -1 ? '<p>销售单-待审核(总部自建)</p>' : ''}
+            //   ${res.data.indexOf('AUDIT_REJECT') != -1 ? '<p>销售单-审核不通过(总部自建)</p>' : ''}
+            //   ${res.data.indexOf('HQ_CHANGE') != -1 ? '<p>销售单-总公司改单</p>' : ''}
+            //   ${res.data.indexOf('WAIT_PUSH') != -1 ? '<p>销售单-待下推</p>' : ''}
+            // </div>`
             this.modalHtml = `<div style="width: 100%">
-              <h3 style="font-size: 15px;font-weight: bold;margin: 20px 0 5px;text-align: center;">存在以下状态的销售单,无法盘点。</h3>
-              <h3 style="font-size: 15px;font-weight: bold;margin-bottom: 25px;text-align: center;">请先检查并处理完以下单据再试。</h3>
-              ${res.data.indexOf('WAIT_AUDIT') != -1 ? '<p>销售单-待审核(总部自建)</p>' : ''}
-              ${res.data.indexOf('AUDIT_REJECT') != -1 ? '<p>销售单-审核不通过(总部自建)</p>' : ''}
-              ${res.data.indexOf('HQ_CHANGE') != -1 ? '<p>销售单-总公司改单</p>' : ''}
-              ${res.data.indexOf('WAIT_PUSH') != -1 ? '<p>销售单-待下推</p>' : ''}
+              ${res.data.indexOf('WAIT_PUSH') != -1 ? '<p>存在“待下推”状态的销售单,无法盘点。</p>' : ''}
             </div>`
             this.openCommonModal = true
           } else {