优化excel导入,支持链接等特殊类型

This commit is contained in:
huangyp 2024-12-03 16:16:03 +08:00
parent 3e1093b78a
commit 5e16a105a5
2 changed files with 26 additions and 8 deletions

View File

@ -150,6 +150,19 @@ const importData = async (buffer: Buffer) => {
let favorite = columnIndex.favorite !== -1 ? row.getCell(columnIndex.favorite) : null
let customFields = columnIndex.customFields !== -1 ? row.getCell(columnIndex.customFields) : null
if (address && typeof address.value === 'object') {
address.value = address.value.text
}
if (username && typeof username.value === 'object') {
username.value = username.value.text
}
if (passwordValue && typeof passwordValue.value === 'object') {
passwordValue.value = passwordValue.value.text
}
if (remark && typeof remark.value === 'object') {
remark.value = remark.value.text
}
//
let favoriteValue = favorite && favorite.value === '是'

View File

@ -51,6 +51,7 @@ export const searchStr = (searchText: string, value: string): boolean => {
if (!value) return false;
if (!searchText) return false;
try {
const lowerSearchText = searchText.toLowerCase();
const lowerValue = value.toLowerCase();
@ -58,6 +59,10 @@ export const searchStr = (searchText: string, value: string): boolean => {
if (lowerValue.includes(lowerSearchText)) {
return true;
}
} catch (e) {
console.log(e)
}
return false;
};