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
f641a3ef
Commit
f641a3ef
authored
Jan 04, 2024
by
tianhongyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自定义表单整体逻辑完成,待嵌入使用组件
parent
cf0d067b
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
216 additions
and
42 deletions
+216
-42
package.json
dsk-operate-ui/package.json
+1
-0
main.js
dsk-operate-ui/src/main.js
+3
-0
custom-design-options.js
dsk-operate-ui/src/utils/generator/custom-design-options.js
+4
-4
CustomFormDesign.vue
...ent/components/CustomForm/components/CustomFormDesign.vue
+103
-20
SetFieldOption.vue
...ement/components/CustomForm/components/SetFieldOption.vue
+72
-11
SubfieldItem.vue
...agement/components/CustomForm/components/SubfieldItem.vue
+28
-6
SubfieldModule.vue
...ement/components/CustomForm/components/SubfieldModule.vue
+5
-1
No files found.
dsk-operate-ui/package.json
View file @
f641a3ef
...
@@ -47,6 +47,7 @@
...
@@ -47,6 +47,7 @@
"js-md5"
:
"^0.7.3"
,
"js-md5"
:
"^0.7.3"
,
"jsencrypt"
:
"3.0.0-rc.1"
,
"jsencrypt"
:
"3.0.0-rc.1"
,
"json-editor-vue"
:
"^0.11.1"
,
"json-editor-vue"
:
"^0.11.1"
,
"mitt"
:
"^3.0.1"
,
"nprogress"
:
"0.2.0"
,
"nprogress"
:
"0.2.0"
,
"quill"
:
"1.3.7"
,
"quill"
:
"1.3.7"
,
"screenfull"
:
"5.0.2"
,
"screenfull"
:
"5.0.2"
,
...
...
dsk-operate-ui/src/main.js
View file @
f641a3ef
import
Vue
from
'vue'
;
import
Vue
from
'vue'
;
import
VCA
from
'@vue/composition-api'
;
//composition APi
import
VCA
from
'@vue/composition-api'
;
//composition APi
import
mitt
from
"mitt"
;
import
Cookies
from
'js-cookie'
;
import
Cookies
from
'js-cookie'
;
import
Element
from
'element-ui'
;
import
Element
from
'element-ui'
;
...
@@ -60,6 +62,7 @@ Vue.prototype.selectDictLabel = selectDictLabel;
...
@@ -60,6 +62,7 @@ Vue.prototype.selectDictLabel = selectDictLabel;
Vue
.
prototype
.
selectDictLabels
=
selectDictLabels
;
Vue
.
prototype
.
selectDictLabels
=
selectDictLabels
;
Vue
.
prototype
.
download
=
download
;
Vue
.
prototype
.
download
=
download
;
Vue
.
prototype
.
handleTree
=
handleTree
;
Vue
.
prototype
.
handleTree
=
handleTree
;
Vue
.
prototype
.
$mitt
=
mitt
();
// 全局组件挂载
// 全局组件挂载
Vue
.
component
(
'DictTag'
,
DictTag
);
Vue
.
component
(
'DictTag'
,
DictTag
);
...
...
dsk-operate-ui/src/utils/generator/custom-design-options.js
View file @
f641a3ef
...
@@ -4,14 +4,12 @@
...
@@ -4,14 +4,12 @@
* 模块模板
* 模块模板
*/
*/
export
const
subfieldModuleTemplate
=
{
export
const
subfieldModuleTemplate
=
{
defaultSubfieldModuleName
:
"
分栏名称
"
,
defaultSubfieldModuleName
:
""
,
subfieldModuleName
:
""
,
subfieldModuleName
:
""
,
subfieldModuleNameRules
:
{
subfieldModuleNameRules
:
{
trigger
:
[
"blur"
,
"change"
],
trigger
:
[
"blur"
,
"change"
],
// required: true,
// message: "请输入分栏名称"
validator
:
(
rule
,
value
,
callback
)
=>
{
validator
:
(
rule
,
value
,
callback
)
=>
{
alert
(
1
)
alert
(
1
)
;
if
(
!
value
)
{
if
(
!
value
)
{
return
callback
(
new
Error
(
"请输入分栏名称"
));
return
callback
(
new
Error
(
"请输入分栏名称"
));
}
}
...
@@ -29,6 +27,8 @@ export const defaultComOptions = [
...
@@ -29,6 +27,8 @@ export const defaultComOptions = [
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"
),
// 验证通过
checkedAllow
:
false
,
// 表单属性
// 表单属性
formAttribute
:
{
formAttribute
:
{
// 验证规则
// 验证规则
...
...
dsk-operate-ui/src/views/consultingOrgManagement/components/CustomForm/components/CustomFormDesign.vue
View file @
f641a3ef
This diff is collapsed.
Click to expand it.
dsk-operate-ui/src/views/consultingOrgManagement/components/CustomForm/components/SetFieldOption.vue
View file @
f641a3ef
...
@@ -6,6 +6,10 @@
...
@@ -6,6 +6,10 @@
:rules=
"setFieldOptionRules.fieldName"
>
:rules=
"setFieldOptionRules.fieldName"
>
<el-input
v-model=
"comActiveFieldData.formAttribute.fieldName"
placeholder=
"请输入字段名称"
clearable
></el-input>
<el-input
v-model=
"comActiveFieldData.formAttribute.fieldName"
placeholder=
"请输入字段名称"
clearable
></el-input>
</el-form-item>
</el-form-item>
<!-- label展示名称 -->
<el-form-item
label=
"字段label"
class=
"set-field-option-item"
prop=
"formAttribute.label"
v-if=
"comActiveFieldData.formAttribute"
>
<el-input
v-model=
"comActiveFieldData.formAttribute.label"
placeholder=
"请输入字段label"
clearable
></el-input>
</el-form-item>
<!-- placeholder文字 -->
<!-- placeholder文字 -->
<el-form-item
label=
"提示文字"
class=
"set-field-option-item"
prop=
"componentAttribute.placeholder"
v-if=
"comActiveFieldData.componentAttribute"
>
<el-form-item
label=
"提示文字"
class=
"set-field-option-item"
prop=
"componentAttribute.placeholder"
v-if=
"comActiveFieldData.componentAttribute"
>
<el-input
v-model=
"comActiveFieldData.componentAttribute.placeholder"
placeholder=
"请输入提示文字"
clearable
></el-input>
<el-input
v-model=
"comActiveFieldData.componentAttribute.placeholder"
placeholder=
"请输入提示文字"
clearable
></el-input>
...
@@ -14,10 +18,6 @@
...
@@ -14,10 +18,6 @@
<el-form-item
label=
"默认值"
class=
"set-field-option-item"
prop=
"componentAttribute.value"
v-if=
"comActiveFieldData.componentAttribute"
>
<el-form-item
label=
"默认值"
class=
"set-field-option-item"
prop=
"componentAttribute.value"
v-if=
"comActiveFieldData.componentAttribute"
>
<el-input
v-model=
"comActiveFieldData.componentAttribute.value"
placeholder=
"请输入默认值"
clearable
></el-input>
<el-input
v-model=
"comActiveFieldData.componentAttribute.value"
placeholder=
"请输入默认值"
clearable
></el-input>
</el-form-item>
</el-form-item>
<!-- label展示名称 -->
<el-form-item
label=
"字段label"
class=
"set-field-option-item"
prop=
"formAttribute.label"
v-if=
"comActiveFieldData.formAttribute"
>
<el-input
v-model=
"comActiveFieldData.formAttribute.label"
placeholder=
"请输入字段label"
clearable
></el-input>
</el-form-item>
<!-- 表单样式 -->
<!-- 表单样式 -->
<div
class=
"set-field-option-styles-item"
v-if=
"comActiveFieldData.formAttribute"
>
<div
class=
"set-field-option-styles-item"
v-if=
"comActiveFieldData.formAttribute"
>
...
@@ -43,7 +43,10 @@
...
@@ -43,7 +43,10 @@
</el-form>
</el-form>
<!-- 确定编辑 -->
<!-- 确定编辑 -->
<div
class=
"set-field-option-footer"
>
<div
class=
"set-field-option-footer"
>
<div
class=
"set-field-option-inner"
v-if=
"this.comActiveFieldData && this.comActiveFieldData.uid"
>
<el-button
@
click=
"cancelSet"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"formCheck"
>
确定
</el-button>
</div>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
@@ -59,29 +62,60 @@ export default {
...
@@ -59,29 +62,60 @@ export default {
componentAttribute
:
{},
componentAttribute
:
{},
componentOptions
:
{}
componentOptions
:
{}
})
})
}
},
parentUid
:
String
,
activeUid
:
String
},
},
watch
:
{
watch
:
{
"activeFieldData.uid"
:
{
handler
(
newValue
)
{
this
.
$refs
[
"customDesignFormRef"
].
clearValidate
();
}
},
activeFieldData
:
{
activeFieldData
:
{
handler
(
newValue
)
{
handler
(
newValue
)
{
// 通过保存更新源数据按钮
// 通过保存更新源数据按钮
this
.
comActiveFieldData
=
newValue
;
this
.
comActiveFieldData
=
JSON
.
parse
(
JSON
.
stringify
(
newValue
));
},
deep
:
true
},
comActiveFieldData
:
{
handler
(
newValue
)
{
// 通过保存更新源数据按钮
this
.
$mitt
.
emit
(
"fieldOptionChange"
,
newValue
);
},
},
deep
:
true
deep
:
true
}
}
},
},
data
()
{
data
()
{
const
fieldNameValidor
=
(
rule
,
value
,
callback
)
=>
{
const
reg
=
/^
[
a-zA-Z0-9_
]
+$/
;
const
numReg
=
/^
[
0-9
]
/
;
if
(
!
value
)
{
return
callback
(
new
Error
(
"请输入字段名称"
));
}
if
(
numReg
.
test
(
value
))
{
return
callback
(
new
Error
(
"字段名称不能以数字开头"
));
}
if
(
!
reg
.
test
(
value
))
{
return
callback
(
new
Error
(
"字段名称只能为数字、字母(大小写)、下划线组成"
));
}
callback
();
};
return
{
return
{
// 通过保存更新源数据按钮
// 通过保存更新源数据按钮
comActiveFieldData
:
this
.
activeFieldData
,
comActiveFieldData
:
JSON
.
parse
(
JSON
.
stringify
(
this
.
activeFieldData
))
,
setFieldOptionRules
:
{
setFieldOptionRules
:
{
fieldName
:
[{
required
:
true
,
trigger
:
[
"blur"
,
"change"
],
message
:
"请输入字段名称"
}]
fieldName
:
[{
required
:
true
,
trigger
:
[
"blur"
,
"change"
],
validator
:
fieldNameValidor
}]
}
}
};
};
},
},
//可访问data属性
//可访问data属性
created
()
{
created
()
{
this
.
$mitt
.
on
(
"subfieldItemChange"
,
this
.
setOptions
);
},
beforeDestroy
()
{
this
.
$mitt
.
off
(
"subfieldItemChange"
);
},
},
//计算集
//计算集
computed
:
{
computed
:
{
...
@@ -89,7 +123,22 @@ export default {
...
@@ -89,7 +123,22 @@ export default {
},
},
//方法集
//方法集
methods
:
{
methods
:
{
setOptions
(
value
)
{
this
.
comActiveFieldData
=
value
;
},
cancelSet
()
{
this
.
$emit
(
"cancelSetOptions"
);
},
async
formCheck
()
{
try
{
const
result
=
await
this
.
$refs
[
"customDesignFormRef"
].
validate
();
if
(
result
)
{
this
.
$emit
(
"setOptionsFinish"
,
this
.
comActiveFieldData
,
this
.
parentUid
);
}
}
catch
(
error
)
{
console
.
log
(
error
);
}
}
},
},
}
}
</
script
>
</
script
>
...
@@ -101,6 +150,7 @@ export default {
...
@@ -101,6 +150,7 @@ export default {
.set-field-option-form
{
.set-field-option-form
{
width
:
100%
;
width
:
100%
;
height
:
calc
(
100%
-
56px
);
height
:
calc
(
100%
-
56px
);
/* height: 100%; */
padding
:
16px
;
padding
:
16px
;
overflow-y
:
auto
;
overflow-y
:
auto
;
overflow-x
:
hidden
;
overflow-x
:
hidden
;
...
@@ -114,6 +164,17 @@ export default {
...
@@ -114,6 +164,17 @@ export default {
align-items
:
center
;
align-items
:
center
;
border-top
:
1px
solid
#eeeeee
;
border-top
:
1px
solid
#eeeeee
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
padding
:
0px
12px
;
.set-field-option-inner
{
button
{
height
:
32px
;
line-height
:
32px
;
padding
:
0px
;
width
:
60px
;
border-radius
:
4px
;
}
}
}
}
::v-deep
.set-field-option-item
{
::v-deep
.set-field-option-item
{
...
...
dsk-operate-ui/src/views/consultingOrgManagement/components/CustomForm/components/SubfieldItem.vue
View file @
f641a3ef
<
template
>
<
template
>
<div
class=
"subfield-item-container"
:class=
"
{'is-active-subfield-item' : activeUid == comChildModuleInfo.uid}" @click="activeSubfieldItem">
<div
class=
"subfield-item-container"
:class=
"
{'is-active-subfield-item' : activeUid == comChildModuleInfo.uid}" :style="styles"
@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.formAttribute.label"
>
<el-form-item
class=
"subfield-module-form-item"
:class=
"
{'is-required' : comChildModuleInfo.formAttribute.required}"
:label="comChildModuleInfo.formAttribute.label">
<!-- 输入框类型 -->
<!-- 输入框类型 -->
<el-input
v-model=
"comChildModuleInfo.componentAttribute.value"
:placeholder=
"comChildModuleInfo.componentAttribute.placeholder"
clearable
<el-input
v-model=
"comChildModuleInfo.componentAttribute.value"
:placeholder=
"comChildModuleInfo.componentAttribute.placeholder"
clearable
v-if=
"comChildModuleInfo.comType == 'el-input'"
></el-input>
v-if=
"comChildModuleInfo.comType == 'el-input'"
></el-input>
...
@@ -21,30 +23,47 @@ export default {
...
@@ -21,30 +23,47 @@ export default {
watch
:
{
watch
:
{
childModuleInfo
:
{
childModuleInfo
:
{
handler
(
newValue
)
{
handler
(
newValue
)
{
this
.
comChildModuleInfo
=
newValue
;
this
.
comChildModuleInfo
=
JSON
.
parse
(
JSON
.
stringify
(
newValue
));
},
deep
:
true
},
comChildModuleInfo
:
{
handler
(
newValue
)
{
this
.
$mitt
.
emit
(
"subfieldItemChange"
,
newValue
);
},
},
deep
:
true
deep
:
true
}
}
},
},
data
()
{
data
()
{
return
{
return
{
comChildModuleInfo
:
this
.
childModuleInfo
,
comChildModuleInfo
:
JSON
.
parse
(
JSON
.
stringify
(
this
.
childModuleInfo
))
,
};
};
},
},
//可访问data属性
//可访问data属性
created
()
{
created
()
{
this
.
$mitt
.
on
(
"fieldOptionChange"
,
this
.
setFieldOption
);
},
beforeDestroy
()
{
this
.
$mitt
.
off
(
"fieldOptionChange"
);
},
},
//计算集
//计算集
computed
:
{
computed
:
{
styles
()
{
return
{
width
:
this
.
comChildModuleInfo
.
formAttribute
?
`
${
this
.
comChildModuleInfo
.
formAttribute
.
width
}
%`
:
"100%"
};
}
},
},
//方法集
//方法集
methods
:
{
methods
:
{
setFieldOption
(
value
)
{
this
.
comChildModuleInfo
=
value
;
},
removeModuleItem
()
{
removeModuleItem
()
{
this
.
$emit
(
"removeModuleItem"
,
this
.
comChildModuleInfo
,
this
.
parentUid
);
this
.
$emit
(
"removeModuleItem"
,
this
.
comChildModuleInfo
,
this
.
parentUid
);
},
},
activeSubfieldItem
()
{
activeSubfieldItem
()
{
if
(
this
.
activeUid
==
this
.
comChildModuleInfo
?.
uid
)
return
;
this
.
$emit
(
"activeSubfieldItem"
,
this
.
comChildModuleInfo
,
this
.
parentUid
);
this
.
$emit
(
"activeSubfieldItem"
,
this
.
comChildModuleInfo
,
this
.
parentUid
);
}
}
},
},
...
@@ -60,6 +79,8 @@ export default {
...
@@ -60,6 +79,8 @@ export default {
align-items
:
center
;
align-items
:
center
;
background
:
#dcebff
;
background
:
#dcebff
;
transition
:
width
0
.3s
linear
;
&
.is-active-subfield-item
{
&
.is-active-subfield-item
{
border
:
1px
solid
#0081ff
;
border
:
1px
solid
#0081ff
;
}
}
...
@@ -78,6 +99,7 @@ export default {
...
@@ -78,6 +99,7 @@ export default {
font-size
:
14px
;
font-size
:
14px
;
font-weight
:
400
;
font-weight
:
400
;
color
:
rgba
(
35
,
35
,
35
,
0
.8
);
color
:
rgba
(
35
,
35
,
35
,
0
.8
);
white-space
:
nowrap
;
}
}
.el-form-item__content
{
.el-form-item__content
{
flex
:
1
;
flex
:
1
;
...
...
dsk-operate-ui/src/views/consultingOrgManagement/components/CustomForm/components/SubfieldModule.vue
View file @
f641a3ef
...
@@ -68,7 +68,8 @@ export default {
...
@@ -68,7 +68,8 @@ export default {
this
.
$emit
(
"removeModule"
,
this
.
comModuleInfo
);
this
.
$emit
(
"removeModule"
,
this
.
comModuleInfo
);
},
},
editModule
()
{
editModule
()
{
this
.
comModuleInfo
.
edit
=
true
;
this
.
$emit
(
"editModule"
,
this
.
comModuleInfo
);
// this.comModuleInfo.edit = true;
},
},
editCancel
()
{
editCancel
()
{
this
.
comModuleInfo
.
edit
=
false
;
this
.
comModuleInfo
.
edit
=
false
;
...
@@ -85,6 +86,8 @@ export default {
...
@@ -85,6 +86,8 @@ export default {
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.subfield-module-item-container
{
.subfield-module-item-container
{
display
:
flex
;
flex-wrap
:
wrap
;
margin-bottom
:
12px
;
margin-bottom
:
12px
;
width
:
100%
;
width
:
100%
;
border
:
1px
solid
#dcdfe6
;
border
:
1px
solid
#dcdfe6
;
...
@@ -93,6 +96,7 @@ export default {
...
@@ -93,6 +96,7 @@ export default {
overflow
:
hidden
;
overflow
:
hidden
;
.subfield-module-header
{
.subfield-module-header
{
width
:
100%
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
justify-content
:
space-between
;
justify-content
:
space-between
;
...
...
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