Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzrt
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzrt
提交
fb21e1df
提交
fb21e1df
编写于
9月 07, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更名
上级
41e37bdc
变更
7
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
365 行增加
和
396 行删除
+365
-396
app-header-menus.vue
app_Web/src/components/app-header-menus/app-header-menus.vue
+1
-1
login.vue
app_Web/src/components/login/login.vue
+1
-1
environment.ts
app_Web/src/environments/environment.ts
+1
-1
dept-tree-treeview.vue
...s/ibzdepartment/dept-tree-treeview/dept-tree-treeview.vue
+0
-190
org-tree-treeview.vue
...s/ibzorganization/org-tree-treeview/org-tree-treeview.vue
+0
-182
dept-tree-treeview.vue
.../sys-department/dept-tree-treeview/dept-tree-treeview.vue
+185
-11
org-tree-treeview.vue
.../sys-organization/org-tree-treeview/org-tree-treeview.vue
+177
-10
未找到文件。
app_Web/src/components/app-header-menus/app-header-menus.vue
浏览文件 @
fb21e1df
...
...
@@ -41,7 +41,7 @@ export default class AppHeaderMenus extends Vue {
{
name
:
"ibizstudio"
,
title
:
"components.appHeaderMenus.ibizstudio.title"
,
url
:
`
${
Environment
.
StudioUrl
}
?#/common_
slnindex/srfkeys=
${
Environment
.
SlnId
}
/sysdesign_psdevslnsysmodeltreeexpview
`
,
url
:
`
${
Environment
.
StudioUrl
}
?#/common_
mosindex/srfkeys=
${
Environment
.
SysId
}
`
,
iconcls
:
'fa fa-wrench'
,
},
{
...
...
app_Web/src/components/login/login.vue
浏览文件 @
fb21e1df
...
...
@@ -89,7 +89,7 @@
* @type {*}
* @memberof Login
*/
public
form
:
any
=
{
loginname
:
'
guest
'
,
password
:
'123456'
};
public
form
:
any
=
{
loginname
:
'
ibzadmin
'
,
password
:
'123456'
};
/**
...
...
app_Web/src/environments/environment.ts
浏览文件 @
fb21e1df
...
...
@@ -24,7 +24,7 @@ export const Environment = {
// 是否开启权限认证
enablePermissionValid
:
false
,
// 项目模板地址
ProjectUrl
:
"http
://demo.ibizlab.cn/ibizr7pfstdtempl/ibizvuer7
"
,
ProjectUrl
:
"http
s://gitee.com/ibizlab/ibizlab-runtime
"
,
// 打开目标工具,可选参数:sln、mos
debugOpenMode
:
'mos'
,
// 配置平台地址
...
...
app_Web/src/widgets/ibzdepartment/dept-tree-treeview/dept-tree-treeview.vue
已删除
100644 → 0
浏览文件 @
41e37bdc
<
template
>
<div
class=
"design-tree-container"
>
<context-menu-container>
<el-input
size=
"small"
placeholder=
"搜索..."
v-model=
"filerText"
@
input=
"filterChange"
>
<i
slot=
"prefix"
class=
"el-input__icon el-icon-search"
></i>
</el-input>
<el-tree
:filter-node-method=
"filterNode"
class=
"tre"
:data=
"this.TreeData"
ref=
"DeptTree"
:show-checkbox=
"false"
node-key=
"id"
:default-expand-all=
"false"
highlight-current
:default-expanded-keys=
"this.defaultExpandedKeys"
:props=
"this.defaultProps"
@
node-click=
"handleNodeClick"
>
<span
class=
"custom-tree-node"
slot-scope=
"
{node, data}">
<i
v-if=
"node.isLeaf"
class=
"fa fa-building"
style=
"margin-right: 2px;"
></i>
<i
v-if=
"!node.isLeaf"
class=
"fa fa-building-o"
style=
"margin-right: 2px;"
></i>
<span>
{{
node
.
label
}}
</span>
</span>
</el-tree>
</context-menu-container>
</div>
</
template
>
<
script
lang=
'tsx'
>
import
{
Component
,
Vue
}
from
'vue-property-decorator'
;
@
Component
({
components
:
{}
})
export
default
class
DeptTree
extends
Vue
{
// 过滤文本
public
filerText
:
any
=
''
;
/**
* 过滤节点
*/
public
filterNode
(
value
:
any
,
data
:
any
){
if
(
!
value
)
return
true
;
return
data
.
label
.
indexOf
(
value
)
!==-
1
;
}
/**
* 树搜索触发
*/
public
filterChange
(){
const
DeptTree
:
any
=
this
.
$refs
.
DeptTree
;
DeptTree
.
filter
(
this
.
filerText
);
}
/*树数据*/
public
TreeData
:
any
=
[];
/*树显示说明:子树为节点对象的children,节点标签为节点对象的label*/
public
defaultProps
:
any
=
{
children
:
'children'
,
label
:
'label'
}
/*默认展开节点*/
public
defaultExpandedKeys
:
any
=
[];
/*当前登录人信息*/
public
curUserContext
:
any
=
{};
/**
* vue 创建
*/
public
created
()
{
var
_this
:
any
=
this
;
// 获取当前登录人信息
if
(
_this
&&
_this
.
$attrs
&&
_this
.
$attrs
.
context
)
{
_this
.
curUserContext
=
_this
.
$attrs
.
context
;
}
}
/**
* vue 挂载
*/
public
mounted
()
{
this
.
initTree
();
}
/**
* 初始化树
*/
private
initTree
()
{
const
_this
=
this
;
// 获取当前登录人的身份
const
userStr
=
localStorage
.
getItem
(
'user'
);
let
user
:
any
=
{};
if
(
userStr
)
{
user
=
JSON
.
parse
(
userStr
);
}
// 获取当前登录人所处组织的部门及下级组织的部门
let
url
=
''
;
// 判断是否超级用户
if
(
user
.
superuser
==
1
)
{
// 获取所有组织的部门及下级组织的部门
url
=
'ibzorganizations/alls/suborg/ibzdepartments/picker'
;
}
else
{
// 获取当前登录人所在组织的部门及下级组织的部门
if
(
_this
.
curUserContext
&&
_this
.
curUserContext
.
srforgid
)
{
url
=
'ibzorganizations/'
+
_this
.
curUserContext
.
srforgid
+
'/suborg/ibzdepartments/picker'
;
}
else
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'当前登录人组织为空'
});
}
}
this
.
$http
.
get
(
url
).
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
return
;
}
else
{
// 给树赋值,数据结构在后台已经按照eltree格式化
_this
.
TreeData
=
response
.
data
;
if
(
response
.
data
&&
response
.
data
.
length
>
0
)
{
// 设置默认选中第一个节点,即高亮显示
this
.
$nextTick
(
function
(){
let
deptTree
:
any
=
this
.
$refs
.
DeptTree
;
deptTree
.
setCurrentKey
(
response
.
data
[
0
].
id
);
})
// 默认加载第一个节点的右侧视图,调用选中数据变更事件
_this
.
selectionChange
(
response
.
data
[
0
]);
}
}
}).
catch
((
e
:
any
)
=>
{
console
.
log
(
e
);
});
}
/**
* 处理点击节点
*/
protected
handleNodeClick
()
{
// 获取当前树
const
DeptTree
:
any
=
this
.
$refs
.
DeptTree
;
// 获取点击状态的节点
let
node
=
DeptTree
.
getCurrentNode
();
// console.log("选中的node:" + JSON.stringify(node));
// if (node.isLeaf && node.isLeaf == true)
// 选中数据变更事件
this
.
selectionChange
(
node
);
}
/**
* 选中数据变更事件
*
* @public
* @param {*} node 节点对应node对象
* @memberof OrgTree
*/
public
selectionChange
(
node
:
any
)
{
// 获取右侧视图渲染数据需要的参数
let
temp
=
JSON
.
parse
(
JSON
.
stringify
(
node
));
let
srfappctx
:
any
=
{};
if
(
node
.
disabled
==
true
)
{
// 单位
temp
.
id
=
"Dept;"
+
node
.
id
;
temp
.
srfparentdename
=
"IBZOrganization"
;
temp
.
ibzorganization
=
node
.
id
;
srfappctx
.
ibzorganization
=
temp
.
ibzorganization
;
}
else
{
// 部门
temp
.
id
=
"Dept;"
+
node
.
id
;
temp
.
srfparentdename
=
"IBZDepartment"
;
temp
.
ibzdepartment
=
node
.
id
;
srfappctx
.
ibzdepartment
=
temp
.
ibzdepartment
;
}
temp
.
srfparentkey
=
node
.
id
;
temp
.
navparams
=
"{}"
;
srfappctx
.
srfparentkey
=
temp
.
srfparentkey
;
srfappctx
.
srfparentdename
=
temp
.
srfparentdename
;
temp
.
srfappctx
=
srfappctx
;
// 抛出参数
let
selectiondata
:
any
=
[
temp
];
this
.
$emit
(
'selectionchange'
,
selectiondata
);
}
}
</
script
>
<
style
lang=
'less'
>
@import './dept-tree-treeview.less';
</
style
>
\ No newline at end of file
app_Web/src/widgets/ibzorganization/org-tree-treeview/org-tree-treeview.vue
已删除
100644 → 0
浏览文件 @
41e37bdc
<
template
>
<div
class=
"design-tree-container"
>
<context-menu-container>
<el-input
size=
"small"
placeholder=
"搜索..."
v-model=
"filerText"
@
input=
"filterChange"
>
<i
slot=
"prefix"
class=
"el-input__icon el-icon-search"
></i>
</el-input>
<el-tree
:filter-node-method=
"filterNode"
class=
"tre"
:data=
"this.TreeData"
ref=
"OrgTree"
:show-checkbox=
"false"
node-key=
"id"
:default-expand-all=
"false"
highlight-current
:default-expanded-keys=
"this.defaultExpandedKeys"
:props=
"this.defaultProps"
@
node-click=
"handleNodeClick"
>
<span
class=
"custom-tree-node"
slot-scope=
"
{node, data}">
<i
v-if=
"node.isLeaf"
class=
"fa fa-building"
style=
"margin-right: 2px;"
></i>
<i
v-if=
"!node.isLeaf"
class=
"fa fa-building-o"
style=
"margin-right: 2px;"
></i>
<span>
{{
node
.
label
}}
</span>
</span>
</el-tree>
</context-menu-container>
</div>
</
template
>
<
script
lang=
'tsx'
>
import
{
Component
,
Vue
}
from
'vue-property-decorator'
;
@
Component
({
components
:
{}
})
export
default
class
OrgTree
extends
Vue
{
// 过滤文本
public
filerText
:
any
=
''
;
/**
* 过滤节点
*/
public
filterNode
(
value
:
any
,
data
:
any
){
if
(
!
value
)
return
true
;
return
data
.
label
.
indexOf
(
value
)
!==-
1
;
}
/**
* 树搜索触发
*/
public
filterChange
(){
const
OrgTree
:
any
=
this
.
$refs
.
OrgTree
;
OrgTree
.
filter
(
this
.
filerText
);
}
/*树数据*/
public
TreeData
:
any
=
[];
/*树显示说明:子树为节点对象的children,节点标签为节点对象的label*/
public
defaultProps
:
any
=
{
children
:
'children'
,
label
:
'label'
}
/*默认展开节点*/
public
defaultExpandedKeys
:
any
=
[];
/*当前登录人信息*/
public
curUserContext
:
any
=
{};
/**
* vue 创建
*/
public
created
()
{
var
_this
:
any
=
this
;
// 获取当前登录人信息
if
(
_this
&&
_this
.
$attrs
&&
_this
.
$attrs
.
context
)
{
_this
.
curUserContext
=
_this
.
$attrs
.
context
;
}
}
/**
* vue 挂载
*/
public
mounted
()
{
this
.
initTree
();
}
/**
* 初始化树
*/
private
initTree
()
{
const
_this
=
this
;
// 获取当前登录人的身份
const
userStr
=
localStorage
.
getItem
(
'user'
);
let
user
:
any
=
{};
if
(
userStr
)
{
user
=
JSON
.
parse
(
userStr
);
}
// 获取当前登录人所处组织及其下级组织
let
url
=
''
;
if
(
user
.
superuser
==
1
)
{
// 获取所有组织
url
=
'ibzorganizations/alls/suborg/picker'
;
}
else
{
if
(
_this
.
curUserContext
&&
_this
.
curUserContext
.
srforgid
)
{
url
=
'ibzorganizations/'
+
_this
.
curUserContext
.
srforgid
+
'/suborg/picker'
;
}
else
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'当前登录人组织为空'
});
}
}
this
.
$http
.
get
(
url
).
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
return
;
}
else
{
// 给树赋值,数据结构在后台已经按照eltree格式化
_this
.
TreeData
=
response
.
data
;
if
(
response
.
data
&&
response
.
data
.
length
>
0
)
{
// 设置默认选中第一个节点,即高亮显示
this
.
$nextTick
(
function
(){
let
orgTree
:
any
=
this
.
$refs
.
OrgTree
;
orgTree
.
setCurrentKey
(
response
.
data
[
0
].
id
);
})
// 默认加载第一个节点的右侧视图,调用选中数据变更事件
_this
.
selectionChange
(
response
.
data
[
0
]);
}
}
}).
catch
((
e
:
any
)
=>
{
console
.
log
(
e
);
});
}
/**
* 处理点击节点
*/
protected
handleNodeClick
()
{
// 获取当前树
const
OrgTree
:
any
=
this
.
$refs
.
OrgTree
;
// 获取点击状态的节点
let
node
=
OrgTree
.
getCurrentNode
();
// console.log("选中的node:" + JSON.stringify(node));
// if (node.isLeaf && node.isLeaf == true)
// 选中数据变更事件
this
.
selectionChange
(
node
);
}
/**
* 选中数据变更事件
*
* @public
* @param {*} node 节点对应node对象
* @memberof OrgTree
*/
public
selectionChange
(
node
:
any
)
{
// 获取右侧视图渲染数据需要的参数
let
temp
=
JSON
.
parse
(
JSON
.
stringify
(
node
));
temp
.
id
=
"Org;"
+
node
.
id
;
temp
.
srfparentdename
=
"IBZOrganization"
;
temp
.
srfparentkey
=
node
.
id
;
temp
.
navparams
=
"{}"
;
temp
.
ibzorganization
=
node
.
id
;
let
srfappctx
:
any
=
{};
srfappctx
.
srfparentkey
=
temp
.
srfparentkey
;
srfappctx
.
srfparentdename
=
temp
.
srfparentdename
;
srfappctx
.
ibzorganization
=
temp
.
ibzorganization
;
temp
.
srfappctx
=
srfappctx
;
// 抛出参数
let
selectiondata
:
any
=
[
temp
];
this
.
$emit
(
'selectionchange'
,
selectiondata
);
}
}
</
script
>
<
style
lang=
'less'
>
@import './org-tree-treeview.less';
</
style
>
\ No newline at end of file
app_Web/src/widgets/sys-department/dept-tree-treeview/dept-tree-treeview.vue
浏览文件 @
fb21e1df
<
template
>
<div
class=
"design-tree-container"
>
<context-menu-container>
<el-input
size=
"small"
placeholder=
"搜索..."
v-model=
"filerText"
@
input=
"filterChange"
>
<i
slot=
"prefix"
class=
"el-input__icon el-icon-search"
></i>
</el-input>
<el-tree
:filter-node-method=
"filterNode"
class=
"tre"
:data=
"this.TreeData"
ref=
"DeptTree"
:show-checkbox=
"false"
node-key=
"id"
:default-expand-all=
"false"
highlight-current
:default-expanded-keys=
"this.defaultExpandedKeys"
:props=
"this.defaultProps"
@
node-click=
"handleNodeClick"
>
<span
class=
"custom-tree-node"
slot-scope=
"
{node, data}">
<i
v-if=
"node.isLeaf"
class=
"fa fa-building-o"
style=
"margin-right: 2px;"
></i>
<i
v-if=
"!node.isLeaf"
class=
"fa fa-building"
style=
"margin-right: 2px;"
></i>
<span>
{{
node
.
label
}}
</span>
</span>
</el-tree>
</context-menu-container>
</div>
</
template
>
<
script
lang=
'tsx'
>
import
{
Component
}
from
'vue-property-decorator'
;
import
DeptTreeBase
from
'./dept-tree-treeview-base.vue'
;
import
{
Component
,
Vue
}
from
'vue-property-decorator'
;
@
Component
({
components
:
{
}
})
export
default
class
DeptTree
extends
DeptTreeBase
{
}
</
script
>
\ No newline at end of file
@
Component
({
components
:
{}
})
export
default
class
DeptTree
extends
Vue
{
// 过滤文本
public
filerText
:
any
=
''
;
/**
* 过滤节点
*/
public
filterNode
(
value
:
any
,
data
:
any
){
if
(
!
value
)
return
true
;
return
data
.
label
.
indexOf
(
value
)
!==-
1
;
}
/**
* 树搜索触发
*/
public
filterChange
(){
const
DeptTree
:
any
=
this
.
$refs
.
DeptTree
;
DeptTree
.
filter
(
this
.
filerText
);
}
/*树数据*/
public
TreeData
:
any
=
[];
/*树显示说明:子树为节点对象的children,节点标签为节点对象的label*/
public
defaultProps
:
any
=
{
children
:
'children'
,
label
:
'label'
}
/*默认展开节点*/
public
defaultExpandedKeys
:
any
=
[];
/*当前登录人信息*/
public
curUserContext
:
any
=
{};
/**
* vue 创建
*/
public
created
()
{
var
_this
:
any
=
this
;
// 获取当前登录人信息
if
(
_this
&&
_this
.
$attrs
&&
_this
.
$attrs
.
context
)
{
_this
.
curUserContext
=
_this
.
$attrs
.
context
;
}
}
/**
* vue 挂载
*/
public
mounted
()
{
this
.
initTree
();
}
/**
* 初始化树
*/
private
initTree
()
{
const
_this
=
this
;
// 获取当前登录人的身份
const
userStr
=
localStorage
.
getItem
(
'user'
);
let
user
:
any
=
{};
if
(
userStr
)
{
user
=
JSON
.
parse
(
userStr
);
}
// 获取当前登录人所处组织的部门及下级组织的部门
let
url
=
''
;
// 判断是否超级用户
if
(
user
.
superuser
==
1
)
{
// 获取所有组织的部门及下级组织的部门
url
=
'sysorganizations/alls/suborg/sysdepartments/picker'
;
}
else
{
// 获取当前登录人所在组织的部门及下级组织的部门
if
(
_this
.
curUserContext
&&
_this
.
curUserContext
.
srforgid
)
{
url
=
'sysorganizations/'
+
_this
.
curUserContext
.
srforgid
+
'/suborg/sysdepartments/picker'
;
}
else
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'当前登录人组织为空'
});
}
}
this
.
$http
.
get
(
url
).
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
return
;
}
else
{
// 给树赋值,数据结构在后台已经按照eltree格式化
_this
.
TreeData
=
response
.
data
;
if
(
response
.
data
&&
response
.
data
.
length
>
0
)
{
// 设置默认选中第一个节点,即高亮显示
this
.
$nextTick
(
function
(){
let
deptTree
:
any
=
this
.
$refs
.
DeptTree
;
deptTree
.
setCurrentKey
(
response
.
data
[
0
].
id
);
})
// 默认加载第一个节点的右侧视图,调用选中数据变更事件
_this
.
selectionChange
(
response
.
data
[
0
]);
}
}
}).
catch
((
e
:
any
)
=>
{
console
.
log
(
e
);
});
}
/**
* 处理点击节点
*/
protected
handleNodeClick
()
{
// 获取当前树
const
DeptTree
:
any
=
this
.
$refs
.
DeptTree
;
// 获取点击状态的节点
let
node
=
DeptTree
.
getCurrentNode
();
// console.log("选中的node:" + JSON.stringify(node));
// if (node.isLeaf && node.isLeaf == true)
// 选中数据变更事件
this
.
selectionChange
(
node
);
}
/**
* 选中数据变更事件
*
* @public
* @param {*} node 节点对应node对象
* @memberof OrgTree
*/
public
selectionChange
(
node
:
any
)
{
// 获取右侧视图渲染数据需要的参数
let
temp
=
JSON
.
parse
(
JSON
.
stringify
(
node
));
let
srfappctx
:
any
=
{};
if
(
node
.
disabled
==
true
)
{
// 单位
temp
.
id
=
"Dept;"
+
node
.
id
;
temp
.
srfparentdename
=
"SysOrganization"
;
temp
.
sysorganization
=
node
.
id
;
srfappctx
.
sysorganization
=
temp
.
sysorganization
;
}
else
{
// 部门
temp
.
id
=
"Dept;"
+
node
.
id
;
temp
.
srfparentdename
=
"SysDepartment"
;
temp
.
sysdepartment
=
node
.
id
;
srfappctx
.
sysdepartment
=
temp
.
sysdepartment
;
}
temp
.
srfparentkey
=
node
.
id
;
temp
.
navparams
=
"{}"
;
srfappctx
.
srfparentkey
=
temp
.
srfparentkey
;
srfappctx
.
srfparentdename
=
temp
.
srfparentdename
;
temp
.
srfappctx
=
srfappctx
;
// 抛出参数
let
selectiondata
:
any
=
[
temp
];
this
.
$emit
(
'selectionchange'
,
selectiondata
);
}
}
</
script
>
<
style
lang=
'less'
>
@import './dept-tree-treeview.less';
</
style
>
\ No newline at end of file
app_Web/src/widgets/sys-organization/org-tree-treeview/org-tree-treeview.vue
浏览文件 @
fb21e1df
<
template
>
<div
class=
"design-tree-container"
>
<context-menu-container>
<el-input
size=
"small"
placeholder=
"搜索..."
v-model=
"filerText"
@
input=
"filterChange"
>
<i
slot=
"prefix"
class=
"el-input__icon el-icon-search"
></i>
</el-input>
<el-tree
:filter-node-method=
"filterNode"
class=
"tre"
:data=
"this.TreeData"
ref=
"OrgTree"
:show-checkbox=
"false"
node-key=
"id"
:default-expand-all=
"false"
highlight-current
:default-expanded-keys=
"this.defaultExpandedKeys"
:props=
"this.defaultProps"
@
node-click=
"handleNodeClick"
>
<span
class=
"custom-tree-node"
slot-scope=
"
{node, data}">
<i
v-if=
"node.isLeaf"
class=
"fa fa-building-o"
style=
"margin-right: 2px;"
></i>
<i
v-if=
"!node.isLeaf"
class=
"fa fa-building"
style=
"margin-right: 2px;"
></i>
<span>
{{
node
.
label
}}
</span>
</span>
</el-tree>
</context-menu-container>
</div>
</
template
>
<
script
lang=
'tsx'
>
import
{
Component
}
from
'vue-property-decorator'
;
import
OrgTreeBase
from
'./org-tree-treeview-base.vue'
;
import
{
Component
,
Vue
}
from
'vue-property-decorator'
;
@
Component
({
components
:
{}
})
export
default
class
OrgTree
extends
Vue
{
// 过滤文本
public
filerText
:
any
=
''
;
/**
* 过滤节点
*/
public
filterNode
(
value
:
any
,
data
:
any
){
if
(
!
value
)
return
true
;
return
data
.
label
.
indexOf
(
value
)
!==-
1
;
}
/**
* 树搜索触发
*/
public
filterChange
(){
const
OrgTree
:
any
=
this
.
$refs
.
OrgTree
;
OrgTree
.
filter
(
this
.
filerText
);
}
/*树数据*/
public
TreeData
:
any
=
[];
/*树显示说明:子树为节点对象的children,节点标签为节点对象的label*/
public
defaultProps
:
any
=
{
children
:
'children'
,
label
:
'label'
}
/*默认展开节点*/
public
defaultExpandedKeys
:
any
=
[];
/*当前登录人信息*/
public
curUserContext
:
any
=
{};
/**
* vue 创建
*/
public
created
()
{
var
_this
:
any
=
this
;
// 获取当前登录人信息
if
(
_this
&&
_this
.
$attrs
&&
_this
.
$attrs
.
context
)
{
_this
.
curUserContext
=
_this
.
$attrs
.
context
;
}
}
/**
* vue 挂载
*/
public
mounted
()
{
this
.
initTree
();
}
/**
* 初始化树
*/
private
initTree
()
{
const
_this
=
this
;
// 获取当前登录人的身份
const
userStr
=
localStorage
.
getItem
(
'user'
);
let
user
:
any
=
{};
if
(
userStr
)
{
user
=
JSON
.
parse
(
userStr
);
}
// 获取当前登录人所处组织及其下级组织
let
url
=
''
;
if
(
user
.
superuser
==
1
)
{
// 获取所有组织
url
=
'sysorganizations/alls/suborg/picker'
;
}
else
{
if
(
_this
.
curUserContext
&&
_this
.
curUserContext
.
srforgid
)
{
url
=
'sysorganizations/'
+
_this
.
curUserContext
.
srforgid
+
'/suborg/picker'
;
}
else
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'当前登录人组织为空'
});
}
}
this
.
$http
.
get
(
url
).
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
return
;
}
else
{
// 给树赋值,数据结构在后台已经按照eltree格式化
_this
.
TreeData
=
response
.
data
;
if
(
response
.
data
&&
response
.
data
.
length
>
0
)
{
// 设置默认选中第一个节点,即高亮显示
this
.
$nextTick
(
function
(){
let
orgTree
:
any
=
this
.
$refs
.
OrgTree
;
orgTree
.
setCurrentKey
(
response
.
data
[
0
].
id
);
})
// 默认加载第一个节点的右侧视图,调用选中数据变更事件
_this
.
selectionChange
(
response
.
data
[
0
]);
}
}
}).
catch
((
e
:
any
)
=>
{
console
.
log
(
e
);
});
}
/**
* 处理点击节点
*/
protected
handleNodeClick
()
{
// 获取当前树
const
OrgTree
:
any
=
this
.
$refs
.
OrgTree
;
// 获取点击状态的节点
let
node
=
OrgTree
.
getCurrentNode
();
// console.log("选中的node:" + JSON.stringify(node));
// if (node.isLeaf && node.isLeaf == true)
// 选中数据变更事件
this
.
selectionChange
(
node
);
}
/**
* 选中数据变更事件
*
* @public
* @param {*} node 节点对应node对象
* @memberof OrgTree
*/
public
selectionChange
(
node
:
any
)
{
// 获取右侧视图渲染数据需要的参数
let
temp
=
JSON
.
parse
(
JSON
.
stringify
(
node
));
temp
.
id
=
"Org;"
+
node
.
id
;
temp
.
srfparentdename
=
"SysOrganization"
;
temp
.
srfparentkey
=
node
.
id
;
temp
.
navparams
=
"{}"
;
temp
.
sysorganization
=
node
.
id
;
let
srfappctx
:
any
=
{};
srfappctx
.
srfparentkey
=
temp
.
srfparentkey
;
srfappctx
.
srfparentdename
=
temp
.
srfparentdename
;
srfappctx
.
sysorganization
=
temp
.
sysorganization
;
temp
.
srfappctx
=
srfappctx
;
// 抛出参数
let
selectiondata
:
any
=
[
temp
];
this
.
$emit
(
'selectionchange'
,
selectiondata
);
}
@
Component
({
components
:
{
}
})
export
default
class
OrgTree
extends
OrgTreeBase
{
</
script
>
}
</
script
>
\ No newline at end of file
<
style
lang=
'less'
>
@import './org-tree-treeview.less';
</
style
>
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录