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