|
@@ -24,7 +24,24 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
<el-form-item label="商品品牌" prop="brandId">
|
|
<el-form-item label="商品品牌" prop="brandId">
|
|
|
- <el-input v-model="queryParams.brandId" placeholder="请选择" clearable />
|
|
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="queryParams.brandId"
|
|
|
|
|
+ placeholder="请输入品牌名称搜索"
|
|
|
|
|
+ filterable
|
|
|
|
|
+ remote
|
|
|
|
|
+ clearable
|
|
|
|
|
+ :remote-method="handleBrandSearch"
|
|
|
|
|
+ :loading="brandLoading"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in brandOptions"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="item.brandName"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
@@ -38,25 +55,28 @@
|
|
|
</el-row>
|
|
</el-row>
|
|
|
<el-row :gutter="20">
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="商品类别" prop="categoryId">
|
|
|
|
|
|
|
+ <el-form-item label="商品分类" prop="bottomCategoryId">
|
|
|
<el-tree-select
|
|
<el-tree-select
|
|
|
- v-model="queryParams.categoryId"
|
|
|
|
|
|
|
+ v-model="queryParams.bottomCategoryId"
|
|
|
:data="categoryOptions"
|
|
:data="categoryOptions"
|
|
|
- :props="{ value: 'id', label: 'label', children: 'children' }"
|
|
|
|
|
- check-strictly
|
|
|
|
|
- :render-after-expand="false"
|
|
|
|
|
|
|
+ :props="{ value: 'id', label: 'label', children: 'children' } as any"
|
|
|
|
|
+ value-key="id"
|
|
|
|
|
+ placeholder="请选择商品分类"
|
|
|
clearable
|
|
clearable
|
|
|
- placeholder="请选择商品类别"
|
|
|
|
|
- >
|
|
|
|
|
- <template #default="{ data }">
|
|
|
|
|
- <span>{{ getCategoryFullPath(data.id) }}</span>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-tree-select>
|
|
|
|
|
|
|
+ check-strictly
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
<el-form-item label="创建供应商" prop="supplier">
|
|
<el-form-item label="创建供应商" prop="supplier">
|
|
|
- <el-input v-model="queryParams.supplier" placeholder="请选择创建供应商" clearable />
|
|
|
|
|
|
|
+ <el-select v-model="queryParams.supplier" placeholder="请选择创建供应商" clearable filterable>
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in supplierOptions"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="item.enterpriseName || item.shortName"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
@@ -156,7 +176,11 @@
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="入池时间" align="center" prop="createTime" width="120" />
|
|
<el-table-column label="入池时间" align="center" prop="createTime" width="120" />
|
|
|
- <el-table-column label="创建供应商" align="center" prop="supplier" width="100" />
|
|
|
|
|
|
|
+ <el-table-column label="创建供应商" align="center" width="100">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <span>{{ getSupplierName(scope.row.supplier) }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="操作" align="center" width="120" fixed="right">
|
|
<el-table-column label="操作" align="center" width="120" fixed="right">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<div class="flex flex-col gap-1">
|
|
<div class="flex flex-col gap-1">
|
|
@@ -337,6 +361,10 @@ import { categoryTree, listBase } from '@/api/product/base';
|
|
|
import { BaseVO, BaseQuery } from '@/api/product/base/types';
|
|
import { BaseVO, BaseQuery } from '@/api/product/base/types';
|
|
|
import { listPoolLink, batchAddProducts, BatchAddProductData, editPrice, editStock, delPoolLink, PoolLinkForm } from '@/api/product/poolLink';
|
|
import { listPoolLink, batchAddProducts, BatchAddProductData, editPrice, editStock, delPoolLink, PoolLinkForm } from '@/api/product/poolLink';
|
|
|
import { PoolLinkQuery, PoolLinkVO } from '@/api/product/poolLink/types';
|
|
import { PoolLinkQuery, PoolLinkVO } from '@/api/product/poolLink/types';
|
|
|
|
|
+import { listInfo } from '@/api/customer/supplierInfo';
|
|
|
|
|
+import { InfoVO } from '@/api/customer/supplierInfo/types';
|
|
|
|
|
+import { listBrand } from '@/api/product/brand';
|
|
|
|
|
+import { BrandVO } from '@/api/product/brand/types';
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
@@ -357,13 +385,17 @@ const queryParams = ref({
|
|
|
itemName: undefined,
|
|
itemName: undefined,
|
|
|
brandId: undefined,
|
|
brandId: undefined,
|
|
|
productStatus: undefined,
|
|
productStatus: undefined,
|
|
|
- categoryId: undefined,
|
|
|
|
|
|
|
+ bottomCategoryId: undefined,
|
|
|
supplier: undefined,
|
|
supplier: undefined,
|
|
|
dateRange: undefined,
|
|
dateRange: undefined,
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const categoryOptions = ref<any[]>([]);
|
|
const categoryOptions = ref<any[]>([]);
|
|
|
const categoryMap = ref<Map<string | number, any>>(new Map());
|
|
const categoryMap = ref<Map<string | number, any>>(new Map());
|
|
|
|
|
+const supplierOptions = ref<InfoVO[]>([]); // 供应商选项
|
|
|
|
|
+const brandOptions = ref<BrandVO[]>([]); // 品牌选项
|
|
|
|
|
+const brandLoading = ref(false); // 品牌加载状态
|
|
|
|
|
+let brandSearchTimer: ReturnType<typeof setTimeout> | null = null; // 品牌搜索防抖定时器
|
|
|
|
|
|
|
|
// 添加商品对话框
|
|
// 添加商品对话框
|
|
|
const addProductDialog = reactive({
|
|
const addProductDialog = reactive({
|
|
@@ -403,6 +435,44 @@ const getCategoryTree = async () => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+/** 获取供应商列表 */
|
|
|
|
|
+const getSupplierList = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await listInfo();
|
|
|
|
|
+ supplierOptions.value = res.data || res.rows|| [];
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('获取供应商列表失败:', error);
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** 获取供应商名称 */
|
|
|
|
|
+const getSupplierName = (supplierId: string | number | undefined): string => {
|
|
|
|
|
+ if (!supplierId) return '-';
|
|
|
|
|
+ const supplier = supplierOptions.value.find(item => item.id === supplierId);
|
|
|
|
|
+ return supplier?.enterpriseName || supplier?.shortName || '-';
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** 加载品牌选项(默认100条) */
|
|
|
|
|
+const loadBrandOptions = async (keyword?: string) => {
|
|
|
|
|
+ brandLoading.value = true;
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await listBrand({ pageNum: 1, pageSize: 100, brandName: keyword });
|
|
|
|
|
+ brandOptions.value = res.rows || [];
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('加载品牌列表失败:', error);
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ brandLoading.value = false;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** 品牌远程搜索(防抖) */
|
|
|
|
|
+const handleBrandSearch = (query: string) => {
|
|
|
|
|
+ if (brandSearchTimer) clearTimeout(brandSearchTimer);
|
|
|
|
|
+ brandSearchTimer = setTimeout(() => {
|
|
|
|
|
+ loadBrandOptions(query || undefined);
|
|
|
|
|
+ }, 300);
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
/** 构建分类映射 */
|
|
/** 构建分类映射 */
|
|
|
const buildCategoryMap = (categories: any[], parentPath = '') => {
|
|
const buildCategoryMap = (categories: any[], parentPath = '') => {
|
|
|
categories.forEach(category => {
|
|
categories.forEach(category => {
|
|
@@ -431,7 +501,7 @@ const getList = async () => {
|
|
|
productNo: queryParams.value.productNo,
|
|
productNo: queryParams.value.productNo,
|
|
|
itemName: queryParams.value.itemName,
|
|
itemName: queryParams.value.itemName,
|
|
|
brandId: queryParams.value.brandId,
|
|
brandId: queryParams.value.brandId,
|
|
|
- categoryId: queryParams.value.categoryId,
|
|
|
|
|
|
|
+ bottomCategoryId: queryParams.value.bottomCategoryId,
|
|
|
productStatus: queryParams.value.productStatus,
|
|
productStatus: queryParams.value.productStatus,
|
|
|
supplier: queryParams.value.supplier
|
|
supplier: queryParams.value.supplier
|
|
|
};
|
|
};
|
|
@@ -439,8 +509,8 @@ const getList = async () => {
|
|
|
// 处理日期范围
|
|
// 处理日期范围
|
|
|
if (queryParams.value.dateRange && queryParams.value.dateRange.length === 2) {
|
|
if (queryParams.value.dateRange && queryParams.value.dateRange.length === 2) {
|
|
|
query.params = {
|
|
query.params = {
|
|
|
- beginCreateTime: queryParams.value.dateRange[0],
|
|
|
|
|
- endCreateTime: queryParams.value.dateRange[1]
|
|
|
|
|
|
|
+ beginCreateTime: proxy?.parseTime(queryParams.value.dateRange[0], '{y}-{m}-{d} {h}:{i}:{s}') || queryParams.value.dateRange[0],
|
|
|
|
|
+ endCreateTime: proxy?.parseTime(queryParams.value.dateRange[1], '{y}-{m}-{d} {h}:{i}:{s}') || queryParams.value.dateRange[1]
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -741,7 +811,9 @@ const handleRemoveProduct = async (row: PoolLinkVO) => {
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
getCategoryTree();
|
|
getCategoryTree();
|
|
|
|
|
+ getSupplierList();
|
|
|
getList();
|
|
getList();
|
|
|
|
|
+ loadBrandOptions();
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|