Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
58b30aae
提交
58b30aae
authored
10月 29, 2022
作者:
无木
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: form advanced logic,fixed #2124, #2078,#2089 . follow #2125
上级
4f9cdc56
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
13 行增加
和
6 行删除
+13
-6
BasicForm.vue
src/components/Form/src/BasicForm.vue
+3
-1
FormItem.vue
src/components/Form/src/components/FormItem.vue
+5
-2
useAdvanced.ts
src/components/Form/src/hooks/useAdvanced.ts
+5
-3
没有找到文件。
src/components/Form/src/BasicForm.vue
浏览文件 @
58b30aae
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
<slot
name=
"formHeader"
></slot>
<slot
name=
"formHeader"
></slot>
<template
v-for=
"schema in getSchema"
:key=
"schema.field"
>
<template
v-for=
"schema in getSchema"
:key=
"schema.field"
>
<FormItem
<FormItem
:isAdvanced=
"fieldsIsAdvancedMap[schema.field]"
:tableAction=
"tableAction"
:tableAction=
"tableAction"
:formActionType=
"formActionType"
:formActionType=
"formActionType"
:schema=
"schema"
:schema=
"schema"
...
@@ -141,7 +142,7 @@
...
@@ -141,7 +142,7 @@
}
}
});
});
const
{
handleToggleAdvanced
}
=
useAdvanced
({
const
{
handleToggleAdvanced
,
fieldsIsAdvancedMap
}
=
useAdvanced
({
advanceState
,
advanceState
,
emit
,
emit
,
getProps
,
getProps
,
...
@@ -299,6 +300,7 @@
...
@@ -299,6 +300,7 @@
getFormActionBindProps
:
computed
(
getFormActionBindProps
:
computed
(
():
Recordable
=>
({
...
getProps
.
value
,
...
advanceState
}),
():
Recordable
=>
({
...
getProps
.
value
,
...
advanceState
}),
),
),
fieldsIsAdvancedMap
,
...
formActionType
,
...
formActionType
,
};
};
},
},
...
...
src/components/Form/src/components/FormItem.vue
浏览文件 @
58b30aae
...
@@ -44,6 +44,9 @@
...
@@ -44,6 +44,9 @@
formActionType
:
{
formActionType
:
{
type
:
Object
as
PropType
<
FormActionType
>
,
type
:
Object
as
PropType
<
FormActionType
>
,
},
},
isAdvanced
:
{
type
:
Boolean
,
},
},
},
setup
(
props
,
{
slots
})
{
setup
(
props
,
{
slots
})
{
const
{
t
}
=
useI18n
();
const
{
t
}
=
useI18n
();
...
@@ -103,8 +106,8 @@
...
@@ -103,8 +106,8 @@
const
{
show
,
ifShow
}
=
props
.
schema
;
const
{
show
,
ifShow
}
=
props
.
schema
;
const
{
showAdvancedButton
}
=
props
.
formProps
;
const
{
showAdvancedButton
}
=
props
.
formProps
;
const
itemIsAdvanced
=
showAdvancedButton
const
itemIsAdvanced
=
showAdvancedButton
?
isBoolean
(
props
.
schema
.
isAdvanced
)
?
isBoolean
(
props
.
isAdvanced
)
?
props
.
schema
.
isAdvanced
?
props
.
isAdvanced
:
true
:
true
:
true
;
:
true
;
...
...
src/components/Form/src/hooks/useAdvanced.ts
浏览文件 @
58b30aae
import
type
{
ColEx
}
from
'../types'
;
import
type
{
ColEx
}
from
'../types'
;
import
type
{
AdvanceState
}
from
'../types/hooks'
;
import
type
{
AdvanceState
}
from
'../types/hooks'
;
import
{
ComputedRef
,
getCurrentInstance
,
Ref
}
from
'vue'
;
import
{
ComputedRef
,
getCurrentInstance
,
Ref
,
shallowReactive
}
from
'vue'
;
import
type
{
FormProps
,
FormSchema
}
from
'../types/form'
;
import
type
{
FormProps
,
FormSchema
}
from
'../types/form'
;
import
{
computed
,
unref
,
watch
}
from
'vue'
;
import
{
computed
,
unref
,
watch
}
from
'vue'
;
import
{
isBoolean
,
isFunction
,
isNumber
,
isObject
}
from
'/@/utils/is'
;
import
{
isBoolean
,
isFunction
,
isNumber
,
isObject
}
from
'/@/utils/is'
;
...
@@ -113,6 +113,8 @@ export default function ({
...
@@ -113,6 +113,8 @@ export default function ({
}
}
}
}
const
fieldsIsAdvancedMap
=
shallowReactive
({});
function
updateAdvanced
()
{
function
updateAdvanced
()
{
let
itemColSum
=
0
;
let
itemColSum
=
0
;
let
realItemColSum
=
0
;
let
realItemColSum
=
0
;
...
@@ -148,7 +150,7 @@ export default function ({
...
@@ -148,7 +150,7 @@ export default function ({
if
(
isAdvanced
)
{
if
(
isAdvanced
)
{
realItemColSum
=
itemColSum
;
realItemColSum
=
itemColSum
;
}
}
schema
.
isAdvanced
=
isAdvanced
;
fieldsIsAdvancedMap
[
schema
.
field
]
=
isAdvanced
;
}
}
}
}
...
@@ -166,5 +168,5 @@ export default function ({
...
@@ -166,5 +168,5 @@ export default function ({
advanceState
.
isAdvanced
=
!
advanceState
.
isAdvanced
;
advanceState
.
isAdvanced
=
!
advanceState
.
isAdvanced
;
}
}
return
{
handleToggleAdvanced
};
return
{
handleToggleAdvanced
,
fieldsIsAdvancedMap
};
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论