|
@@ -10,10 +10,11 @@ const fullscreenLoading = ref(false)
|
|
|
// 数据
|
|
// 数据
|
|
|
const photoList = ref<any[]>([]);
|
|
const photoList = ref<any[]>([]);
|
|
|
const selectedProducts = ref<number[]>([]); // 存储选中的货号索引
|
|
const selectedProducts = ref<number[]>([]); // 存储选中的货号索引
|
|
|
-
|
|
|
|
|
|
|
+// 绑定参数的变量
|
|
|
|
|
+const goodsArtNo = ref<string>('');
|
|
|
// 分页状态
|
|
// 分页状态
|
|
|
const currentPage = ref(1);
|
|
const currentPage = ref(1);
|
|
|
-const pageSize = ref(10); // 每页显示10条记录
|
|
|
|
|
|
|
+const pageSize = ref(20); // 每页显示10条记录
|
|
|
const totalCount = ref(0);
|
|
const totalCount = ref(0);
|
|
|
const totalPages = ref(1);
|
|
const totalPages = ref(1);
|
|
|
const hasPrev = ref(false);
|
|
const hasPrev = ref(false);
|
|
@@ -25,7 +26,7 @@ const selectedCount = computed(() => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// 获取拍照列表数据
|
|
// 获取拍照列表数据
|
|
|
-const fetchPhotoList = async (page: number = 1, append = false) => {
|
|
|
|
|
|
|
+const fetchPhotoList = async (page: number = 1, append = false, goodsArtNo?: string) => {
|
|
|
if (page === 1) {
|
|
if (page === 1) {
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
|
} else {
|
|
} else {
|
|
@@ -36,7 +37,9 @@ const fetchPhotoList = async (page: number = 1, append = false) => {
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
// 调用API时传递分页参数
|
|
// 调用API时传递分页参数
|
|
|
- const data = await GetPhotoListApp(page.toString());
|
|
|
|
|
|
|
+ const searchKeyword = goodsArtNo ?? '';
|
|
|
|
|
+ console.log("搜索货号:", searchKeyword);
|
|
|
|
|
+ const data = await GetPhotoListApp(page.toString(),searchKeyword);
|
|
|
console.log("获取的拍照列表数据:", data);
|
|
console.log("获取的拍照列表数据:", data);
|
|
|
|
|
|
|
|
if (data) {
|
|
if (data) {
|
|
@@ -153,6 +156,23 @@ const handleBatchCutout = async() => {
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
fetchPhotoList(1, false);
|
|
fetchPhotoList(1, false);
|
|
|
});
|
|
});
|
|
|
|
|
+// 搜索处理函数
|
|
|
|
|
+const handleSearch = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // if (!goodsArtNo.value) {
|
|
|
|
|
+ // await ElMessageBox.confirm('货号不能为空',{
|
|
|
|
|
+ // closeOnClickModal: false, // 点击遮罩层不关闭
|
|
|
|
|
+ // closeOnPressEscape: false, // 按ESC键不关闭
|
|
|
|
|
+ // showCancelButton: false, // 隐藏取消按钮
|
|
|
|
|
+ // })
|
|
|
|
|
+ // return;
|
|
|
|
|
+ // }
|
|
|
|
|
+ await fetchPhotoList(1, false, goodsArtNo.value);
|
|
|
|
|
+
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error("搜索失败:", error);
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -177,6 +197,17 @@ onMounted(() => {
|
|
|
|
|
|
|
|
<!-- 正常内容 -->
|
|
<!-- 正常内容 -->
|
|
|
<div v-else>
|
|
<div v-else>
|
|
|
|
|
+ <!-- 新增:搜索框区域 -->
|
|
|
|
|
+ <div class="search-container">
|
|
|
|
|
+ <input
|
|
|
|
|
+ v-model="goodsArtNo"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ class="search-input"
|
|
|
|
|
+ placeholder="请输入货号进行搜索"
|
|
|
|
|
+ @keyup.enter="handleSearch"
|
|
|
|
|
+ />
|
|
|
|
|
+ <button class="search-btn" @click="handleSearch">搜索</button>
|
|
|
|
|
+ </div>
|
|
|
<!-- 货号卡片列表 -->
|
|
<!-- 货号卡片列表 -->
|
|
|
<div class="product-cards-container">
|
|
<div class="product-cards-container">
|
|
|
<div
|
|
<div
|
|
@@ -418,4 +449,33 @@ onMounted(() => {
|
|
|
padding: 40px 20px;
|
|
padding: 40px 20px;
|
|
|
text-align: center;
|
|
text-align: center;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+.search-container {
|
|
|
|
|
+ margin: 20px auto;
|
|
|
|
|
+ max-width: 800px; /* 根据页面宽度调整 */
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ gap: 10px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.search-input {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ padding: 10px 15px;
|
|
|
|
|
+ border: 1px solid #ddd;
|
|
|
|
|
+ border-radius: 8px;
|
|
|
|
|
+ font-size: 16px;
|
|
|
|
|
+ outline: none;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.search-input:focus {
|
|
|
|
|
+ border-color: #409eff; /* 你的主题色 */
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.search-btn {
|
|
|
|
|
+ padding: 10px 20px;
|
|
|
|
|
+ background-color: #409eff;
|
|
|
|
|
+ color: white;
|
|
|
|
|
+ border: none;
|
|
|
|
|
+ border-radius: 8px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|