Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Simoje丶
vue-vben-admin
提交
1c075a7a
V
vue-vben-admin
项目概览
Simoje丶
/
vue-vben-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-vben-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1c075a7a
编写于
10月 22, 2020
作者:
V
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: reset back to default value after fixing form query
上级
5cff73bc
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
83 addition
and
47 deletion
+83
-47
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+1
-0
lint-staged.config.js
lint-staged.config.js
+2
-2
src/components/Basic/src/BasicArrow.vue
src/components/Basic/src/BasicArrow.vue
+0
-3
src/components/Form/src/BasicForm.vue
src/components/Form/src/BasicForm.vue
+26
-16
src/components/Table/src/BasicTable.vue
src/components/Table/src/BasicTable.vue
+27
-25
src/views/demo/table/tableData.tsx
src/views/demo/table/tableData.tsx
+27
-1
未找到文件。
CHANGELOG.zh_CN.md
浏览文件 @
1c075a7a
...
...
@@ -3,6 +3,7 @@
### 🐛 Bug Fixes
-
修复抽屉组件自动高度及显示 footer 显示问题
-
修复表单查询后重置回默认值
# 2.0.0-rc.4 (2020-10-21)
...
...
lint-staged.config.js
浏览文件 @
1c075a7a
...
...
@@ -2,7 +2,7 @@ module.exports = {
'
*.{js,jsx,ts,tsx}
'
:
[
'
eslint --fix
'
,
'
prettier --write
'
],
'
{!(package)*.json,*.code-snippets,.!(browserslist)*rc}
'
:
[
'
prettier --write--parser json
'
],
'
package.json
'
:
[
'
prettier --write
'
],
'
*.vue
'
:
[
'
prettier --write
'
,
'
stylelint --fix
'
,
'
git add .
'
],
'
*.{scss,less,styl,css,html}
'
:
[
'
stylelint --fix
'
,
'
prettier --write
'
,
'
git add .
'
],
'
*.vue
'
:
[
'
prettier --write
'
,
'
stylelint --fix
'
],
'
*.{scss,less,styl,css,html}
'
:
[
'
stylelint --fix
'
,
'
prettier --write
'
],
'
*.md
'
:
[
'
prettier --write
'
],
};
src/components/Basic/src/BasicArrow.vue
浏览文件 @
1c075a7a
...
...
@@ -51,9 +51,6 @@
&__active {
transform: rotate(90deg);
// > span {
// transform: rotate(90deg);
// }
}
}
</
style
>
src/components/Form/src/BasicForm.vue
浏览文件 @
1c075a7a
...
...
@@ -6,7 +6,7 @@
<FormItem
:schema=
"schema"
:formProps=
"getProps"
:allDefaultValues=
"
getAllDefaultValues
"
:allDefaultValues=
"
defaultValueRef
"
:formModel=
"formModel"
>
<template
#[item]=
"data"
v-for=
"item in Object.keys($slots)"
>
...
...
@@ -56,8 +56,8 @@
export
default
defineComponent
({
name
:
'
BasicForm
'
,
inheritAttrs
:
false
,
components
:
{
FormItem
,
Form
,
Row
,
FormAction
},
inheritAttrs
:
false
,
props
:
basicProps
,
emits
:
[
'
advanced-change
'
,
'
reset
'
,
'
submit
'
,
'
register
'
],
setup
(
props
,
{
emit
})
{
...
...
@@ -68,6 +68,7 @@
isLoad
:
false
,
actionSpan
:
6
,
});
const
defaultValueRef
=
ref
<
any
>
({});
const
propsRef
=
ref
<
Partial
<
FormProps
>>
({});
const
schemaRef
=
ref
<
FormSchema
[]
|
null
>
(
null
);
const
formElRef
=
ref
<
Nullable
<
FormType
>>
(
null
);
...
...
@@ -132,17 +133,6 @@
return
schemas
as
FormSchema
[];
});
const
getAllDefaultValues
=
computed
(()
=>
{
const
schemas
=
unref
(
getSchema
);
const
obj
:
any
=
{};
schemas
.
forEach
((
item
)
=>
{
if
(
item
.
defaultValue
)
{
obj
[
item
.
field
]
=
item
.
defaultValue
;
(
formModel
as
any
)[
item
.
field
]
=
item
.
defaultValue
;
}
});
return
obj
;
});
const
getEmptySpanRef
=
computed
(():
number
=>
{
if
(
!
advanceState
.
isAdvanced
)
{
return
0
;
...
...
@@ -174,6 +164,19 @@
},
{
immediate
:
true
}
);
function
initDefault
()
{
const
schemas
=
unref
(
getSchema
);
const
obj
:
any
=
{};
schemas
.
forEach
((
item
)
=>
{
if
(
item
.
defaultValue
)
{
obj
[
item
.
field
]
=
item
.
defaultValue
;
(
formModel
as
any
)[
item
.
field
]
=
item
.
defaultValue
;
}
});
defaultValueRef
.
value
=
obj
;
}
function
updateAdvanced
()
{
let
itemColSum
=
0
;
let
realItemColSum
=
0
;
...
...
@@ -191,7 +194,7 @@
model
:
formModel
,
field
:
schema
.
field
,
values
:
{
...
getAllDefaultValues
,
...
unerf
(
defaultValueRef
)
,
...
formModel
,
},
});
...
...
@@ -343,6 +346,7 @@
}
schemaRef
.
value
=
schemaList
as
any
;
}
/**
* @description: 根据字段名删除
*/
...
...
@@ -354,6 +358,7 @@
}
}
}
/**
* @description: 往某个字段后面插入,如果没有插入最后一个
*/
...
...
@@ -400,7 +405,6 @@
}
});
});
schemaRef
.
value
=
unique
(
schema
,
'
field
'
)
as
any
;
}
...
...
@@ -412,6 +416,7 @@
toRef
(
props
,
'
transformDateFunc
'
),
toRef
(
props
,
'
fieldMapToTime
'
)
);
function
getFieldsValue
():
any
{
const
formEl
=
unref
(
formElRef
);
if
(
!
formEl
)
return
;
...
...
@@ -426,6 +431,7 @@
return
item
.
field
===
key
?
dateItemType
.
includes
(
item
.
component
!
)
:
false
;
});
}
/**
* @description:设置表单
*/
...
...
@@ -438,6 +444,7 @@
if
(
!
formElRef
.
value
)
return
;
return
formElRef
.
value
.
validateFields
(
nameList
);
}
function
validate
(
nameList
?:
NamePath
[]
|
undefined
)
{
if
(
!
formElRef
.
value
)
return
;
return
formElRef
.
value
.
validate
(
nameList
);
...
...
@@ -460,14 +467,17 @@
validateFields
:
validateFields
as
ValidateFields
,
validate
:
validate
as
ValidateFields
,
};
onMounted
(()
=>
{
initDefault
();
emit
(
'
register
'
,
methods
);
});
return
{
handleToggleAdvanced
,
formModel
,
getActionPropsRef
,
getAllDefaultValues
,
defaultValueRef
,
advanceState
,
getProps
,
formElRef
,
...
...
src/components/Table/src/BasicTable.vue
浏览文件 @
1c075a7a
...
...
@@ -216,34 +216,36 @@
fetch
();
}
function
handleSummary
()
{
if
(
unref
(
getMergeProps
).
showSummary
)
{
nextTick
(()
=>
{
const
tableEl
=
unref
(
tableElRef
);
if
(
!
tableEl
)
{
return
;
}
const
bodyDomList
=
tableEl
.
$el
.
querySelectorAll
(
'
.ant-table-body
'
)
as
HTMLDivElement
[];
const
bodyDom
=
bodyDomList
[
0
];
useEvent
({
el
:
bodyDom
,
name
:
'
scroll
'
,
listener
:
()
=>
{
const
footerBodyDom
=
tableEl
.
$el
.
querySelector
(
'
.ant-table-footer .ant-table-body
'
)
as
HTMLDivElement
;
if
(
!
footerBodyDom
||
!
bodyDom
)
return
;
footerBodyDom
.
scrollLeft
=
bodyDom
.
scrollLeft
;
},
wait
:
0
,
options
:
true
,
});
});
}
}
watch
(
()
=>
unref
(
getDataSourceRef
),
()
=>
{
if
(
unref
(
getMergeProps
).
showSummary
)
{
nextTick
(()
=>
{
const
tableEl
=
unref
(
tableElRef
);
if
(
!
tableEl
)
{
return
;
}
const
bodyDomList
=
tableEl
.
$el
.
querySelectorAll
(
'
.ant-table-body
'
)
as
HTMLDivElement
[];
const
bodyDom
=
bodyDomList
[
0
];
useEvent
({
el
:
bodyDom
,
name
:
'
scroll
'
,
listener
:
()
=>
{
const
footerBodyDom
=
tableEl
.
$el
.
querySelector
(
'
.ant-table-footer .ant-table-body
'
)
as
HTMLDivElement
;
if
(
!
footerBodyDom
||
!
bodyDom
)
return
;
footerBodyDom
.
scrollLeft
=
bodyDom
.
scrollLeft
;
},
wait
:
0
,
options
:
true
,
});
});
}
handleSummary
();
},
{
immediate
:
true
}
);
...
...
src/views/demo/table/tableData.tsx
浏览文件 @
1c075a7a
...
...
@@ -227,7 +227,33 @@ export const getAdvanceSchema = (itemNumber = 6): FormSchema[] => {
export
function
getFormConfig
():
Partial
<
FormProps
>
{
return
{
labelWidth
:
100
,
schemas
:
getAdvanceSchema
(
6
),
schemas
:
[
...
getAdvanceSchema
(
5
),
{
field
:
`field11`
,
label
:
`字段33`
,
component
:
'
Select
'
,
defaultValue
:
'
1
'
,
componentProps
:
{
options
:
[
{
label
:
'
选项1
'
,
value
:
'
1
'
,
key
:
'
1
'
,
},
{
label
:
'
选项2
'
,
value
:
'
2
'
,
key
:
'
2
'
,
},
],
},
colProps
:
{
xl
:
12
,
xxl
:
8
,
},
},
],
};
}
export
function
getBasicData
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录