lilei 4 yıl önce
ebeveyn
işleme
1cedec06b5

+ 18 - 0
src/api/productType.js

@@ -0,0 +1,18 @@
+import { axios } from '@/utils/request'
+
+//  箭冠 产品分类 列表   一层分类查询   无分页
+export const productTypeQueryList = (params) => {
+  return axios({
+    url: '/productType/queryList',
+    data: params,
+    method: 'post'
+  })
+}
+//  箭冠 产品分类 列表  多层分类查询   无分页
+export const productTypeQuery = (params) => {
+  return axios({
+    url: '/productType/query',
+    data: params,
+    method: 'post'
+  })
+}

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

@@ -24,7 +24,7 @@ const ProductBrand = {
     },
     sysFlag: {
       type: String,
-      default: '1'
+      default: ''
     }
   },
   data() {

+ 2 - 1
src/views/common/productType.js

@@ -41,7 +41,8 @@ const ProductType = {
   methods: {
     handleChange(value) {
       this.defaultVal = value;
-      this.$emit('change', this.value);
+      this.$emit('change', this.defaultVal);
+      this.$emit('input', this.defaultVal);
     },
     //  产品分类列表
     getProductType () {

+ 7 - 54
src/views/inventoryManagement/inventoryQuery/list.vue

@@ -22,28 +22,12 @@
           <template v-if="advanced">
             <a-col :md="6" :sm="24">
               <a-form-item label="产品品牌">
-                <a-select
-                  placeholder="请选择产品品牌"
-                  id="inventoryQueryList-brandSn"
-                  allowClear
-                  v-model="queryParam.brandSn"
-                  :showSearch="true"
-                  option-filter-prop="children"
-                  :filter-option="filterOption">
-                  <a-select-option v-for="item in brandData" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
-                </a-select>
+                <ProductBrand id="inventoryQueryList-brandSn" v-model="queryParam.brandSn"></ProductBrand>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品分类">
-                <a-cascader
-                  :options="typeData"
-                  expand-trigger="hover"
-                  :field-names="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
-                  placeholder="请选择产品分类"
-                  allowClear
-                  v-model="productTypeSn"
-                  @change="changeType" />
+                <ProductType v-model="productTypeSn" @change="changeType"></ProductType>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -110,12 +94,12 @@
 <script>
 import moment from 'moment'
 import { stockList, stockCount } from '@/api/stock'
-import { dealerProductTypeList } from '@/api/dealerProductType'
-import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
 import { STable, VSelect } from '@/components'
 import inventoryQueryDetailModal from './detailModal.vue'
+import ProductBrand from '@/views/common/productBrand.js'
+import ProductType from '@/views/common/productType.js'
 export default {
-  components: { STable, VSelect, inventoryQueryDetailModal },
+  components: { STable, VSelect, inventoryQueryDetailModal, ProductBrand, ProductType },
   data () {
     return {
       advanced: false, // 高级搜索 展开/关闭
@@ -133,8 +117,6 @@ export default {
       productTypeSn: [],
       exportLoading: false, // 导出loading
       disabled: false, //  查询、重置按钮是否可操作
-      brandData: [], //  产品品牌下拉数据
-      typeData: [], //  产品分类下拉数据
       zeroQtyData: [ //  库存情况
         { name: '库存数量为0', id: '1' },
         { name: '库存数量不为0', id: '0' }
@@ -174,14 +156,6 @@ export default {
           this.disabled = false
           // 总计
           this.getTotal(Object.assign(parameter, this.queryParam))
-          // 产品分类
-          if (this.typeData.length == 0) {
-            this.getProductType()
-          }
-          // 产品品牌
-          if (this.brandData.length == 0) {
-            this.getProductBrand()
-          }
           return data
         })
       },
@@ -257,12 +231,6 @@ export default {
       document.body.appendChild(link)
       link.click()
     },
-    getProductType () {
-      dealerProductTypeList({}).then(res => {
-        this.recursionFun(res.data)
-        this.typeData = res.data
-      })
-    },
     //  递归函数
     recursionFun (data) {
       if (data) {
@@ -276,26 +244,11 @@ export default {
       }
     },
     // 分类  changeType
-    changeType (val, selectedOptions) {
-      console.log(val, selectedOptions)
+    changeType (val) {
+      console.log(val)
       for (let i = 0; i < val.length; i++) {
         this.queryParam['productTypeSn' + (i + 1)] = val[i]
       }
-    },
-    //  产品品牌  列表
-    getProductBrand () {
-      dealerProductBrandQuery({}).then(res => {
-        if (res.status == 200) {
-          this.brandData = res.data
-        } else {
-          this.brandData = []
-        }
-      })
-    },
-    filterOption (input, option) {
-      return (
-        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      )
     }
   }
 }