diff --git a/src/views/price/ExcelSearch.vue b/src/views/price/ExcelSearch.vue
index 910f001..71764e4 100644
--- a/src/views/price/ExcelSearch.vue
+++ b/src/views/price/ExcelSearch.vue
@@ -343,6 +343,39 @@ const escapeRegExp = (string: string) => {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
};
+/**
+ * 获取关键字段(key 包含"名称"、"规格"、"价"、"金额")
+ * @param item - ExcelRowData 对象
+ * @returns 关键字段列表
+ */
+const getKeyFields = (item: ExcelRowData) => {
+ const keyNames = ['名称', '规格', '价', '金额'];
+ try {
+ const rowObj = JSON.parse(item.rowData);
+ const keyword = searchKeyword.value.toLowerCase().trim();
+
+ const highlightText = (text: string) => {
+ if (!keyword) return text;
+ const regex = new RegExp(`(${escapeRegExp(keyword)})`, 'gi');
+ return text.replace(regex, '$1');
+ };
+
+ return Object.entries(rowObj)
+ .filter(([key]) => keyNames.some(k => key.includes(k)))
+ .map(([key, value]) => {
+ let displayValue = typeof value === 'object'
+ ? JSON.stringify(value)
+ : String(value);
+ return {
+ key: highlightText(key),
+ value: highlightText(displayValue)
+ };
+ });
+ } catch {
+ return [];
+ }
+};
+
// ==================== 表格列表相关方法 ====================
/**
@@ -694,10 +727,10 @@ loadBatchList();
-
+
-
+