Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
210c4d40
authored
Jun 22, 2024
by
芋道源码
Committed by
Gitee
Jun 22, 2024
Browse files
Options
Browse Files
Download
Plain Diff
!453 fix: Add StringDictDataType type by imitating getIntDictOptions
Merge pull request !453 from AhJindeg/hotfix/dict
parents
33366efe
a9082d8b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
+8
-1
src/utils/dict.ts
+8
-1
No files found.
src/utils/dict.ts
View file @
210c4d40
...
@@ -24,6 +24,10 @@ export interface NumberDictDataType extends DictDataType {
...
@@ -24,6 +24,10 @@ export interface NumberDictDataType extends DictDataType {
value
:
number
value
:
number
}
}
export
interface
StringDictDataType
extends
DictDataType
{
value
:
string
}
export
const
getDictOptions
=
(
dictType
:
string
)
=>
{
export
const
getDictOptions
=
(
dictType
:
string
)
=>
{
return
dictStore
.
getDictByType
(
dictType
)
||
[]
return
dictStore
.
getDictByType
(
dictType
)
||
[]
}
}
...
@@ -44,8 +48,11 @@ export const getIntDictOptions = (dictType: string): NumberDictDataType[] => {
...
@@ -44,8 +48,11 @@ export const getIntDictOptions = (dictType: string): NumberDictDataType[] => {
}
}
export
const
getStrDictOptions
=
(
dictType
:
string
)
=>
{
export
const
getStrDictOptions
=
(
dictType
:
string
)
=>
{
const
dictOption
:
DictDataType
[]
=
[]
// 获得通用的 DictDataType 列表
const
dictOptions
:
DictDataType
[]
=
getDictOptions
(
dictType
)
const
dictOptions
:
DictDataType
[]
=
getDictOptions
(
dictType
)
// 转换成 string 类型的 StringDictDataType 类型
// why 需要特殊转换:避免 IDEA 在 v-for="dict in getStrDictOptions(...)" 时,el-option 的 key 会告警
const
dictOption
:
StringDictDataType
[]
=
[]
dictOptions
.
forEach
((
dict
:
DictDataType
)
=>
{
dictOptions
.
forEach
((
dict
:
DictDataType
)
=>
{
dictOption
.
push
({
dictOption
.
push
({
...
dict
,
...
dict
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment