Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
46210973
o2oa
项目概览
ghsby
/
o2oa
落后 Fork 源项目 2880 个版本
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
1
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,发现更多精彩内容 >>
提交
46210973
编写于
7月 12, 2021
作者:
U
unknown
浏览文件
操作
浏览文件
下载
差异文件
解决冲突
上级
5cfb8a27
8b5bb7ad
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
1300 addition
and
652 deletion
+1300
-652
o2web/source/x_component_Selector/Identity.js
o2web/source/x_component_Selector/Identity.js
+379
-325
o2web/source/x_component_Selector/IdentityWidthDuty.js
o2web/source/x_component_Selector/IdentityWidthDuty.js
+184
-87
o2web/source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js
...e/x_component_Selector/IdentityWidthDutyCategoryByUnit.js
+210
-148
o2web/source/x_component_Selector/Person.js
o2web/source/x_component_Selector/Person.js
+163
-14
o2web/source/x_component_Selector/Unit.js
o2web/source/x_component_Selector/Unit.js
+191
-78
o2web/source/x_component_Selector/UnitWithType.js
o2web/source/x_component_Selector/UnitWithType.js
+13
-0
o2web/source/x_component_Template/Selector/Custom.js
o2web/source/x_component_Template/Selector/Custom.js
+160
-0
未找到文件。
o2web/source/x_component_Selector/Identity.js
浏览文件 @
46210973
此差异已折叠。
点击以展开。
o2web/source/x_component_Selector/IdentityWidthDuty.js
浏览文件 @
46210973
MWF
.
xApplication
.
Selector
=
MWF
.
xApplication
.
Selector
||
{};
MWF
.
xDesktop
.
requireApp
(
"
Selector
"
,
"
Identity
"
,
null
,
false
);
MWF
.
xApplication
.
Selector
.
IdentityWidthDuty
=
new
Class
({
Extends
:
MWF
.
xApplication
.
Selector
.
Identity
,
Extends
:
MWF
.
xApplication
.
Selector
.
Identity
,
options
:
{
"
style
"
:
"
default
"
,
"
count
"
:
0
,
...
...
@@ -23,10 +23,12 @@ MWF.xApplication.Selector.IdentityWidthDuty = new Class({
this
.
setOptions
({
"
title
"
:
MWF
.
xApplication
.
Selector
.
LP
.
selectIdentity
});
},
_init
:
function
(){
this
.
selectType
=
"
identity
"
;
this
.
className
=
"
IdentityWidthDuty
"
this
.
selectType
=
"
identity
"
;
this
.
className
=
"
IdentityWidthDuty
"
},
loadSelectItems
:
function
(
addToNext
){
this
.
loadingCountDuty
=
"
wait
"
;
this
.
allUnitObjectWithDuty
=
{};
var
afterLoadSelectItemFun
=
this
.
afterLoadSelectItem
.
bind
(
this
);
if
(
this
.
options
.
disabled
){
this
.
afterLoadSelectItem
();
...
...
@@ -61,10 +63,15 @@ MWF.xApplication.Selector.IdentityWidthDuty = new Class({
}.
bind
(
this
));
var
loadDuty
=
function
()
{
if
(
this
.
isCheckStatusOrCount
()
){
this
.
loadingCountDuty
=
"
ready
"
;
this
.
checkLoadingCount
();
}
this
.
options
.
dutys
.
each
(
function
(
duty
){
var
data
=
{
"
name
"
:
duty
,
"
id
"
:
duty
};
var
category
=
this
.
_newItemCategory
(
"
ItemCategory
"
,
data
,
this
,
this
.
itemAreaNode
);
this
.
subCategorys
.
push
(
category
);
this
.
allUnitObjectWithDuty
[
data
.
name
]
=
category
;
loadDutySuccess
();
}.
bind
(
this
));
}.
bind
(
this
);
...
...
@@ -136,6 +143,11 @@ MWF.xApplication.Selector.IdentityWidthDuty = new Class({
}
}
}
if
(
this
.
isCheckStatusOrCount
()
)
{
this
.
loadingCountInclude
=
"
wait
"
;
this
.
loadIncludeCount
();
}
},
search
:
function
(){
...
...
@@ -209,7 +221,75 @@ MWF.xApplication.Selector.IdentityWidthDuty = new Class({
},
_newItemSearch
:
function
(
data
,
selector
,
container
,
level
){
return
new
MWF
.
xApplication
.
Selector
.
IdentityWidthDuty
.
SearchItem
(
data
,
selector
,
container
,
level
);
}
},
uniqueIdentityList
:
function
(
list
){
var
items
=
[],
map
=
{};
(
list
||
[]).
each
(
function
(
d
)
{
if
(
d
.
distinguishedName
||
d
.
unique
)
{
if
((
!
d
.
distinguishedName
||
!
map
[
d
.
distinguishedName
])
&&
(
!
d
.
unique
||
!
map
[
d
.
unique
]))
{
items
.
push
(
d
);
map
[
d
.
distinguishedName
]
=
true
;
map
[
d
.
unique
]
=
true
;
}
}
else
{
items
.
push
(
d
);
}
})
return
items
;
},
loadIncludeCount
:
function
(){
var
unitList
=
[];
var
groupList
=
[];
if
(
this
.
options
.
include
.
length
>
0
)
{
this
.
options
.
include
.
each
(
function
(
d
)
{
var
dn
=
typeOf
(
d
)
===
"
string
"
?
d
:
d
.
distinguishedName
;
var
flag
=
dn
.
split
(
"
@
"
).
getLast
().
toLowerCase
();
if
(
flag
===
"
u
"
)
{
unitList
.
push
(
dn
);
}
else
if
(
flag
===
"
g
"
)
{
groupList
.
push
(
dn
)
}
})
}
if
(
unitList
.
length
||
groupList
.
length
){
this
.
_loadUnitAndGroupCount
(
unitList
,
groupList
,
function
()
{
this
.
loadingCountInclude
=
"
ready
"
;
this
.
checkLoadingCount
();
}.
bind
(
this
));
}
else
{
this
.
loadingCountInclude
=
"
ignore
"
;
this
.
checkLoadingCount
();
}
},
checkLoadingCount
:
function
(){
if
(
this
.
loadingCountDuty
===
"
ready
"
&&
this
.
loadingCountInclude
===
"
ready
"
){
this
.
checkCountAndStatus
();
this
.
loadingCount
=
"
done
"
;
}
else
if
(
this
.
loadingCountDuty
===
"
ready
"
&&
this
.
loadingCountInclude
===
"
ignore
"
){
this
.
loadingCount
=
"
done
"
;
}
},
addSelectedCount
:
function
(
itemOrItemSelected
,
count
,
items
){
if
(
this
.
loadingCountInclude
===
"
ignore
"
){
this
.
_addSelectedCountWithDuty
(
itemOrItemSelected
,
count
,
items
);
}
else
{
this
.
_addSelectedCountWithDuty
(
itemOrItemSelected
,
count
,
items
);
this
.
_addSelectedCount
(
itemOrItemSelected
,
count
);
}
},
_addSelectedCountWithDuty
:
function
(
itemOrItemSelected
,
count
,
items
){
var
itemData
=
itemOrItemSelected
.
data
;
debugger
;
items
.
each
(
function
(
item
){
if
(
item
.
category
&&
item
.
category
.
_addSelectedCount
&&
item
.
category
.
className
===
"
ItemCategory
"
){
item
.
category
.
_addSelectedCount
(
count
);
}
}.
bind
(
this
));
},
//_listItemNext: function(last, count, callback){
// this.action.listRoleNext(last, count, function(json){
// if (callback) callback.apply(this, [json]);
...
...
@@ -217,7 +297,7 @@ MWF.xApplication.Selector.IdentityWidthDuty = new Class({
//}
});
MWF
.
xApplication
.
Selector
.
IdentityWidthDuty
.
Item
=
new
Class
({
Extends
:
MWF
.
xApplication
.
Selector
.
Identity
.
Item
,
Extends
:
MWF
.
xApplication
.
Selector
.
Identity
.
Item
,
_getShowName
:
function
(){
return
this
.
data
.
name
;
},
...
...
@@ -237,7 +317,7 @@ MWF.xApplication.Selector.IdentityWidthDuty.SearchItem = new Class({
});
MWF
.
xApplication
.
Selector
.
IdentityWidthDuty
.
ItemSelected
=
new
Class
({
Extends
:
MWF
.
xApplication
.
Selector
.
Identity
.
ItemSelected
,
Extends
:
MWF
.
xApplication
.
Selector
.
Identity
.
ItemSelected
,
_getShowName
:
function
(){
return
this
.
data
.
name
+
((
this
.
data
.
unitLevelName
)
?
"
(
"
+
this
.
data
.
unitLevelName
+
"
)
"
:
""
);
},
...
...
@@ -253,6 +333,7 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemSelected = new Class({
MWF
.
xApplication
.
Selector
.
IdentityWidthDuty
.
ItemCategory
=
new
Class
({
Extends
:
MWF
.
xApplication
.
Selector
.
Identity
.
ItemCategory
,
createNode
:
function
(){
this
.
className
=
"
ItemCategory
"
;
this
.
node
=
new
Element
(
"
div
"
,
{
"
styles
"
:
this
.
selector
.
css
.
selectorItemCategory_department
,
"
title
"
:
this
.
_getTtiteText
()
...
...
@@ -265,9 +346,16 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemCategory = new Class({
var
style
=
this
.
selector
.
options
.
style
;
this
.
iconNode
.
setStyle
(
"
background-image
"
,
"
url(
"
+
"
../x_component_Selector/$Selector/
"
+
style
+
"
/icon/companyicon.png)
"
);
},
_addSelect
edCount
:
function
(){
_addSelect
AllSelectedCount
:
function
(){
var
count
=
this
.
_getSelectedCount
();
this
.
checkCountAndStatus
(
count
);
this
.
_checkCountAndStatus
(
count
);
},
_addSelectedCount
:
function
(){
if
(
this
.
selector
.
loadingCount
===
"
done
"
){
var
count
=
this
.
_getSelectedCount
();
this
.
_checkCountAndStatus
(
count
);
}
},
_getTotalCount
:
function
(){
return
this
.
subItems
.
length
;
...
...
@@ -279,9 +367,12 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemCategory = new Class({
loadSub
:
function
(
callback
){
this
.
_loadSub
(
function
(
firstLoad
)
{
if
(
firstLoad
){
if
(
this
.
selector
.
options
.
showSelectedCount
||
this
.
selector
.
options
.
isCheckStatus
){
var
count
=
this
.
_getSelectedCount
();
this
.
checkCountAndStatus
(
count
);
if
(
this
.
selector
.
isCheckStatusOrCount
()
){
// var count = this._getSelectedCount();
// this.checkCountAndStatus(count);
if
(
this
.
selector
.
loadingCount
===
"
done
"
){
this
.
checkCountAndStatus
();
}
}
}
if
(
callback
)
callback
();
...
...
@@ -299,7 +390,8 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemCategory = new Class({
};
MWF
.
Actions
.
get
(
"
x_organization_assemble_express
"
).
getDuty
(
data
,
function
(
json
){
json
.
data
.
each
(
function
(
idSubData
){
var
list
=
this
.
selector
.
uniqueIdentityList
(
json
.
data
);
list
.
each
(
function
(
idSubData
){
if
(
!
this
.
selector
.
isExcluded
(
idSubData
)
)
{
var
item
=
this
.
selector
.
_newItem
(
idSubData
,
this
.
selector
,
this
.
children
,
this
.
level
+
1
,
this
);
this
.
selector
.
items
.
push
(
item
);
...
...
@@ -316,82 +408,83 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemCategory = new Class({
}.
bind
(
this
),
null
,
false
);
// if (this.selector.options.units.length){
// var action = MWF.Actions.get("x_organization_assemble_express");
// var data = {"name":this.data.name, "unit":""};
// var count = this.selector.options.units.length;
// var i = 0;
//
// if (this.selector.options.expandSubEnable) {
// this.selector.options.units.each(function(u){
// var unitName = "";
// if (typeOf(u)==="string"){
// unitName = u;
// }else{
// unitName = u.distinguishedName || u.unique || u.id || u.levelName
// }
// if (unitName){
// var unitNames;
// action.listUnitNameSubNested({"unitList": [unitName]}, function(json){
// unitNames = json.data.unitList;
// }.bind(this), null, false);
//
// unitNames.push(unitName);
// if (unitNames && unitNames.length){
// data.unitList = unitNames;
// action.getDuty(data, function(json){
// json.data.each(function(idSubData){
// if( !this.selector.isExcluded( idSubData ) ) {
// var item = this.selector._newItem(idSubData, this.selector, this.children, this.level + 1, this);
// this.selector.items.push(item);
// if(this.subItems)this.subItems.push( item );
// }
// }.bind(this));
// }.bind(this), null, false);
// }
// }
//
// i++;
// if (i>=count){
// if (!this.loaded) {
// this.loaded = true;
// this.loadingsub = false;
// this.itemLoaded = true;
// if (callback) callback();
// }
// }
// }.bind(this));
// }else{
// this.selector.options.units.each(function(u){
// if (typeOf(u)==="string"){
// data.unit = u;
// }else{
// data.unit = u.distinguishedName || u.unique || u.id || u.levelName
// }
// action.getDuty(data, function(json){
// json.data.each(function(idSubData){
// if( !this.selector.isExcluded( idSubData ) ) {
// var item = this.selector._newItem(idSubData, this.selector, this.children, this.level + 1, this);
// this.selector.items.push(item);
// if(this.subItems)this.subItems.push( item );
// }
// }.bind(this));
// i++;
// if (i>=count){
// if (!this.loaded) {
// this.loaded = true;
// this.loadingsub = false;
// this.itemLoaded = true;
// if (callback) callback();
// }
// }
// }.bind(this));
// }.bind(this));
// }
// if (this.selector.options.units.length){
// var action = MWF.Actions.get("x_organization_assemble_express");
// var data = {"name":this.data.name, "unit":""};
// var count = this.selector.options.units.length;
// var i = 0;
//
// if (this.selector.options.expandSubEnable) {
// this.selector.options.units.each(function(u){
// var unitName = "";
// if (typeOf(u)==="string"){
// unitName = u;
// }else{
// unitName = u.distinguishedName || u.unique || u.id || u.levelName
// }
// if (unitName){
// var unitNames;
// action.listUnitNameSubNested({"unitList": [unitName]}, function(json){
// unitNames = json.data.unitList;
// }.bind(this), null, false);
//
// unitNames.push(unitName);
// if (unitNames && unitNames.length){
// data.unitList = unitNames;
// action.getDuty(data, function(json){
// json.data.each(function(idSubData){
// if( !this.selector.isExcluded( idSubData ) ) {
// var item = this.selector._newItem(idSubData, this.selector, this.children, this.level + 1, this);
// this.selector.items.push(item);
// if(this.subItems)this.subItems.push( item );
// }
// }.bind(this));
// }.bind(this), null, false);
// }
// }
//
// i++;
// if (i>=count){
// if (!this.loaded) {
// this.loaded = true;
// this.loadingsub = false;
// this.itemLoaded = true;
// if (callback) callback();
// }
// }
// }.bind(this));
// }else{
// this.selector.options.units.each(function(u){
// if (typeOf(u)==="string"){
// data.unit = u;
// }else{
// data.unit = u.distinguishedName || u.unique || u.id || u.levelName
// }
// action.getDuty(data, function(json){
// json.data.each(function(idSubData){
// if( !this.selector.isExcluded( idSubData ) ) {
// var item = this.selector._newItem(idSubData, this.selector, this.children, this.level + 1, this);
// this.selector.items.push(item);
// if(this.subItems)this.subItems.push( item );
// }
// }.bind(this));
// i++;
// if (i>=count){
// if (!this.loaded) {
// this.loaded = true;
// this.loadingsub = false;
// this.itemLoaded = true;
// if (callback) callback();
// }
// }
// }.bind(this));
// }.bind(this));
// }
}
else
{
this
.
selector
.
orgAction
.
listIdentityWithDuty
(
function
(
json
){
json
.
data
.
each
(
function
(
idSubData
){
var
list
=
this
.
selector
.
uniqueIdentityList
(
json
.
data
);
list
.
each
(
function
(
idSubData
){
if
(
!
this
.
selector
.
isExcluded
(
idSubData
)
)
{
var
item
=
this
.
selector
.
_newItem
(
idSubData
,
this
.
selector
,
this
.
children
,
this
.
level
+
1
,
this
);
this
.
selector
.
items
.
push
(
item
);
...
...
@@ -433,7 +526,8 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemUnitCategory = new Class({
if
(
!
this
.
loaded
){
this
.
selector
.
orgAction
.
listIdentityWithUnit
(
function
(
idJson
){
if
(
!
this
.
itemLoaded
){
idJson
.
data
.
each
(
function
(
idSubData
){
var
list
=
this
.
selector
.
uniqueIdentityList
(
idJson
.
data
);
list
.
each
(
function
(
idSubData
){
if
(
!
this
.
selector
.
isExcluded
(
idSubData
)
)
{
var
item
=
this
.
selector
.
_newItem
(
idSubData
,
this
.
selector
,
this
.
children
,
this
.
level
+
1
,
this
);
this
.
selector
.
items
.
push
(
item
);
...
...
@@ -452,8 +546,10 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemUnitCategory = new Class({
this
.
selector
.
orgAction
.
listSubUnitDirect
(
function
(
json
){
json
.
data
.
each
(
function
(
subData
){
if
(
!
this
.
selector
.
isExcluded
(
subData
)
)
{
if
(
subData
&&
this
.
data
.
parentLevelName
)
subData
.
parentLevelName
=
this
.
data
.
parentLevelName
+
"
/
"
+
subData
.
name
;
var
category
=
this
.
selector
.
_newItemCategory
(
"
ItemUnitCategory
"
,
subData
,
this
.
selector
,
this
.
children
,
this
.
level
+
1
,
this
);
this
.
subCategorys
.
push
(
category
);
this
.
subCategoryMap
[
subData
.
parentLevelName
||
subData
.
levelName
]
=
category
;
}
}.
bind
(
this
));
this
.
loaded
=
true
;
...
...
@@ -491,7 +587,8 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemUnitCategory = new Class({
loadItemChildren
:
function
(
callback
){
if
(
!
this
.
itemLoaded
){
this
.
selector
.
orgAction
.
listIdentityWithUnit
(
function
(
idJson
){
idJson
.
data
.
each
(
function
(
idSubData
){
var
list
=
this
.
selector
.
uniqueIdentityList
(
idJson
.
data
);
list
.
each
(
function
(
idSubData
){
if
(
!
this
.
selector
.
isExcluded
(
idSubData
)
)
{
var
item
=
this
.
selector
.
_newItem
(
idSubData
,
this
.
selector
,
this
.
children
,
this
.
level
+
1
,
this
);
this
.
selector
.
items
.
push
(
item
);
...
...
o2web/source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js
浏览文件 @
46210973
此差异已折叠。
点击以展开。
o2web/source/x_component_Selector/Person.js
浏览文件 @
46210973
...
...
@@ -13,7 +13,6 @@ MWF.xApplication.Selector.Person = new Class({
"
roles
"
:
[],
"
values
"
:
[],
"
exclude
"
:
[],
"
exclude
"
:
[],
"
zIndex
"
:
1000
,
"
expand
"
:
true
,
"
embedded
"
:
false
,
//是否嵌入在其他容器中
...
...
@@ -93,10 +92,15 @@ MWF.xApplication.Selector.Person = new Class({
this
.
subCategorys
=
[];
//直接的分类
this
.
subItems
=
[];
//直接的选择项
this
.
subCategoryMap
=
{};
this
.
subCategoryMapWithDuty
=
{};
if
(
!
this
.
options
.
values
){
this
.
options
.
values
=
[];
}
this
.
availableStatusTypes
=
[
"
identity
"
,
"
custom
"
];
this
.
_init
();
},
_init
:
function
(){
...
...
@@ -1104,10 +1108,12 @@ MWF.xApplication.Selector.Person = new Class({
if
(
this
.
options
.
values
.
length
){
this
.
options
.
values
.
each
(
function
(
v
,
i
){
if
(
typeOf
(
v
)
===
"
object
"
){
v
.
isFromValues
=
true
;
this
.
selectedItems
.
push
(
this
.
_newItemSelected
(
v
,
this
,
null
));
}
else
{
this
.
_getItem
(
function
(
json
){
this
.
options
.
values
[
i
]
=
json
.
data
;
json
.
data
.
isFromValues
=
true
;
this
.
selectedItems
.
push
(
this
.
_newItemSelected
(
json
.
data
,
this
,
null
));
}.
bind
(
this
),
null
,
v
,
false
);
}
...
...
@@ -1372,6 +1378,22 @@ MWF.xApplication.Selector.Person = new Class({
}.
bind
(
this
),
null
,
role
);
}.
bind
(
this
));
},
isInValues
:
function
(
d
){
if
(
this
.
options
.
values
.
length
===
0
)
return
false
;
if
(
!
this
.
valueFlagMap
){
this
.
valueFlagMap
=
{};
this
.
options
.
values
.
each
(
function
(
e
){
if
(
!
e
)
return
;
this
.
valueFlagMap
[
typeOf
(
e
)
===
"
string
"
?
e
:
(
e
.
distinguishedName
||
e
.
id
||
e
.
unique
||
e
.
employee
||
e
.
levelName
)
]
=
true
;
}.
bind
(
this
));
}
var
map
=
this
.
valueFlagMap
;
return
(
d
.
distinguishedName
&&
map
[
d
.
distinguishedName
]
)
||
(
d
.
id
&&
map
[
d
.
id
]
)
||
(
d
.
unique
&&
map
[
d
.
unique
]
)
||
(
d
.
employee
&&
map
[
d
.
employee
]
)
||
(
d
.
levelName
&&
map
[
d
.
levelName
]
);
},
isExcluded
:
function
(
d
){
if
(
this
.
options
.
exclude
.
length
===
0
)
return
false
;
if
(
!
this
.
excludeFlagMap
){
...
...
@@ -1555,8 +1577,6 @@ MWF.xApplication.Selector.Person = new Class({
},
setSize
:
function
(){
debugger
;
if
(
!
this
.
options
.
width
&&
!
this
.
options
.
height
)
return
;
var
getOffsetX
=
function
(
node
){
...
...
@@ -1761,6 +1781,39 @@ MWF.xApplication.Selector.Person = new Class({
}
return
subCategoryListNode
;
},
isCheckStatusOrCount
:
function
(){
if
(
this
.
isCheckStatusFlag
)
return
this
.
isCheckStatusFlag
===
"
y
"
;
if
(
this
.
availableStatusTypes
.
contains
(
this
.
selectType
)
&&
(
this
.
options
.
count
.
toInt
()
!==
1
)
&&
(
this
.
options
.
resultType
!==
"
person
"
)
&&
(
this
.
options
.
showSelectedCount
||
this
.
options
.
isCheckStatus
)
){
if
(
this
.
selectType
===
"
unit
"
){
if
(
this
.
options
.
expandSubEnable
){
this
.
isCheckStatusFlag
=
"
y
"
;
return
true
;
}
else
{
this
.
isCheckStatusFlag
=
"
n
"
;
return
false
;
}
}
else
{
this
.
isCheckStatusFlag
=
"
y
"
;
return
true
;
}
}
else
{
this
.
isCheckStatusFlag
=
"
n
"
;
return
false
;
}
},
checkCountAndStatus
:
function
(){
if
(
this
.
subCategorys
&&
this
.
subCategorys
.
length
){
this
.
subCategorys
.
each
(
function
(
category
)
{
if
(
category
.
checkCountAndStatus
)
category
.
checkCountAndStatus
(
true
);
})
}
},
addSelectedCount
:
function
(
itemOrItemSelected
,
count
){
}
//checkClickFlatCategoryItem : function(categoryItemNode, itemNodeContainer){
// if( !this.flatCategorySeqObj_current ){
...
...
@@ -1827,6 +1880,8 @@ MWF.xApplication.Selector.Person.Item = new Class({
this
.
category
=
category
;
this
.
subItems
=
[];
this
.
subCategorys
=
[];
this
.
subCategoryMap
=
{};
this
.
subCategoryMapWithDuty
=
{};
if
(
!
delay
)
this
.
load
();
},
_getShowName
:
function
(){
...
...
@@ -1975,7 +2030,7 @@ MWF.xApplication.Selector.Person.Item = new Class({
// this.selectedSingle( checkValid );
// }else{
if
(
this
.
isSelected
){
this
.
unSelected
(
checkValid
);
this
.
unSelected
(
checkValid
);
}
else
{
this
.
selected
(
checkValid
);
}
...
...
@@ -2139,17 +2194,28 @@ MWF.xApplication.Selector.Person.Item = new Class({
}.
bind
(
this
))
}
var
countItems
=
[];
if
(
this
.
selectedItem
){
this
.
selector
.
selectedItems
.
erase
(
this
.
selectedItem
);
this
.
selectedItem
.
items
.
each
(
function
(
item
){
if
(
item
.
isSelected
||
(
item
===
this
&&
isSelected
)
){
var
flag
=
this
.
selector
.
options
.
selectAllRange
===
"
all
"
||
(
this
.
selector
.
selectType
==
"
identity
"
&&
(
this
.
selector
.
options
.
showSelectedCount
||
this
.
selector
.
options
.
isCheckStatus
));
if
(
flag
){
if
(
item
.
category
&&
item
.
category
.
_addSelectedCount
)
item
.
category
.
_addSelectedCount
(
-
1
,
true
);
debugger
;
if
(
this
.
selector
.
isCheckStatusOrCount
()){
this
.
selectedItem
.
items
.
each
(
function
(
item
){
if
(
item
.
isSelected
||
(
item
===
this
&&
isSelected
)
){
countItems
.
push
(
item
);
}
}
}.
bind
(
this
));
}
else
if
(
this
.
selector
.
options
.
selectAllRange
===
"
all
"
){
this
.
selectedItem
.
items
.
each
(
function
(
item
)
{
if
(
item
.
isSelected
||
(
item
===
this
&&
isSelected
))
{
if
(
item
.
category
&&
item
.
category
.
_addSelectAllSelectedCount
)
item
.
category
.
_addSelectAllSelectedCount
(
-
1
,
true
);
}
}.
bind
(
this
))
}
this
.
selectedItem
.
items
.
each
(
function
(
item
){
if
(
item
!=
this
){
item
.
isSelected
=
false
;
...
...
@@ -2168,6 +2234,11 @@ MWF.xApplication.Selector.Person.Item = new Class({
this
.
selectedItem
.
destroy
();
this
.
selectedItem
=
null
;
}
if
(
this
.
selector
.
isCheckStatusOrCount
()){
this
.
selector
.
addSelectedCount
(
this
,
-
1
,
countItems
);
}
this
.
selector
.
fireEvent
(
"
unselectItem
"
,[
this
]);
if
(
checkValid
)
this
.
selector
.
fireEvent
(
"
valid
"
,
[
this
.
selector
,
this
]);
if
(
callback
)
callback
();
...
...
@@ -2202,6 +2273,11 @@ MWF.xApplication.Selector.Person.ItemSelected = new Class({
}).
inject
(
this
.
container
);
this
.
node
.
setStyle
(
"
display
"
,
"
none
"
);
if
(
this
.
data
.
isFromValues
){
this
.
isFromValues
=
true
;
this
.
data
.
isFromValues
=
false
;
}
this
.
getData
(
function
(){
this
.
node
.
setStyle
(
"
display
"
,
""
);
this
.
load
();
...
...
@@ -2223,13 +2299,30 @@ MWF.xApplication.Selector.Person.ItemSelected = new Class({
},
clickItem
:
function
(
callback
,
checkValid
){
if
(
this
.
items
.
length
){
var
items
=
[],
map
=
{};
this
.
items
.
each
(
function
(
item
){
if
(
item
.
data
.
distinguishedName
||
item
.
data
.
unique
){
if
(
(
!
item
.
data
.
distinguishedName
||
!
map
[
item
.
data
.
distinguishedName
])
&&
(
!
item
.
data
.
unique
||
!
map
[
item
.
data
.
unique
])){
items
.
push
(
item
);
map
[
item
.
data
.
distinguishedName
]
=
true
;
map
[
item
.
data
.
unique
]
=
true
;
}
}
else
{
items
.
push
(
item
);
}
});
items
.
each
(
function
(
item
){
item
.
unSelected
(
checkValid
);
});
if
(
checkValid
)
this
.
selector
.
fireEvent
(
"
valid
"
,
[
this
.
selector
,
this
])
}
else
{
//this.item.selectedItem = null;
//this.item.isSelected = false;
if
(
this
.
selector
.
isCheckStatusOrCount
()){
this
.
selector
.
addSelectedCount
(
this
,
-
1
,
[]
);
}
this
.
destroy
();
this
.
selector
.
selectedItems
.
erase
(
this
);
if
(
checkValid
)
this
.
selector
.
fireEvent
(
"
valid
"
,
[
this
.
selector
,
this
])
...
...
@@ -2320,6 +2413,8 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
this
.
category
=
parentCategory
;
this
.
subItems
=
[];
this
.
subCategorys
=
[];
this
.
subCategoryMap
=
{};
this
.
subCategoryMapWithDuty
=
{};
if
(
!
delay
)
this
.
load
();
},
load
:
function
(){
...
...
@@ -2500,7 +2595,7 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
var
m
=
this
.
textNode
.
getStyle
(
"
margin-left
"
).
toFloat
()
+
indent
;
this
.
textNode
.
setStyle
(
"
margin-left
"
,
""
+
m
+
"
px
"
);
if
(
this
.
selector
.
options
.
showSelectedCount
&&
this
.
selector
.
selectType
==
"
identity
"
){
if
(
this
.
selector
.
options
.
showSelectedCount
&&
this
.
selector
.
availableStatusTypes
.
contains
(
this
.
selector
.
selectType
)
){
this
.
selectedCountNode
=
new
Element
(
"
span
"
).
inject
(
this
.
textNode
);
}
...
...
@@ -2650,7 +2745,7 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
var
styles
=
this
.
selector
.
css
.
selectorItemCategoryActionNode_selectAll_selected
;
if
(
this
.
selector
.
options
.
isCheckStatus
&&
this
.
selector
.
selectType
===
"
identity
"
){
if
(
this
.
selector
.
options
.
isCheckStatus
&&
this
.
selector
.
availableStatusTypes
.
contains
(
this
.
selector
.
selectType
)
){
if
(
this
.
_getSelectedCount
()
<
this
.
_getTotalCount
()
){
styles
=
this
.
selector
.
css
.
selectorItemCategoryActionNode_selectsome_selected
;
}
...
...
@@ -2829,8 +2924,62 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
}
else
{
return
this
.
data
.
name
;
}
},
checkCountAndStatus
:
function
(
nestedSub
){
var
count
=
this
.
_getSelectedCount
();
this
.
_checkCountAndStatus
(
count
);
if
(
nestedSub
&&
this
.
subCategorys
&&
this
.
subCategorys
.
length
){
this
.
subCategorys
.
each
(
function
(
category
){
if
(
category
.
checkCountAndStatus
)
category
.
checkCountAndStatus
(
nestedSub
);
}.
bind
(
this
))
}
},
_checkCountAndStatus
:
function
(
count
){
if
(
this
.
selector
.
isCheckStatusOrCount
()
){
if
(
this
.
selectedCountNode
){
if
(
this
.
selector
.
options
.
showSelectedCount
&&
this
.
selector
.
options
.
showAllCount
){
var
totalCount
=
this
.
_getTotalCount
();
if
(
count
||
totalCount
)
this
.
selectedCountNode
.
set
(
"
text
"
,
(
count
||
0
)
+
"
/
"
+
(
totalCount
||
0
));
}
else
if
(
this
.
selector
.
options
.
showSelectedCount
){
this
.
selectedCountNode
.
set
(
"
text
"
,
count
?
"
(
"
+
count
+
"
)
"
:
""
);
}
else
if
(
this
.
selector
.
options
.
showAllCount
){
var
totalCount
=
this
.
_getTotalCount
();
this
.
selectedCountNode
.
set
(
"
text
"
,
totalCount
?
"
(
"
+
totalCount
+
"
)
"
:
""
);
}
}
if
(
this
.
selector
.
options
.
isCheckStatus
&&
this
.
selectAllNode
){
var
total
=
this
.
_getTotalCount
();
if
(
total
){
var
styles
;
if
(
count
>=
total
){
styles
=
this
.
selector
.
css
.
selectorItemCategoryActionNode_selectAll_selected
;
this
.
isSelectedSome
=
false
;
this
.
isSelectedAll
=
true
;
}
else
if
(
count
>
0
){
styles
=
this
.
selector
.
css
.
selectorItemCategoryActionNode_selectsome_selected
;
this
.
isSelectedSome
=
true
;
this
.
isSelectedAll
=
false
;
}
else
{
styles
=
this
.
selector
.
css
.
selectorItemCategoryActionNode_selectAll
;
this
.
isSelectedSome
=
false
;
this
.
isSelectedAll
=
false
;
}
this
.
selectAllNode
.
setStyles
(
styles
);
}
}
}
else
if
(
count
===
0
&&
this
.
selector
.
options
.
selectAllRange
===
"
all
"
&&
this
.
selectAllNode
){
styles
=
this
.
selector
.
css
.
selectorItemCategoryActionNode_selectAll
;
this
.
isSelectedSome
=
false
;
this
.
isSelectedAll
=
false
;
this
.
selectAllNode
.
setStyles
(
styles
);
}
// if( !this.selectedCountNode1 ){
// this.selectedCountNode1 = new Element("span").inject(this.textNode);
// }
// this.selectedCountNode1.set("text",count);
}
})
;
})
MWF
.
xApplication
.
Selector
.
Person
.
ItemGroupCategory
=
new
Class
({
Extends
:
MWF
.
xApplication
.
Selector
.
Person
.
ItemCategory
,
...
...
o2web/source/x_component_Selector/Unit.js
浏览文件 @
46210973
...
...
@@ -29,6 +29,9 @@ MWF.xApplication.Selector.Unit = new Class({
return
;
}
this
.
_loadSelectItems
();
},
_loadSelectItems
:
function
(){
var
afterLoadSelectItemFun
=
this
.
afterLoadSelectItem
.
bind
(
this
);
if
(
this
.
options
.
units
.
length
){
...
...
@@ -41,6 +44,12 @@ MWF.xApplication.Selector.Unit = new Class({
unitList
.
push
(
unit
.
id
||
unit
.
distinguishedName
||
unit
.
unique
||
unit
.
levelName
);
}
}
if
(
this
.
isCheckStatusOrCount
()
)
{
this
.
loadingCount
=
"
wait
"
;
this
.
loadCount
(
unitList
);
}
o2
.
Actions
.
load
(
"
x_organization_assemble_express
"
).
UnitAction
.
listObject
(
{
"
unitList
"
:
unitList
}
,
function
(
json
)
{
debugger
;
if
(
json
.
data
.
length
){
...
...
@@ -49,6 +58,7 @@ MWF.xApplication.Selector.Unit = new Class({
if
(
data
.
subDirectUnitCount
){
var
category
=
this
.
_newItemCategory
(
"
ItemCategory
"
,
data
,
this
,
this
.
itemAreaNode
);
this
.
subCategorys
.
push
(
category
);
this
.
subCategoryMap
[
data
.
levelName
]
=
category
;
}
}
else
{
var
item
=
this
.
_newItem
(
data
,
this
,
this
.
itemAreaNode
);
...
...
@@ -59,92 +69,25 @@ MWF.xApplication.Selector.Unit = new Class({
}
afterLoadSelectItemFun
();
}.
bind
(
this
),
afterLoadSelectItemFun
)
// var unitLoaded = 0;
//
// var loadUnitSuccess = function () {
// unitLoaded++;
// if( unitLoaded === this.options.units.length ){
// afterLoadSelectItemFun();
// }
// }.bind(this);
// var loadUnitFailure = loadUnitSuccess;
//
// this.options.units.each(function(unit){
//
// var container = new Element("div").inject( this.itemAreaNode );
//
// // this.action.listUnitByKey(function(json){
// // if (json.data.length){
// // json.data.each(function(data){
// // if (data.subDirectUnitCount) var category = this._newItemCategory("ItemCategory", data, this, this.itemAreaNode);
// // }.bind(this));
// // }
// // }.bind(this), null, comp);
//
// if (typeOf(unit)==="string"){
// this.orgAction.getUnit(function(json){
// json.data = typeOf( json.data ) == "object" ? [json.data] : json.data;
// if (json.data.length){
// json.data.each( function(data){
// if( this.options.expandSubEnable ){
// if (data.subDirectUnitCount){
// var category = this._newItemCategory("ItemCategory", data, this, container );
// this.subCategorys.push(category);
// }
// }else{
// var item = this._newItem( data, this, container );
// this.items.push( item );
// this.subItems.push(item);
// }
// }.bind(this));
// }
// loadUnitSuccess();
// }.bind(this), loadUnitFailure, unit);
//
//
// }else{
// this.orgAction.getUnit(function(json){
// json.data = typeOf( json.data ) == "object" ? [json.data] : json.data;
// if (json.data.length){
// json.data.each( function(data){
// if( this.options.expandSubEnable ) {
// if (data.subDirectUnitCount){
// var category = this._newItemCategory("ItemCategory", data, this, container );
// this.subCategorys.push(category);
// }
// }else{
// var item = this._newItem(data, this, container );
// this.items.push( item );
// this.subItems.push(item);
// }
// }.bind(this));
// }
// loadUnitSuccess();
// }.bind(this), loadUnitFailure, unit.id);
// //if (unit.subDirectUnitCount) var category = this._newItemCategory("ItemCategory", unit, this, this.itemAreaNode);
// }
//
// }.bind(this));
}
else
{
this
.
orgAction
.
listTopUnit
(
function
(
json
){
// if( this.isCheckStatusOrCount() ) {
// this.loadingCount = "wait";
//
// unitList = json.data.filter(function (data) {
// return !this.isExcluded( data );
// }).map(function(data){
// return unit.id || unit.distinguishedName || unit.unique || unit.levelName
// }.bind(this)).clean();
//
// this.loadCount( unitList );
// }
json
.
data
.
each
(
function
(
data
){
// var flag = true;
// if (this.options.unitTypes.length){
// flag = data.typeList.some(function(item){
// return (!this.options.unitTypes.length) || (this.options.unitTypes.indexOf(item)!==-1)
// }.bind(this));
// }
// if (flag){
if
(
!
this
.
isExcluded
(
data
)
)
{
var
unit
=
this
.
_newItem
(
data
,
this
,
this
.
itemAreaNode
,
1
);
this
.
items
.
push
(
unit
);
this
.
subItems
.
push
(
unit
);
}
//unit.loadSubItem();
// }else{
// var category = this._newItemCategory("ItemCategory", data, this, this.itemAreaNode);
// }
}.
bind
(
this
));
afterLoadSelectItemFun
();
...
...
@@ -219,6 +162,158 @@ MWF.xApplication.Selector.Unit = new Class({
},
_newItemSearch
:
function
(
data
,
selector
,
container
,
level
){
return
new
MWF
.
xApplication
.
Selector
.
Unit
.
SearchItem
(
data
,
selector
,
container
,
level
);
},
loadCount
:
function
(
unitList
){
var
check
=
function
()
{
this
.
loadingCount
=
"
ready
"
;
this
.
checkCountAndStatus
();
this
.
loadingCount
=
"
done
"
;
}.
bind
(
this
);
var
unitLoaded
,
selectedUnitLoaded
,
excludeUnitLoaded
;
var
unitTree
;
this
.
unitExcludedCount
=
{};
this
.
unitSelectedCount
=
{};
debugger
;
var
caculate
=
function
()
{
if
(
unitLoaded
&&
selectedUnitLoaded
&&
excludeUnitLoaded
)
{
if
(
!
this
.
allUnitObject
)
this
.
allUnitObject
=
{};
if
(
unitTree
&&
unitTree
.
length
){
unitTree
.
each
(
function
(
tree
)
{
if
(
!
this
.
allUnitObject
[
tree
.
levelName
]
){
this
.
caculateNestedSubCount
(
tree
)
}
}.
bind
(
this
)
);
check
();
}
}
}.
bind
(
this
);
this
.
getUnitCountMap
(
this
.
options
.
values
,
function
(
map
)
{
this
.
unitSelectedCount
=
map
;
selectedUnitLoaded
=
true
;
caculate
();
}.
bind
(
this
));
this
.
getUnitCountMap
(
this
.
options
.
exclude
,
function
(
map
)
{
this
.
unitExcludedCount
=
map
;
excludeUnitLoaded
=
true
;
caculate
();
}.
bind
(
this
));
o2
.
Actions
.
load
(
"
x_organization_assemble_express
"
).
UnitAction
.
listWithUnitTree
({
"
unitList
"
:
unitList
},
function
(
json
)
{
unitTree
=
json
.
data
;
unitLoaded
=
true
;
caculate
();
}.
bind
(
this
))
},
getUnitCountMap
:
function
(
identityList
,
callback
){
var
result
=
{};
this
.
listUnitObject
(
identityList
,
function
(
identityObjectList
)
{
identityObjectList
.
each
(
function
(
id
)
{
if
(
id
&&
id
.
levelName
)
{
result
[
id
.
levelName
]
=
(
result
[
id
.
levelName
]
||
0
)
+
1
;
}
}.
bind
(
this
));
if
(
callback
)
callback
(
result
);
})
},
listUnitObject
:
function
(
unitList
,
callback
){
var
list
=
[];
unitList
.
each
(
function
(
d
)
{
if
(
typeOf
(
d
)
===
"
object
"
){
if
(
!
d
.
levelName
||
!
d
.
distinguishedName
)
list
.
push
(
d
.
distinguishedName
||
d
.
id
||
d
.
unique
)
}
else
{
list
.
push
(
d
)
}
});
if
(
list
.
length
>
0
){
o2
.
Actions
.
load
(
"
x_organization_assemble_express
"
).
UnitAction
.
listObject
({
unitList
:
list
},
function
(
json
)
{
var
map
=
{};
json
.
data
.
each
(
function
(
d
)
{
map
[
d
.
matchKey
]
=
d
;
});
var
unitObjectList
=
[];
unitList
.
each
(
function
(
d
)
{
var
key
=
typeOf
(
d
)
===
"
object
"
?
(
d
.
distinguishedName
||
d
.
id
||
d
.
unique
)
:
d
;
unitObjectList
.
push
(
map
[
key
]
?
map
[
key
]
:
d
);
});
if
(
callback
)
callback
(
unitList
);
}.
bind
(
this
))
}
else
{
if
(
callback
)
callback
(
unitList
);
}
},
caculateNestedSubCount
:
function
(
tree
)
{
if
(
this
.
isExcluded
(
tree
)
)
return
;
var
count
;
var
selectedCount
;
if
(
!
this
.
allUnitObject
[
tree
.
levelName
]){
this
.
allUnitObject
[
tree
.
levelName
]
=
tree
;
count
=
tree
.
subDirectUnitCount
;
if
(
this
.
unitExcludedCount
&&
this
.
unitExcludedCount
[
tree
.
levelName
]
){
count
=
(
count
||
0
)
-
this
.
unitExcludedCount
[
tree
.
levelName
];
}
selectedCount
=
0
;
if
(
this
.
unitSelectedCount
&&
this
.
unitSelectedCount
[
tree
.
levelName
]
){
selectedCount
=
this
.
unitSelectedCount
[
tree
.
levelName
];
}
}
else
{
count
=
this
.
allUnitObject
[
tree
.
levelName
].
subNestedUnitCount
||
0
;
selectedCount
=
this
.
allUnitObject
[
tree
.
levelName
].
selectedNestedUnitCount
||
0
;
}
var
nameList
=
tree
.
levelName
.
split
(
"
/
"
);
var
names
=
[];
nameList
.
each
(
function
(
n
)
{
names
.
push
(
n
);
var
levelName
=
names
.
join
(
"
/
"
);
var
unitObject
=
this
.
allUnitObject
[
levelName
];
if
(
unitObject
){
unitObject
.
subNestedUnitCount
=
(
unitObject
.
subNestedUnitCount
||
0
)
+
count
;
unitObject
.
selectedNestedUnitCount
=
(
unitObject
.
selectedNestedUnitCount
||
0
)
+
selectedCount
;
}
}.
bind
(
this
));
tree
.
subUnits
.
each
(
function
(
unit
)
{
this
.
caculateNestedSubCount
(
unit
)
}.
bind
(
this
))
},
_addSelectedCount
:
function
(
itemOrItemSelected
,
count
){
var
itemData
=
itemOrItemSelected
.
data
;
[
itemOrItemSelected
.
data
.
levelName
].
each
(
function
(
levelName
){
if
(
!
levelName
)
return
;
var
list
=
levelName
.
split
(
"
/
"
);
var
nameList
=
[];
var
subCategoryMapList
=
[
this
.
subCategoryMap
];
for
(
var
j
=
0
;
j
<
list
.
length
;
j
++
)
{
nameList
.
push
(
list
[
j
]);
var
name
=
nameList
.
join
(
"
/
"
);
var
maplist
=
[];
subCategoryMapList
.
each
(
function
(
subCategoryMap
){
if
(
subCategoryMap
[
name
]
)
{
var
category
=
subCategoryMap
[
name
];
category
.
_addSelectedCount
(
count
);
maplist
.
push
(
category
.
subCategoryMap
)
;
}
});
subCategoryMapList
=
subCategoryMapList
.
concat
(
maplist
);
if
(
this
.
loadingCount
===
"
done
"
){
var
obj
=
this
.
allUnitObject
[
name
];
if
(
obj
)
{
obj
.
selectedNestedUnitCount
=
obj
.
selectedNestedUnitCount
+
count
;
}
}
}
}.
bind
(
this
));
}
});
...
...
@@ -820,6 +915,22 @@ MWF.xApplication.Selector.Unit.ItemSelected = new Class({
MWF
.
xApplication
.
Selector
.
Unit
.
ItemCategory
=
new
Class
({
Extends
:
MWF
.
xApplication
.
Selector
.
Identity
.
ItemCategory
,
_getTotalCount
:
function
(){
if
(
!
this
.
selector
.
allUnitObject
)
return
0
;
var
unit
=
this
.
selector
.
allUnitObject
[
this
.
data
.
levelName
];
var
count
=
unit
?
unit
.
subNestedUnitCount
:
0
;
return
count
;
},
_getSelectedCount
:
function
(){
if
(
typeOf
(
this
.
selectedCount
)
===
"
number
"
)
return
this
.
selectedCount
;
if
(
!
this
.
selector
.
allUnitObject
)
return
0
;
var
unit
=
this
.
selector
.
allUnitObject
[
this
.
data
.
levelName
];
var
count
=
unit
?
unit
.
selectedNestedUnitCount
:
0
;
this
.
selectedCount
=
count
+
(
this
.
selectedCount_wait
||
0
);
this
.
selectedCount_wait
=
0
;
return
this
.
selectedCount
;
},
loadSub
:
function
(
callback
){
if
(
!
this
.
loaded
){
this
.
selector
.
orgAction
.
listSubUnitDirect
(
function
(
subJson
){
...
...
@@ -831,6 +942,7 @@ MWF.xApplication.Selector.Unit.ItemCategory = new Class({
this
.
selector
.
items
.
push
(
category
);
if
(
this
.
subItems
)
this
.
subItems
.
push
(
category
);
this
.
subCategorys
.
push
(
category
);
this
.
subCategoryMap
[
subData
.
levelName
]
=
category
;
}
//var category = this.selector._newItemCategory("ItemCategory", subData, this.selector, this.children, this.level+1);
}.
bind
(
this
));
...
...
@@ -869,6 +981,7 @@ MWF.xApplication.Selector.Unit.ItemCategory = new Class({
category
.
load
();
//if(this.subItems)this.subItems.push( category );
this
.
subCategorys
.
push
(
category
);
this
.
subCategoryMap
[
subData
.
levelName
]
=
category
;
}
//var category = this.selector._newItemCategory("ItemCategory", subData, this.selector, this.children, this.level+1);
}.
bind
(
this
));
...
...
o2web/source/x_component_Selector/UnitWithType.js
浏览文件 @
46210973
...
...
@@ -29,6 +29,9 @@ MWF.xApplication.Selector.UnitWithType = new Class({
return
;
}
this
.
_loadSelectItems
();
},
_loadSelectItems
:
function
(){
var
afterLoadSelectItemFun
=
this
.
afterLoadSelectItem
.
bind
(
this
);
var
data
=
{};
...
...
@@ -42,6 +45,11 @@ MWF.xApplication.Selector.UnitWithType = new Class({
}
}.
bind
(
this
));
if
(
this
.
isCheckStatusOrCount
()
)
{
this
.
loadingCount
=
"
wait
"
;
this
.
loadCount
(
data
.
unitList
);
}
//data.unitList = this.options.units;
this
.
orgAction
.
listUnitByType
(
function
(
json
){
if
(
json
.
data
.
length
){
...
...
@@ -55,6 +63,7 @@ MWF.xApplication.Selector.UnitWithType = new Class({
if
(
data
.
woSubDirectUnitList
.
length
){
var
category
=
this
.
_newItemCategory
(
"
ItemCategory
"
,
data
,
this
,
this
.
itemAreaNode
);
this
.
subCategorys
.
push
(
category
);
this
.
subCategoryMap
[
data
.
levelName
]
=
category
;
}
}
}
...
...
@@ -225,6 +234,7 @@ MWF.xApplication.Selector.UnitWithType.Item = new Class({
if
(
subData
.
woSubDirectUnitList
.
length
){
// ? 原来是data.woSubDirectUnitList.length 2020-3-1
var
category
=
this
.
selector
.
_newItemCategory
(
"
ItemCategory
"
,
subData
,
this
.
selector
,
this
.
children
,
this
.
level
+
1
,
this
);
this
.
subCategorys
.
push
(
category
);
this
.
subCategoryMap
[
subData
.
levelName
]
=
category
;
}
}
}
...
...
@@ -249,6 +259,7 @@ MWF.xApplication.Selector.UnitWithType.Item = new Class({
if
(
subData
.
woSubDirectUnitList
.
length
){
var
category
=
this
.
selector
.
_newItemCategory
(
"
ItemCategory
"
,
subData
,
this
.
selector
,
this
.
children
,
this
.
level
+
1
,
this
);
this
.
subCategorys
.
push
(
category
);
this
.
subCategoryMap
[
subData
.
levelName
]
=
category
;
}
}
}
...
...
@@ -334,6 +345,7 @@ MWF.xApplication.Selector.UnitWithType.ItemCategory = new Class({
if
(
subData
.
woSubDirectUnitList
.
length
){
var
category
=
this
.
selector
.
_newItemCategory
(
"
ItemCategory
"
,
subData
,
this
.
selector
,
this
.
children
,
this
.
level
+
1
,
this
);
this
.
subCategorys
.
push
(
category
);
this
.
subCategoryMap
[
subData
.
levelName
]
=
category
;
}
}
}
...
...
@@ -390,6 +402,7 @@ MWF.xApplication.Selector.UnitWithType.ItemCategory = new Class({
if
(
subData
.
woSubDirectUnitList
.
length
){
var
category
=
this
.
selector
.
_newItemCategory
(
"
ItemCategory
"
,
subData
,
this
.
selector
,
this
.
children
,
this
.
level
+
1
,
this
);
this
.
subCategorys
.
push
(
category
);
this
.
subCategoryMap
[
subData
.
levelName
]
=
category
;
}
}
}
...
...
o2web/source/x_component_Template/Selector/Custom.js
浏览文件 @
46210973
...
...
@@ -72,8 +72,17 @@ MWF.xApplication.Template.Selector.Custom = new Class({
this
.
subCategorys
=
[];
//直接的分类
this
.
subItems
=
[];
//直接的选择项
this
.
availableStatusTypes
=
[
"
identity
"
,
"
custom
"
];
this
.
_init
();
},
_init
:
function
(){
this
.
selectType
=
"
custom
"
;
this
.
className
=
"
Custom
"
},
loadSelectItems
:
function
(
addToNext
)
{
this
.
loadingCount
=
"
done
"
;
if
(
!
this
.
options
.
category
)
{
this
.
options
.
selectableItems
.
each
(
function
(
it
)
{
var
name
=
typeOf
(
it
)
===
"
string
"
?
it
:
it
.
name
;
...
...
@@ -83,6 +92,9 @@ MWF.xApplication.Template.Selector.Custom = new Class({
this
.
subItems
.
push
(
item
);
}.
bind
(
this
))
}
else
{
if
(
this
.
isCheckStatusOrCount
()
){
this
.
loadCount
();
}
this
.
options
.
selectableItems
.
each
(
function
(
item
,
index
)
{
if
(
item
.
isItem
)
{
var
item
=
this
.
_newItem
(
item
,
this
,
this
.
itemAreaNode
);
...
...
@@ -199,6 +211,80 @@ MWF.xApplication.Template.Selector.Custom = new Class({
}
else
{
if
(
callback
)
callback
();
}
},
loadCount
:
function
(){
this
.
allCategoryDataObject
=
{};
this
.
getValueString
(
this
.
options
.
values
);
this
.
calculateCount
();
},
reloadCount
:
function
(){
var
map
=
this
.
allCategoryDataObject
;
for
(
var
key
in
map
){
map
[
key
].
subNestedItemCount
=
0
;
map
[
key
].
selectedNestedItemCount
=
0
;
}
var
values
=
this
.
selectedItems
.
map
(
function
(
item
)
{
return
item
.
data
;
}.
bind
(
this
));
this
.
getValueString
(
values
);
this
.
calculateCount
();
},
getValueString
:
function
(
values
){
this
.
valueStringList
=
values
.
map
(
function
(
item
)
{
switch
(
o2
.
typeOf
(
item
))
{
case
"
string
"
:
return
item
;
case
"
object
"
:
return
this
.
options
.
uniqueFlag
?
item
[
this
.
options
.
uniqueFlag
]
:
(
item
.
id
||
item
.
name
);
default
:
return
""
;
}
}.
bind
(
this
));
},
calculateCount
:
function
(
data
,
parentLevelName
){
var
map
=
this
.
allCategoryDataObject
;
if
(
data
){
var
levelName
=
parentLevelName
?
(
parentLevelName
+
"
/
"
+
data
.
name
)
:
data
.
name
;
if
(
!
map
[
levelName
]
)
map
[
levelName
]
=
data
;
if
(
data
.
subItemList
&&
data
.
subItemList
.
length
){
var
selectedItems
=
data
.
subItemList
.
filter
(
function
(
item
){
var
string
=
this
.
options
.
uniqueFlag
?
item
[
this
.
options
.
uniqueFlag
]
:
(
item
.
id
||
item
.
name
);
return
this
.
valueStringList
.
contains
(
string
);
}.
bind
(
this
));
var
nameList
=
[];
levelName
.
split
(
"
/
"
).
each
(
function
(
name
){
nameList
.
push
(
name
);
var
lName
=
nameList
.
join
(
"
/
"
);
var
d
=
map
[
lName
];
if
(
d
){
d
.
subNestedItemCount
=
(
d
.
subNestedItemCount
||
0
)
+
data
.
subItemList
.
length
;
d
.
selectedNestedItemCount
=
(
d
.
selectedNestedItemCount
||
0
)
+
selectedItems
.
length
;
}
});
}
if
(
data
.
subCategoryList
&&
data
.
subCategoryList
.
length
){
data
.
subCategoryList
.
each
(
function
(
category
)
{
this
.
calculateCount
(
category
,
levelName
);
}.
bind
(
this
))
}
}
else
{
this
.
options
.
selectableItems
.
each
(
function
(
item
,
i
)
{
if
(
!
item
.
isItem
)
this
.
calculateCount
(
item
,
""
);
}.
bind
(
this
))
}
},
addSelectedCount
:
function
(
itemOrItemSelected
,
count
,
items
){
var
itemData
=
itemOrItemSelected
.
data
;
debugger
;
items
.
each
(
function
(
item
){
if
(
item
.
category
&&
item
.
category
.
_addSelectedCount
){
item
.
category
.
_addSelectedCount
(
count
,
true
);
}
}.
bind
(
this
));
}
});
MWF
.
xApplication
.
Template
.
Selector
.
Custom
.
Item
=
new
Class
({
...
...
@@ -295,6 +381,15 @@ MWF.xApplication.Template.Selector.Custom.ItemSelected = new Class({
}.
bind
(
this
));
}
}
debugger
;
if
(
!
this
.
isFromValues
){
if
(
this
.
selector
.
isCheckStatusOrCount
()
){
this
.
selector
.
addSelectedCount
(
this
,
1
,
items
||
[]);
}
}
if
(
this
.
afterCheck
)
this
.
afterCheck
();
}
});
...
...
@@ -305,6 +400,9 @@ MWF.xApplication.Template.Selector.Custom.ItemCategory = new Class({
return
this
.
data
.
name
;
},
createNode
:
function
()
{
if
(
!
this
.
levelName
){
this
.
levelName
=
this
.
category
?
(
this
.
category
.
levelName
+
"
/
"
+
this
.
data
.
name
)
:
this
.
data
.
name
;
}
this
.
node
=
new
Element
(
"
div
"
,
{
"
styles
"
:
this
.
selector
.
css
.
selectorItemCategory_department
}).
inject
(
this
.
container
);
...
...
@@ -316,6 +414,37 @@ MWF.xApplication.Template.Selector.Custom.ItemCategory = new Class({
_getTtiteText
:
function
()
{
return
this
.
data
.
name
;
},
_addSelectedCount
:
function
(
count
,
nested
){
//增加数字并向上回溯
if
(
this
.
selector
.
loadingCount
===
"
done
"
){
var
c
=
(
this
.
_getSelectedCount
()
||
0
)
+
count
;
this
.
selectedCount
=
c
;
this
.
_checkCountAndStatus
(
c
);
}
else
{
this
.
selectedCount_wait
=
(
this
.
selectedCount_wait
||
0
)
+
count
;
}
if
(
nested
&&
this
.
category
&&
this
.
category
.
_addSelectedCount
){
this
.
category
.
_addSelectedCount
(
count
,
nested
);
}
},
_getTotalCount
:
function
(){
// return this.subItems.length;
if
(
!
this
.
selector
.
allCategoryDataObject
)
return
0
;
var
d
=
this
.
selector
.
allCategoryDataObject
[
this
.
levelName
];
return
d
?
d
.
subNestedItemCount
:
0
;
},
_getSelectedCount
:
function
(){
if
(
typeOf
(
this
.
selectedCount
)
===
"
number
"
)
return
this
.
selectedCount
;
if
(
!
this
.
selector
.
allCategoryDataObject
)
return
0
;
var
d
=
this
.
selector
.
allCategoryDataObject
[
this
.
levelName
];
var
count
=
d
?
d
.
selectedNestedItemCount
:
0
;
this
.
selectedCount
=
count
+
(
this
.
selectedCount_wait
||
0
);
this
.
selectedCount_wait
=
0
;
return
this
.
selectedCount
;
},
// _getSelectedCount : function(){
// var list = this.subItems.filter( function (item) { return item.isSelected; });
// return list.length;
// },
clickItem
:
function
(
callback
)
{
if
(
this
.
_hasChild
()
||
this
.
selector
.
options
.
expandEmptyCategory
)
{
var
firstLoaded
=
!
this
.
loaded
;
...
...
@@ -389,6 +518,7 @@ MWF.xApplication.Template.Selector.Custom.ItemCategory = new Class({
this
.
subCategorys
.
push
(
category
);
}.
bind
(
this
));
}
this
.
loaded
=
true
;
if
(
callback
)
callback
();
}
else
{
...
...
@@ -414,6 +544,22 @@ MWF.xApplication.Template.Selector.Custom.ItemCategory = new Class({
this
.
actionNode
.
setStyles
(
this
.
selector
.
css
.
selectorItemCategoryActionNode_collapse
);
this
.
isExpand
=
false
;
}
debugger
;
if
(
this
.
selector
.
isCheckStatusOrCount
()
){
if
(
this
.
selector
.
loadingCount
===
"
done
"
){
this
.
checkCountAndStatus
();
}
}
},
reloadCount
:
function
()
{
if
(
this
.
selector
.
isCheckStatusOrCount
()
){
this
.
selector
.
reloadCount
();
if
(
this
.
selector
.
loadingCount
===
"
done
"
){
this
.
checkCountAndStatus
();
}
}
}
});
...
...
@@ -435,6 +581,17 @@ MWF.xApplication.Template.Selector.Custom.ItemCategorySelectable = new Class({
_getTtiteText
:
function
()
{
return
this
.
data
.
name
;
},
_addSelectedCount
:
function
(
count
,
nested
){
//增加数字并向上回溯
},
_getTotalCount
:
function
(){
},
_getSelectedCount
:
function
(){
},
destroy
:
function
(){
if
(
this
.
isSelected
)
this
.
unSelected
();
this
.
selector
.
items
.
erase
(
this
);
...
...
@@ -574,5 +731,8 @@ MWF.xApplication.Template.Selector.Custom.ItemCategorySelectable = new Class({
},
afterLoad
:
function
()
{
},
reloadCount
:
function
()
{
}
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录