|
@@ -22,12 +22,30 @@
|
|
|
<template v-if="advanced">
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="产品品牌">
|
|
|
- <ProductBrand id="inventoryQueryList-brandSn" v-model="queryParam.brandSn"></ProductBrand>
|
|
|
+ <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 productBrandList" :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="产品分类">
|
|
|
- <ProductType v-model="productTypeSn" @change="changeType"></ProductType>
|
|
|
+ <a-cascader
|
|
|
+ @change="changeProductType"
|
|
|
+ expand-trigger="hover"
|
|
|
+ change-on-select
|
|
|
+ :options="productTypeList"
|
|
|
+ :fieldNames="{ label: 'productTypeName', value: 'id', children: 'children' }"
|
|
|
+ id="inventoryQueryList-productType"
|
|
|
+ placeholder="请选择产品分类"
|
|
|
+ allowClear
|
|
|
+ v-model="productType" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
@@ -58,7 +76,7 @@
|
|
|
</div>
|
|
|
<!-- 合计 -->
|
|
|
<a-alert type="info" showIcon style="margin-bottom:15px">
|
|
|
- <div class="ftext" slot="message">现有库存总数量(个):<strong>{{ currentStock.currentStockQty || 0 }}</strong>;现有库存总成本(¥):<strong>{{ currentStock.currentStockCost || 0 }}</strong>。</div>
|
|
|
+ <div class="ftext" slot="message">现有库存总数量(个):<strong>{{ stockQty }}</strong>;现有库存总成本(¥):<strong>{{ stockCost }}</strong>。</div>
|
|
|
</a-alert>
|
|
|
<!-- 列表 -->
|
|
|
<s-table
|
|
@@ -70,11 +88,6 @@
|
|
|
:data="loadData"
|
|
|
:scroll="{ x: 1630, y: tableHeight }"
|
|
|
bordered>
|
|
|
- <!-- 产品分类 -->
|
|
|
- <template slot="productTypeName" slot-scope="text, record">
|
|
|
- <span v-if="record.productTypeName2">{{ record.productTypeName2 || '' }} ></span>
|
|
|
- <span v-if="record.productTypeName3">{{ record.productTypeName3 || '' }}</span>
|
|
|
- </template>
|
|
|
<!-- 现有库存数量 -->
|
|
|
<template slot="currentStockQty" slot-scope="text, record">
|
|
|
{{ (record.currentStockQty + record.freezeQty) || 0 }}
|
|
@@ -93,13 +106,13 @@
|
|
|
|
|
|
<script>
|
|
|
import moment from 'moment'
|
|
|
-import { stockList, stockCount } from '@/api/stock'
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import inventoryQueryDetailModal from './detailModal.vue'
|
|
|
-import ProductBrand from '@/views/common/productBrand.js'
|
|
|
-import ProductType from '@/views/common/productType.js'
|
|
|
+import { productBrandQuery } from '@/api/productBrand'
|
|
|
+import { productTypeQuery } from '@/api/productType'
|
|
|
+import { stockList, stockCount } from '@/api/stock'
|
|
|
export default {
|
|
|
- components: { STable, VSelect, inventoryQueryDetailModal, ProductBrand, ProductType },
|
|
|
+ components: { STable, VSelect, inventoryQueryDetailModal },
|
|
|
data () {
|
|
|
return {
|
|
|
advanced: false, // 高级搜索 展开/关闭
|
|
@@ -108,15 +121,17 @@ export default {
|
|
|
productCode: '', // 产品编码
|
|
|
productName: '', // 产品名称
|
|
|
productOrigCode: '', // 原厂编码
|
|
|
- brandSn: undefined, // 产品品牌
|
|
|
+ productBrandSn: undefined, // 产品品牌
|
|
|
productTypeSn1: '', // 产品分类1
|
|
|
productTypeSn2: '', // 产品分类2
|
|
|
productTypeSn3: '', // 产品分类3
|
|
|
zeroQtyFlag: undefined // 库存数量是否为0
|
|
|
},
|
|
|
- productTypeSn: [],
|
|
|
+ productType: [],
|
|
|
exportLoading: false, // 导出loading
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
+ productBrandList: [], // 品牌下拉数据
|
|
|
+ productTypeList: [], // 分类下拉数据
|
|
|
zeroQtyData: [ // 库存情况
|
|
|
{ name: '库存数量为0', id: '1' },
|
|
|
{ name: '库存数量不为0', id: '0' }
|
|
@@ -125,11 +140,11 @@ export default {
|
|
|
{ title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
{ title: '产品编码', dataIndex: 'productCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '产品名称', dataIndex: 'productName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
|
|
|
- { title: '原厂编码', dataIndex: 'productOrigCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品品牌', dataIndex: 'brandName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品分类', scopedSlots: { customRender: 'productTypeName' }, width: 240, align: 'center' },
|
|
|
- { title: '现有库存数量(个)', dataIndex: 'currentStockQty', scopedSlots: { customRender: 'currentStockQty' }, width: 165, align: 'center', sorter: true },
|
|
|
- { title: '现有库存成本(¥)', dataIndex: 'currentStockCost', width: 165, align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '最后入库时间', dataIndex: 'lastStockTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '单位', dataIndex: 'productUnit', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品品牌', dataIndex: 'productBrandName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '库存数量(个)', dataIndex: 'currentStockQty', scopedSlots: { customRender: 'currentStockQty' }, width: 165, align: 'center', sorter: true },
|
|
|
+ { title: '库存成本(¥)', dataIndex: 'currentStockCost', width: 165, align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center', fixed: 'right' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
@@ -156,6 +171,14 @@ export default {
|
|
|
this.disabled = false
|
|
|
// 总计
|
|
|
this.getTotal(Object.assign(parameter, this.queryParam))
|
|
|
+ // 产品分类
|
|
|
+ if (this.productTypeList.length == 0) {
|
|
|
+ this.getProductType()
|
|
|
+ }
|
|
|
+ // 产品品牌
|
|
|
+ if (this.productBrandList.length == 0) {
|
|
|
+ this.getProductBrand()
|
|
|
+ }
|
|
|
return data
|
|
|
})
|
|
|
},
|
|
@@ -167,20 +190,30 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ stockQty () { // 库存总数量 合计
|
|
|
+ const currentStockQty = Number(this.currentStock.currentStockQty) || 0
|
|
|
+ const freezeStockQty = Number(this.currentStock.freezeStockQty) || 0
|
|
|
+ return currentStockQty + freezeStockQty
|
|
|
+ },
|
|
|
+ stockCost () { // 库存总成本 合计
|
|
|
+ const currentStockCost = Number(this.currentStock.currentStockCost) || 0
|
|
|
+ const freezeStockCost = Number(this.currentStock.freezeStockCost) || 0
|
|
|
+ return currentStockCost + freezeStockCost
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
// 重置
|
|
|
resetSearchForm () {
|
|
|
- this.queryParam.brandSn = undefined
|
|
|
+ this.queryParam.productBrandSn = undefined
|
|
|
this.queryParam.productTypeSn1 = ''
|
|
|
this.queryParam.productTypeSn2 = ''
|
|
|
this.queryParam.productTypeSn3 = ''
|
|
|
this.queryParam.productCode = ''
|
|
|
this.queryParam.productOrigCode = ''
|
|
|
this.queryParam.productName = ''
|
|
|
- this.queryParam.brandName = undefined
|
|
|
- this.queryParam.productTypeName = undefined
|
|
|
this.queryParam.zeroQtyFlag = undefined
|
|
|
- this.productTypeSn = []
|
|
|
+ this.productType = []
|
|
|
this.$refs.table.refresh(true)
|
|
|
},
|
|
|
// 合计
|
|
@@ -243,12 +276,36 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- // 分类 changeType
|
|
|
- changeType (val) {
|
|
|
- console.log(val)
|
|
|
- for (let i = 0; i < val.length; i++) {
|
|
|
- this.queryParam['productTypeSn' + (i + 1)] = val[i]
|
|
|
- }
|
|
|
+ // 产品分类 change
|
|
|
+ changeProductType (val, opt) {
|
|
|
+ this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
+ 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 = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ filterOption (input, option) {
|
|
|
+ return (
|
|
|
+ option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
}
|