fix: update version to 4.2.0 and improve import handling in user actions
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "vue3-element-admin",
|
||||
"description": "Vue3 + Vite + TypeScript + Element-Plus 的后台管理模板,vue-element-admin 的 Vue3 版本",
|
||||
"version": "4.1.0",
|
||||
"version": "4.2.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -178,7 +178,7 @@ const contentConfig: IContentConfig<UserQueryParams, UserItem> = reactive({
|
||||
},
|
||||
deleteAction: UserAPI.deleteByIds,
|
||||
importAction(file: File) {
|
||||
return UserAPI.import("1", file);
|
||||
return UserAPI.import(file);
|
||||
},
|
||||
exportAction: UserAPI.export,
|
||||
importTemplate: UserAPI.downloadTemplate,
|
||||
|
||||
@@ -20,7 +20,7 @@ const contentConfig: IContentConfig<UserQueryParams, UserItem> = {
|
||||
},
|
||||
deleteAction: UserAPI.deleteByIds,
|
||||
importAction(file) {
|
||||
return UserAPI.import("1", file);
|
||||
return UserAPI.import(file);
|
||||
},
|
||||
exportAction: UserAPI.export,
|
||||
importTemplate: UserAPI.downloadTemplate,
|
||||
|
||||
@@ -48,30 +48,32 @@
|
||||
|
||||
<!-- 验证码 -->
|
||||
<el-form-item prop="captchaCode">
|
||||
<div flex>
|
||||
<div flex items-center gap-10px>
|
||||
<el-input
|
||||
v-model.trim="model.captchaCode"
|
||||
:placeholder="t('login.captchaCode')"
|
||||
clearable
|
||||
class="flex-1"
|
||||
@keyup.enter="submit"
|
||||
>
|
||||
<template #prefix>
|
||||
<div class="i-svg:captcha" />
|
||||
</template>
|
||||
</el-input>
|
||||
<div cursor-pointer h="[44px]" w="[140px]" flex-center ml-10px @click="getCaptcha">
|
||||
<el-icon v-if="codeLoading" class="is-loading"><Loading /></el-icon>
|
||||
|
||||
<div cursor-pointer h-44px w-140px flex-center @click="getCaptcha">
|
||||
<el-icon v-if="codeLoading" class="is-loading" size="20"><Loading /></el-icon>
|
||||
<img
|
||||
v-else
|
||||
v-else-if="captchaBase64"
|
||||
border-rd-4px
|
||||
w-full
|
||||
h-full
|
||||
block
|
||||
object-contain
|
||||
object-cover
|
||||
shadow="[0_0_0_1px_var(--el-border-color)_inset]"
|
||||
:src="captchaBase64"
|
||||
alt="code"
|
||||
/>
|
||||
<el-text v-else type="info" size="small">点击获取验证码</el-text>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
@@ -374,7 +374,7 @@ function handleResetQuery(): void {
|
||||
* 表格选择变化事件
|
||||
*/
|
||||
function handleSelectionChange(selection: NoticeItem[]): void {
|
||||
selectIds.value = selection.map((item) => item.id);
|
||||
selectIds.value = selection.map((item) => Number(item.id)).filter((id) => Number.isFinite(id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -481,15 +481,28 @@ function normalizeTargetUsers(value?: unknown): number[] {
|
||||
if (!value) {
|
||||
return [];
|
||||
}
|
||||
const toNumberArray = (arr: unknown[]): number[] =>
|
||||
arr.map((v) => Number(v)).filter((v) => Number.isFinite(v));
|
||||
if (Array.isArray(value)) {
|
||||
return value;
|
||||
return toNumberArray(value);
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
try {
|
||||
const parsed = JSON.parse(value);
|
||||
return Array.isArray(parsed) ? parsed : value.split(",").filter(Boolean);
|
||||
if (Array.isArray(parsed)) {
|
||||
return toNumberArray(parsed);
|
||||
}
|
||||
return value
|
||||
.split(",")
|
||||
.filter(Boolean)
|
||||
.map((v) => Number(v))
|
||||
.filter((v) => Number.isFinite(v));
|
||||
} catch {
|
||||
return value.split(",").filter(Boolean);
|
||||
return value
|
||||
.split(",")
|
||||
.filter(Boolean)
|
||||
.map((v) => Number(v))
|
||||
.filter((v) => Number.isFinite(v));
|
||||
}
|
||||
}
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user