lilei 2 年 前
コミット
083868c5f2

+ 11 - 72
src/views/common/chooseProductsModal.vue

@@ -29,39 +29,21 @@
                   </a-form-model-item>
                 </a-col>
                 <a-col :md="6" :sm="24">
-                  <a-form-model-item label="产品品牌" :prop="type=='dealership'?'productBrandSn':''">
-                    <a-select
-                      placeholder="请选择产品品牌"
-                      id="chooseProducts-productBrandSn"
-                      allowClear
-                      v-model="queryParam.productBrandSn"
-                      :showSearch="true"
-                      option-filter-prop="children"
-                      :filter-option="filterOption">
-                      <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
-                    </a-select>
-                  </a-form-model-item>
+                  <a-form-item label="产品品牌" :prop="type=='dealership'?'productBrandSn':''">
+                    <ProductBrand id="chooseProducts-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
+                  </a-form-item>
                 </a-col>
                 <a-col :md="6" :sm="24">
-                  <a-form-model-item label="产品分类" :prop="type=='dealership'?'productType':''">
-                    <a-cascader
-                      @change="changeProductType"
-                      change-on-select
-                      v-model="queryParam.productType"
-                      expand-trigger="hover"
-                      :options="productTypeList"
-                      :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
-                      id="chooseProducts-productType"
-                      placeholder="请选择产品分类"
-                      allowClear />
-                  </a-form-model-item>
+                  <a-form-item label="产品分类" :prop="type=='dealership'?'productType':''">
+                    <productTypeAll :isAll="type!='default'" placeholder="请选择产品分类" @change="changeProductType" v-model="queryParam.productType" id="chooseProducts-productType"></productTypeAll>
+                  </a-form-item>
                 </a-col>
                 <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
                   <a-button type="primary" @click="handleSearch" :disabled="disabled" id="chooseProducts-refresh">查询</a-button>
                   <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chooseProducts-reset">重置</a-button>
                 </a-col>
               </a-row>
-            </a-form-model></a-form>
+            </a-form-model>
           </div>
           <p style="font-weight: bold;">当前已选:{{ rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length }}个</p>
           <!-- 列表 -->
@@ -103,13 +85,13 @@
 <script>
 import { STable } from '@/components'
 import tablePagination from '@/views/common/tablePagination.vue'
-import { productBrandQuery } from '@/api/productBrand'
-import { productTypeQuery, productTypeQueryAll } from '@/api/productType'
+import ProductBrand from '@/views/common/productBrand.js'
+import productTypeAll from '@/views/common/productTypeAll.js'
 import { dealerScopeValidProduct } from '@/api/dealerScope'
 import { productPricedList, productPricingList } from '@/api/product'
 export default {
   name: 'ChooseProductsModal',
-  components: { STable, tablePagination },
+  components: { STable, tablePagination, ProductBrand, productTypeAll },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -123,7 +105,7 @@ export default {
     },
     type: { //  类型,经销权设置dealership,  供应商添加产品supplier
       type: String,
-      default: ''
+      default: 'default'
     },
     dealerSn: {
       type: String || Number,
@@ -183,8 +165,6 @@ export default {
           return data
         })
       },
-      productBrandList: [], //  品牌下拉数据
-      productTypeList: [], //  分类下拉数据
       rowSelectionInfo: null
     }
   },
@@ -282,41 +262,6 @@ export default {
       this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
       this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
       this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
-    },
-    filterOption (input, option) {
-      return (
-        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      )
-    },
-    //  产品品牌  列表
-    getProductBrand () {
-      productBrandQuery({}).then(res => {
-        if (res.status == 200) {
-          this.productBrandList = res.data
-        } else {
-          this.productBrandList = []
-        }
-      })
-    },
-    //  产品分类  列表
-    getProductType () {
-      if (this.type != 'supplier' && this.type != 'dealership') { //  促销
-        productTypeQueryAll({}).then(res => {
-          if (res.status == 200) {
-            this.productTypeList = res.data
-          } else {
-            this.productTypeList = []
-          }
-        })
-      } else {
-        productTypeQuery({}).then(res => {
-          if (res.status == 200) {
-            this.productTypeList = res.data
-          } else {
-            this.productTypeList = []
-          }
-        })
-      }
     }
   },
   watch: {
@@ -347,12 +292,6 @@ export default {
         this.$nextTick(() => { // 页面渲染完成后的回调
           _this.$refs.table.setTableSelected(selectedRowKeys, selectedRows) // 设置表格选中项
         })
-        if (this.productBrandList.length == 0) {
-          this.getProductBrand()
-        }
-        if (this.productTypeList.length == 0) {
-          this.getProductType()
-        }
       }
     }
   }

