Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz-Vue-R7-Res
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7前端标准模板
iBiz-Vue-R7-Res
提交
8ac3aa48
提交
8ac3aa48
编写于
5月 22, 2020
作者:
JunZai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
ecf6d70a
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
52 行增加
和
53 行删除
+52
-53
ibiz-group-picker.vue
src/components/ibiz-group-picker/ibiz-group-picker.vue
+8
-20
ibiz-group-select.vue
src/components/ibiz-group-select/ibiz-group-select.vue
+44
-33
未找到文件。
src/components/ibiz-group-picker/ibiz-group-picker.vue
浏览文件 @
8ac3aa48
...
...
@@ -2,7 +2,7 @@
<div
class=
"ibiz-group-picker"
>
<div
class=
"ibiz-group-container"
>
<div
v-if=
"showTree"
class=
"ibiz-group-tree"
>
<ibiz-select-tree
:NodesData=
"treeItems"
v-model=
"treeSelectVal"
:
isShowSearchBar=
"fals
e"
@
select=
"treeSelect"
></ibiz-select-tree>
<ibiz-select-tree
:NodesData=
"treeItems"
v-model=
"treeSelectVal"
:
treeOnly=
"tru
e"
@
select=
"treeSelect"
></ibiz-select-tree>
</div>
<div
class=
"ibiz-group-content"
>
<ibiz-group-card
:data=
"cardItems"
text=
"label"
value=
"id"
groupName=
"group"
:multiple=
"multiple"
:defaultSelect=
"cardSelctVal"
@
select=
"groupSelect"
></ibiz-group-card>
...
...
@@ -130,7 +130,10 @@ export default class IBizGroupPicker extends Vue {
this
.
viewParam
=
JSON
.
parse
(
this
.
viewparam
);
this
.
multiple
=
this
.
viewParam
.
multiple
;
if
(
this
.
viewParam
.
selects
)
{
this
.
cardSelctVal
=
this
.
viewParam
.
selects
;
this
.
viewParam
.
selects
.
forEach
((
select
:
any
)
=>
{
this
.
selects
.
push
(
select
);
this
.
cardSelctVal
.
push
(
select
.
id
)
})
}
this
.
load
();
}
...
...
@@ -161,6 +164,7 @@ export default class IBizGroupPicker extends Vue {
get
.
then
((
response
:
any
)
=>
{
if
(
response
.
status
===
200
)
{
this
.
treeItems
=
response
.
data
;
this
.
treeItems
[
0
].
disabled
=
false
}
}).
catch
((
error
:
any
)
=>
{
console
.
log
(
error
)
...
...
@@ -205,7 +209,7 @@ export default class IBizGroupPicker extends Vue {
* @memberof IBizGroupPicker
*/
public
groupSelect
(
event
:
any
)
{
if
(
!
event
||
!
event
.
select
s
)
{
if
(
!
event
||
!
event
.
select
)
{
return
;
}
if
(
!
this
.
multiple
)
{
...
...
@@ -217,7 +221,7 @@ export default class IBizGroupPicker extends Vue {
this
.
selects
.
splice
(
index
,
1
);
}
}
else
{
event
.
select
s
.
forEach
((
key
:
string
)
=>
{
event
.
select
.
forEach
((
key
:
string
)
=>
{
let
index
:
number
=
this
.
selects
.
findIndex
((
item
:
any
)
=>
Object
.
is
(
key
,
item
.
id
));
if
(
index
>=
0
)
{
return
;
...
...
@@ -228,22 +232,6 @@ export default class IBizGroupPicker extends Vue {
}
});
}
// 测试 start
// if(!this.multiple) {
// this.selects = [];
// }
// event.forEach((key: string) => {
// let index: number = this.selects.findIndex((item: any) => Object.is(key, item.id));
// if(index >= 0) {
// return;
// }
// let item: any = this.cardItems.find((item: any) => Object.is(key, item.id));
// if (item) {
// this.selects.push(item);
// }
// });
// 测试 end
}
/**
...
...
src/components/ibiz-group-select/ibiz-group-select.vue
浏览文件 @
8ac3aa48
...
...
@@ -96,6 +96,14 @@ export default class IBizGroupSelect extends Vue {
*/
@
Prop
()
valueitem
:
any
;
/**
* 填充属性
*
* @type {*}
* @memberof IBizGroupSelect
*/
@
Prop
()
fillmap
:
any
;
/**
* 选中项集合
*
...
...
@@ -114,17 +122,22 @@ export default class IBizGroupSelect extends Vue {
onValueChange
(
newVal
:
any
)
{
this
.
selects
=
[];
if
(
newVal
)
{
let
vals
:
any
[]
=
newVal
.
split
(
','
)
;
let
vals2
:
any
[]
=
[]
;
let
item
:
any
=
{}
;
item
.
label
=
newVal
.
split
(
','
)
;
if
(
this
.
valueitem
)
{
vals2
=
this
.
data
[
this
.
valueitem
].
split
(
','
);
item
.
id
=
this
.
data
[
this
.
valueitem
]
?
this
.
data
[
this
.
valueitem
].
split
(
','
)
:
[];
}
if
(
this
.
fillmap
)
{
for
(
let
key
in
this
.
fillmap
)
{
item
[
this
.
fillmap
[
key
]]
=
this
.
data
[
key
]
?
this
.
data
[
key
].
split
(
','
)
:
[];
}
}
console
.
log
(
this
.
data
[
this
.
valueitem
])
vals
.
forEach
((
val
:
string
,
index
:
number
)
=>
{
this
.
selects
.
push
(
{
label
:
val
,
id
:
vals2
.
length
>
0
?
vals2
[
index
]
:
null
}
)
item
.
label
.
forEach
((
val
:
string
,
index
:
number
)
=>
{
let
_item
:
any
=
{};
for
(
let
key
in
item
)
{
_item
[
key
]
=
item
[
key
][
index
]
?
item
[
key
][
index
]
:
null
;
}
this
.
selects
.
push
(
_item
)
})
}
}
...
...
@@ -152,16 +165,13 @@ export default class IBizGroupSelect extends Vue {
viewname
:
'ibiz-group-picker'
,
title
:
'分组选择'
};
let
sels
:
any
=
this
.
selects
.
map
((
select
:
any
)
=>
{
return
select
.
id
;
})
const
context
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
));
const
param
:
any
=
{};
Object
.
assign
(
param
,
{
hasfilter
:
this
.
filter
?
true
:
false
,
filtervalue
:
this
.
filter
?
this
.
data
[
this
.
filter
]
:
''
,
multiple
:
this
.
multiple
,
selects
:
sel
s
selects
:
this
.
select
s
});
let
container
:
Subject
<
any
>
=
this
.
$appmodal
.
openModal
(
view
,
context
,
param
);
container
.
subscribe
((
result
:
any
)
=>
{
...
...
@@ -182,12 +192,7 @@ export default class IBizGroupSelect extends Vue {
console
.
log
(
result
)
this
.
selects
=
[];
if
(
result
.
datas
&&
result
.
datas
.
length
>
0
)
{
result
.
datas
.
forEach
((
data
:
any
)
=>
{
this
.
selects
.
push
({
id
:
data
.
id
,
label
:
data
.
label
})
});
this
.
selects
=
result
.
datas
}
this
.
setValue
()
}
...
...
@@ -212,25 +217,31 @@ export default class IBizGroupSelect extends Vue {
public
setValue
()
{
let
item
:
any
=
{};
if
(
this
.
multiple
)
{
let
label
=
''
;
let
value
=
''
;
this
.
selects
.
forEach
((
select
:
any
)
=>
{
label
+=
','
+
select
.
label
;
value
+=
','
+
select
.
id
;
item
[
this
.
name
]
=
item
[
this
.
name
]
?
`
${
item
[
this
.
name
]}
,
${
select
.
label
}
`
:
select
.
label
;
if
(
this
.
valueitem
)
{
item
[
this
.
valueitem
]
=
item
[
this
.
valueitem
]
?
`
${
item
[
this
.
valueitem
]}
,
${
select
.
id
}
`
:
select
.
id
;
}
if
(
this
.
fillmap
)
{
for
(
let
key
in
this
.
fillmap
)
{
item
[
key
]
=
item
[
key
]
?
`
${
item
[
key
]}
,
${
select
[
this
.
fillmap
[
key
]]}
`
:
select
[
this
.
fillmap
[
key
]];
}
}
});
Object
.
assign
(
item
,
{
label
:
label
?
label
.
substring
(
1
)
:
null
,
id
:
value
?
value
.
substring
(
1
)
:
null
})
}
else
{
item
=
this
.
selects
.
length
>
0
?
this
.
selects
[
0
]
:
{};
item
[
this
.
name
]
=
this
.
selects
.
length
>
0
?
this
.
selects
[
0
].
label
:
null
;
if
(
this
.
valueitem
)
{
item
[
this
.
valueitem
]
=
this
.
selects
.
length
>
0
?
this
.
selects
[
0
].
id
:
null
;
}
if
(
this
.
fillmap
)
{
for
(
let
key
in
this
.
fillmap
)
{
item
[
key
]
=
this
.
selects
.
length
>
0
?
this
.
selects
[
0
][
this
.
fillmap
[
key
]]
:
null
;
}
}
}
if
(
this
.
name
)
{
this
.
$emit
(
'formitemvaluechange'
,
{
name
:
this
.
name
,
value
:
item
.
label
});
}
if
(
this
.
valueitem
)
{
this
.
$emit
(
'formitemvaluechange'
,
{
name
:
this
.
valueitem
,
value
:
item
.
id
});
for
(
let
key
in
item
)
{
this
.
$emit
(
'formitemvaluechange'
,
{
name
:
key
,
value
:
item
[
key
]
});
}
}
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录