|
@@ -22,14 +22,27 @@
|
|
|
<template v-if="advanced">
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="产品品牌">
|
|
|
- <a-select id="inventoryQueryList-productBrandSn" placeholder="请选择产品品牌" allowClear v-model="queryParam.productBrandSn">
|
|
|
- <a-select-option v-for="item in brandData" :key="item.stationNo" :value="item.stationNo">{{ item.name }}</a-select-option>
|
|
|
+ <a-select
|
|
|
+ placeholder="请选择产品品牌"
|
|
|
+ id="inventoryQueryList-productBrandSn"
|
|
|
+ allowClear
|
|
|
+ v-model="queryParam.productBrandSn"
|
|
|
+ :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>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="产品分类">
|
|
|
- <a-cascader :options="typeData" placeholder="请选择产品分类" allowClear v-model="productTypeSn" @change="changeType" />
|
|
|
+ <a-cascader
|
|
|
+ :options="typeData"
|
|
|
+ :field-names="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
|
|
|
+ placeholder="请选择产品分类"
|
|
|
+ allowClear
|
|
|
+ v-model="productTypeSn"
|
|
|
+ @change="changeType" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
@@ -90,6 +103,8 @@
|
|
|
<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'
|
|
|
export default {
|
|
@@ -135,6 +150,14 @@ 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
|
|
|
})
|
|
|
},
|
|
@@ -158,20 +181,20 @@ export default {
|
|
|
this.queryParam.productName = ''
|
|
|
this.queryParam.brandName = undefined
|
|
|
this.queryParam.productTypeName = undefined
|
|
|
- this.queryParam.currentStockQty = false
|
|
|
+ this.queryParam.zeroQtyFlag = undefined
|
|
|
+ this.productTypeSn = []
|
|
|
this.$refs.table.refresh(true)
|
|
|
},
|
|
|
- // 分类 changeType
|
|
|
- changeType (val) {
|
|
|
- console.log(val)
|
|
|
- },
|
|
|
// 合计
|
|
|
getTotal (param) {
|
|
|
stockCount(param).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
+ if (res.status == 200 && res.data) {
|
|
|
this.currentStock = res.data
|
|
|
} else {
|
|
|
- this.currentStock = null
|
|
|
+ this.currentStock = { // 合计信息
|
|
|
+ currentStockQty: '',
|
|
|
+ currentStockCost: ''
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -209,6 +232,46 @@ export default {
|
|
|
link.setAttribute('download', fname + '.xlsx')
|
|
|
document.body.appendChild(link)
|
|
|
link.click()
|
|
|
+ },
|
|
|
+ getProductType () {
|
|
|
+ dealerProductTypeList().then(res => {
|
|
|
+ this.recursionFun(res.data)
|
|
|
+ this.typeData = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 递归函数
|
|
|
+ recursionFun (data) {
|
|
|
+ if (data) {
|
|
|
+ data.map((item, index) => {
|
|
|
+ if (item.children && item.children.length == 0) {
|
|
|
+ delete item.children
|
|
|
+ } else {
|
|
|
+ this.recursionFun(item.children)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 分类 changeType
|
|
|
+ changeType (val, selectedOptions) {
|
|
|
+ console.log(val, selectedOptions)
|
|
|
+ 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
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
}
|