|
|
|
|
@ -35,6 +35,7 @@
|
|
|
|
|
filterable
|
|
|
|
|
:placeholder="t('ErpStock.Stock.placeholderWarehouse')"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
@change="handleWarehouseChange"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in warehouseList"
|
|
|
|
|
@ -44,6 +45,23 @@
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</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-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>
|
|
|
|
|
@ -135,11 +153,11 @@
|
|
|
|
|
<span v-else>-</span>
|
|
|
|
|
</template>
|
|
|
|
|
</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 }">
|
|
|
|
|
{{ formatStockCount(row.totalPackageCount) }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table-column> -->
|
|
|
|
|
<el-table-column :label="t('ErpStock.Stock.totalBaseCount')" align="center" sortable prop="totalBaseCount" min-width="120">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
{{ formatStockCount(row.totalBaseCount) }}
|
|
|
|
|
@ -182,6 +200,7 @@ import { DICT_TYPE, getDictObj, getIntDictOptions } from '@/utils/dict'
|
|
|
|
|
import { StockApi, StockVO } from '@/api/erp/stock/stock'
|
|
|
|
|
import { ProductApi, ProductVO } from '@/api/erp/product/product'
|
|
|
|
|
import { WarehouseApi, WarehouseVO } from '@/api/erp/stock/warehouse'
|
|
|
|
|
import { WarehouseAreaApi, WarehouseAreaVO } from '@/api/erp/stock/warehousearea'
|
|
|
|
|
import { useDictStoreWithOut } from '@/store/modules/dict'
|
|
|
|
|
import { formatDate } from '@/utils/formatTime'
|
|
|
|
|
import { isHexColor } from '@/utils/color'
|
|
|
|
|
@ -212,12 +231,14 @@ const queryParams = reactive<{
|
|
|
|
|
pageSize: number
|
|
|
|
|
productId?: number
|
|
|
|
|
warehouseId?: number
|
|
|
|
|
areaId?: string
|
|
|
|
|
categoryType?: number
|
|
|
|
|
}>({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
productId: undefined,
|
|
|
|
|
warehouseId: undefined,
|
|
|
|
|
areaId: undefined,
|
|
|
|
|
categoryType: undefined
|
|
|
|
|
})
|
|
|
|
|
const queryFormRef = ref() // 搜索的表单
|
|
|
|
|
@ -225,6 +246,7 @@ const exportLoading = ref(false) // 导出的加载中
|
|
|
|
|
const activeName = ref('')
|
|
|
|
|
const productList = ref<ProductVO[]>([]) // 产品列表
|
|
|
|
|
const warehouseList = ref<WarehouseVO[]>([]) // 仓库列表
|
|
|
|
|
const areaList = ref<WarehouseAreaVO[]>([])
|
|
|
|
|
const categoryTypeOptions = computed(() => getIntDictOptions(DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE))
|
|
|
|
|
|
|
|
|
|
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 () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
@ -310,10 +352,16 @@ const resetQuery = async () => {
|
|
|
|
|
queryFormRef.value.resetFields()
|
|
|
|
|
activeName.value = ''
|
|
|
|
|
queryParams.categoryType = undefined
|
|
|
|
|
areaList.value = []
|
|
|
|
|
await getProductList()
|
|
|
|
|
handleQuery()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleWarehouseChange = async () => {
|
|
|
|
|
queryParams.areaId = undefined
|
|
|
|
|
await getAreaList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleTabClick = async (tab: any) => {
|
|
|
|
|
const value = String(tab.paneName || '')
|
|
|
|
|
activeName.value = value
|
|
|
|
|
@ -376,6 +424,7 @@ onMounted(async () => {
|
|
|
|
|
// 加载产品、仓库列表
|
|
|
|
|
await getProductList()
|
|
|
|
|
warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
|
|
|
|
|
await getAreaList()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
|
|