Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
1c075a7a
提交
1c075a7a
authored
10月 22, 2020
作者:
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: reset back to default value after fixing form query
上级
5cff73bc
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
83 行增加
和
47 行删除
+83
-47
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+1
-0
lint-staged.config.js
lint-staged.config.js
+2
-2
BasicArrow.vue
src/components/Basic/src/BasicArrow.vue
+0
-3
BasicForm.vue
src/components/Form/src/BasicForm.vue
+26
-16
BasicTable.vue
src/components/Table/src/BasicTable.vue
+27
-25
tableData.tsx
src/views/demo/table/tableData.tsx
+27
-1
没有找到文件。
CHANGELOG.zh_CN.md
浏览文件 @
1c075a7a
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
### 🐛 Bug Fixes
### 🐛 Bug Fixes
-
修复抽屉组件自动高度及显示 footer 显示问题
-
修复抽屉组件自动高度及显示 footer 显示问题
-
修复表单查询后重置回默认值
# 2.0.0-rc.4 (2020-10-21)
# 2.0.0-rc.4 (2020-10-21)
...
...
lint-staged.config.js
浏览文件 @
1c075a7a
...
@@ -2,7 +2,7 @@ module.exports = {
...
@@ -2,7 +2,7 @@ module.exports = {
'*.{js,jsx,ts,tsx}'
:
[
'eslint --fix'
,
'prettier --write'
],
'*.{js,jsx,ts,tsx}'
:
[
'eslint --fix'
,
'prettier --write'
],
'{!(package)*.json,*.code-snippets,.!(browserslist)*rc}'
:
[
'prettier --write--parser json'
],
'{!(package)*.json,*.code-snippets,.!(browserslist)*rc}'
:
[
'prettier --write--parser json'
],
'package.json'
:
[
'prettier --write'
],
'package.json'
:
[
'prettier --write'
],
'*.vue'
:
[
'prettier --write'
,
'stylelint --fix'
,
'git add .'
],
'*.vue'
:
[
'prettier --write'
,
'stylelint --fix'
],
'*.{scss,less,styl,css,html}'
:
[
'stylelint --fix'
,
'prettier --write'
,
'git add .'
],
'*.{scss,less,styl,css,html}'
:
[
'stylelint --fix'
,
'prettier --write'
],
'*.md'
:
[
'prettier --write'
],
'*.md'
:
[
'prettier --write'
],
};
};
src/components/Basic/src/BasicArrow.vue
浏览文件 @
1c075a7a
...
@@ -51,9 +51,6 @@
...
@@ -51,9 +51,6 @@
&
__active
{
&
__active
{
transform
:
rotate
(
90deg
);
transform
:
rotate
(
90deg
);
//
>
span
{
//
transform
:
rotate
(
90deg
);
//
}
}
}
}
}
</
style
>
</
style
>
src/components/Form/src/BasicForm.vue
浏览文件 @
1c075a7a
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<FormItem
<FormItem
:schema=
"schema"
:schema=
"schema"
:formProps=
"getProps"
:formProps=
"getProps"
:allDefaultValues=
"
getAllDefaultValues
"
:allDefaultValues=
"
defaultValueRef
"
:formModel=
"formModel"
:formModel=
"formModel"
>
>
<template
#[
item
]="
data
"
v-for=
"item in Object.keys($slots)"
>
<template
#[
item
]="
data
"
v-for=
"item in Object.keys($slots)"
>
...
@@ -56,8 +56,8 @@
...
@@ -56,8 +56,8 @@
export
default
defineComponent
({
export
default
defineComponent
({
name
:
'BasicForm'
,
name
:
'BasicForm'
,
inheritAttrs
:
false
,
components
:
{
FormItem
,
Form
,
Row
,
FormAction
},
components
:
{
FormItem
,
Form
,
Row
,
FormAction
},
inheritAttrs
:
false
,
props
:
basicProps
,
props
:
basicProps
,
emits
:
[
'advanced-change'
,
'reset'
,
'submit'
,
'register'
],
emits
:
[
'advanced-change'
,
'reset'
,
'submit'
,
'register'
],
setup
(
props
,
{
emit
})
{
setup
(
props
,
{
emit
})
{
...
@@ -68,6 +68,7 @@
...
@@ -68,6 +68,7 @@
isLoad
:
false
,
isLoad
:
false
,
actionSpan
:
6
,
actionSpan
:
6
,
});
});
const
defaultValueRef
=
ref
<
any
>
({});
const
propsRef
=
ref
<
Partial
<
FormProps
>>
({});
const
propsRef
=
ref
<
Partial
<
FormProps
>>
({});
const
schemaRef
=
ref
<
FormSchema
[]
|
null
>
(
null
);
const
schemaRef
=
ref
<
FormSchema
[]
|
null
>
(
null
);
const
formElRef
=
ref
<
Nullable
<
FormType
>>
(
null
);
const
formElRef
=
ref
<
Nullable
<
FormType
>>
(
null
);
...
@@ -132,17 +133,6 @@
...
@@ -132,17 +133,6 @@
return
schemas
as
FormSchema
[];
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
=>
{
const
getEmptySpanRef
=
computed
(():
number
=>
{
if
(
!
advanceState
.
isAdvanced
)
{
if
(
!
advanceState
.
isAdvanced
)
{
return
0
;
return
0
;
...
@@ -174,6 +164,19 @@
...
@@ -174,6 +164,19 @@
},
},
{
immediate
:
true
}
{
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
()
{
function
updateAdvanced
()
{
let
itemColSum
=
0
;
let
itemColSum
=
0
;
let
realItemColSum
=
0
;
let
realItemColSum
=
0
;
...
@@ -191,7 +194,7 @@
...
@@ -191,7 +194,7 @@
model
:
formModel
,
model
:
formModel
,
field
:
schema
.
field
,
field
:
schema
.
field
,
values
:
{
values
:
{
...
getAllDefaultValues
,
...
unerf
(
defaultValueRef
)
,
...
formModel
,
...
formModel
,
},
},
});
});
...
@@ -343,6 +346,7 @@
...
@@ -343,6 +346,7 @@
}
}
schemaRef
.
value
=
schemaList
as
any
;
schemaRef
.
value
=
schemaList
as
any
;
}
}
/**
/**
* @description: 根据字段名删除
* @description: 根据字段名删除
*/
*/
...
@@ -354,6 +358,7 @@
...
@@ -354,6 +358,7 @@
}
}
}
}
}
}
/**
/**
* @description: 往某个字段后面插入,如果没有插入最后一个
* @description: 往某个字段后面插入,如果没有插入最后一个
*/
*/
...
@@ -400,7 +405,6 @@
...
@@ -400,7 +405,6 @@
}
}
});
});
});
});
schemaRef
.
value
=
unique
(
schema
,
'field'
)
as
any
;
schemaRef
.
value
=
unique
(
schema
,
'field'
)
as
any
;
}
}
...
@@ -412,6 +416,7 @@
...
@@ -412,6 +416,7 @@
toRef
(
props
,
'transformDateFunc'
),
toRef
(
props
,
'transformDateFunc'
),
toRef
(
props
,
'fieldMapToTime'
)
toRef
(
props
,
'fieldMapToTime'
)
);
);
function
getFieldsValue
():
any
{
function
getFieldsValue
():
any
{
const
formEl
=
unref
(
formElRef
);
const
formEl
=
unref
(
formElRef
);
if
(
!
formEl
)
return
;
if
(
!
formEl
)
return
;
...
@@ -426,6 +431,7 @@
...
@@ -426,6 +431,7 @@
return
item
.
field
===
key
?
dateItemType
.
includes
(
item
.
component
!
)
:
false
;
return
item
.
field
===
key
?
dateItemType
.
includes
(
item
.
component
!
)
:
false
;
});
});
}
}
/**
/**
* @description:设置表单
* @description:设置表单
*/
*/
...
@@ -438,6 +444,7 @@
...
@@ -438,6 +444,7 @@
if
(
!
formElRef
.
value
)
return
;
if
(
!
formElRef
.
value
)
return
;
return
formElRef
.
value
.
validateFields
(
nameList
);
return
formElRef
.
value
.
validateFields
(
nameList
);
}
}
function
validate
(
nameList
?:
NamePath
[]
|
undefined
)
{
function
validate
(
nameList
?:
NamePath
[]
|
undefined
)
{
if
(
!
formElRef
.
value
)
return
;
if
(
!
formElRef
.
value
)
return
;
return
formElRef
.
value
.
validate
(
nameList
);
return
formElRef
.
value
.
validate
(
nameList
);
...
@@ -460,14 +467,17 @@
...
@@ -460,14 +467,17 @@
validateFields
:
validateFields
as
ValidateFields
,
validateFields
:
validateFields
as
ValidateFields
,
validate
:
validate
as
ValidateFields
,
validate
:
validate
as
ValidateFields
,
};
};
onMounted
(()
=>
{
onMounted
(()
=>
{
initDefault
();
emit
(
'register'
,
methods
);
emit
(
'register'
,
methods
);
});
});
return
{
return
{
handleToggleAdvanced
,
handleToggleAdvanced
,
formModel
,
formModel
,
getActionPropsRef
,
getActionPropsRef
,
getAllDefaultValues
,
defaultValueRef
,
advanceState
,
advanceState
,
getProps
,
getProps
,
formElRef
,
formElRef
,
...
...
src/components/Table/src/BasicTable.vue
浏览文件 @
1c075a7a
...
@@ -216,34 +216,36 @@
...
@@ -216,34 +216,36 @@
fetch
();
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
(
watch
(
()
=>
unref
(
getDataSourceRef
),
()
=>
unref
(
getDataSourceRef
),
()
=>
{
()
=>
{
if
(
unref
(
getMergeProps
).
showSummary
)
{
handleSummary
();
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
,
});
});
}
},
},
{
immediate
:
true
}
{
immediate
:
true
}
);
);
...
...
src/views/demo/table/tableData.tsx
浏览文件 @
1c075a7a
...
@@ -227,7 +227,33 @@ export const getAdvanceSchema = (itemNumber = 6): FormSchema[] => {
...
@@ -227,7 +227,33 @@ export const getAdvanceSchema = (itemNumber = 6): FormSchema[] => {
export
function
getFormConfig
():
Partial
<
FormProps
>
{
export
function
getFormConfig
():
Partial
<
FormProps
>
{
return
{
return
{
labelWidth
:
100
,
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
()
{
export
function
getBasicData
()
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论