Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web-project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
海康威视
web-project
Commits
a9f95047
Commit
a9f95047
authored
Aug 15, 2024
by
jiaxu.yan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 表单构建
parent
249c78b8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
1 deletion
+59
-1
FormBuilder.vue
src/components/FormBuilder.vue
+54
-0
PageData.vue
src/components/PageData.vue
+5
-1
No files found.
src/components/FormBuilder.vue
0 → 100644
View file @
a9f95047
<
template
>
<div
class=
"annual-param-container"
>
<el-form
ref=
"searchForm"
label-suffix=
":"
>
<el-row
:gutter=
"20"
justify=
"space-evenly"
>
<el-col
v-for=
"(item, index) in props.schemas"
:key=
"index"
v-bind=
"item.colProps"
>
<el-form-item
:label=
"item.label"
:prop=
"item.prop"
>
<component
:is=
"components[item.type]"
:prop=
"item.prop"
:items=
"item.componentProps"
></component>
<!--
<el-input
v-model=
"queryPrarms"
placeholder=
"请选择"
/>
-->
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</
template
>
<
script
setup
>
import
{
defineProps
,
reactive
,
watch
,
ref
}
from
"vue"
;
import
mitter
from
"@/utils/mitter"
;
import
components
from
"@/components/FormComponents/index"
;
// 将所有组件引入
const
emit
=
defineEmits
([
"DataChange"
]);
const
props
=
defineProps
({
schemas
:
{
type
:
Array
,
default
:
[],
},
formData
:
{
type
:
Object
,
default
:
()
=>
{},
},
});
// 监听chageVal
mitter
.
on
(
"changeVal"
,
(
data
)
=>
{
const
{
name
,
value
}
=
data
;
if
(
name
)
{
props
.
formData
[
name
]
=
value
;
}
});
watch
(
()
=>
props
.
formData
,
(
newVal
)
=>
{
emit
(
"DataChange"
,
newVal
);
},
{
deep
:
true
}
);
defineExpose
({
formData
:
props
.
formData
});
</
script
>
src/components/PageData.vue
View file @
a9f95047
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
<el-table
<el-table
:data=
"data"
:data=
"data"
stripe
stripe
v-loading=
"loading"
border
border
style=
"width: 100%"
style=
"width: 100%"
:header-cell-class-name=
"tableHeaderClass"
:header-cell-class-name=
"tableHeaderClass"
...
@@ -55,7 +56,7 @@
...
@@ -55,7 +56,7 @@
:align=
"column.align"
:align=
"column.align"
>
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"操作"
width=
"300"
>
<el-table-column
label=
"操作"
fixed=
"right"
width=
"300"
>
<template
#
default=
"scope"
>
<template
#
default=
"scope"
>
<template
<template
v-for=
"(action, index) in actions"
v-for=
"(action, index) in actions"
...
@@ -149,6 +150,7 @@ let data = ref([]);
...
@@ -149,6 +150,7 @@ let data = ref([]);
const
total
=
ref
(
0
);
const
total
=
ref
(
0
);
const
searchForm
=
reactive
({});
const
searchForm
=
reactive
({});
const
getData
=
()
=>
{
const
getData
=
()
=>
{
loading
.
value
=
true
let
params
=
{
let
params
=
{
...
PagePrarms
,
...
PagePrarms
,
...
props
.
formData
,
...
props
.
formData
,
...
@@ -156,8 +158,10 @@ const getData = () => {
...
@@ -156,8 +158,10 @@ const getData = () => {
http
http
.
post
(
props
.
api
,
params
)
.
post
(
props
.
api
,
params
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
loading
.
value
=
false
if
(
res
.
success
)
{
if
(
res
.
success
)
{
data
.
value
=
res
.
data
;
data
.
value
=
res
.
data
;
total
.
value
=
res
.
data
.
length
}
}
})
})
.
catch
(
function
(
error
)
{
.
catch
(
function
(
error
)
{
...
...
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