+ 24 - 10
src/views/common/productTypeAll.js

@@ -1,4 +1,4 @@
-import { productTypeQueryAll } from '@/api/productType'
+import { productTypeQueryAll, productTypeQuery } from '@/api/productType'
 const ProductType = {
   template: `
       <a-cascader
@@ -32,6 +32,10 @@ const ProductType = {
     disabled: {
       type: Boolean,
       default: false
+    },
+    isAll: {
+      type: Boolean,
+      default: true
     }
   },
   data () {
@@ -63,19 +67,29 @@ const ProductType = {
     },
     //  产品分类  列表
     getProductType () {
-      productTypeQueryAll({}).then(res => {
-        if (res.status == 200) {
-          if (res.data && res.data.length > 0) {
-            //  递归处理disabled禁用
-            this.recursionFun(res.data, false)
+      if(this.isAll){
+        productTypeQueryAll({}).then(res => {
+          if (res.status == 200) {
+            if (res.data && res.data.length > 0) {
+              //  递归处理disabled禁用
+              this.recursionFun(res.data, false)
+              this.productTypeList = res.data
+            } else {
+              this.productTypeList = []
+            }
+          } else {
+            this.productTypeList = []
+          }
+        })
+      }else{
+        productTypeQuery({}).then(res => {
+          if (res.status == 200) {
             this.productTypeList = res.data
           } else {
             this.productTypeList = []
           }
-        } else {
-          this.productTypeList = []
-        }
-      })
+        })
+      }
     },
     //  递归函数
     recursionFun (data, state) {

+ 7 - 41
src/views/salesManagement/priceInquiry/list.vue

@@ -30,18 +30,9 @@
           </a-col>
           <template v-if="advanced">
             <a-col :md="6" :sm="24">
-              <a-form-model-item label="产品分类">
-                <a-cascader
-                  @change="changeProductType"
-                  change-on-select
-                  v-model="productType"
-                  expand-trigger="hover"
-                  :options="productTypeList"
-                  :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
-                  id="priceInquiryList-productType"
-                  placeholder="请选择产品分类"
-                  allowClear />
-              </a-form-model-item>
+              <a-form-item label="产品分类">
+                <ProductType v-model="productType" id="priceInquiryList-productType" @change="changeProductType" placeholder="请选择产品分类"></ProductType>
+              </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-model-item label="产品品牌">
@@ -119,15 +110,14 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import carInfoModal from './carInfoModal.vue'
-import { productBrandQuery } from '@/api/productBrand'
-import { productTypeQuery } from '@/api/productType'
+import ProductType from '@/views/common/productType.js'
+import ProductBrand from '@/views/common/productBrand.js'
 import { productPriceList } from '@/api/product'
 import { supperCodeByVin, vinCodeParse } from '@/api/sales'
-import ProductBrand from '@/views/common/productBrand.js'
 export default {
   name: 'PriceInquiryList',
   mixins: [commonMixin],
-  components: { STable, VSelect, ProductBrand, carInfoModal },
+  components: { STable, VSelect, ProductBrand, carInfoModal, ProductType},
   data () {
     return {
       advanced: true, // 高级搜索 展开/关闭
@@ -182,8 +172,6 @@ export default {
         }
       },
       vinInfoData: null,
-      productBrandList: [], //  品牌下拉数据
-      productTypeList: [], //  分类下拉数据
       openCarInfoModal: false,
       onlyList: false
     }
@@ -310,37 +298,15 @@ 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 => {
-        if (res.status == 200) {
-          this.productTypeList = res.data
-        } else {
-          this.productTypeList = []
-        }
-      })
-    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
-      this.getProductBrand()
-      this.getProductType()
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 195
+      this.tableHeight = window.innerHeight - tableSearchH - 200
     }
   },
   watch: {

+ 9 - 31
src/views/salesManagement/shortageStatisticsC/list.vue

@@ -32,24 +32,13 @@
                 </a-form-item>
               </a-col>
               <a-col :md="6" :sm="24">
-                <a-form-model-item label="省份">
-                  <a-form-model-item prop="provinceSn">
-                    <Area id="shortageStatisticsCList-provinceSn" v-model="queryParam.provinceSn" placeholder="请选择省"></Area>
-                  </a-form-model-item>
+                <a-form-model-item label="省份" prop="provinceSn">
+                  <Area id="shortageStatisticsCList-provinceSn" v-model="queryParam.provinceSn" placeholder="请选择省"></Area>
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-item label="产品分类">
-                  <a-cascader
-                    @change="changeProductType"
-                    expand-trigger="hover"
-                    change-on-select
-                    :options="productTypeList"
-                    :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
-                    id="shortageStatisticsCList-productType"
-                    placeholder="请选择产品分类"
-                    allowClear
-                    v-model="productType" />
+                  <ProductType v-model="productType" id="shortageStatisticsCList-productType" @change="changeProductType" placeholder="请选择产品分类"></ProductType>
                 </a-form-item>
               </a-col>
               <a-col :md="6" :sm="24">
@@ -67,7 +56,7 @@
                   <a-input id="shortageStatisticsCList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
                 </a-form-item>
               </a-col>
-              <a-col :md="5" :sm="24">
+              <a-col :md="6" :sm="24">
                 <a-form-item label="客户类型">
                   <v-select code="DEALER_TYPE" id="shortageStatisticsCList-dealerType" v-model="queryParam.dealerType" allowClear placeholder="请选择客户类型"></v-select>
                 </a-form-item>
@@ -122,7 +111,8 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :rowKey="(record) => record.id"
+        :rowKey="(record) => record.no"
+        rowKeyName = "no"
         :columns="columns"
         :data="loadData"
         :defaultLoadData="false"
@@ -146,13 +136,13 @@ import rangeDate from '@/views/common/rangeDate.vue'
 import custList from '@/views/common/custList.vue'
 import subarea from '@/views/common/subarea.js'
 import Area from '@/views/common/area.js'
-import { productTypeQuery } from '@/api/productType'
+import ProductType from '@/views/common/productType.js'
 import ProductBrand from '@/views/common/productBrand.js'
 import { oosBuyerList, oosBuyerDetailCount, oosBuyerDetailPageCount, oosDetailExport } from '@/api/oos'
 export default {
   name: 'ShortageStatisticsCList',
   mixins: [commonMixin],
-  components: { STable, VSelect, custList, subarea, Area, rangeDate, ProductBrand },
+  components: { STable, VSelect, custList, subarea, Area, rangeDate, ProductBrand, ProductType },
   data () {
     return {
       spinning: false,
@@ -204,7 +194,6 @@ export default {
         })
       },
       productType: [],
-      productTypeList: [], //  分类下拉数据
       productTotal: null,
       currentTotal: null
     }
@@ -344,26 +333,15 @@ export default {
       this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
       this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
     },
-    //  产品分类  列表
-    getProductType () {
-      productTypeQuery({}).then(res => {
-        if (res.status == 200) {
-          this.productTypeList = res.data
-        } else {
-          this.productTypeList = []
-        }
-      })
-    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
-      this.getProductType()
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 250
+      this.tableHeight = window.innerHeight - tableSearchH - 260
     }
   },
   watch: {

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

@@ -69,7 +69,8 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :rowKey="(record) => record.id"
+        :rowKey="(record) => record.no"
+        rowKeyName="no"
         :columns="columns"
         :data="loadData"
         :scroll="{ y: tableHeight }"