Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
5113e93b
提交
5113e93b
authored
5月 26, 2022
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
perf: 优化树形过滤器
上级
a0fb3a62
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
53 行增加
和
32 行删除
+53
-32
index.vue
frontend/src/components/ElTreeSelect/index.vue
+24
-1
DeSelectTree.vue
frontend/src/components/widget/DeWidget/DeSelectTree.vue
+12
-29
TextSelectTreeServiceImpl.js
...omponents/widget/serviceImpl/TextSelectTreeServiceImpl.js
+5
-1
conditionUtil.js
frontend/src/utils/conditionUtil.js
+12
-1
没有找到文件。
frontend/src/components/ElTreeSelect/index.vue
浏览文件 @
5113e93b
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
v-model=
"labels"
v-model=
"labels"
v-popover:popover
v-popover:popover
:style=
"styles"
:style=
"styles"
:collapse-tags=
"showNumber"
class=
"el-tree-select-input"
class=
"el-tree-select-input"
:disabled=
"disabled"
:disabled=
"disabled"
popper-class=
"select-option"
popper-class=
"select-option"
...
@@ -119,8 +120,10 @@ export default {
...
@@ -119,8 +120,10 @@ export default {
}
}
},
},
// 树渲染方法,具体参考el-tree Function(h, { node, data, store }) {}
// 树渲染方法,具体参考el-tree Function(h, { node, data, store }) {}
// eslint-disable-next-line vue/require-default-prop
treeRenderFun
:
Function
,
treeRenderFun
:
Function
,
// 搜索过滤方法,具体参考el-tree Function(h, { value, data, node }) {}
// 搜索过滤方法,具体参考el-tree Function(h, { value, data, node }) {}
// eslint-disable-next-line vue/require-default-prop
filterNodeMethod
:
Function
,
filterNodeMethod
:
Function
,
/*
/*
文本框参数,几乎支持el-select所有的API<br>
文本框参数,几乎支持el-select所有的API<br>
...
@@ -215,7 +218,8 @@ export default {
...
@@ -215,7 +218,8 @@ export default {
ids
:
[],
// 存储id
ids
:
[],
// 存储id
visible
:
false
,
// popover v-model
visible
:
false
,
// popover v-model
width
:
150
,
width
:
150
,
showParent
:
false
showParent
:
false
,
showNumber
:
false
}
}
},
},
computed
:
{
computed
:
{
...
@@ -241,6 +245,9 @@ export default {
...
@@ -241,6 +245,9 @@ export default {
this
.
ids
=
val
===
''
?
[]
:
[
val
]
this
.
ids
=
val
===
''
?
[]
:
[
val
]
}
}
}
}
},
labels
:
function
()
{
this
.
setShowNumber
()
}
}
},
},
created
()
{
created
()
{
...
@@ -549,6 +556,22 @@ export default {
...
@@ -549,6 +556,22 @@ export default {
*/
*/
filterFun
(
val
)
{
filterFun
(
val
)
{
this
.
$refs
.
tree
.
filter
(
val
)
this
.
$refs
.
tree
.
filter
(
val
)
},
setShowNumber
()
{
this
.
showNumber
=
false
this
.
$nextTick
(()
=>
{
if
(
!
this
.
selectParams
.
multiple
||
!
this
.
$refs
.
select
||
!
this
.
$refs
.
select
.
$refs
.
tags
)
{
return
}
const
kids
=
this
.
$refs
.
select
.
$refs
.
tags
.
children
[
0
].
children
let
contentWidth
=
0
kids
.
forEach
(
kid
=>
{
contentWidth
+=
kid
.
offsetWidth
})
this
.
showNumber
=
contentWidth
>
((
this
.
$refs
.
select
.
$refs
.
tags
.
clientWidth
-
35
)
*
0.9
)
})
}
}
}
}
}
}
...
...
frontend/src/components/widget/DeWidget/DeSelectTree.vue
浏览文件 @
5113e93b
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
ref=
"deSelectTree"
ref=
"deSelectTree"
v-model=
"value"
v-model=
"value"
popover-class=
"test-class-wrap"
popover-class=
"test-class-wrap"
:is-single=
"isSingle"
:data=
"datas"
:data=
"datas"
:select-params=
"selectParams"
:select-params=
"selectParams"
:tree-params=
"treeParams"
:tree-params=
"treeParams"
...
@@ -45,9 +44,8 @@ export default {
...
@@ -45,9 +44,8 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
showNumber
:
false
,
selectOptionWidth
:
0
,
show
:
true
,
show
:
true
,
selectOptionWidth
:
0
,
datas
:
[],
datas
:
[],
value
:
this
.
isSingle
?
''
:
[],
value
:
this
.
isSingle
?
''
:
[],
selectParams
:
{
selectParams
:
{
...
@@ -135,14 +133,17 @@ export default {
...
@@ -135,14 +133,17 @@ export default {
},
},
'element.options.attrs.multiple'
:
function
(
value
,
old
)
{
'element.options.attrs.multiple'
:
function
(
value
,
old
)
{
if
(
typeof
old
===
'undefined'
||
value
===
old
)
return
if
(
typeof
old
===
'undefined'
||
value
===
old
)
return
if
(
!
this
.
inDraw
)
{
if
(
!
this
.
inDraw
)
{
this
.
value
=
value
?
[]
:
null
this
.
value
=
value
?
[]
:
null
this
.
element
.
options
.
value
=
''
this
.
element
.
options
.
value
=
''
}
}
this
.
show
=
false
this
.
show
=
false
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
show
=
true
this
.
show
=
true
this
.
$nextTick
(()
=>
{
this
.
$refs
.
deSelectTree
&&
this
.
$refs
.
deSelectTree
.
treeDataUpdateFun
(
this
.
datas
)
})
})
})
}
}
...
@@ -212,25 +213,14 @@ export default {
...
@@ -212,25 +213,14 @@ export default {
this
.
element
.
options
.
manualModify
=
true
this
.
element
.
options
.
manualModify
=
true
}
}
this
.
setCondition
()
this
.
setCondition
()
this
.
showNumber
=
false
this
.
$nextTick
(()
=>
{
if
(
!
this
.
element
.
options
.
attrs
.
multiple
||
!
this
.
$refs
.
deSelect
||
!
this
.
$refs
.
deSelect
.
$refs
.
tags
)
{
return
}
const
kids
=
this
.
$refs
.
deSelect
.
$refs
.
tags
.
children
[
0
].
children
let
contentWidth
=
0
kids
.
forEach
(
kid
=>
{
contentWidth
+=
kid
.
offsetWidth
})
this
.
showNumber
=
contentWidth
>
((
this
.
$refs
.
deSelectTree
.
$refs
.
tags
.
clientWidth
-
30
)
*
0.9
)
})
},
},
setCondition
()
{
setCondition
()
{
const
val
=
this
.
formatFilterValue
()
const
param
=
{
const
param
=
{
component
:
this
.
element
,
component
:
this
.
element
,
value
:
this
.
formatFilterValue
()
,
value
:
val
,
operator
:
this
.
operator
,
operator
:
this
.
operator
,
isTree
:
true
isTree
:
true
}
}
...
@@ -267,7 +257,8 @@ export default {
...
@@ -267,7 +257,8 @@ export default {
return
results
return
results
// return this.value
// return this.value
}
}
return
this
.
value
.
split
(
','
)
const
result
=
this
.
value
.
split
(
','
).
map
(
v
=>
v
.
replaceAll
(
SEPARATOR
,
','
))
return
result
},
},
fillValueDerfault
()
{
fillValueDerfault
()
{
...
@@ -286,14 +277,6 @@ export default {
...
@@ -286,14 +277,6 @@ export default {
return
datas
.
filter
(
item
=>
!!
item
)
return
datas
.
filter
(
item
=>
!!
item
)
},
},
setOptionWidth
(
event
)
{
// 下拉框弹出时,设置弹框的宽度
this
.
$nextTick
(()
=>
{
// this.selectOptionWidth = event.srcElement.offsetWidth + 'px'
this
.
selectOptionWidth
=
event
.
srcElement
.
parentElement
.
parentElement
.
offsetWidth
+
'px'
})
},
/* 下面是树的渲染方法 */
/* 下面是树的渲染方法 */
_filterFun
(
value
,
data
,
node
)
{
_filterFun
(
value
,
data
,
node
)
{
...
@@ -308,9 +291,9 @@ export default {
...
@@ -308,9 +291,9 @@ export default {
_searchFun
(
value
)
{
_searchFun
(
value
)
{
console
.
log
(
value
,
'<--_searchFun'
)
console
.
log
(
value
,
'<--_searchFun'
)
// 自行判断 是走后台查询,还是前端过滤
// 自行判断 是走后台查询,还是前端过滤
this
.
$refs
.
treeSelect
.
filterFun
(
value
)
this
.
$refs
.
deSelectTree
.
filterFun
(
value
)
// 后台查询
// 后台查询
// this.$refs.
treeSelect
.treeDataUpdateFun(treeData);
// this.$refs.
deSelectTree
.treeDataUpdateFun(treeData);
},
},
// 自定义render
// 自定义render
_renderFun
(
h
,
{
node
,
data
,
store
})
{
_renderFun
(
h
,
{
node
,
data
,
store
})
{
...
...
frontend/src/components/widget/serviceImpl/TextSelectTreeServiceImpl.js
浏览文件 @
5113e93b
...
@@ -88,7 +88,11 @@ class TextSelectTreeServiceImpl extends WidgetService {
...
@@ -88,7 +88,11 @@ class TextSelectTreeServiceImpl extends WidgetService {
const
param
=
{
const
param
=
{
component
:
element
,
component
:
element
,
value
:
!
value
?
[]
:
Array
.
isArray
(
value
)
?
value
:
value
.
toString
().
split
(
','
),
value
:
!
value
?
[]
:
Array
.
isArray
(
value
)
?
value
:
value
.
toString
().
split
(
','
),
operator
:
element
.
options
.
attrs
.
multiple
?
'in'
:
'eq'
operator
:
element
.
options
.
attrs
.
multiple
?
'in'
:
'eq'
,
isTree
:
true
}
if
(
param
.
value
&&
param
.
value
.
length
)
{
param
.
value
=
param
.
value
.
map
(
val
=>
val
.
replaceAll
(
'-de-'
,
','
))
}
}
return
param
return
param
}
}
...
...
frontend/src/utils/conditionUtil.js
浏览文件 @
5113e93b
...
@@ -27,8 +27,19 @@ export const valueValid = condition => {
...
@@ -27,8 +27,19 @@ export const valueValid = condition => {
export
const
formatCondition
=
obj
=>
{
export
const
formatCondition
=
obj
=>
{
const
{
component
,
value
,
operator
,
isTree
}
=
obj
const
{
component
,
value
,
operator
,
isTree
}
=
obj
const
fieldId
=
component
.
options
.
attrs
.
fieldId
let
fieldId
=
component
.
options
.
attrs
.
fieldId
const
viewIds
=
component
.
options
.
attrs
.
viewIds
const
viewIds
=
component
.
options
.
attrs
.
viewIds
if
(
isTree
&&
!
component
.
options
.
attrs
.
multiple
&&
value
&&
value
.
length
)
{
// 单选树
const
val
=
value
[
0
]
if
(
val
)
{
const
len
=
val
.
split
(
','
).
length
if
(
len
)
{
fieldId
=
fieldId
.
split
(
','
).
slice
(
0
,
len
).
join
(
','
)
}
}
}
const
condition
=
new
Condition
(
component
.
id
,
fieldId
,
operator
,
value
,
viewIds
,
isTree
)
const
condition
=
new
Condition
(
component
.
id
,
fieldId
,
operator
,
value
,
viewIds
,
isTree
)
return
condition
return
condition
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论