lilei před 3 roky
rodič
revize
d846be6c35

+ 11 - 1
src/api/oos.js

@@ -19,7 +19,7 @@ export const oosDetail = (params) => {
     method: 'get'
   })
 }
-//  缺货 导出
+//  缺货 按客户导出
 export const oosDetailExport = (params) => {
   return axios({
     url: '/oos/detail/exportByBuyer',
@@ -28,6 +28,16 @@ export const oosDetailExport = (params) => {
     responseType: 'blob'
   })
 }
+//  缺货 按产品导出
+export const oosDetailExportByProduct = (params) => {
+  return axios({
+    url: '/oos/detail/exportByProduct',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}
+
 //  缺货  详情  列表  分页
 export const oosDetailList = (params) => {
   const url = `/oos/detail/queryPage/${params.pageNo}/${params.pageSize}`

+ 9 - 1
src/views/common/productBrand.js

@@ -25,6 +25,10 @@ const ProductBrand = {
     sysFlag: {
       type: String,
       default: ''
+    },
+    brandType: {
+      type: String,
+      default: ''
     }
   },
   data() {
@@ -39,6 +43,10 @@ const ProductBrand = {
   watch: {
     value(newValue, oldValue) {
       this.defaultVal = newValue
+    },
+    brandType(newValue,oldValue){
+      this.handleChange(undefined)
+      this.getProductBrand()
     }
   },
   methods: {
@@ -54,7 +62,7 @@ const ProductBrand = {
     },
     //  产品品牌列表, sysFlag: 1 箭冠 0 自建
     getProductBrand () {
-      productBrandQuery({ 'sysFlag': this.sysFlag }).then(res => {
+      productBrandQuery({ 'sysFlag': this.sysFlag, 'brandType': this.brandType }).then(res => {
         if (res.status == 200) {
           this.productBrandList = res.data
         } else {

+ 1 - 13
src/views/reportData/salesDetails/list.vue

@@ -56,7 +56,7 @@
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="产品品牌">
-                  <ProductBrand id="salesDetailsList-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
+                  <ProductBrand id="salesDetailsList-productBrandSn" :brandType="queryParam.productBrandTypeSn" v-model="queryParam.productBrandSn"></ProductBrand>
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
@@ -229,7 +229,6 @@ export default {
       addrProvinceList: [], //  省下拉
       addrCityList: [], //  市下拉
       addrDistrictList: [], //  区下拉
-      productBrandList: [], //  品牌下拉数据
       productTypeList: [] //  分类下拉数据
     }
   },
@@ -371,16 +370,6 @@ export default {
       this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
       this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
     },
-    //  产品品牌  列表
-    getProductBrand () {
-      productBrandQuery({}).then(res => {
-        if (res.status == 200) {
-          this.productBrandList = res.data
-        } else {
-          this.productBrandList = []
-        }
-      })
-    },
     //  产品分类  列表
     getProductType () {
       productTypeQuery({}).then(res => {
@@ -438,7 +427,6 @@ export default {
       })
     },
     pageInit () {
-      this.getProductBrand()
       this.getProductType()
       this.getArea('province')
     }

+ 47 - 1
src/views/salesManagement/shortageStatisticsP/list.vue

@@ -30,6 +30,14 @@
             <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
               <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="shortageStatisticsPList-refresh">查询</a-button>
               <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="shortageStatisticsPList-reset">重置</a-button>
+              <a-button
+                style="margin-left: 5px"
+                type="primary"
+                class="button-warning"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                id="shortageStatisticsCList-export">导出</a-button>
               <a @click="advanced=!advanced" style="margin-left: 5px">
                 {{ advanced ? '收起' : '展开' }}
                 <a-icon :type="advanced ? 'up' : 'down'"/>
@@ -68,10 +76,11 @@
 </template>
 
 <script>
+import moment from 'moment'
 import getDate from '@/libs/getDate.js'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
-import { oosProductList, oosProductDetailCount, oosProductDetailPageCount } from '@/api/oos'
+import { oosProductList, oosProductDetailCount, oosProductDetailPageCount, oosDetailExportByProduct } from '@/api/oos'
 export default {
   components: { STable, VSelect, rangeDate },
   data () {
@@ -87,6 +96,7 @@ export default {
         origCode: ''
       },
       disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false, // 导出loading
       time: [
         getDate.getCurrMonthDays().starttime,
         getDate.getCurrMonthDays().endtime
@@ -163,6 +173,42 @@ export default {
         }
       })
     },
+    //  导出
+    handleExport () {
+      const _this = this
+      const params = this.queryParam
+      this.exportLoading = true
+      _this.spinning = true
+      oosDetailExportByProduct(params).then(res => {
+        this.exportLoading = false
+        _this.spinning = false
+        if (res.type == 'application/json') {
+          var reader = new FileReader()
+          reader.addEventListener('loadend', function () {
+            const obj = JSON.parse(reader.result)
+            _this.$notification.error({
+              message: '提示',
+              description: obj.message
+            })
+          })
+          reader.readAsText(res)
+        } else {
+          this.download(res)
+        }
+      })
+    },
+    download (data) {
+      if (!data) { return }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const a = moment().format('YYYYMMDDHHmmss')
+      const fname = '缺货统计(按产品)' + a
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
+    },
     //  重置
     resetSearchForm () {
       this.$refs.rangeDate.resetDate(this.time)

+ 2 - 2
vue.config.js

@@ -108,9 +108,9 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.16.188:8602/ocs-admin',
+        target: 'http://192.168.16.155:8602/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  Á·Ï°
-        target: 'http://p.ocs.360arrow.com/ocs-admin', //  Ô¤·¢²¼
+        // target: 'http://p.ocs.360arrow.com/ocs-admin', //  Ô¤·¢²¼
         // target: 'http://ocs-admin.360arrow.com/ocs-admin', //  Éú²ú
         ws: false,
         changeOrigin: true,