优化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,13 +51,18 @@ export const searchStr = (searchText: string, value: string): boolean => {
if (!value) return false;
if (!searchText) return false;
const lowerSearchText = searchText.toLowerCase();
const lowerValue = value.toLowerCase();
try {
const lowerSearchText = searchText.toLowerCase();
const lowerValue = value.toLowerCase();
// 普通大小写忽略搜索
if (lowerValue.includes(lowerSearchText)) {
return true;
// 普通大小写忽略搜索
if (lowerValue.includes(lowerSearchText)) {
return true;
}
} catch (e) {
console.log(e)
}
return false;
};
@ -121,7 +126,7 @@ export function randomPassword(generateRule: GenerateRule) {
pool = pool.filter(Boolean)
if (!pool.length) {
ElNotification.error({title: '生成失败',message: '请检查易混淆字符配置'})
ElNotification.error({title: '生成失败', message: '请检查易混淆字符配置'})
return ''
}
@ -425,13 +430,13 @@ const joinPassword = (password: Password) => {
// 比较密码
export const comparePassword = (a: Password, b: Password): boolean => {
return joinPassword(a) ===joinPassword(b)
return joinPassword(a) === joinPassword(b)
}
// 获取当前域名地址
export const getLocationUrl = () => {
let url = location.origin
if(url.startsWith('file://')){
if (url.startsWith('file://')) {
url += location.pathname
}
return url