|
|
|
|
@ -104,12 +104,7 @@
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<el-tabs v-model="activeName" @tab-click="handleTabClick">
|
|
|
|
|
<el-tab-pane :label="t('ErpStock.Record.categoryProduct')" name="2" />
|
|
|
|
|
<el-tab-pane :label="t('ErpStock.Record.categoryMaterial')" name="1" />
|
|
|
|
|
<el-tab-pane :label="t('ErpStock.Record.categorySpare')" name="5" />
|
|
|
|
|
<el-tab-pane :label="t('ErpStock.Record.categoryTool')" name="3" />
|
|
|
|
|
<el-tab-pane :label="t('ErpStock.Record.categoryConsumable')" name="4" />
|
|
|
|
|
<el-tab-pane :label="t('ErpStock.Record.categoryOther')" name="0" />
|
|
|
|
|
<el-tab-pane v-for="item in categoryTabs" :key="item.id" :label="item.name" :name="String(item.id)" />
|
|
|
|
|
</el-tabs>
|
|
|
|
|
|
|
|
|
|
<el-table
|
|
|
|
|
@ -181,6 +176,7 @@ import download from '@/utils/download'
|
|
|
|
|
import { StockRecordApi, StockRecordVO } from '@/api/erp/stock/record'
|
|
|
|
|
import { ProductApi, ProductVO } from '@/api/erp/product/product'
|
|
|
|
|
import { WarehouseApi, WarehouseVO } from '@/api/erp/stock/warehouse'
|
|
|
|
|
import { ProductCategoryApi, ProductCategoryVO } from '@/api/erp/product/category'
|
|
|
|
|
import { erpCountTableColumnFormatter } from '@/utils'
|
|
|
|
|
|
|
|
|
|
/** ERP 产品库存明细列表 */
|
|
|
|
|
@ -206,6 +202,7 @@ const queryFormRef = ref() // 搜索的表单
|
|
|
|
|
const exportLoading = ref(false) // 导出的加载中
|
|
|
|
|
const productList = ref<ProductVO[]>([]) // 产品列表
|
|
|
|
|
const warehouseList = ref<WarehouseVO[]>([]) // 仓库列表
|
|
|
|
|
const categoryTabs = ref<ProductCategoryVO[]>([])
|
|
|
|
|
|
|
|
|
|
/** 查询列表 */
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
@ -282,7 +279,7 @@ onActivated(() => {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
queryParams.categoryId = 2
|
|
|
|
|
await loadCategoryTabs()
|
|
|
|
|
await getList()
|
|
|
|
|
// 加载产品、仓库列表
|
|
|
|
|
productList.value = await ProductApi.getProductSimpleList()
|
|
|
|
|
@ -290,9 +287,24 @@ onMounted(async () => {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
/** tab 切换 */
|
|
|
|
|
let activeName = '2'
|
|
|
|
|
const activeName = ref('')
|
|
|
|
|
const handleTabClick = (tab: TabsPaneContext) => {
|
|
|
|
|
queryParams.categoryId = tab.paneName
|
|
|
|
|
queryParams.categoryId = tab.paneName ? Number(tab.paneName) : undefined
|
|
|
|
|
handleQuery()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const loadCategoryTabs = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const data = await ProductCategoryApi.getProductCategoryList({})
|
|
|
|
|
const roots = (data || []).filter((item: any) => item && (item.parentId === 0 || item.parentId === null || item.parentId === undefined))
|
|
|
|
|
categoryTabs.value = roots.sort((a: any, b: any) => Number(a?.sort ?? 0) - Number(b?.sort ?? 0))
|
|
|
|
|
const defaultId = categoryTabs.value.find((v) => String(v.id) === '2')?.id ?? categoryTabs.value[0]?.id
|
|
|
|
|
queryParams.categoryId = defaultId
|
|
|
|
|
activeName.value = defaultId !== undefined && defaultId !== null ? String(defaultId) : ''
|
|
|
|
|
} catch {
|
|
|
|
|
categoryTabs.value = []
|
|
|
|
|
queryParams.categoryId = undefined
|
|
|
|
|
activeName.value = ''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|