Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fuyue82
o2oa
提交
622a6d65
o2oa
项目概览
fuyue82
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
622a6d65
编写于
6月 17, 2020
作者:
U
unknown
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
自定义弹出选择器支持多层级
上级
58d61be6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
169 addition
and
70 deletion
+169
-70
o2web/source/x_component_Selector/Person.js
o2web/source/x_component_Selector/Person.js
+3
-1
o2web/source/x_component_Template/Selector/Custom.js
o2web/source/x_component_Template/Selector/Custom.js
+166
-69
未找到文件。
o2web/source/x_component_Selector/Person.js
浏览文件 @
622a6d65
...
...
@@ -32,7 +32,9 @@ MWF.xApplication.Selector.Person = new Class({
"
flatCategory
"
:
false
,
//扁平化展现分类
"
itemHeight
"
:
29
"
itemHeight
"
:
29
,
"
showEmptyText
"
:
true
},
initialize
:
function
(
container
,
options
){
this
.
active
=
true
;
...
...
o2web/source/x_component_Template/Selector/Custom.js
浏览文件 @
622a6d65
...
...
@@ -2,6 +2,46 @@ MWF.xApplication.Selector = MWF.xApplication.Selector || {};
MWF
.
xApplication
.
Template
=
MWF
.
xApplication
.
Template
||
{};
MWF
.
xApplication
.
Template
.
Selector
=
MWF
.
xApplication
.
Template
.
Selector
||
{};
MWF
.
xDesktop
.
requireApp
(
"
Selector
"
,
"
Person
"
,
null
,
false
);
// this.options.selectableItems = [
// {
// "name": "项目1",
// "id": "item1",
// "isItem" : true //第一层的item需要isItem = true
// },
// {
// "name": "项目2",
// "id": "item2",
// "isItem" : true //第一层的item需要isItem = true
// },
// {
// "name": "分类1",
// "id": "category1",
// "subItemList": [
// {
// "id": "item1.1",
// "name": "项目1.1"
// },
// {
// "id": "item1.2",
// "name": "项目1.2"
// }
// ],
// "subCategoryList" : [
// {
// "name": "分类1.1",
// "id": "category1.1",
// "subItemList" : [
// {
// "id": "item1.1.1",
// "name": "项目1.1.1"
// }
// ]
// }
// ]
// }
// ];
MWF
.
xApplication
.
Template
.
Selector
.
Custom
=
new
Class
({
Extends
:
MWF
.
xApplication
.
Selector
.
Person
,
options
:
{
...
...
@@ -9,86 +49,91 @@ MWF.xApplication.Template.Selector.Custom = new Class({
"
count
"
:
0
,
"
title
"
:
"
选择列表
"
,
"
values
"
:
[],
"
selectableItems
"
:
[],
"
selectableItems
"
:
[],
"
names
"
:
[],
"
category
"
:
false
,
"
expand
"
:
false
"
category
"
:
false
,
"
expand
"
:
true
,
"
expandSubEnable
"
:
true
},
initialize
:
function
(
container
,
options
)
{
initialize
:
function
(
container
,
options
)
{
this
.
setOptions
(
options
);
this
.
path
=
"
../x_component_Selector/$Selector/
"
;
this
.
cssPath
=
"
../x_component_Selector/$Selector/
"
+
this
.
options
.
style
+
"
/css.wcss
"
;
this
.
cssPath
=
"
../x_component_Selector/$Selector/
"
+
this
.
options
.
style
+
"
/css.wcss
"
;
this
.
_loadCss
(
true
);
this
.
container
=
$
(
container
);
this
.
selectedItems
=
[];
this
.
items
=
[];
this
.
categorys
=
[];
},
loadSelectItems
:
function
(
addToNext
){
if
(
!
this
.
options
.
category
){
this
.
options
.
selectableItems
.
each
(
function
(
it
){
var
name
=
typeOf
(
it
)
===
"
string
"
?
it
:
it
.
name
;
var
id
=
typeOf
(
it
)
===
"
string
"
?
it
:
it
.
id
;
var
item
=
this
.
_newItem
({
name
:
name
,
id
:
id
},
this
,
this
.
itemAreaNode
);
loadSelectItems
:
function
(
addToNext
)
{
debugger
;
if
(
!
this
.
options
.
category
)
{
this
.
options
.
selectableItems
.
each
(
function
(
it
)
{
var
name
=
typeOf
(
it
)
===
"
string
"
?
it
:
it
.
name
;
var
id
=
typeOf
(
it
)
===
"
string
"
?
it
:
it
.
id
;
var
item
=
this
.
_newItem
({
name
:
name
,
id
:
id
},
this
,
this
.
itemAreaNode
);
this
.
items
.
push
(
item
);
}.
bind
(
this
))
}
else
{
}
else
{
this
.
options
.
selectableItems
.
each
(
function
(
item
,
index
)
{
if
(
item
.
isItem
)
{
if
(
item
.
isItem
)
{
var
item
=
this
.
_newItem
(
item
,
this
,
this
.
itemAreaNode
);
this
.
items
.
push
(
item
);
}
if
(
item
.
subItemList
&&
item
.
subItemList
.
length
>
0
)
{
if
(
(
item
.
subItemList
&&
item
.
subItemList
.
length
>
0
)
||
item
.
subCategoryList
&&
item
.
subCategoryList
.
length
>
0
)
{
var
category
=
this
.
_newItemCategory
(
item
,
this
,
this
.
itemAreaNode
);
item
.
subItemList
.
each
(
function
(
subItem
,
index
)
{
var
item
=
this
.
_newItem
(
subItem
,
this
,
category
.
children
,
2
,
category
);
this
.
items
.
push
(
item
);
category
.
subItems
.
push
(
item
);
}.
bind
(
this
));
this
.
categorys
.
push
(
category
);
// item.subItemList.each(function (subItem, index) {
// var item = this._newItem(subItem, this, category.children, 2, category);
// this.items.push(item);
// category.subItems.push(item);
// }.bind(this));
}
}.
bind
(
this
));
}
},
_scrollEvent
:
function
(
y
)
{
_scrollEvent
:
function
(
y
)
{
return
true
;
},
_getChildrenItemIds
:
function
(
data
)
{
_getChildrenItemIds
:
function
(
data
)
{
return
data
.
subItemList
||
[];
},
_newItemCategory
:
function
(
data
,
selector
,
item
,
level
)
{
_newItemCategory
:
function
(
data
,
selector
,
item
,
level
)
{
return
new
MWF
.
xApplication
.
Template
.
Selector
.
Custom
.
ItemCategory
(
data
,
selector
,
item
,
level
)
},
_listItemByKey
:
function
(
callback
,
failure
,
key
)
{
if
(
key
){
_listItemByKey
:
function
(
callback
,
failure
,
key
)
{
if
(
key
)
{
this
.
initSearchArea
(
true
);
this
.
searchInItems
(
key
);
}
else
{
}
else
{
this
.
initSearchArea
(
false
);
}
},
_newItemSelected
:
function
(
data
,
selector
,
item
)
{
_newItemSelected
:
function
(
data
,
selector
,
item
)
{
return
new
MWF
.
xApplication
.
Template
.
Selector
.
Custom
.
ItemSelected
(
data
,
selector
,
item
)
},
_listItemByPinyin
:
function
(
callback
,
failure
,
key
)
{
if
(
key
){
_listItemByPinyin
:
function
(
callback
,
failure
,
key
)
{
if
(
key
)
{
this
.
initSearchArea
(
true
);
this
.
searchInItems
(
key
);
}
else
{
}
else
{
this
.
initSearchArea
(
false
);
}
},
_getItem
:
function
(
callback
,
failure
,
id
,
async
)
{
if
(
callback
)
callback
.
apply
(
id
,
[{
"
id
"
:
id
}]);
_getItem
:
function
(
callback
,
failure
,
id
,
async
)
{
if
(
callback
)
callback
.
apply
(
id
,
[{
"
id
"
:
id
}]);
},
_newItem
:
function
(
data
,
selector
,
container
,
level
,
category
)
{
_newItem
:
function
(
data
,
selector
,
container
,
level
,
category
)
{
return
new
MWF
.
xApplication
.
Template
.
Selector
.
Custom
.
Item
(
data
,
selector
,
container
,
level
,
category
);
},
createItemsSearchData
:
function
(
callback
)
{
if
(
!
this
.
itemsSearchData
){
createItemsSearchData
:
function
(
callback
)
{
if
(
!
this
.
itemsSearchData
)
{
this
.
itemsSearchData
=
[];
MWF
.
require
(
"
MWF.widget.PinYin
"
,
function
()
{
MWF
.
require
(
"
MWF.widget.PinYin
"
,
function
()
{
var
initIds
=
[];
this
.
items
.
each
(
function
(
item
)
{
if
(
initIds
.
indexOf
(
item
.
data
.
name
)
==-
1
)
{
this
.
items
.
each
(
function
(
item
)
{
if
(
initIds
.
indexOf
(
item
.
data
.
name
)
==
-
1
)
{
var
text
=
item
.
_getShowName
().
toLowerCase
();
var
pinyin
=
text
.
toPY
().
toLowerCase
();
var
firstPY
=
text
.
toPYFirst
().
toLowerCase
();
...
...
@@ -104,41 +149,41 @@ MWF.xApplication.Template.Selector.Custom = new Class({
delete
initIds
;
if
(
callback
)
callback
();
}.
bind
(
this
));
}
else
{
}
else
{
if
(
callback
)
callback
();
}
}
});
MWF
.
xApplication
.
Template
.
Selector
.
Custom
.
Item
=
new
Class
({
Extends
:
o2
.
xApplication
.
Selector
.
Person
.
Item
,
_getShowName
:
function
()
{
_getShowName
:
function
()
{
return
this
.
data
.
name
;
},
_setIcon
:
function
()
{
_setIcon
:
function
()
{
var
style
=
this
.
selector
.
options
.
style
;
this
.
iconNode
.
setStyle
(
"
background-image
"
,
"
url(
"
+
"
../x_component_Selector/$Selector/
"
+
style
+
"
/icon/processicon.png)
"
);
this
.
iconNode
.
setStyle
(
"
background-image
"
,
"
url(
"
+
"
../x_component_Selector/$Selector/
"
+
style
+
"
/icon/processicon.png)
"
);
},
_getTtiteText
:
function
()
{
_getTtiteText
:
function
()
{
return
this
.
data
.
name
;
},
loadSubItem
:
function
()
{
loadSubItem
:
function
()
{
return
false
;
},
checkSelectedSingle
:
function
()
{
var
selectedItem
=
this
.
selector
.
options
.
values
.
filter
(
function
(
item
,
index
)
{
if
(
typeOf
(
item
)
===
"
object
"
)
return
(
this
.
data
.
id
===
item
.
id
)
||
(
this
.
data
.
name
===
item
.
name
)
;
if
(
typeOf
(
item
)
===
"
string
"
)
return
(
this
.
data
.
id
===
item
)
||
(
this
.
data
.
name
===
item
);
checkSelectedSingle
:
function
()
{
var
selectedItem
=
this
.
selector
.
options
.
values
.
filter
(
function
(
item
,
index
)
{
if
(
typeOf
(
item
)
===
"
object
"
)
return
(
this
.
data
.
id
===
item
.
id
)
||
(
this
.
data
.
name
===
item
.
name
)
;
if
(
typeOf
(
item
)
===
"
string
"
)
return
(
this
.
data
.
id
===
item
)
||
(
this
.
data
.
name
===
item
);
return
false
;
}.
bind
(
this
));
if
(
selectedItem
.
length
){
if
(
selectedItem
.
length
)
{
this
.
selectedSingle
();
}
},
checkSelected
:
function
()
{
var
selectedItem
=
this
.
selector
.
selectedItems
.
filter
(
function
(
item
,
index
)
{
checkSelected
:
function
()
{
var
selectedItem
=
this
.
selector
.
selectedItems
.
filter
(
function
(
item
,
index
)
{
return
(
item
.
data
.
id
===
this
.
data
.
id
)
||
(
item
.
data
.
name
===
this
.
data
.
name
);
}.
bind
(
this
));
if
(
selectedItem
.
length
){
if
(
selectedItem
.
length
)
{
//selectedItem[0].item = this;
selectedItem
[
0
].
addItem
(
this
);
this
.
selectedItem
=
selectedItem
[
0
];
...
...
@@ -148,24 +193,24 @@ MWF.xApplication.Template.Selector.Custom.Item = new Class({
});
MWF
.
xApplication
.
Template
.
Selector
.
Custom
.
ItemSelected
=
new
Class
({
Extends
:
o2
.
xApplication
.
Selector
.
Person
.
ItemSelected
,
_getShowName
:
function
()
{
_getShowName
:
function
()
{
return
this
.
data
.
name
;
},
_setIcon
:
function
()
{
_setIcon
:
function
()
{
var
style
=
this
.
selector
.
options
.
style
;
this
.
iconNode
.
setStyle
(
"
background-image
"
,
"
url(
"
+
"
../x_component_Selector/$Selector/
"
+
style
+
"
/icon/processicon.png)
"
);
this
.
iconNode
.
setStyle
(
"
background-image
"
,
"
url(
"
+
"
../x_component_Selector/$Selector/
"
+
style
+
"
/icon/processicon.png)
"
);
},
_getTtiteText
:
function
()
{
_getTtiteText
:
function
()
{
return
this
.
data
.
name
;
},
check
:
function
()
{
if
(
this
.
selector
.
items
.
length
){
var
items
=
this
.
selector
.
items
.
filter
(
function
(
item
,
index
)
{
check
:
function
()
{
if
(
this
.
selector
.
items
.
length
)
{
var
items
=
this
.
selector
.
items
.
filter
(
function
(
item
,
index
)
{
return
(
item
.
data
.
id
===
this
.
data
.
id
)
||
(
item
.
data
.
name
===
this
.
data
.
name
);
}.
bind
(
this
));
this
.
items
=
items
;
if
(
items
.
length
){
items
.
each
(
function
(
item
)
{
if
(
items
.
length
)
{
items
.
each
(
function
(
item
)
{
item
.
selectedItem
=
this
;
item
.
setSelected
();
}.
bind
(
this
));
...
...
@@ -175,27 +220,79 @@ MWF.xApplication.Template.Selector.Custom.ItemSelected = new Class({
});
MWF
.
xApplication
.
Template
.
Selector
.
Custom
.
ItemCategory
=
new
Class
({
Extends
:
o2
.
xApplication
.
Selector
.
Person
.
ItemCategory
,
_getShowName
:
function
()
{
_getShowName
:
function
()
{
return
this
.
data
.
name
;
},
createNode
:
function
()
{
createNode
:
function
()
{
this
.
node
=
new
Element
(
"
div
"
,
{
"
styles
"
:
this
.
selector
.
css
.
selectorItemCategory_department
}).
inject
(
this
.
container
);
this
.
loaded
=
true
;
},
_setIcon
:
function
()
{
_setIcon
:
function
()
{
var
style
=
this
.
selector
.
options
.
style
;
this
.
iconNode
.
setStyle
(
"
background-image
"
,
"
url(
"
+
"
../x_component_Selector/$Selector/
"
+
style
+
"
/icon/applicationicon.png)
"
);
this
.
iconNode
.
setStyle
(
"
background-image
"
,
"
url(
"
+
"
../x_component_Selector/$Selector/
"
+
style
+
"
/icon/applicationicon.png)
"
);
},
_getTtiteText
:
function
()
{
_getTtiteText
:
function
()
{
return
this
.
data
.
name
;
},
_hasChildItem
:
function
(){
clickItem
:
function
(
callback
)
{
if
(
this
.
_hasChild
())
{
var
firstLoaded
=
!
this
.
loaded
;
debugger
;
this
.
loadSub
(
function
()
{
if
(
firstLoaded
)
{
if
(
!
this
.
selector
.
isFlatCategory
)
{
this
.
children
.
setStyles
({
"
display
"
:
"
block
"
,
"
height
"
:
"
auto
"
});
this
.
actionNode
.
setStyles
(
this
.
selector
.
css
.
selectorItemCategoryActionNode_expand
);
this
.
isExpand
=
true
;
}
}
else
{
var
display
=
this
.
children
.
getStyle
(
"
display
"
);
if
(
display
===
"
none
"
)
{
this
.
children
.
setStyles
({
"
display
"
:
"
block
"
,
"
height
"
:
"
auto
"
});
this
.
actionNode
.
setStyles
(
this
.
selector
.
css
.
selectorItemCategoryActionNode_expand
);
this
.
isExpand
=
true
;
}
else
{
this
.
children
.
setStyles
({
"
display
"
:
"
none
"
,
"
height
"
:
"
0px
"
});
this
.
actionNode
.
setStyles
(
this
.
selector
.
css
.
selectorItemCategoryActionNode_collapse
);
this
.
isExpand
=
false
;
}
}
if
(
callback
)
callback
();
}.
bind
(
this
));
}
},
loadSub
:
function
(
callback
)
{
debugger
;
if
(
!
this
.
loaded
)
{
if
(
this
.
_hasChild
()
){
this
.
data
.
subItemList
.
each
(
function
(
subItem
,
index
)
{
var
item
=
this
.
selector
.
_newItem
(
subItem
,
this
.
selector
,
this
.
children
,
this
.
level
+
1
,
this
);
this
.
selector
.
items
.
push
(
item
);
if
(
this
.
subItems
)
this
.
subItems
.
push
(
item
);
}.
bind
(
this
));
}
if
(
this
.
_hasChildCategory
()
)
{
this
.
data
.
subCategoryList
.
each
(
function
(
subCategory
,
index
)
{
var
category
=
this
.
selector
.
_newItemCategory
(
subCategory
,
this
.
selector
,
this
.
children
,
this
.
level
+
1
,
this
);
this
.
subCategorys
.
push
(
category
);
}.
bind
(
this
));
}
this
.
loaded
=
true
;
if
(
callback
)
callback
();
}
else
{
if
(
callback
)
callback
();
}
},
_hasChildCategory
:
function
()
{
return
(
this
.
data
.
subCategoryList
&&
this
.
data
.
subCategoryList
.
length
);
},
_hasChildItem
:
function
()
{
return
this
.
_hasChild
();
},
_hasChild
:
function
()
{
_hasChild
:
function
()
{
return
(
this
.
data
.
subItemList
&&
this
.
data
.
subItemList
.
length
);
},
check
:
function
(){}
check
:
function
()
{
}
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录