|
|
|
|
@ -42,6 +42,21 @@
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('ErpStock.Record.materialCategory')" prop="categoryType">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.categoryType"
|
|
|
|
|
clearable
|
|
|
|
|
:placeholder="t('ErpStock.Record.placeholderMaterialCategory')"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in categoryTypeOptions"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('ErpStock.Record.bizType')" prop="bizType">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.bizType"
|
|
|
|
|
@ -110,15 +125,6 @@
|
|
|
|
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<el-tabs v-model="activeName" @tab-click="handleTabClick">
|
|
|
|
|
<el-tab-pane
|
|
|
|
|
v-for="item in categoryTabs"
|
|
|
|
|
:key="String(item.value)"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:name="String(item.value)"
|
|
|
|
|
/>
|
|
|
|
|
</el-tabs>
|
|
|
|
|
|
|
|
|
|
<el-table
|
|
|
|
|
v-loading="loading"
|
|
|
|
|
:data="list"
|
|
|
|
|
@ -139,6 +145,11 @@
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :label="t('ErpStock.Record.categoryType')" align="center" prop="bizDocType" min-width="120" sortable />
|
|
|
|
|
<el-table-column :label="t('ErpStock.Record.productName')" align="center" sortable prop="productName" min-width="160" />
|
|
|
|
|
<el-table-column :label="t('ErpStock.Record.materialCategory')" align="center" prop="categoryType" min-width="120" sortable>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :type="DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE" :value="scope.row.categoryType" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :label="t('ErpStock.Record.categoryName')" align="center" prop="categoryName" min-width="120" sortable />
|
|
|
|
|
<el-table-column :label="t('ErpStock.Record.warehouseName')" align="center" prop="warehouseName" min-width="140" sortable />
|
|
|
|
|
<el-table-column :label="t('ErpStock.Record.areaName')" align="center" prop="areaName" min-width="120" sortable />
|
|
|
|
|
@ -234,7 +245,7 @@ const toggleFilters = () => {
|
|
|
|
|
}
|
|
|
|
|
const productList = ref<ProductVO[]>([]) // 产品列表
|
|
|
|
|
const warehouseList = ref<WarehouseVO[]>([]) // 仓库列表
|
|
|
|
|
const categoryTabs = computed(() => getIntDictOptions(DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE))
|
|
|
|
|
const categoryTypeOptions = computed(() => getIntDictOptions(DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE))
|
|
|
|
|
|
|
|
|
|
const isStockIn = (direction?: string) => direction === '入库'
|
|
|
|
|
const isStockOut = (direction?: string) => direction === '出库'
|
|
|
|
|
@ -271,11 +282,17 @@ const formatCountWithUnit = (row: StockRecordVO, withDirectionSign = false) => {
|
|
|
|
|
return `${formatNumber(value)}${unit}`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const buildQueryParams = () => {
|
|
|
|
|
return Object.fromEntries(
|
|
|
|
|
Object.entries(queryParams).filter(([, value]) => value !== undefined && value !== null && value !== '')
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 查询列表 */
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = await StockRecordApi.getStockRecordPage(queryParams)
|
|
|
|
|
const data = await StockRecordApi.getStockRecordPage(buildQueryParams())
|
|
|
|
|
list.value = data.list
|
|
|
|
|
total.value = data.total
|
|
|
|
|
} finally {
|
|
|
|
|
@ -323,7 +340,7 @@ const handleExport = async () => {
|
|
|
|
|
exportLoading.value = true
|
|
|
|
|
const ids = selectionList.value.map((item) => item.id).filter((v) => v != null)
|
|
|
|
|
const params = {
|
|
|
|
|
...queryParams,
|
|
|
|
|
...buildQueryParams(),
|
|
|
|
|
ids: ids.length ? ids.join(',') : undefined
|
|
|
|
|
}
|
|
|
|
|
const data = await StockRecordApi.exportStockRecord(params)
|
|
|
|
|
@ -347,25 +364,11 @@ onActivated(() => {
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
await dictStore.setDictMap()
|
|
|
|
|
await loadCategoryTabs()
|
|
|
|
|
await getList()
|
|
|
|
|
// 加载产品、仓库列表
|
|
|
|
|
productList.value = await ProductApi.getProductSimpleList()
|
|
|
|
|
warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
/** tab 切换 */
|
|
|
|
|
const activeName = ref('')
|
|
|
|
|
const handleTabClick = (tab: TabsPaneContext) => {
|
|
|
|
|
queryParams.categoryType = tab.paneName ? Number(tab.paneName) : undefined
|
|
|
|
|
handleQuery()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const loadCategoryTabs = async () => {
|
|
|
|
|
const defaultValue = categoryTabs.value[0]?.value
|
|
|
|
|
queryParams.categoryType = defaultValue !== undefined && defaultValue !== null ? Number(defaultValue) : undefined
|
|
|
|
|
activeName.value = defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : ''
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|