Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d7f71b0a
authored
Jun 11, 2023
by
xinla
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
智能表单
1 parent
84226464
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
45 deletions
vue3-lw-pc/package.json
vue3-lw-pc/src/views/drainageCode/smartForms/build/DraggableItem.vue
vue3-lw-pc/src/views/drainageCode/smartForms/build/RightPanel.vue
vue3-lw-pc/src/views/drainageCode/smartForms/build/generator/render.jsx
vue3-lw-pc/src/views/drainageCode/smartForms/build/index.vue
vue3-lw-pc/src/views/groupMessage/add.vue
vue3-lw-pc/package.json
View file @
d7f71b0
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
"crypto-js"
:
"^4.1.1"
,
"crypto-js"
:
"^4.1.1"
,
"driver.js"
:
"^0.9.8"
,
"driver.js"
:
"^0.9.8"
,
"echarts"
:
"^5.4.2"
,
"echarts"
:
"^5.4.2"
,
"element-plus"
:
"^2.3.
4
"
,
"element-plus"
:
"^2.3.
6
"
,
"fabric"
:
"^5.3.0"
,
"fabric"
:
"^5.3.0"
,
"file-saver"
:
"^2.0.5"
,
"file-saver"
:
"^2.0.5"
,
"fuse.js"
:
"^6.6.2"
,
"fuse.js"
:
"^6.6.2"
,
...
...
vue3-lw-pc/src/views/drainageCode/smartForms/build/DraggableItem.vue
View file @
d7f71b0
...
@@ -3,14 +3,14 @@ import draggable from 'vuedraggable'
...
@@ -3,14 +3,14 @@ import draggable from 'vuedraggable'
import
render
from
'./generator/render'
import
render
from
'./generator/render'
const
components
=
{
const
components
=
{
itemBtns
(
element
,
index
,
parent
)
{
itemBtns
(
element
,
index
,
parent
)
{
const
{
copyItem
,
d
eleteItem
}
=
this
.
$attrs
const
{
onCopyItem
,
onD
eleteItem
}
=
this
.
$attrs
return
(
return
(
<>
<>
<
span
<
span
class
=
'drawing-item-copy ssc'
class
=
'drawing-item-copy ssc'
title
=
'复制'
title
=
'复制'
onClick
=
{(
event
)
=>
{
onClick
=
{(
event
)
=>
{
c
opyItem
(
element
,
parent
)
onC
opyItem
(
element
,
parent
)
event
.
stopPropagation
()
event
.
stopPropagation
()
}}
>
}}
>
<
el
-
icon
-
CopyDocument
class
=
'el-icon-CopyDocument'
/>
<
el
-
icon
-
CopyDocument
class
=
'el-icon-CopyDocument'
/>
...
@@ -19,7 +19,7 @@ const components = {
...
@@ -19,7 +19,7 @@ const components = {
class
=
'drawing-item-delete ssc'
class
=
'drawing-item-delete ssc'
title
=
'删除'
title
=
'删除'
onClick
=
{(
event
)
=>
{
onClick
=
{(
event
)
=>
{
d
eleteItem
(
index
,
parent
)
onD
eleteItem
(
index
,
parent
)
event
.
stopPropagation
()
event
.
stopPropagation
()
}}
>
}}
>
<
el
-
icon
-
delete
class
=
'el-icon-delete'
/>
<
el
-
icon
-
delete
class
=
'el-icon-delete'
/>
...
@@ -30,7 +30,7 @@ const components = {
...
@@ -30,7 +30,7 @@ const components = {
}
}
const
layouts
=
{
const
layouts
=
{
colFormItem
(
element
,
index
,
parent
)
{
colFormItem
(
element
,
index
,
parent
)
{
const
{
a
ctiveItem
}
=
this
.
$attrs
const
{
onA
ctiveItem
}
=
this
.
$attrs
console
.
log
(
'element.formId'
,
element
.
formId
)
console
.
log
(
'element.formId'
,
element
.
formId
)
let
className
=
this
.
activeId
===
element
.
formId
?
'drawing-item active-from-item'
:
'drawing-item'
let
className
=
this
.
activeId
===
element
.
formId
?
'drawing-item active-from-item'
:
'drawing-item'
//只是用顶部样式
//只是用顶部样式
...
@@ -42,7 +42,7 @@ const layouts = {
...
@@ -42,7 +42,7 @@ const layouts = {
span
=
{
element
.
span
}
span
=
{
element
.
span
}
class
=
{
className
}
class
=
{
className
}
onClick
=
{(
event
)
=>
{
onClick
=
{(
event
)
=>
{
activeItem
&&
a
ctiveItem
(
element
)
onActiveItem
&&
onA
ctiveItem
(
element
)
event
.
stopPropagation
()
event
.
stopPropagation
()
}}
>
}}
>
<
el
-
form
-
item
<
el
-
form
-
item
...
@@ -80,7 +80,7 @@ const layouts = {
...
@@ -80,7 +80,7 @@ const layouts = {
)
)
},
},
rowFormItem
(
element
,
index
,
parent
)
{
rowFormItem
(
element
,
index
,
parent
)
{
const
{
a
ctiveItem
}
=
this
.
$attrs
const
{
onA
ctiveItem
}
=
this
.
$attrs
const
className
=
this
.
activeId
===
element
.
formId
?
'drawing-row-item active-from-item'
:
'drawing-row-item'
const
className
=
this
.
activeId
===
element
.
formId
?
'drawing-row-item active-from-item'
:
'drawing-row-item'
let
child
=
renderChildren
.
apply
(
this
,
arguments
)
let
child
=
renderChildren
.
apply
(
this
,
arguments
)
if
(
element
.
type
===
'flex'
)
{
if
(
element
.
type
===
'flex'
)
{
...
@@ -97,7 +97,7 @@ const layouts = {
...
@@ -97,7 +97,7 @@ const layouts = {
gutter
=
{
element
.
gutter
}
gutter
=
{
element
.
gutter
}
class
=
{
className
}
class
=
{
className
}
onClick
=
{(
event
)
=>
{
onClick
=
{(
event
)
=>
{
activeItem
&&
a
ctiveItem
(
element
)
onActiveItem
&&
onA
ctiveItem
(
element
)
event
.
stopPropagation
()
event
.
stopPropagation
()
}}
>
}}
>
<
span
class
=
'component-name'
>
{
element
.
componentName
}
<
/span
>
<
span
class
=
'component-name'
>
{
element
.
componentName
}
<
/span
>
...
...
vue3-lw-pc/src/views/drainageCode/smartForms/build/RightPanel.vue
View file @
d7f71b0
...
@@ -113,7 +113,7 @@
...
@@ -113,7 +113,7 @@
:min=
"0"
:min=
"0"
:max=
"activeData.options.length"
:max=
"activeData.options.length"
placeholder=
"至少应选"
placeholder=
"至少应选"
@
input=
"
$set(activeData, 'maxZ', $event ? $event : undefined)
"
/>
@
input=
"
activeData['maxZ'] = $event ? $event : undefined
"
/>
</el-form-item>
</el-form-item>
<el-form-item
v-if=
"activeData.tag === 'el-checkbox-group'"
label=
"最多可选"
>
<el-form-item
v-if=
"activeData.tag === 'el-checkbox-group'"
label=
"最多可选"
>
<el-input-number
<el-input-number
...
@@ -121,7 +121,7 @@
...
@@ -121,7 +121,7 @@
:min=
"0"
:min=
"0"
:max=
"activeData.options.length"
:max=
"activeData.options.length"
placeholder=
"最多可选"
placeholder=
"最多可选"
@
input=
"
$set(activeData, 'max', $event ? $event : undefined)
"
/>
@
input=
"
activeData['max'] = $event ? $event : undefined
"
/>
</el-form-item>
</el-form-item>
<!-- <el-form-item v-if="activeData.prepend!==undefined" label="前缀">
<!-- <el-form-item v-if="activeData.prepend!==undefined" label="前缀">
<el-input v-model="activeData.prepend" placeholder="请输入前缀" />
<el-input v-model="activeData.prepend" placeholder="请输入前缀" />
...
@@ -294,7 +294,7 @@
...
@@ -294,7 +294,7 @@
</
template
>
</
template
>
</draggable>
</draggable>
<div
style=
"margin-left: 20px"
>
<div
style=
"margin-left: 20px"
>
<el-button
style=
"padding-bottom: 0"
icon=
"el-icon-
circle - plus - outline
"
text
@
click=
"addSelectItem"
>
<el-button
style=
"padding-bottom: 0"
icon=
"el-icon-
CirclePlus
"
text
@
click=
"addSelectItem"
>
添加选项
添加选项
</el-button>
</el-button>
</div>
</div>
...
@@ -333,7 +333,7 @@
...
@@ -333,7 +333,7 @@
:expand-on-click-node=
"false"
:expand-on-click-node=
"false"
:render-content=
"renderContent"
/>
:render-content=
"renderContent"
/>
<div
v-if=
"activeData.dataType === 'static'"
style=
"margin-left: 20px"
>
<div
v-if=
"activeData.dataType === 'static'"
style=
"margin-left: 20px"
>
<el-button
style=
"padding-bottom: 0"
icon=
"el-icon-
circle - plus - outline
"
text
@
click=
"addTreeItem"
>
<el-button
style=
"padding-bottom: 0"
icon=
"el-icon-
CirclePlus
"
text
@
click=
"addTreeItem"
>
添加父级
添加父级
</el-button>
</el-button>
</div>
</div>
...
...
vue3-lw-pc/src/views/drainageCode/smartForms/build/generator/render.jsx
View file @
d7f71b0
...
@@ -19,9 +19,9 @@ const isAttr = makeMap(
...
@@ -19,9 +19,9 @@ const isAttr = makeMap(
)
)
function
vModel
(
self
,
dataObject
,
defaultValue
)
{
function
vModel
(
self
,
dataObject
,
defaultValue
)
{
console
.
log
(
'defaultValue111'
,
defaultValue
)
//
console.log('defaultValue111', defaultValue)
console
.
log
(
'dataObject'
,
dataObject
)
//
console.log('dataObject', dataObject)
console
.
log
(
'self'
,
self
)
//
console.log('self', self)
if
(
dataObject
.
formCodeId
==
5
||
dataObject
.
formCodeId
==
625
)
{
if
(
dataObject
.
formCodeId
==
5
||
dataObject
.
formCodeId
==
625
)
{
if
(
defaultValue
)
{
if
(
defaultValue
)
{
console
.
log
(
'(/(^[1-9]d*$)/.test(defaultValue))'
,
/
(
^
[
1-9
]\d
*$
)
/
.
test
(
defaultValue
))
console
.
log
(
'(/(^[1-9]d*$)/.test(defaultValue))'
,
/
(
^
[
1-9
]\d
*$
)
/
.
test
(
defaultValue
))
...
@@ -47,9 +47,9 @@ function vModel(self, dataObject, defaultValue) {
...
@@ -47,9 +47,9 @@ function vModel(self, dataObject, defaultValue) {
// console.log('dataObject.props', dataObject.props)
// console.log('dataObject.props', dataObject.props)
dataObject
[
'model-value'
]
=
defaultValue
dataObject
[
'model-value'
]
=
defaultValue
//
dataObject.onInput = (val) => {
dataObject
.
onInput
=
(
val
)
=>
{
//
self.$emit('input', val)
self
.
$emit
(
'input'
,
val
)
//
}
}
}
}
const
componentChild
=
{
const
componentChild
=
{
...
@@ -145,6 +145,26 @@ const componentChild = {
...
@@ -145,6 +145,26 @@ const componentChild = {
export
default
{
export
default
{
props
:
[
'conf'
],
props
:
[
'conf'
],
data
()
{
return
{
props
:{
value
:
'id'
,
label
:
'name'
,
lazy
:
true
,
lazyLoad
(
node
,
resolve
)
{
debugger
if
(
node
.
level
==
0
)
{
getProvinceCityTree
().
then
((
data
)
=>
{
resolve
(
data
)
})
}
else
{
if
(
node
.
level
==
2
)
{
node
.
data
.
children
.
forEach
((
e
)
=>
(
e
.
leaf
=
true
))
}
resolve
([])
}
},
}}
},
render
()
{
render
()
{
const
dataObject
=
{
const
dataObject
=
{
// attrs: {},
// attrs: {},
...
@@ -165,11 +185,13 @@ export default {
...
@@ -165,11 +185,13 @@ export default {
})
})
}
}
console
.
log
(
'confClone'
,
confClone
.
formCodeId
)
console
.
log
(
'confClone'
,
confClone
.
formCodeId
)
Object
.
keys
(
confClone
).
forEach
((
key
)
=>
{
if
(
confClone
.
layout
!=
'rowFormItem'
)
{
const
val
=
confClone
[
key
]
vModel
(
this
,
dataObject
,
confClone
.
defaultValue
)
if
(
confClone
.
layout
!=
'rowFormItem'
)
{
}
vModel
(
this
,
dataObject
,
confClone
.
defaultValue
)
Object
.
assign
(
dataObject
,
confClone
)
}
// Object.keys(confClone).forEach((key) => {
// const val = confClone[key]
// if (key === 'style') {
// if (key === 'style') {
// Object.assign(dataObject[key], val)
// Object.assign(dataObject[key], val)
// } else if (!isAttr(key)) {
// } else if (!isAttr(key)) {
...
@@ -177,29 +199,14 @@ export default {
...
@@ -177,29 +199,14 @@ export default {
// } else {
// } else {
// dataObject.attrs[key] = val
// dataObject.attrs[key] = val
// }
// }
})
// })
Object
.
assign
(
dataObject
,
confClone
)
debugger
// 配置省市区数据首次懒加载
// 配置省市区数据首次懒加载
if
(
confClone
.
formCodeId
==
9
)
{
if
(
confClone
.
formCodeId
==
9
)
{
dataObject
.
props
=
{
debugger
value
:
'id'
,
dataObject
.
props
=
this
.
props
label
:
'name'
,
lazy
:
true
,
lazyLoad
(
node
,
resolve
)
{
if
(
node
.
level
==
0
)
{
getProvinceCityTree
().
then
((
data
)
=>
{
resolve
(
data
)
})
}
else
{
if
(
node
.
level
==
2
)
{
node
.
data
.
children
.
forEach
((
e
)
=>
(
e
.
leaf
=
true
))
}
resolve
([])
}
},
}
}
}
return
h
(
resolveComponent
(
this
.
conf
.
tag
),
dataObject
,
children
)
return
h
(
resolveComponent
(
this
.
conf
.
tag
),
dataObject
,
children
)
...
...
vue3-lw-pc/src/views/drainageCode/smartForms/build/index.vue
View file @
d7f71b0
...
@@ -398,7 +398,7 @@ export default {
...
@@ -398,7 +398,7 @@ export default {
activeFormItem
(
element
)
{
activeFormItem
(
element
)
{
this
.
activeData
=
element
this
.
activeData
=
element
this
.
activeId
=
element
.
formId
this
.
activeId
=
element
.
formId
//
this.$forceUpdate()
this
.
$forceUpdate
()
},
},
onEnd
(
obj
,
a
)
{
onEnd
(
obj
,
a
)
{
if
(
obj
.
from
!==
obj
.
to
)
{
if
(
obj
.
from
!==
obj
.
to
)
{
...
@@ -412,6 +412,7 @@ export default {
...
@@ -412,6 +412,7 @@ export default {
this
.
activeFormItem
(
clone
)
this
.
activeFormItem
(
clone
)
},
},
cloneComponent
(
origin
)
{
cloneComponent
(
origin
)
{
debugger
const
clone
=
JSON
.
parse
(
JSON
.
stringify
(
origin
))
const
clone
=
JSON
.
parse
(
JSON
.
stringify
(
origin
))
clone
.
formId
=
this
.
idGlobal
=
uuid
()
clone
.
formId
=
this
.
idGlobal
=
uuid
()
clone
.
span
=
formConf
.
span
clone
.
span
=
formConf
.
span
...
@@ -460,8 +461,11 @@ export default {
...
@@ -460,8 +461,11 @@ export default {
document
.
getElementById
(
'copyNode'
).
click
()
document
.
getElementById
(
'copyNode'
).
click
()
},
},
empty
()
{
empty
()
{
this
.
$confirm
(
'确定要清空所有组件吗?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
this
.
$confirm
(
'确定要清空所有组件吗?'
,
'提示'
,
{
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
}).
then
(()
=>
{
this
.
drawingList
=
[]
this
.
drawingList
=
[]
})
})
},
},
...
...
vue3-lw-pc/src/views/groupMessage/add.vue
View file @
d7f71b0
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
Attach a file
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 post a comment