style:库存查询-添加库区筛选条件

main
黄伟杰 2 weeks ago
parent 8525e25d73
commit 6437c0c408

@ -694,6 +694,7 @@ export default {
placeholderProduct: 'Please select product', placeholderProduct: 'Please select product',
placeholderCategory: 'Please select material category', placeholderCategory: 'Please select material category',
placeholderWarehouse: 'Please select warehouse', placeholderWarehouse: 'Please select warehouse',
placeholderArea: 'Please select area',
exportName: 'Product Stock.xls' exportName: 'Product Stock.xls'
}, },
In: { In: {

@ -694,6 +694,7 @@ export default {
placeholderProduct: '请选择产品', placeholderProduct: '请选择产品',
placeholderCategory: '请选择物料大类', placeholderCategory: '请选择物料大类',
placeholderWarehouse: '请选择仓库', placeholderWarehouse: '请选择仓库',
placeholderArea: '\u8bf7\u9009\u62e9\u5e93\u533a',
exportName: '产品库存.xls' exportName: '产品库存.xls'
}, },
In: { In: {

@ -35,6 +35,7 @@
filterable filterable
:placeholder="t('ErpStock.Stock.placeholderWarehouse')" :placeholder="t('ErpStock.Stock.placeholderWarehouse')"
class="!w-240px" class="!w-240px"
@change="handleWarehouseChange"
> >
<el-option <el-option
v-for="item in warehouseList" v-for="item in warehouseList"
@ -44,6 +45,23 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="t('ErpStock.Stock.area')" prop="areaId">
<el-select
v-model="queryParams.areaId"
clearable
filterable
:placeholder="t('ErpStock.Stock.placeholderArea')"
class="!w-240px"
:disabled="!queryParams.warehouseId"
>
<el-option
v-for="item in areaList"
:key="item.id"
:label="getAreaLabel(item)"
:value="String(item.id)"
/>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> {{ t('common.query') }}</el-button> <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> {{ t('common.query') }}</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> {{ t('common.reset') }}</el-button> <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> {{ t('common.reset') }}</el-button>
@ -135,11 +153,11 @@
<span v-else>-</span> <span v-else>-</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="t('ErpStock.Stock.totalPackageCount')" align="center" sortable prop="totalPackageCount" min-width="120"> <!-- <el-table-column :label="t('ErpStock.Stock.totalPackageCount')" align="center" sortable prop="totalPackageCount" min-width="120">
<template #default="{ row }"> <template #default="{ row }">
{{ formatStockCount(row.totalPackageCount) }} {{ formatStockCount(row.totalPackageCount) }}
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column :label="t('ErpStock.Stock.totalBaseCount')" align="center" sortable prop="totalBaseCount" min-width="120"> <el-table-column :label="t('ErpStock.Stock.totalBaseCount')" align="center" sortable prop="totalBaseCount" min-width="120">
<template #default="{ row }"> <template #default="{ row }">
{{ formatStockCount(row.totalBaseCount) }} {{ formatStockCount(row.totalBaseCount) }}
@ -182,6 +200,7 @@ import { DICT_TYPE, getDictObj, getIntDictOptions } from '@/utils/dict'
import { StockApi, StockVO } from '@/api/erp/stock/stock' import { StockApi, StockVO } from '@/api/erp/stock/stock'
import { ProductApi, ProductVO } from '@/api/erp/product/product' import { ProductApi, ProductVO } from '@/api/erp/product/product'
import { WarehouseApi, WarehouseVO } from '@/api/erp/stock/warehouse' import { WarehouseApi, WarehouseVO } from '@/api/erp/stock/warehouse'
import { WarehouseAreaApi, WarehouseAreaVO } from '@/api/erp/stock/warehousearea'
import { useDictStoreWithOut } from '@/store/modules/dict' import { useDictStoreWithOut } from '@/store/modules/dict'
import { formatDate } from '@/utils/formatTime' import { formatDate } from '@/utils/formatTime'
import { isHexColor } from '@/utils/color' import { isHexColor } from '@/utils/color'
@ -212,12 +231,14 @@ const queryParams = reactive<{
pageSize: number pageSize: number
productId?: number productId?: number
warehouseId?: number warehouseId?: number
areaId?: string
categoryType?: number categoryType?: number
}>({ }>({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
productId: undefined, productId: undefined,
warehouseId: undefined, warehouseId: undefined,
areaId: undefined,
categoryType: undefined categoryType: undefined
}) })
const queryFormRef = ref() // const queryFormRef = ref() //
@ -225,6 +246,7 @@ const exportLoading = ref(false) // 导出的加载中
const activeName = ref('') const activeName = ref('')
const productList = ref<ProductVO[]>([]) // const productList = ref<ProductVO[]>([]) //
const warehouseList = ref<WarehouseVO[]>([]) // const warehouseList = ref<WarehouseVO[]>([]) //
const areaList = ref<WarehouseAreaVO[]>([])
const categoryTypeOptions = computed(() => getIntDictOptions(DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE)) const categoryTypeOptions = computed(() => getIntDictOptions(DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE))
const formatStockCount = (value: number | string | undefined) => { const formatStockCount = (value: number | string | undefined) => {
@ -286,6 +308,26 @@ const getProductList = async () => {
} }
} }
const getAreaLabel = (area: WarehouseAreaVO) => {
return area.areaName || area.areaCode || String(area.id)
}
const getAreaList = async () => {
if (!queryParams.warehouseId) {
areaList.value = []
return
}
const data = await WarehouseAreaApi.getWarehouseAreaPage({
pageNo: 1,
pageSize: 100,
warehouseId: queryParams.warehouseId
})
areaList.value = data?.list ?? []
if (queryParams.areaId && !areaList.value.some((item) => String(item.id) === String(queryParams.areaId))) {
queryParams.areaId = undefined
}
}
/** 查询列表 */ /** 查询列表 */
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
@ -310,10 +352,16 @@ const resetQuery = async () => {
queryFormRef.value.resetFields() queryFormRef.value.resetFields()
activeName.value = '' activeName.value = ''
queryParams.categoryType = undefined queryParams.categoryType = undefined
areaList.value = []
await getProductList() await getProductList()
handleQuery() handleQuery()
} }
const handleWarehouseChange = async () => {
queryParams.areaId = undefined
await getAreaList()
}
const handleTabClick = async (tab: any) => { const handleTabClick = async (tab: any) => {
const value = String(tab.paneName || '') const value = String(tab.paneName || '')
activeName.value = value activeName.value = value
@ -376,6 +424,7 @@ onMounted(async () => {
// //
await getProductList() await getProductList()
warehouseList.value = await WarehouseApi.getWarehouseSimpleList() warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
await getAreaList()
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {

Loading…
Cancel
Save