Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-operate-sys-cscec
Project
Project
Details
Activity
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
fulixin
dsk-operate-sys-cscec
Commits
0fccfe33
Commit
0fccfe33
authored
Dec 29, 2023
by
tianhongyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自定义表单 右侧字段设置同步
parent
fa399750
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
125 additions
and
37 deletions
+125
-37
custom-design-options.js
dsk-operate-ui/src/utils/generator/custom-design-options.js
+18
-7
CustomFormDesign.vue
...ent/components/CustomForm/components/CustomFormDesign.vue
+50
-25
SetFieldOption.vue
...ement/components/CustomForm/components/SetFieldOption.vue
+43
-0
SubfieldItem.vue
...agement/components/CustomForm/components/SubfieldItem.vue
+14
-5
No files found.
dsk-operate-ui/src/utils/generator/custom-design-options.js
View file @
0fccfe33
...
@@ -18,16 +18,27 @@ export const subfieldModuleTemplate = {
...
@@ -18,16 +18,27 @@ export const subfieldModuleTemplate = {
export
const
defaultComOptions
=
[
export
const
defaultComOptions
=
[
{
{
comLabel
:
"单行文本"
,
// 组件类型
// 组件类型
comType
:
"el-input"
,
comType
:
"el-input"
,
// 组件展示图标
// 组件展示图标
comShowIcon
:
require
(
"@/assets/images/consultingAgencyManagement/customForm/icon_single_line_text@2x.png"
),
comShowIcon
:
require
(
"@/assets/images/consultingAgencyManagement/customForm/icon_single_line_text@2x.png"
),
// 验证规则
// 表单属性
rules
:
{},
formAttribute
:
{
// 绑定的值
// 验证规则
value
:
""
,
rules
:
{},
// 输入值为空提示
// 是否必填
placeholder
:
"请输入"
required
:
false
,
// 字段名称
fieldName
:
""
,
// 展示label
label
:
"单行文本"
,
},
// 组件属性
componentAttribute
:
{
// 绑定的值
value
:
""
,
// 输入值为空提示
placeholder
:
"请输入"
}
}
}
];
];
\ No newline at end of file
dsk-operate-ui/src/views/consultingOrgManagement/components/CustomForm/components/CustomFormDesign.vue
View file @
0fccfe33
...
@@ -7,12 +7,12 @@
...
@@ -7,12 +7,12 @@
<div
class=
"design-main fields-main"
>
<div
class=
"design-main fields-main"
>
<vuedraggable
:list=
"defaultComOptions"
:group=
"
{name: 'customComGroup', pull: 'clone', put: false}" class="design-draggable-fields"
<vuedraggable
:list=
"defaultComOptions"
:group=
"
{name: 'customComGroup', pull: 'clone', put: false}" class="design-draggable-fields"
draggable=".draggable-fields-item" ghostClass="subfield-origin-dragClass" :clone="targetComClone" :sort="false"
draggable=".draggable-fields-item" ghostClass="subfield-origin-dragClass" :clone="targetComClone" :sort="false"
:disabled="!subfieldModuleList.length"
@end="endCheck"
>
:disabled="!subfieldModuleList.length">
<transition-group
name=
"fade"
tag=
"div"
class=
"draggable-fields-list"
>
<transition-group
name=
"fade"
tag=
"div"
class=
"draggable-fields-list"
>
<div
class=
"draggable-fields-item"
:class=
"
{'has-no-subfield-module' : !subfieldModuleList.length}"
<div
class=
"draggable-fields-item"
:class=
"
{'has-no-subfield-module' : !subfieldModuleList.length}"
v-for="(item,index) of defaultComOptions" :key="index" @click="fieldsItemClick">
v-for="(item,index) of defaultComOptions" :key="index" @click="fieldsItemClick">
<img
:src=
"item.comShowIcon"
alt=
""
>
<img
:src=
"item.comShowIcon"
alt=
""
>
<span>
{{
item
.
comL
abel
}}
</span>
<span>
{{
item
.
formAttribute
.
l
abel
}}
</span>
</div>
</div>
</transition-group>
</transition-group>
</vuedraggable>
</vuedraggable>
...
@@ -32,9 +32,9 @@
...
@@ -32,9 +32,9 @@
<!--
<div
class=
"subfield-module-draggable-list"
v-for=
"(item,index) of subfieldModuleList"
:key=
"item.uid"
>
-->
<!--
<div
class=
"subfield-module-draggable-list"
v-for=
"(item,index) of subfieldModuleList"
:key=
"item.uid"
>
-->
<vuedraggable
v-for=
"(item,index) of subfieldModuleList"
:key=
"item.uid"
draggable=
".subfield-item-container"
<vuedraggable
v-for=
"(item,index) of subfieldModuleList"
:key=
"item.uid"
draggable=
".subfield-item-container"
handle=
".subfield-module-item-dragg-target-icon"
tag=
"subfield-module"
:list=
"item.children"
group=
"customComGroup"
handle=
".subfield-module-item-dragg-target-icon"
tag=
"subfield-module"
:list=
"item.children"
group=
"customComGroup"
:component-data=
"createComponentData(item)"
:animation=
"340"
ghostClass=
"subfield-item-dragClass"
:sort=
"true"
@
end=
"endCheck
"
>
:component-data=
"createComponentData(item)"
:animation=
"340"
ghostClass=
"subfield-item-dragClass"
:sort=
"true"
@
change=
"dataChange
"
>
<subfield-item
v-for=
"(child,index) of item.children"
:key=
"child.uid"
:
parentUid=
"item.uid"
:childModuleInfo=
"chil
d"
<subfield-item
v-for=
"(child,index) of item.children"
:key=
"child.uid"
:
activeUid=
"activeUid"
:parentUid=
"item.ui
d"
@
removeModuleItem=
"removeModule
Item"
></subfield-item>
:childModuleInfo=
"child"
@
removeModuleItem=
"removeModuleItem"
@
activeSubfieldItem=
"activeSubfield
Item"
></subfield-item>
</vuedraggable>
</vuedraggable>
<!--
</div>
-->
<!--
</div>
-->
</transition-group>
</transition-group>
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
<div
class=
"custom-form-design-field-options"
>
<div
class=
"custom-form-design-field-options"
>
<div
class=
"design-header field-options-header"
>
字段设置
</div>
<div
class=
"design-header field-options-header"
>
字段设置
</div>
<div
class=
"design-main field-options-main"
>
<div
class=
"design-main field-options-main"
>
<set-field-option
:activeFieldData=
"activeItemData"
></set-field-option>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -74,13 +74,15 @@
...
@@ -74,13 +74,15 @@
<
script
>
<
script
>
import
{
defaultComOptions
,
subfieldModuleTemplate
}
from
"@/utils/generator/custom-design-options"
;
import
{
defaultComOptions
,
subfieldModuleTemplate
}
from
"@/utils/generator/custom-design-options"
;
import
SubfieldItem
from
"@/views/consultingOrgManagement/components/CustomForm/components/SubfieldItem"
;
import
SubfieldItem
from
"@/views/consultingOrgManagement/components/CustomForm/components/SubfieldItem"
;
import
SetFieldOption
from
"@/views/consultingOrgManagement/components/CustomForm/components/SetFieldOption"
;
import
vuedraggable
from
"vuedraggable"
;
import
vuedraggable
from
"vuedraggable"
;
import
{
v4
}
from
'uuid'
;
import
{
v4
}
from
'uuid'
;
export
default
{
export
default
{
name
:
"customFormDesign"
,
name
:
"customFormDesign"
,
components
:
{
components
:
{
vuedraggable
,
vuedraggable
,
SubfieldItem
SubfieldItem
,
SetFieldOption
}
,
}
,
data
()
{
data
()
{
return
{
return
{
...
@@ -93,7 +95,11 @@ export default {
...
@@ -93,7 +95,11 @@ export default {
// 要删除的分栏信息
// 要删除的分栏信息
removeSubfieldModule
:
{
}
,
removeSubfieldModule
:
{
}
,
// 当前选中正在编辑的组件id
// 当前选中正在编辑的组件id
activeUid
:
""
activeUid
:
""
,
// 编辑的组件数据
activeItemData
:
{
}
,
// active moduleId 当前命中的模块id
activeModuleId
:
""
}
;
}
;
}
,
}
,
//可访问data属性
//可访问data属性
...
@@ -119,12 +125,20 @@ export default {
...
@@ -119,12 +125,20 @@ export default {
this
.
$message
.
warning
(
"请先添加分栏"
);
this
.
$message
.
warning
(
"请先添加分栏"
);
}
}
}
,
}
,
endCheck
(
e
)
{
dataChange
({
added
,
removed
,
moved
}
)
{
console
.
log
(
"成功"
,
e
);
if
(
added
)
{
this
.
currentActiveByItemId
(
added
.
element
);
}
if
(
moved
)
{
this
.
currentActiveByItemId
(
moved
.
element
);
}
}
,
}
,
subFieldItemActive
(
childItem
)
{
// 命中变化的表单元素
console
.
log
(
childItem
);
currentActiveByItemId
(
current
)
{
this
.
activeUid
=
childItem
.
uid
;
this
.
activeUid
=
current
.
uid
;
this
.
activeItemData
=
current
;
this
.
activeModuleId
=
this
.
subfieldModuleList
.
find
(
item
=>
item
?.
children
?.
findIndex
(
child
=>
child
.
uid
==
current
.
uid
)
>
-
1
).
uid
;
console
.
log
(
this
.
activeModuleId
);
}
,
}
,
// 添加分栏
// 添加分栏
addSubfieldModule
()
{
addSubfieldModule
()
{
...
@@ -145,38 +159,49 @@ export default {
...
@@ -145,38 +159,49 @@ export default {
}
,
}
,
editOK
(
module
)
{
editOK
(
module
)
{
}
,
activeSubfieldItem
(
itemModule
,
parentUid
)
{
this
.
activeUid
=
itemModule
.
uid
;
this
.
activeModuleId
=
parentUid
;
this
.
activeItemData
=
itemModule
;
}
,
}
,
removeModuleItem
(
itemModule
,
parentUid
)
{
removeModuleItem
(
itemModule
,
parentUid
)
{
if
(
itemModule
.
uid
==
this
.
activeUid
)
this
.
activeUid
=
""
;
const
parentModule
=
this
.
subfieldModuleList
.
find
(
item
=>
item
.
uid
==
parentUid
);
const
parentModule
=
this
.
subfieldModuleList
.
find
(
item
=>
item
.
uid
==
parentUid
);
if
(
parentModule
)
{
if
(
parentModule
)
{
// 更新源数据标题
const
index
=
parentModule
?.
children
?.
findIndex
(
item
=>
item
.
uid
==
itemModule
.
uid
);
const
index
=
parentModule
?.
children
?.
findIndex
(
item
=>
item
.
uid
==
itemModule
.
uid
);
if
(
index
>
-
1
)
{
if
(
index
>
-
1
)
{
if
(
itemModule
.
uid
==
this
.
activeUid
)
this
.
activeUid
=
""
;
parentModule
?.
children
?.
splice
(
index
,
1
);
parentModule
?.
children
?.
splice
(
index
,
1
);
}
}
}
}
}
,
}
,
// 删除分栏
removeModule
(
module
)
{
removeModule
(
module
)
{
this
.
removeSubfieldModule
=
module
;
this
.
removeSubfieldModule
=
module
;
this
.
removeSubFiledModuleDialog
=
true
;
this
.
removeSubFiledModuleDialog
=
true
;
const
findModule
=
this
.
subfieldModuleList
.
find
(
item
=>
item
.
uid
==
module
.
uid
);
if
(
findModule
)
{
// 更新源数据标题
findModule
.
subfieldModuleName
=
module
.
subfieldModuleName
;
this
.
activeUid
=
""
;
}
}
,
removeDialogClose
()
{
this
.
removeSubfieldModule
=
{
}
;
}
,
}
,
// 确定删除分栏
removeOk
()
{
removeOk
()
{
if
(
this
.
activeModuleId
==
this
.
removeSubfieldModule
.
uid
)
{
this
.
activeModuleId
=
""
;
}
// 查看当前命中的表单元素 是否存在于当前分栏下
if
(
this
.
removeSubfieldModule
?.
children
?.
length
)
{
const
index
=
this
.
removeSubfieldModule
.
children
.
findIndex
(
item
=>
item
.
uid
==
this
.
activeUid
);
if
(
index
>
-
1
)
{
this
.
activeUid
=
""
;
this
.
activeItemData
=
{
}
;
}
}
const
index
=
this
.
subfieldModuleList
.
findIndex
(
item
=>
item
.
uid
==
this
.
removeSubfieldModule
.
uid
);
const
index
=
this
.
subfieldModuleList
.
findIndex
(
item
=>
item
.
uid
==
this
.
removeSubfieldModule
.
uid
);
if
(
index
>
-
1
)
{
if
(
index
>
-
1
)
{
this
.
subfieldModuleList
.
splice
(
index
,
1
);
this
.
subfieldModuleList
.
splice
(
index
,
1
);
}
}
this
.
removeSubFiledModuleDialog
=
false
;
this
.
removeSubFiledModuleDialog
=
false
;
}
}
,
removeDialogClose
()
{
this
.
removeSubfieldModule
=
{
}
;
}
,
}
,
}
,
}
}
<
/script
>
<
/script
>
...
...
dsk-operate-ui/src/views/consultingOrgManagement/components/CustomForm/components/SetFieldOption.vue
0 → 100644
View file @
0fccfe33
<
template
>
<div
class=
"set-field-option-container"
>
</div>
</
template
>
<
script
>
export
default
{
name
:
"setFieldOption"
,
props
:
{
activeFieldData
:
Object
},
watch
:
{
activeFieldData
:
{
handler
(
newValue
)
{
this
.
comActiveFieldData
=
newValue
;
}
}
},
data
()
{
return
{
comActiveFieldData
:
this
.
activeFieldData
};
},
//可访问data属性
created
()
{
},
//计算集
computed
:
{
},
//方法集
methods
:
{
},
}
</
script
>
<
style
lang=
"scss"
scoped
>
.set-field-option-container
{
width
:
100%
;
height
:
100%
;
}
</
style
>
dsk-operate-ui/src/views/consultingOrgManagement/components/CustomForm/components/SubfieldItem.vue
View file @
0fccfe33
<
template
>
<
template
>
<div
class=
"subfield-item-container"
>
<div
class=
"subfield-item-container"
:class=
"
{'is-active-subfield-item' : activeUid == comChildModuleInfo.uid}" @click="activeSubfieldItem"
>
<img
src=
"@/assets/images/consultingAgencyManagement/customForm/icon_drag@2x.png"
alt=
""
class=
"subfield-module-item-dragg-target-icon"
>
<img
src=
"@/assets/images/consultingAgencyManagement/customForm/icon_drag@2x.png"
alt=
""
class=
"subfield-module-item-dragg-target-icon"
>
<el-form-item
class=
"subfield-module-form-item"
:label=
"comChildModuleInfo.comLabel"
>
<el-form-item
class=
"subfield-module-form-item"
:label=
"comChildModuleInfo.formAttribute.label"
>
<el-input
v-model=
"comChildModuleInfo.value"
:placeholder=
"comChildModuleInfo.placeholder"
clearable
></el-input>
<component
:is=
"comChildModuleInfo.comType"
v-model=
"comChildModuleInfo.componentAttribute.value"
:placeholder=
"comChildModuleInfo.componentAttribute.placeholder"
clearable
></component>
</el-form-item>
</el-form-item>
<img
src=
"@/assets/images/consultingAgencyManagement/customForm/icon_delete@2x.png"
alt=
""
class=
"remove-subfield-item-icon"
<img
src=
"@/assets/images/consultingAgencyManagement/customForm/icon_delete@2x.png"
alt=
""
class=
"remove-subfield-item-icon"
@
click
.
stop=
"removeModuleItem"
>
@
click
.
stop=
"removeModuleItem"
>
...
@@ -13,7 +14,8 @@ export default {
...
@@ -13,7 +14,8 @@ export default {
name
:
"subfieldItem"
,
name
:
"subfieldItem"
,
props
:
{
props
:
{
childModuleInfo
:
Object
,
childModuleInfo
:
Object
,
parentUid
:
String
parentUid
:
String
,
activeUid
:
String
},
},
watch
:
{
watch
:
{
childModuleInfo
:
{
childModuleInfo
:
{
...
@@ -25,7 +27,7 @@ export default {
...
@@ -25,7 +27,7 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
comChildModuleInfo
:
this
.
childModuleInfo
comChildModuleInfo
:
this
.
childModuleInfo
,
};
};
},
},
//可访问data属性
//可访问data属性
...
@@ -41,6 +43,9 @@ export default {
...
@@ -41,6 +43,9 @@ export default {
removeModuleItem
()
{
removeModuleItem
()
{
this
.
$emit
(
"removeModuleItem"
,
this
.
comChildModuleInfo
,
this
.
parentUid
);
this
.
$emit
(
"removeModuleItem"
,
this
.
comChildModuleInfo
,
this
.
parentUid
);
},
},
activeSubfieldItem
()
{
this
.
$emit
(
"activeSubfieldItem"
,
this
.
comChildModuleInfo
,
this
.
parentUid
);
}
},
},
}
}
</
script
>
</
script
>
...
@@ -54,6 +59,10 @@ export default {
...
@@ -54,6 +59,10 @@ export default {
align-items
:
center
;
align-items
:
center
;
background
:
#dcebff
;
background
:
#dcebff
;
&
.is-active-subfield-item
{
border
:
1px
solid
#0081ff
;
}
.subfield-module-item-dragg-target-icon
{
.subfield-module-item-dragg-target-icon
{
width
:
14px
;
width
:
14px
;
height
:
14px
;
height
:
14px
;
...
...
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