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
df2d5daa
Commit
df2d5daa
authored
Aug 09, 2024
by
王纵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
低代码表单校验
parent
51d624c0
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
738 additions
and
389 deletions
+738
-389
DCheckbox.vue
...ynamic/ConfigRenderComponent/DForm/FormItem/DCheckbox.vue
+25
-8
DDate.vue
src/Dynamic/ConfigRenderComponent/DForm/FormItem/DDate.vue
+28
-6
DField.vue
src/Dynamic/ConfigRenderComponent/DForm/FormItem/DField.vue
+9
-4
DLabel.vue
src/Dynamic/ConfigRenderComponent/DForm/FormItem/DLabel.vue
+0
-0
DLov.vue
src/Dynamic/ConfigRenderComponent/DForm/FormItem/DLov.vue
+75
-23
DSelect.vue
src/Dynamic/ConfigRenderComponent/DForm/FormItem/DSelect.vue
+247
-0
DSwitch.vue
src/Dynamic/ConfigRenderComponent/DForm/FormItem/DSwitch.vue
+24
-8
DUrl.vue
src/Dynamic/ConfigRenderComponent/DForm/FormItem/DUrl.vue
+8
-7
index.less
src/Dynamic/ConfigRenderComponent/DForm/FormItem/index.less
+20
-2
index.vue
src/Dynamic/ConfigRenderComponent/DForm/index.vue
+66
-30
index.vue
src/Dynamic/ConfigRenderComponent/DTable/index.vue
+7
-4
index.vue
src/Dynamic/ConfigRenderComponent/DTitle/index.vue
+5
-44
index.vue
src/Dynamic/ConfigRenderComponent/QueryForm/index.vue
+7
-5
query-form-fields.vue
...mic/ConfigRenderComponent/QueryForm/query-form-fields.vue
+0
-124
init.jsx
src/Dynamic/ConfigRenderComponent/init.jsx
+3
-12
utils.jsx
src/Dynamic/ConfigRenderComponent/utils.jsx
+44
-48
index.vue
src/Dynamic/LayoutButtons/index.vue
+2
-17
index.vue
src/Dynamic/index.vue
+3
-3
service.js
src/Dynamic/service.js
+49
-0
index.js
src/Dynamic/store/index.js
+22
-42
utils.js
src/Dynamic/utils/utils.js
+91
-2
global.less
src/global.less
+3
-0
No files found.
src/Dynamic/FormItem/DCheckbox.vue
→
src/Dynamic/
ConfigRenderComponent/DForm/
FormItem/DCheckbox.vue
View file @
df2d5daa
...
...
@@ -2,33 +2,50 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-0
7 10:58:40
* @LastEditTime: 2024-08-0
9 18:19:46
* @Version: 1.0.0
* @Description: 动态渲染-复选框组件
* @Copyright: Copyright (c) 2021, Hand-RongJing
-->
<
template
>
<van-cell
center
class=
"d-form-item"
:required=
"required"
:title=
"label"
>
<!--
<template
#
title
>
<span
v-if=
"required"
class=
"required"
>
*
</span>
{{
label
}}
</
template
>
-->
<!--
<van-cell
center
class=
"d-form-item"
:required=
"required"
:title=
"label"
>
<template
#
right-icon
>
<van-checkbox
v-model=
"currentValue"
@
change=
"checked"
:disabled=
"disabled"
/>
</
template
>
</van-cell>
</van-cell>
-->
<div
class=
"d-form-item"
>
<van-field
:disabled=
"disabled"
:required=
"required"
:rules=
"[{ required, message: `请填写${label}` }]"
>
<d-label
:label=
"label"
:help=
"help"
slot=
"label"
/>
<
template
#
input
>
<van-checkbox
v-model=
"currentValue"
@
change=
"checked"
:disabled=
"disabled"
/>
</
template
>
</van-field>
</div>
</template>
<
script
>
import
{
Cell
,
Checkbox
}
from
'vant'
;
import
{
Cell
,
Checkbox
,
Field
}
from
'vant'
;
import
DLabel
from
'./DLabel'
;
export
default
{
name
:
'DCheckbox'
,
components
:
{
[
Cell
.
name
]:
Cell
,
[
Checkbox
.
name
]:
Checkbox
,
[
Field
.
name
]:
Field
,
DLabel
},
props
:
{
help
:
{
type
:
String
,
default
:
''
},
label
:
{
type
:
String
,
default
:
''
...
...
src/Dynamic/FormItem/DDate.vue
→
src/Dynamic/
ConfigRenderComponent/DForm/
FormItem/DDate.vue
View file @
df2d5daa
...
...
@@ -2,21 +2,38 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-0
7 15:56:1
9
* @LastEditTime: 2024-08-0
9 18:21:2
9
* @Version: 1.0.0
* @Description: 动态渲染-日期组件
* @Copyright: Copyright (c) 2021, Hand-RongJing
-->
<
template
>
<div
class=
"d-form-item"
>
<van-cell
center
:required=
"required"
>
<d-label
:label=
"label"
:help=
"
fieldConfig.
help"
slot=
"title"
/>
<
!--
<
van-cell
center
:required=
"required"
>
<d-label
:label=
"label"
:help=
"help"
slot=
"title"
/>
<span
@
click=
"showDate(true)"
class=
"cell-value"
>
<input
placeholder=
"请选择"
:value=
"currentValue"
readonly
class=
"value-input"
/>
<van-icon
name=
"clear"
v-show=
"clearable && currentValue"
@
click=
"clear"
/>
<img
src=
"../assets/date-icon.png"
alt=
""
class=
"right-icon"
v-show=
"!(clearable && currentValue)"
/>
<img
src=
"../
../../
assets/date-icon.png"
alt=
""
class=
"right-icon"
v-show=
"!(clearable && currentValue)"
/>
</span>
</van-cell>
</van-cell>
-->
<van-field
readonly
v-model=
"currentValue"
placeholder=
"请选择"
:disabled=
"disabled"
:required=
"required"
@
click=
"showDate(true)"
:rules=
"[
{ required, message: `请选择${label}` }]"
:error="false"
>
<d-label
:label=
"label"
:help=
"help"
slot=
"label"
/>
<template
slot=
"right-icon"
>
<van-icon
name=
"clear"
v-show=
"clearable && currentValue"
@
click=
"clear"
/>
<img
src=
"../../../assets/date-icon.png"
alt=
""
class=
"right-icon"
/>
</
template
>
</van-field>
<van-popup
v-model=
"visible"
round
position=
"bottom"
class=
"d-date-popup"
>
<van-datetime-picker
...
...
@@ -31,7 +48,7 @@
</template>
<
script
>
import
{
Cell
,
DatetimePicker
,
Popup
,
Icon
}
from
'vant'
;
import
{
Cell
,
DatetimePicker
,
Popup
,
Icon
,
Field
}
from
'vant'
;
import
DLabel
from
'./DLabel'
;
export
default
{
...
...
@@ -41,6 +58,7 @@ export default {
[
DatetimePicker
.
name
]:
DatetimePicker
,
[
Popup
.
name
]:
Popup
,
[
Icon
.
name
]:
Icon
,
[
Field
.
name
]:
Field
,
DLabel
},
props
:
{
...
...
@@ -52,6 +70,10 @@ export default {
type
:
String
,
default
:
'DatePicker'
},
help
:
{
type
:
String
,
default
:
''
},
label
:
{
type
:
String
,
default
:
''
...
...
src/Dynamic/FormItem/DField.vue
→
src/Dynamic/
ConfigRenderComponent/DForm/
FormItem/DField.vue
View file @
df2d5daa
...
...
@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-0
7 14:21:09
* @LastEditTime: 2024-08-0
9 18:19:34
* @Version: 1.0.0
* @Description: 动态渲染-文本框组件
* @Copyright: Copyright (c) 2021, Hand-RongJing
...
...
@@ -11,16 +11,17 @@
<div
class=
"d-form-item"
>
<van-field
v-model=
"currentValue"
placeholder=
"请输入"
input-align=
"right"
placeholder=
"请输入"
@
input=
"fieldInput"
:type=
"fieldType[type]"
:disabled=
"disabled"
:required=
"required"
:clearable=
"clearable"
:formatter=
"formatter"
:rules=
"[
{ required: true, message: `请输入${label}` }]"
:error="false"
>
<d-label
:label=
"label"
:help=
"
fieldConfig.
help"
slot=
"label"
/>
<d-label
:label=
"label"
:help=
"help"
slot=
"label"
/>
<span
slot=
"extra"
v-if=
"type === 'CentField'"
>
%
</span>
</van-field>
</div>
...
...
@@ -48,6 +49,10 @@ export default {
type
:
String
,
default
:
'TextField'
,
},
help
:
{
type
:
String
,
default
:
''
},
label
:
{
type
:
String
,
default
:
''
...
...
src/Dynamic/FormItem/DLabel.vue
→
src/Dynamic/
ConfigRenderComponent/DForm/
FormItem/DLabel.vue
View file @
df2d5daa
File moved
src/Dynamic/FormItem/DLov.vue
→
src/Dynamic/
ConfigRenderComponent/DForm/
FormItem/DLov.vue
View file @
df2d5daa
...
...
@@ -2,15 +2,15 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-0
7 22:35:19
* @LastEditTime: 2024-08-0
9 18:18:35
* @Version: 1.0.0
* @Description: 动态渲染-Lov
* @Copyright: Copyright (c) 2021, Hand-RongJing
-->
<
template
>
<div
class=
"d-form-item d-lov"
>
<van-cell
center
:required=
"required"
:title=
"label"
>
<d-label
:label=
"label"
:help=
"
fieldConfig.
help"
slot=
"title"
/>
<
!--
<
van-cell
center
:required=
"required"
:title=
"label"
>
<d-label
:label=
"label"
:help=
"help"
slot=
"title"
/>
<template
#
right-icon
>
<span
@
click=
"changeVisible(true)"
>
...
...
@@ -22,7 +22,26 @@
</span>
<van-icon
name=
"arrow"
style=
"margin-left: 5px"
/>
</
template
>
</van-cell>
</van-cell>
-->
<van-field
v-model=
"fieldValue"
:disabled=
"disabled"
:required=
"required"
:rules=
"[{ required, message: `请选择${label}` }]"
>
<d-label
:label=
"label"
:help=
"help"
slot=
"label"
/>
<
template
#
input
>
<div
@
click=
"changeVisible(true)"
class=
"cell-value"
>
<span
v-if=
"!currentValue || currentValue.length === 0"
class=
"placeholder"
>
请选择
</span>
<span
v-else
>
{{
valueDisplay
()
}}
</span>
</div>
</
template
>
<
template
slot=
"right-icon"
>
<van-icon
name=
"clear"
v-show=
"clearable && !(!currentValue || currentValue.length === 0)"
@
click=
"clear"
/>
<van-icon
name=
"arrow"
/>
</
template
>
</van-field>
<van-popup
v-model=
"visible"
round
position=
"bottom"
class=
"d-lov-popup"
>
<div
class=
"title"
>
...
...
@@ -39,7 +58,6 @@
<scroll
ref=
"scroll"
:pullUp=
"true"
:height=
"multiple ? 'calc(100% - 165px)' : 'calc(100% - 105px)'"
@
pullingUp=
"getLovData"
>
<ul
class=
"list"
>
<li
...
...
@@ -67,17 +85,17 @@
</scroll>
<div
class=
"footer"
v-if=
"multiple"
>
<van-checkbox
shape=
"square"
v-model=
"selectAllFlag"
@
change=
"selectAllData"
>
全选
</van-checkbox>
<button
type=
"primary"
@
click=
"
test
"
>
确定
</button>
<button
type=
"primary"
@
click=
"
confirm
"
>
确定
</button>
</div>
</van-popup>
</div>
</template>
<
script
>
import
{
Cell
,
Switch
,
Icon
,
Popup
,
Search
,
Checkbox
,
Tag
}
from
'vant'
;
import
{
Cell
,
Switch
,
Icon
,
Popup
,
Search
,
Checkbox
,
Tag
,
Field
}
from
'vant'
;
import
DLabel
from
'./DLabel'
;
import
hlsHttp
from
'../utils/hlsHttp'
;
import
utils
from
'../../scripts/hlsUtil
'
;
import
hlsHttp
from
'../
../../
utils/hlsHttp'
;
import
{
getOrganizationId
}
from
'../../../utils/utils
'
;
export
default
{
name
:
'DLov'
,
...
...
@@ -90,12 +108,17 @@ export default {
[
Search
.
name
]:
Search
,
[
Checkbox
.
name
]:
Checkbox
,
[
Tag
.
name
]:
Tag
,
[
Field
.
name
]:
Field
,
},
props
:
{
fieldConfig
:
{
type
:
Object
,
default
:
()
=>
{}
},
help
:
{
type
:
String
,
default
:
''
},
label
:
{
type
:
String
,
default
:
''
...
...
@@ -113,19 +136,27 @@ export default {
default
:
false
,
},
multiple
:
{
// 是否多选
type
:
Boolean
,
default
:
true
,
},
clearable
:
{
type
:
Boolean
,
default
:
false
,
},
cascadesParams
:
{
type
:
Object
,
default
:
()
=>
({})
}
},
data
()
{
return
{
fieldValue
:
''
,
// 该变量纯粹用来判断是否有选值,给form校验用
lovConfig
:
{},
// lov配置
lovData
:
[],
searchValue
:
''
,
//搜索字段
selectAllFlag
:
false
,
page
:
0
,
size
:
10
,
currentValue
:
null
,
testValue
:
false
,
visible
:
false
,
...
...
@@ -137,7 +168,7 @@ export default {
},
methods
:
{
getLovConfig
()
{
hlsHttp
.
get
(
`/hpfm/v1/
${
utils
.
getOrganizationId
()}
/lov-view/info`
,
{
viewCode
:
this
.
fieldConfig
.
lovCode
}).
then
(
res
=>
{
hlsHttp
.
get
(
`/hpfm/v1/
${
getOrganizationId
()}
/lov-view/info`
,
{
viewCode
:
this
.
fieldConfig
.
lovCode
}).
then
(
res
=>
{
this
.
lovConfig
=
res
;
// this.getLovData();
});
...
...
@@ -148,8 +179,10 @@ export default {
lovCode
,
page
:
this
.
page
,
size
:
this
.
size
,
tenantId
:
utils
.
getOrganizationId
()
tenantId
:
getOrganizationId
(),
...
this
.
cascadesParams
}
console
.
log
(
'cascadesParams'
,
this
.
cascadesParams
)
hlsHttp
.
get
(
queryUrl
,
params
).
then
(
res
=>
{
this
.
lovData
=
this
.
lovData
.
concat
(
res
.
content
.
map
(
item
=>
({...
item
,
_selected
:
false
})));
if
(
res
.
totalElements
>
this
.
lovData
.
length
)
{
...
...
@@ -163,8 +196,13 @@ export default {
changeVisible
(
flag
)
{
if
(
!
this
.
disabled
)
{
this
.
visible
=
flag
;
if
(
flag
&&
this
.
lovData
.
length
===
0
)
{
this
.
getLovData
()
if
(
flag
)
{
if
(
this
.
cascadesParams
&&
JSON
.
stringify
(
this
.
cascadesParams
)
!==
'{}'
)
{
// 存在级联查询参数
this
.
page
=
0
;
this
.
getLovData
();
}
else
if
(
this
.
lovData
.
length
===
0
)
{
this
.
getLovData
()
}
}
}
},
...
...
@@ -175,21 +213,19 @@ export default {
if
(
!
this
.
multiple
)
{
this
.
currentValue
=
val
;
this
.
changeVisible
(
false
);
this
.
$emit
(
'input'
,
val
[
this
.
lovConfig
.
displayField
]
);
this
.
inputValue
(
this
.
currentValue
);
}
else
{
val
.
_selected
=
true
;
}
},
// 确定
test
()
{
confirm
()
{
this
.
changeVisible
(
false
);
console
.
log
(
'过来了 '
)
const
data
=
this
.
lovData
.
filter
(
o
=>
o
.
_selected
);
this
.
currentValue
=
data
;
this
.
$emit
(
'input'
,
data
);
this
.
$emit
(
'change'
,
data
)
this
.
inputValue
(
this
.
currentValue
);
},
// 删除
// 删除
- 暂时无用
del
(
val
,
index
)
{
const
newData
=
[...
this
.
currentValue
];
newData
.
splice
(
index
,
1
);
...
...
@@ -205,7 +241,23 @@ export default {
// 全选
selectAllData
(
flag
)
{
this
.
lovData
=
this
.
lovData
.
map
(
o
=>
({...
o
,
_selected
:
flag
}));
}
},
inputValue
(
val
)
{
this
.
fieldValue
=
val
?
JSON
.
stringify
(
val
)
:
''
;
this
.
$emit
(
'input'
,
val
);
this
.
$emit
(
'change'
,
val
);
},
valueDisplay
()
{
console
.
log
(
'this.currentValue'
,
this
.
currentValue
)
if
(
this
.
multiple
)
{
return
this
.
currentValue
.
map
(
o
=>
o
[
this
.
lovConfig
.
displayField
]).
join
(
'、'
);
}
else
{
return
this
.
currentValue
[
this
.
lovConfig
.
displayField
];
}
},
clear
()
{
this
.
inputValue
(
undefined
);
},
},
}
</
script
>
...
...
@@ -213,8 +265,8 @@ export default {
<
style
lang=
"less"
>
@import './index.less';
.d-lov-popup {
//
display: flex;
//
flex-direction: column;
display: flex;
flex-direction: column;
overflow: hidden;
// min-height: 200px;
// max-height: 75%;
...
...
src/Dynamic/FormItem/DSelect.vue
→
src/Dynamic/
ConfigRenderComponent/DForm/
FormItem/DSelect.vue
View file @
df2d5daa
...
...
@@ -2,73 +2,94 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-0
7 11:58:0
4
* @LastEditTime: 2024-08-0
9 18:20:4
4
* @Version: 1.0.0
* @Description: 动态渲染-Select
* @Copyright: Copyright (c) 2021, Hand-RongJing
-->
<
template
>
<div
class=
"d-form-item d-select"
>
<van-cell
<
!--
<
van-cell
center
:required=
"required"
:class=
"disabled && 'van-field--disabled'"
>
<d-label
:label=
"label"
:help=
"
fieldConfig.
help"
slot=
"title"
/>
<d-label
:label=
"label"
:help=
"help"
slot=
"title"
/>
<div
@
click=
"showSelectOption(true)"
class=
"cell-value"
>
<input
placeholder=
"请选择"
:value=
"currentValue.meaning"
readonly
class=
"value-input"
/>
<van-icon
name=
"arrow"
/>
</div>
</van-cell>
</van-cell>
-->
<van-field
v-model=
"currentValue.meaning"
:disabled=
"disabled"
:required=
"required"
:rules=
"[
{ required, message: `请选择${label}` }]"
>
<d-label
:label=
"label"
:help=
"help"
slot=
"label"
/>
<template
#
input
>
<div
@
click=
"showSelectOption(true)"
class=
"cell-value"
>
<span
v-if=
"!(currentValue.length || currentValue.meaning)"
class=
"placeholder"
>
请选择
</span>
<span
v-else
>
{{
valueDisplay
()
}}
</span>
</div>
</
template
>
<
template
slot=
"right-icon"
>
<van-icon
name=
"clear"
v-show=
"clearable && (currentValue.length || currentValue.meaning)"
@
click=
"clear"
/>
<van-icon
name=
"arrow"
/>
</
template
>
</van-field>
<van-popup
v-model=
"visible"
round
position=
"bottom"
class=
"d-select-popup"
>
<!--
<div
class=
"d-select-popup"
>
<div
class=
"title"
>
<span
class=
"cancel"
@
click=
"showSelectOption(false)"
>
取消
</span>
<span
class=
"title-label"
>
请选择
{{
fieldConfig
.
description
}}
</span>
<span
class=
"confirm"
></span>
</div>
<ul
class=
"list"
>
<li
v-for=
"option in options"
:class=
"value === option.value ? 'item active' : 'item'"
:key=
"option.value"
@
click=
"selectOption(option)"
>
{{
option
.
meaning
}}
</li>
</ul>
</div>
-->
<van-picker
show-toolbar
:title=
"`请选择$
{fieldConfig.description}`"
:columns="columns"
@cancel="visible = false"
@confirm="onConfirm"
ref="pickerRef"
/>
<div
class=
"d-select-popup"
>
<div
class=
"title"
>
<span
class=
"cancel"
@
click=
"showSelectOption(false)"
>
取消
</span>
<span
class=
"title-label"
>
请选择{{fieldConfig.description}}
</span>
<span
class=
"confirm"
@
click=
"onConfirm"
>
确定
</span>
</div>
<ul
class=
"list"
>
<li
v-for=
"(option, index) in options"
:class=
"option.selected ? 'item active' : 'item'"
:key=
"option.value"
@
click=
"selectOption(option, index)"
>
{{option.meaning}}
</li>
</ul>
</div>
</van-popup>
</div>
</template>
<
script
>
import
{
Cell
,
Switch
,
Icon
,
Popup
,
Picker
}
from
'vant'
;
import
{
Cell
,
Switch
,
Icon
,
Popup
,
Field
}
from
'vant'
;
import
DLabel
from
'./DLabel'
;
import
hlsHttp
from
'../utils/hlsHttp'
;
import
utils
from
'../../scripts/hlsUtil
'
;
import
hlsHttp
from
'../
../../
utils/hlsHttp'
;
import
{
getOrganizationId
}
from
'../../../utils/utils
'
;
export
default
{
name
:
'DSelect'
,
components
:
{
DLabel
,
[
Picker
.
name
]:
Picker
,
[
Cell
.
name
]:
Cell
,
[
Switch
.
name
]:
Switch
,
[
Icon
.
name
]:
Icon
,
[
Popup
.
name
]:
Popup
[
Popup
.
name
]:
Popup
,
[
Field
.
name
]:
Field
,
},
props
:
{
fieldConfig
:
{
type
:
Object
,
default
:
()
=>
{}
default
:
()
=>
({})
},
multiple
:
{
type
:
Boolean
,
default
:
true
},
help
:
{
type
:
String
,
default
:
''
},
label
:
{
type
:
String
,
...
...
@@ -85,17 +106,20 @@ export default {
required
:
{
type
:
Boolean
,
default
:
false
,
}
},
clearable
:
{
type
:
Boolean
,
default
:
false
,
},
},
data
()
{
return
{
currentValue
:
{
currentValue
:
this
.
multiple
?
[]
:
{
meaning
:
''
,
value
:
''
},
visible
:
false
,
options
:
[],
columns
:
[],
}
},
mounted
()
{
...
...
@@ -103,36 +127,65 @@ export default {
},
methods
:
{
getOptions
()
{
hlsHttp
.
get
(
`/hpfm/v1/
${
utils
.
getOrganizationId
()}
/lovs/data`
,
{
lovCode
:
this
.
fieldConfig
.
lookupCode
}).
then
(
res
=>
{
this
.
options
=
res
;
this
.
columns
=
this
.
options
.
map
(
o
=>
o
.
meaning
)
if
(
this
.
value
)
{
const
index
=
res
.
findIndex
(
o
=>
o
.
value
===
this
.
value
);
this
.
currentValue
=
index
>
-
1
?
res
[
index
]
:
{
meaning
:
''
,
value
:
''
hlsHttp
.
get
(
`/hpfm/v1/
${
getOrganizationId
()}
/lovs/data`
,
{
lovCode
:
this
.
fieldConfig
.
lookupCode
}).
then
(
res
=>
{
// 处理值
const
selectData
=
[];
const
valueArr
=
(
this
.
value
||
''
).
split
(
','
);
this
.
options
=
res
.
map
(
item
=>
{
if
(
valueArr
.
includes
(
item
.
value
))
{
item
.
selected
=
true
;
selectData
.
push
({...
item
});
}
this
.
$refs
.
pickerRef
.
setColumnIndex
(
index
);
return
item
;
});
if
(
this
.
multiple
)
{
// 多选
this
.
currentValue
=
selectData
;
}
else
{
this
.
currentValue
=
selectData
.
length
?
selectData
:
{
meaning
:
''
,
value
:
''
};
}
});
},
showSelectOption
(
flag
)
{
console
.
log
(
'laile'
,
flag
)
if
(
!
this
.
disabled
)
{
this
.
visible
=
flag
;
}
},
onInput
(
val
)
{
this
.
$emit
(
'input'
,
val
);
clear
()
{
this
.
options
=
this
.
options
.
map
(
o
=>
({...
o
,
selected
:
false
}));
if
(
this
.
multiple
)
{
this
.
currentValue
=
[];
}
else
{
this
.
currentValue
=
{
meaning
:
''
,
value
:
''
};
}
this
.
inputValue
(
''
);
},
onConfirm
()
{
this
.
selectOption
(
this
.
options
[
this
.
$refs
.
pickerRef
.
getColumnIndex
(
0
)]);
},
selectOption
(
val
)
{
this
.
currentValue
=
val
;
if
(
this
.
multiple
)
{
this
.
currentValue
=
this
.
options
.
filter
(
o
=>
o
.
selected
);
const
values
=
this
.
currentValue
.
map
(
o
=>
o
.
value
).
join
(
','
);
this
.
inputValue
(
values
);
}
else
{
this
.
currentValue
=
this
.
options
.
find
(
o
=>
o
.
selected
);
this
.
inputValue
(
this
.
currentValue
.
value
);
}
this
.
showSelectOption
(
false
);
this
.
$emit
(
'input'
,
val
.
value
);
this
.
$emit
(
'change'
,
val
.
value
);
},
selectOption
(
val
,
index
)
{
if
(
!
this
.
multiple
)
{
this
.
options
=
this
.
options
.
map
(
o
=>
({...
o
,
selected
:
false
}))
}
this
.
$set
(
this
.
options
[
index
],
'selected'
,
!
this
.
options
[
index
].
selected
);
},
inputValue
(
val
)
{
this
.
$emit
(
'input'
,
val
);
this
.
$emit
(
'change'
,
val
);
},
valueDisplay
()
{
if
(
this
.
multiple
)
{
return
this
.
currentValue
.
map
(
o
=>
o
.
meaning
).
join
(
'、'
);
}
else
{
return
this
.
currentValue
.
meaning
;
}
}
},
}
...
...
@@ -141,13 +194,6 @@ export default {
<
style
lang=
"less"
>
@import './index.less';
.d-select-popup {
.van-picker__title {
color: #131313;
}
.van-picker__toolbar {
border-bottom: 1px solid #F1F0F5;
}
.title{
padding: 13px;
display: flex;
...
...
@@ -169,17 +215,31 @@ export default {
font-weight: 400;
}
.list {
padding: 15px 20px;
min-height: 200px;
max-height: 60%;
overflow: auto;
.item {
padding:
6px 12
px;
padding:
15px 30
px;
text-align: center;
font-family: PingFangSC-Regular;
font-size: 14px;
color: rgba(56,63,69,0.60);
color: #131313;
// border-bottom: 1px solid #ebedf0;
&.active {
font-size: 16px;
color: #131313;
position: relative;
font: normal normal normal 14px / 1 'vant-icon';
font: normal normal normal 14px / 1 var(--van-icon-font-family, 'vant-icon');
text-rendering: auto;
color: @primary-color;
&::after {
position: absolute;
right: 0;
top: 50%;
margin-top: -8px;
content: '\e728';
font-size: 16px;
}
}
}
}
...
...
src/Dynamic/FormItem/DSwitch.vue
→
src/Dynamic/
ConfigRenderComponent/DForm/
FormItem/DSwitch.vue
View file @
df2d5daa
...
...
@@ -2,33 +2,49 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-0
7 10:58:08
* @LastEditTime: 2024-08-0
9 18:20:53
* @Version: 1.0.0
* @Description: 动态渲染-开关组件
* @Copyright: Copyright (c) 2021, Hand-RongJing
-->
<
template
>
<van-cell
center
class=
"d-form-item"
:required=
"required"
:title=
"label"
>
<!--
<template
#
title
>
<span
v-if=
"required"
class=
"required"
>
*
</span>
{{
label
}}
</
template
>
-->
<!--
<van-cell
center
class=
"d-form-item"
:required=
"required"
:title=
"label"
>
<template
#
right-icon
>
<van-switch
@
change=
"checked"
v-model=
"currentValue"
:disabled=
"disabled"
size=
"19"
/>
</
template
>
</van-cell>
</van-cell>
-->
<div
class=
"d-form-item"
>
<van-field
:disabled=
"disabled"
:required=
"required"
:rules=
"[{ required, message: `请填写${label}` }]"
>
<d-label
:label=
"label"
:help=
"help"
slot=
"label"
/>
<
template
#
input
>
<van-switch
v-model=
"currentValue"
@
change=
"checked"
:disabled=
"disabled"
size=
"19"
/>
</
template
>
</van-field>
</div>
</template>
<
script
>
import
{
Cell
,
Switch
}
from
'vant'
;
import
{
Cell
,
Switch
,
Field
}
from
'vant'
;
import
DLabel
from
'./DLabel'
;
export
default
{
name
:
'DSwitch'
,
components
:
{
[
Cell
.
name
]:
Cell
,
[
Switch
.
name
]:
Switch
,
[
Field
.
name
]:
Field
,
DLabel
},
props
:
{
help
:
{
type
:
String
,
default
:
''
},
label
:
{
type
:
String
,
default
:
''
...
...
src/Dynamic/FormItem/DUrl.vue
→
src/Dynamic/
ConfigRenderComponent/DForm/
FormItem/DUrl.vue
View file @
df2d5daa
...
...
@@ -2,19 +2,16 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-0
7 10:57:58
* @LastEditTime: 2024-08-0
9 16:22:01
* @Version: 1.0.0
* @Description: 动态渲染-超链接组件
* @Copyright: Copyright (c) 2021, Hand-RongJing
-->
<
template
>
<van-cell
center
class=
"d-form-item d-url"
:required=
"required"
:title=
"label"
>
<!--
<template
#
title
>
<span
v-if=
"required"
class=
"required"
>
*
</span>
{{
label
}}
</
template
>
-->
<van-cell
center
class=
"d-form-item d-url"
:required=
"required"
>
<d-label
:label=
"label"
:help=
"help"
slot=
"title"
/>
<div
class=
"d-url-value cell-value"
>
<img
src=
"../assets/url-icon.png"
alt=
""
class=
"right-icon"
/>
<img
src=
"../
../../
assets/url-icon.png"
alt=
""
class=
"right-icon"
/>
<a>
{{
value
}}
</a>
</div>
</van-cell>
...
...
@@ -30,6 +27,10 @@ export default {
[
Checkbox
.
name
]:
Checkbox
,
},
props
:
{
help
:
{
type
:
String
,
default
:
''
},
label
:
{
type
:
String
,
default
:
''
...
...
src/Dynamic/FormItem/index.less
→
src/Dynamic/
ConfigRenderComponent/DForm/
FormItem/index.less
View file @
df2d5daa
@import '../../../index.less';
.d-form-item {
position: relative;
.required {
color: red;
.value-input {
text-align: right;
&::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
color: #B4B4B5;
}
}
.placeholder {
text-align: right;
color: #B4B4B5;
}
.cell-value {
width: 100%;
display: inline-flex;
align-items: center;
justify-content: end;
.right-icon {
width: 16px;
}
...
...
@@ -31,6 +38,17 @@
color: #c8c9cc;
}
.van-field__right-icon {
display: flex;
align-items: center;
img {
width: 16px;
}
}
.van-field__error-message {
line-height: normal;
}
&:after {
position: absolute;
box-sizing: border-box;
...
...
src/Dynamic/ConfigRenderComponent/DForm/index.vue
View file @
df2d5daa
...
...
@@ -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-08-0
7 16:21:07
* @LastEditTime: 2024-08-0
9 18:06:06
* @Version: 1.0.0
* @Description: 表单渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
...
...
@@ -11,23 +11,14 @@
<fragment>
<DTitle
v-if=
"showTitle"
:title=
"tabInfo.description"
:tabButtons=
"tabInfo.tabButtons || []"
/>
<van-form
@
submit=
"onSubmit"
>
<fragment
v-for=
"field in fields"
:key=
"field.columnName"
>
<!--
<h-field
v-if=
"fieldComponents.indexOf(field.validationTypeDisplay) > -1"
v-model=
"fieldsObj[field.columnName]"
:type=
"getInputType(field.validationTypeDisplay)"
placeholder=
"请输入"
:label=
"field.description"
:disabled=
"field.readOnly"
:required=
"field.required"
/>
-->
<van-form
@
submit=
"onSubmit"
ref=
"formRef"
error-message-align=
"right"
input-align=
"right"
>
<fragment
v-for=
"field in fieldList"
:key=
"field.columnName"
>
<d-field
v-if=
"fieldComponents.indexOf(field.validationTypeDisplay) > -1"
v-model=
"fieldsObj[field.columnName]"
:fieldConfig=
"field"
:type=
"field.validationTypeDisplay"
placeholder=
"请输入
"
:type=
"field.validationTypeDisplay"
:help=
"field.help
"
:label=
"field.description"
:disabled=
"field.readOnly"
:required=
"field.required"
...
...
@@ -37,56 +28,64 @@
<d-switch
v-if=
"field.validationTypeDisplay === 'Switch'"
:label=
"field.description"
:help=
"field.help"
v-model=
"fieldsObj[field.columnName]"
:disabled=
"field.readOnly"
:required=
"field.required"
@
change=
"
change1
"
@
change=
"
fieldChange
"
/>
<d-checkbox
v-if=
"field.validationTypeDisplay === 'CheckBox'"
v-if=
"field.validationTypeDisplay === 'CheckBox'
|| field.validationTypeDisplay === 'Radio'
"
:label=
"field.description"
:help=
"field.help"
v-model=
"fieldsObj[field.columnName]"
:disabled=
"field.readOnly"
:required=
"field.required"
@
change=
"
change1
"
@
change=
"
fieldChange
"
/>
<d-url
v-if=
"field.validationTypeDisplay === 'UrlField'"
:label=
"field.description"
:help=
"field.help"
v-model=
"fieldsObj[field.columnName]"
:disabled=
"field.readOnly"
:required=
"field.required"
@
change=
"
change1
"
@
change=
"
fieldChange
"
/>
<d-select
v-if=
"field.validationTypeDisplay === 'Select'"
v-model=
"fieldsObj[field.columnName]"
:help=
"field.help"
:label=
"field.description"
:fieldConfig=
"field"
:disabled=
"field.readOnly"
:required=
"field.required"
:clearable=
"field.clearFlag"
@
change=
"
change1
"
@
change=
"
fieldChange
"
/>
<d-lov
v-if=
"field.validationTypeDisplay === 'Lov'"
v-model=
"fieldsObj[field.columnName]"
:record=
"fieldsObj"
:help=
"field.help"
:label=
"field.description"
:fieldConfig=
"field"
:disabled=
"field.readOnly"
:required=
"field.required"
:clearable=
"field.clearFlag"
@
change=
"change1"
:cascadesParams=
"getCascadesParams(field)"
@
change=
"fieldChange"
/>
<d-date
v-if=
"dateComponents.indexOf(field.validationTypeDisplay) > -1"
v-model=
"fieldsObj[field.columnName]"
:label=
"field.description"
:help=
"field.help"
:fieldConfig=
"field"
:disabled=
"field.readOnly"
:required=
"field.required"
...
...
@@ -99,13 +98,13 @@
<
script
>
import
{
Field
,
Form
,
Button
,
Cell
}
from
'vant'
;
import
DField
from
'.
./..
/FormItem/DField'
;
import
DSwitch
from
'.
./..
/FormItem/DSwitch'
;
import
DSelect
from
'.
./..
/FormItem/DSelect'
;
import
DLov
from
'.
./..
/FormItem/DLov'
;
import
DDate
from
'.
./..
/FormItem/DDate'
;
import
DCheckbox
from
'.
./..
/FormItem/DCheckbox'
;
import
DUrl
from
'.
./..
/FormItem/DUrl'
;
import
DField
from
'./FormItem/DField'
;
import
DSwitch
from
'./FormItem/DSwitch'
;
import
DSelect
from
'./FormItem/DSelect'
;
import
DLov
from
'./FormItem/DLov'
;
import
DDate
from
'./FormItem/DDate'
;
import
DCheckbox
from
'./FormItem/DCheckbox'
;
import
DUrl
from
'./FormItem/DUrl'
;
import
DTitle
from
'../DTitle'
;
import
DButtons
from
'../DButtons'
;
...
...
@@ -148,6 +147,10 @@ export default {
type
:
Array
,
default
:
()
=>
[]
},
originFields
:
{
type
:
Array
,
default
:
()
=>
[]
}
},
data
()
{
let
initFields
=
{}
...
...
@@ -158,18 +161,18 @@ export default {
fieldComponents
:
[
'TextField'
,
"TextArea"
,
"Currency"
,
"NumberField"
,
"EmailField"
,
"CentField"
],
dateComponents
:
[
"DatePicker"
,
"DateTimePicker"
],
componentTypes
:
[
"UrlField"
],
fieldList
:
[...
this
.
fields
],
fieldsObj
:
{...
initFields
}
}
},
mounted
()
{
console
.
log
(
this
.
fields
)
console
.
log
(
'D-form'
,
this
.
fields
)
if
(
this
.
record
&&
JSON
.
stringify
(
this
.
record
)
===
'{}'
)
{
this
.
fieldsObj
=
{...
this
.
record
};
}
},
methods
:
{
getInputType
(
type
)
{
console
.
log
(
type
)
if
(
type
===
'TextArea'
)
{
return
'textarea'
;
}
...
...
@@ -178,14 +181,47 @@ export default {
}
return
'text'
},
getCascadesParams
(
field
)
{
if
(
field
.
layoutFieldCascade
.
length
)
{
const
obj
=
{};
field
.
layoutFieldCascade
.
forEach
(
item
=>
{
if
(
item
.
enableFlag
===
'Y'
)
{
const
originField
=
this
.
originFields
.
find
(
o
=>
o
.
columnName
===
item
.
recordField
)
||
{};
if
(
originField
.
bind
)
{
const
bindField
=
originField
.
bind
.
split
(
'.'
);
if
(
bindField
.
length
>
1
)
{
obj
[
item
.
parameterField
]
=
this
.
fieldsObj
[
bindField
[
0
]]
?
this
.
fieldsObj
[
bindField
[
0
]][
bindField
[
1
]]
:
undefined
;
}
else
{
obj
[
item
.
parameterField
]
=
this
.
fieldsObj
[
bindField
[
0
]];
}
}
else
{
obj
[
item
.
parameterField
]
=
this
.
fieldsObj
[
item
.
recordField
];
}
}
})
return
obj
;
}
return
{};
},
onSubmit
()
{
console
.
log
(
'souusole'
,
this
.
fieldsObj
)
},
change1
(
val
)
{
fieldChange
(
val
)
{
console
.
log
(
val
)
},
validate
()
{
console
.
log
(
'字段娇艳'
,
this
.
fieldsObj
)
this
.
$refs
.
formRef
.
submit
();
// this.$refs.formRef.submit((res) => {
// console.log(res);
// }, err => {
// console.log(err)
// })
// this.fields.forEach(field => {
// if (!(this.fieldsObj[field.columnName])) {
// }
// })
}
},
}
...
...
src/Dynamic/ConfigRenderComponent/DTable/index.vue
View file @
df2d5daa
...
...
@@ -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-08-0
8 22:34:26
* @LastEditTime: 2024-08-0
9 15:19:07
* @Version: 1.0.0
* @Description: 表格渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
...
...
@@ -32,7 +32,7 @@
<van-popup
v-model=
"visible"
position=
"top"
class=
"d-table-form-popup"
get-container=
"body"
>
<div
class=
"form-content"
>
<d-form
:fields=
"columns"
ref=
"dformRef"
:record=
"record"
:showTitle=
"false"
/>
<d-form
:fields=
"columns"
:originFields=
"originColumns"
ref=
"dformRef"
:record=
"record"
:showTitle=
"false"
/>
</div>
<div
class=
"d-table-form-footer"
>
<van-button
...
...
@@ -79,6 +79,10 @@ export default {
columns
:
{
type
:
Array
,
default
:
()
=>
[],
},
originColumns
:
{
type
:
Array
,
default
:
()
=>
[],
}
},
data
()
{
...
...
@@ -99,7 +103,6 @@ export default {
methods
:
{
init
()
{
this
.
getList
();
console
.
log
(
'columns'
,
this
.
columns
)
},
getList
()
{
const
params
=
{
...
...
@@ -123,7 +126,7 @@ export default {
},
saveRecord
()
{
this
.
$refs
.
dformRef
.
validate
();
this
.
visible
=
false
;
//
this.visible = false;
},
cancelRecord
()
{
this
.
visible
=
false
;
...
...
src/Dynamic/ConfigRenderComponent/DTitle/index.vue
View file @
df2d5daa
...
...
@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-02 15:32:36
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-0
8 22:40:26
* @LastEditTime: 2024-08-0
9 10:16:37
* @Version: 1.0.0
* @Description: 组件头部渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
...
...
@@ -30,38 +30,11 @@
@
select=
"handlClick"
:offset=
"[12, 14]"
>
<template
#
reference
>
<span
class=
"title-button-more"
>
更多
</span>
</
template
>
</van-popover>
<!-- <fragment v-if="tabButtons.length > num"> -->
<!-- <van-popover
v-model="moreVisible"
trigger="click"
:actions="actions"
@select="handlClick"
>
<template #reference>
<span class="title-button-more" @click="more">更多</span>
</template>
</van-popover> -->
<!-- <span class="title-button-more" @click="more">更多</span>
<div class="title-button-more-content" :style="{display: moreVisible ? 'flex' : 'none'}">
<van-button
v-for="btn in hideBtns"
round
size="mini"
:key="btn.name"
:icon="buttonIcon[btn.name]"
class="title-button"
@click="handlClick(btn)"
>{{btn.description}}</van-button>
</div> -->
<!-- </fragment> -->
<template
#
reference
>
<span
class=
"title-button-more"
>
更多
</span>
</
template
>
</van-popover>
</div>
<!-- <div class="flex-item title-btns"><d-buttons :buttons="tabButtons" /></div> -->
</div>
</template>
...
...
@@ -185,18 +158,6 @@ export default {
font-size: 12px;
color: rgba(19,19,19,0.60);
}
// .title-button-more-content {
// z-index: 1;
// position: absolute;
// right: 0;
// top: 100%;
// display: flex;
// flex-direction: column;
// .title-button {
// margin-top: 8px;
// }
// }
}
}
</
style
>
src/Dynamic/ConfigRenderComponent/QueryForm/index.vue
View file @
df2d5daa
...
...
@@ -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-08-0
7 16:22:15
* @LastEditTime: 2024-08-0
9 14:39:09
* @Version: 1.0.0
* @Description: 查询表单渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
...
...
@@ -23,7 +23,7 @@
</van-search>
<van-popup
v-model=
"show"
position=
"top"
>
<DForm
:fields=
"fields"
ref=
"dformRef"
formType=
"query"
:showTitle=
"false"
/>
<DForm
:fields=
"fields"
:originFields=
"originFields"
ref=
"dformRef"
formType=
"query"
:showTitle=
"false"
/>
<div
style=
"margin: 16px;"
>
<h-button
type=
"primary"
...
...
@@ -39,13 +39,11 @@
<
script
>
import
{
Search
,
Icon
,
Popup
}
from
'vant'
;
import
QueryFormFields
from
'./query-form-fields'
;
import
DForm
from
'../DForm'
;
export
default
{
name
:
'QueryForm'
,
components
:
{
QueryFormFields
,
DForm
,
[
Search
.
name
]:
Search
,
[
Icon
.
name
]:
Icon
,
...
...
@@ -59,7 +57,11 @@ export default {
tabInfo
:
{
type
:
Object
,
default
:
()
=>
{}
}
},
originFields
:
{
type
:
Array
,
default
:
()
=>
[]
}
},
data
()
{
return
{
...
...
src/Dynamic/ConfigRenderComponent/QueryForm/query-form-fields.vue
deleted
100644 → 0
View file @
51d624c0
<!--
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 10:51:56
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-05 17:45:52
* @Version: 1.0.0
* @Description: 查询表单渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
-->
<
template
>
<van-form
@
submit=
"onSubmit"
>
<fragment
v-for=
"field in fields"
:key=
"field.columnName"
>
<h-field
v-if=
"fieldComponents.includes(field.validationTypeDisplay)"
v-model=
"fieldsObj[field.columnName]"
:type=
"getInputType(field.validationTypeDisplay)"
placeholder=
"请输入"
:label=
"field.description"
:disabled=
"field.readOnly"
:required=
"field.required"
/>
<d-switch
v-if=
"field.validationTypeDisplay === 'Switch'"
:label=
"field.description"
v-model=
"fieldsObj[field.columnName]"
:disabled=
"field.readOnly"
:required=
"field.required"
@
change=
"change1"
/>
<d-select
v-if=
"field.validationTypeDisplay === 'Select'"
v-model=
"fieldsObj[field.columnName]"
:label=
"field.description"
:fieldConfig=
"field"
:disabled=
"field.readOnly"
:required=
"field.required"
@
change=
"change1"
/>
<d-lov
v-if=
"field.validationTypeDisplay === 'Lov'"
v-model=
"fieldsObj[field.columnName]"
:label=
"field.description"
:fieldConfig=
"field"
:disabled=
"field.readOnly"
:required=
"field.required"
@
change=
"change1"
/>
</fragment>
<div
style=
"margin: 16px;"
>
<!--
<van-button
round
type=
"info"
native-type=
"submit"
v-for=
""
>
重置
</van-button>
<van-button
round
type=
"info"
native-type=
"submit"
>
提交
</van-button>
-->
<h-button
type=
"primary"
v-for=
"btn in buttons"
:key=
"btn.name"
style=
"margin-left: 10px"
>
{{
btn
.
description
}}
</h-button>
</div>
</van-form>
</
template
>
<
script
>
import
{
Field
,
Form
,
Button
,
Cell
,
Switch
}
from
'vant'
;
import
DSwitch
from
'../../FormItem/DSwitch'
;
import
DSelect
from
'../../FormItem/DSelect'
;
import
DLov
from
'../../FormItem/DLov'
;
export
default
{
name
:
'QueryFormFields'
,
components
:
{
[
Form
.
name
]:
Form
,
[
Field
.
name
]:
Field
,
[
Button
.
name
]:
Button
,
[
Cell
.
name
]:
Cell
,
DSwitch
,
DSelect
,
DLov
},
props
:
{
fields
:
{
type
:
Array
,
default
:
()
=>
[]
},
buttons
:
{
type
:
Array
,
default
:
()
=>
[]
}
},
data
()
{
let
initFields
=
{}
this
.
fields
.
forEach
(
item
=>
{
initFields
[
item
.
columnName
]
=
null
;
})
return
{
fieldComponents
:
[
'TextField'
,
"TextArea"
,
"Currency"
,
"NumberField"
,
"EmailField"
,
"CentField"
],
componentTypes
:
[
'TextField'
,
"TextArea"
,
"Currency"
,
"NumberField"
,
"EmailField"
,
"Select"
,
"DatePicker"
,
"DateTimePicker"
,
"CheckBox"
,
"Switch"
,
"Lov"
,
"UrlField"
,
"CentField"
],
fieldsObj
:
{...
initFields
}
}
},
methods
:
{
getInputType
(
type
)
{
if
(
type
===
'TextArea'
)
{
return
'textarea'
;
}
if
([
'NumberField'
,
'Currency'
,
'CentField'
].
includes
(
type
))
{
return
'number'
;
}
return
'text'
},
onSubmit
()
{
console
.
log
(
'souusole'
,
this
.
fieldsObj
)
},
change1
(
val
)
{
console
.
log
(
val
)
}
},
}
</
script
>
<
style
scoped
lang=
"less"
>
</
style
>
src/Dynamic/ConfigRenderComponent/init.jsx
View file @
df2d5daa
...
...
@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-30 09:41:54
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-0
7 15:55:35
* @LastEditTime: 2024-08-0
9 11:10:49
* @Version: 1.0.0
* @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing
...
...
@@ -102,18 +102,9 @@ const ConfigRenderComponent = {
.
withParentTabCode
(
parentTabCode
)
// .withComponentRenderers(componentRenderers)
.
build
();
// console.log('===init', columns, tabType)
// const buttons = new TabButtonBuilder()
// .withCreateElement(createElement)
// .withType(tabType)
// .withTabButtons(tabButtons)
// .withTabCode(tabCode)
// .withLayoutCode(childrenTab.layoutCode || layoutCode)
// // .withComponentButtons(componentButtons)
// // .withReadOnly(param[Constants.FIELD_READONLY])
// .build();
// return <div>{tabCode}-{description} {buttons}</div>
const
findField
=
find
(
tabFields
,
{
formatCascadeFlag
:
'Y'
});
return
new
ComponentBuilder
()
// .withDataSet(dataSet)
// .withHistoryDataSet(dataSets[`history_${dataSetName}`])
...
...
src/Dynamic/ConfigRenderComponent/utils.jsx
View file @
df2d5daa
...
...
@@ -2,14 +2,14 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-30 21:21:37
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-0
7 16:21:45
* @LastEditTime: 2024-08-0
9 14:44:50
* @Version: 1.0.0
* @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing
*/
import
Vue
from
'vue'
;
import
{
compact
,
head
,
isFunction
,
isNil
,
isNumber
,
isUndefined
,
upperFirst
}
from
'lodash'
;
import
utils
from
'../../scripts/hlsUtil
'
;
import
{
getCurrentUser
}
from
'../utils/utils
'
;
/**
* 格式化代码
...
...
@@ -101,33 +101,35 @@ export class ColumnBuilder extends BaseBuilder {
*/
initFields
(
fields
,
cascadeKey
=
''
)
{
return
fields
.
filter
(
field
=>
isNumber
(
field
.
columnSeq
)
&&
isNumber
(
field
.
rowSeq
))
.
map
(
field
=>
{
return
{
...
field
,
readOnly
:
field
.
inputModeDisplay
===
"READONLY"
,
required
:
field
.
inputModeDisplay
===
"REQUIRED"
,
clearFlag
:
field
.
clearButton
===
'Y'
}
// if (field.validationTypeDisplay === 'UrlField') {
// const {renderer} = this.getCustomizedRenderer(field.columnName, field);
// // if (renderer instanceof FormField) {
// return renderer || <div label={field.description}>{field.columnName}</div>;
// /* } else {
// return renderer || <div label={field.description} newLine={field.columnSeq === 1}>{field.columnName}</div>;
// } */
// }
// const dataClass= `${this.layoutCode}-${this.tabCode}-${field.columnName}`.toLowerCase();
// return FormField({
// ...field,
// key: field.id,
// cascadeKey,
// dataSet: this.dataSet,
// 'data-class':dataClass,
// // showTitle: true,
// });
});
const
newFields
=
fields
.
map
(
field
=>
{
return
{
...
field
,
readOnly
:
field
.
inputModeDisplay
===
"READONLY"
,
required
:
field
.
inputModeDisplay
===
"REQUIRED"
,
clearFlag
:
field
.
clearButton
===
'Y'
}
// if (field.validationTypeDisplay === 'UrlField') {
// const {renderer} = this.getCustomizedRenderer(field.columnName, field);
// // if (renderer instanceof FormField) {
// return renderer || <div label={field.description}>{field.columnName}</div>;
// /* } else {
// return renderer || <div label={field.description} newLine={field.columnSeq === 1}>{field.columnName}</div>;
// } */
// }
// const dataClass= `${this.layoutCode}-${this.tabCode}-${field.columnName}`.toLowerCase();
// return FormField({
// ...field,
// key: field.id,
// cascadeKey,
// dataSet: this.dataSet,
// 'data-class':dataClass,
// // showTitle: true,
// });
});
return
{
fields
:
newFields
.
filter
(
field
=>
isNumber
(
field
.
columnSeq
)
&&
isNumber
(
field
.
rowSeq
)),
_originFields
:
newFields
,
};
}
/**
...
...
@@ -165,25 +167,19 @@ export class ColumnBuilder extends BaseBuilder {
switch
(
this
.
type
)
{
case
'Table'
:
case
'Tree'
:
{
let
titleField
=
{};
const
newFields
=
[];
this
.
fields
.
filter
(
o
=>
o
.
isVisible
===
'Y'
).
map
(
field
=>
{
const
item
=
{
const
newFields
=
this
.
fields
.
map
(
field
=>
{
// .filter(o => o.isVisible === 'Y')
return
{
...
field
,
readOnly
:
field
.
inputModeDisplay
===
"READONLY"
,
required
:
field
.
inputModeDisplay
===
"REQUIRED"
,
clearFlag
:
field
.
clearButton
===
'Y'
}
if
(
field
.
fieldStats
===
'1'
)
{
// 标题
titleField
=
{
...
item
,
isTitle
:
true
}
}
else
{
newFields
.
push
({...
item
})
}
});
return
newFields
;
// return newFields;
return
{
fields
:
newFields
.
filter
(
o
=>
o
.
isVisible
===
'Y'
),
_originFields
:
newFields
,
}
}
case
'Form'
:
return
this
.
parseFormFields
();
...
...
@@ -467,7 +463,7 @@ class BaseComponentBuilder extends BaseBuilder {
// }
urlHandler
(
url
)
{
const
allInfo
=
{
...
utils
.
getCurrentUser
(),
...
this
.
routeParams
};
const
allInfo
=
{
...
getCurrentUser
(),
...
this
.
routeParams
};
if
(
url
===
undefined
||
url
===
null
)
{
return
url
;
}
...
...
@@ -511,7 +507,8 @@ class BaseComponentBuilder extends BaseBuilder {
key
:
refKey
,
tabInfo
:
this
.
props
,
buttons
:
this
.
buttons
,
columns
:
this
.
columns
,
columns
:
this
.
columns
.
fields
,
originColumns
:
this
.
columns
.
_originFields
}
},
[]
...
...
@@ -553,7 +550,8 @@ class BaseComponentBuilder extends BaseBuilder {
props
:
{
formType
:
'normal'
,
showTitle
:
true
,
fields
:
newFields
,
fields
:
newFields
.
fields
,
originFields
:
newFields
.
_originFields
,
tabInfo
:
this
.
props
,
}
}
...
...
@@ -564,6 +562,7 @@ class BaseComponentBuilder extends BaseBuilder {
{
props
:
{
fields
:
newFields
,
originFields
:
newFields
.
_originFields
,
buttons
:
this
.
props
.
tabButtons
,
tabInfo
:
this
.
props
,
}
...
...
@@ -630,9 +629,6 @@ export class ComponentBuilder extends BaseComponentBuilder {
wrapTab
(
tab
,
tabType
,
cols
)
{
const
{
description
,
compareField
}
=
this
.
props
;
const
{
cascadeKey
,
historyButtonName
,
currentButtonName
}
=
this
;
return
super
.
wrapTab
(
tab
,
tabType
,
cols
);
}
}
\ No newline at end of file
src/Dynamic/LayoutButtons/index.vue
View file @
df2d5daa
...
...
@@ -2,28 +2,13 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-31 15:09:30
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-0
8 22:15:10
* @LastEditTime: 2024-08-0
9 17:44:54
* @Version: 1.0.0
* @Description: 页面按钮渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
-->
<
template
>
<div
class=
"layout-buttons"
:id=
"id"
>
<!--
<div
v-if=
"layoutButtons.length > num"
class=
"layout-buttons-more"
>
<span
class=
"layout-button-more"
@
click=
"more"
><van-icon
name=
"more-o"
/>
更多
</span>
<div
class=
"layout-button-more-content"
:style=
"
{display: moreVisible ? 'flex' : 'none'}">
<van-button
v-for=
"btn in hideBtns"
round
type=
"info"
:key=
"btn.name"
:icon=
"buttonIcon[btn.name]"
class=
"layout-button"
@
click=
"handlClick(btn)"
>
{{
btn
.
description
}}
</van-button>
</div>
</div>
-->
<van-popover
v-if=
"layoutButtons.length > num"
v-model=
"moreVisible"
...
...
@@ -73,7 +58,7 @@ export default {
inject
:
[
'config'
],
data
()
{
return
{
id
:
uuidv4
(),
id
:
'layoutButton'
+
uuidv4
(),
configInfo
:
{},
// 配置信息
layoutButtons
:
[],
// 页面按钮
num
:
2
,
...
...
src/Dynamic/index.vue
View file @
df2d5daa
...
...
@@ -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-08-0
8 17:48:08
* @LastEditTime: 2024-08-0
9 17:48:37
* @Version: 1.0.0
* @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing
...
...
@@ -26,7 +26,7 @@
import
{
Loading
}
from
'vant'
;
import
LayoutButtons
from
'./LayoutButtons'
;
import
ConfigRenderComponent
from
'./ConfigRenderComponent/init.jsx'
;
import
{
query
,
queryRoute
}
from
'./s
tor
e'
import
{
query
,
queryRoute
}
from
'./s
ervic
e'
import
'./index.less'
export
default
{
...
...
@@ -66,7 +66,7 @@ export default {
};
},
created
()
{
window
.
localStorage
.
setItem
(
'access_token'
,
'
38581e99-54c3-4252-9b4b-990f89576b08
'
);
window
.
localStorage
.
setItem
(
'access_token'
,
'
75d8f55f-4043-454c-a647-ef62a9bf7e5b
'
);
this
.
queryParams
=
{
...
this
.
$route
.
params
,
...
this
.
$route
.
query
...
...
src/Dynamic/service.js
0 → 100644
View file @
df2d5daa
/*
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-09 10:54:02
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-09 14:42:17
* @Version: 1.0.0
* @Description: 页面配置请求
* @Copyright: Copyright (c) 2021, Hand-RongJing
*/
import
{
getOrganizationId
}
from
'./utils/utils'
;
import
{
get
}
from
'./utils/hlsHttp'
export
async
function
query
(
layoutCode
,
param
)
{
let
config
=
{
datas
:
{},
param
:
{},
};
try
{
const
data
=
await
get
(
`/hllc/v1/
${
getOrganizationId
()}
/doc-layouts/config/app/
${
layoutCode
}
`
,
param
);
config
.
param
=
param
;
config
.
datas
=
data
||
{};
return
config
;
}
catch
(
err
)
{
return
config
;
}
}
export
async
function
queryRoute
(
match
,
param
)
{
let
config
=
{
datas
:
{},
param
:
{},
};
try
{
const
res
=
await
get
(
`/hllc/v1/
${
getOrganizationId
()}
/rule-engine-low-code?route=
${
window
.
encodeURIComponent
(
match
)}
`
);
if
(
res
)
{
const
data
=
await
this
.
query
(
res
.
routeResultValue
,
param
);
return
data
;
}
else
{
return
config
;
}
}
catch
(
err
)
{
return
config
;
}
}
src/Dynamic/store/index.js
View file @
df2d5daa
/*
* @Description: In User Settings Edit
* @Author: huangtianyang
* @Date: 2020-01-06 13:32
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 16:35:07
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-09 10:58:29
* @Version: 1.0.0
* @Description: 状态管理
* @Copyright: Copyright (c) 2021, Hand-RongJing
*/
// import Vue from 'vue'
import
Vuex
from
'vuex'
import
utils
from
'../../scripts/hlsUtil'
;
import
{
get
}
from
'../utils/hlsHttp'
// Vue.use(Vuex)
// lowcode/lowcode_page_config/lowcode_page_tab/FYSQD_NEW/10141?typeId=1305852827234414594&documentCategory=801009
export
async
function
query
(
layoutCode
,
param
)
{
let
config
=
{
datas
:
{},
param
:
{},
};
try
{
const
data
=
await
get
(
`/hllc/v1/
${
utils
.
getOrganizationId
()}
/doc-layouts/config/app/
${
layoutCode
}
`
,
param
);
config
.
param
=
param
;
config
.
datas
=
data
||
{};
return
config
;
}
catch
(
err
)
{
return
config
;
}
}
export
async
function
queryRoute
(
match
,
param
)
{
let
config
=
{
datas
:
{},
param
:
{},
};
try
{
const
res
=
await
get
(
`/hllc/v1/
${
getOrganizationId
()}
/rule-engine-low-code?route=
${
window
.
encodeURIComponent
(
match
)}
`
);
if
(
res
)
{
const
data
=
await
this
.
query
(
res
.
routeResultValue
,
param
);
return
data
;
}
else
{
return
config
;
const
store
=
new
Vuex
.
Store
({
state
:
{
layoutConfig
:
{
}
},
mutations
:
{
saveLayoutConfig
(
code
,
config
)
{
state
.
layoutConfig
[
code
]
=
config
;
}
}
catch
(
err
)
{
return
config
;
}
}
});
export
default
store
;
\ No newline at end of file
src/Dynamic/utils/utils.js
View file @
df2d5daa
...
...
@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-30 14:39:47
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-0
7-30 14:39:49
* @LastEditTime: 2024-0
8-09 15:12:26
* @Version: 1.0.0
* @Description: 工具类
* @Copyright: Copyright (c) 2021, Hand-RongJing
...
...
@@ -29,5 +29,94 @@ const getHeaderExtrasProp = (layoutCode, tabCode, props) => {
);
};
/**
* 判断对象为空
* @param v
* @return {boolean}
*/
const
isEmpty
=
(
v
)
=>
{
if
(
typeof
v
===
'undefined'
)
{
return
true
}
if
(
v
===
undefined
||
v
===
'undefined'
||
v
===
null
||
v
===
''
||
v
===
'null'
)
{
return
true
}
switch
(
typeof
v
)
{
case
'string'
:
if
(
v
.
trim
().
length
===
0
)
{
return
true
}
break
case
'boolean'
:
if
(
!
v
)
{
return
true
}
break
case
'object'
:
return
undefined
!==
v
.
length
&&
v
.
length
===
0
}
return
false
}
const
getOrganizationId
=
()
=>
{
return
0
;
// const globalState = getDvaApp()._store.getState();
// const user = globalState.user || {};
// switch (system) {
// case 'hls': // return getCurrentOrganizationId();
// case 'hcf':
// // return 0;
// return user?.currentUser.tenantId;
// default:
// break;
// }
};
const
getCurrentUser
=
()
=>
{
return
{
"id"
:
1
,
"loginName"
:
"admin"
,
"email"
:
"admin@hzero.com"
,
"organizationId"
:
0
,
"realName"
:
"超级管理员"
,
"phone"
:
"18666666661"
,
"internationalTelCode"
:
"+86"
,
"imageUrl"
:
"http://hlsapp.hand-china.com/hls-file/public/hiam02/0/fd6ca1bdf3254e499b568f15cb8d3f51@WechatIMG775.jpg"
,
"language"
:
"zh_CN"
,
"languageName"
:
"简体中文"
,
"timeZone"
:
"GMT+8"
,
"lastPasswordUpdatedAt"
:
"2024-06-05 11:38:35"
,
"countryId"
:
1
,
"countryName"
:
"安道尔"
,
"regionId"
:
0
,
"phoneCheckFlag"
:
1
,
"emailCheckFlag"
:
1
,
"passwordResetFlag"
:
1
,
"tenantName"
:
"融租易"
,
"tenantNum"
:
"HLS"
,
"dateFormat"
:
"YYYY-MM-DD"
,
"timeFormat"
:
"HH:mm:ss"
,
"dateTimeFormat"
:
"YYYY-MM-DD HH:mm:ss"
,
"changePasswordFlag"
:
0
,
"title"
:
"融租易5.0"
,
"logo"
:
"http://leafdev.hand-china.com/hls-file/public/hpfm05/0/d21ff00430f146caa234a8e5ddde2320@融租易icon.png"
,
"menuLayout"
:
"inline"
,
"menuLayoutTheme"
:
"default"
,
"roleMergeFlag"
:
0
,
"tenantId"
:
0
,
"currentRoleId"
:
1
,
"currentRoleCode"
:
"role/organization/default/administrator"
,
"currentRoleName"
:
"租户管理员"
,
"currentRoleLevel"
:
"organization"
,
"currentRoleLabels"
:
[
"TENANT_ADMIN"
],
"favicon"
:
""
,
"dataHierarchyFlag"
:
0
,
"recentAccessTenantList"
:
[]
};
};
export
{
getCustomizedProp
,
getCustomized
,
getHeaderExtrasProp
};
export
{
getCustomizedProp
,
getCustomized
,
getHeaderExtrasProp
,
getOrganizationId
,
getCurrentUser
};
src/global.less
View file @
df2d5daa
...
...
@@ -8,6 +8,9 @@
@button-default-background-color: #f2f2f2;
@button-default-color: rgba(19,19,19,0.80);
// field
@field-error-message-color: #FF4837;
// picker组件
@text-link-color: @primary-color;
@gray-6: #666666;
...
...
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