Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hls-easy-ui
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
easyUI
hls-easy-ui
Commits
92492547
Commit
92492547
authored
Oct 12, 2024
by
王纵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表单新增字段配置功能
parent
1e780e6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
6 deletions
+24
-6
index.vue
src/Dynamic/ConfigRenderComponent/DForm/index.vue
+24
-6
No files found.
src/Dynamic/ConfigRenderComponent/DForm/index.vue
View file @
92492547
...
...
@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 10:51:56
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-10-12 15:
25:23
* @LastEditTime: 2024-10-12 15:
30:05
* @Version: 1.0.0
* @Description: 表单渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
...
...
@@ -13,7 +13,7 @@
v-if=
"formType === 'normal'"
:title=
"tabInfo.description"
:tabButtons=
"tabInfo.tabButtons || []"
:showBtns=
"
!readOnly
"
:showBtns=
"
true
"
:buttonsFun=
"buttonsClick"
/>
...
...
@@ -133,7 +133,7 @@
</
template
>
<
script
>
import
{
Field
,
Form
,
Button
,
Cell
}
from
'vant'
;
import
{
Field
,
Form
,
Button
,
Cell
,
Toast
}
from
'vant'
;
import
DCurrency
from
'./FormItem/DCurrency'
;
import
DField
from
'./FormItem/DField'
;
import
DSwitch
from
'./FormItem/DSwitch'
;
...
...
@@ -257,7 +257,9 @@ export default {
},
async
loadData
()
{
if
(
this
.
tabInfo
.
readUrl
)
{
const
toastIns
=
Toast
.
loading
({
forbidClick
:
true
});
const
res
=
await
getFormData
(
this
.
tabInfo
.
readUrl
,
this
.
queryParams
)
toastIns
.
clear
();
this
.
fieldsObj
=
res
.
content
.
length
?
res
.
content
[
0
]
:
{};
this
.
dataLoadHandle
(
this
.
fieldsObj
,
this
.
tabInfo
.
tabCode
);
// 数据查询后的回调
this
.
setDataSetData
(
this
.
tabInfo
.
tabCode
,
{...
this
.
fieldsObj
});
// 保存一份原始数据
...
...
@@ -298,8 +300,7 @@ export default {
return
{};
},
fieldChange
(
name
,
val
)
{
this
.
dynamicInfo
().
formUpdate
(
this
.
tabInfo
.
tabCode
,
this
,
name
,
val
,
this
.
fieldsObj
)
// console.log(val)
this
.
dynamicInfo
().
formUpdate
(
this
.
tabInfo
?
this
.
tabInfo
.
tabCode
:
null
,
this
,
name
,
val
,
this
.
fieldsObj
,
this
.
formType
)
},
validate
()
{
return
new
Promise
((
resolve
,
rejcet
)
=>
{
...
...
@@ -372,13 +373,30 @@ export default {
setFieldsValue
(
fieldsValue
)
{
this
.
fieldsObj
=
{...
this
.
fieldsObj
,
...
fieldsValue
};
},
setFieldConfig
(
columnName
,
config
)
{
setFieldConfig
(
columnName
,
config
,
isBefore
=
false
,
positionField
)
{
const
index
=
this
.
fieldList
.
findIndex
(
o
=>
o
.
columnName
===
columnName
);
if
(
index
>
-
1
)
{
this
.
fieldList
[
index
]
=
{
...
this
.
fieldList
[
index
],
...
config
}
}
else
{
const
afterIndex
=
this
.
fieldList
.
findIndex
(
o
=>
o
.
columnName
===
positionField
)
if
(
afterIndex
>
-
1
)
{
this
.
fieldList
.
splice
(
isBefore
?
afterIndex
:
afterIndex
+
1
,
0
,
config
);
}
else
{
this
.
fieldList
.
push
(
config
);
}
}
this
.
fieldList
=
[].
concat
(
this
.
fieldList
);
},
deleteField
(
columnName
,
deleteValue
=
true
)
{
// 移除字段
const
index
=
this
.
fieldList
.
findIndex
(
o
=>
o
.
columnName
===
columnName
);
if
(
index
>
-
1
)
{
this
.
fieldList
.
splice
(
index
,
1
);
if
(
deleteValue
)
{
delete
this
.
fieldsObj
[
columnName
]
}
}
},
buttonsClick
(
btn
)
{
...
...
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