Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
iBiz企业中心
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz企业套件
iBiz企业中心
提交
d0bd61bd
提交
d0bd61bd
编写于
7月 07, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
xignzi006 发布系统代码
上级
5e31f035
变更
9
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
1620 行增加
和
6 行删除
+1620
-6
web-site-channel_en_US.ts
...anres/entities/web-site-channel/web-site-channel_en_US.ts
+1
-1
web-site-channel_zh_CN.ts
...anres/entities/web-site-channel/web-site-channel_zh_CN.ts
+1
-1
web-site-channel-content-tree-view.html
...content-tree-view/web-site-channel-content-tree-view.html
+0
-3
channel-content-treeview-base.tsx
...hannel-content-treeview/channel-content-treeview-base.tsx
+610
-0
channel-content-treeview-model.ts
...hannel-content-treeview/channel-content-treeview-model.ts
+67
-0
channel-content-treeview-service.ts
...nnel-content-treeview/channel-content-treeview-service.ts
+871
-0
channel-content-treeview.html
...el/channel-content-treeview/channel-content-treeview.html
+47
-0
channel-content-treeview.vue
...nel/channel-content-treeview/channel-content-treeview.vue
+22
-0
content-tree-viewtreeexpbar-treeexpbar.vue
...bar-treeexpbar/content-tree-viewtreeexpbar-treeexpbar.vue
+1
-1
未找到文件。
app_WebSite/src/locale/lanres/entities/web-site-channel/web-site-channel_en_US.ts
浏览文件 @
d0bd61bd
...
...
@@ -147,7 +147,7 @@ export default {
tip
:
"Copy {0}"
,
},
},
channel
tree
_treeview
:
{
channel
content
_treeview
:
{
nodes
:
{
root
:
"默认根节点"
,
},
...
...
app_WebSite/src/locale/lanres/entities/web-site-channel/web-site-channel_zh_CN.ts
浏览文件 @
d0bd61bd
...
...
@@ -146,7 +146,7 @@ export default {
tip
:
"拷贝"
,
},
},
channel
tree
_treeview
:
{
channel
content
_treeview
:
{
nodes
:
{
root
:
"默认根节点"
,
},
...
...
app_WebSite/src/pages/web-site/web-site-channel-content-tree-view/web-site-channel-content-tree-view.html
浏览文件 @
d0bd61bd
<studio-view-style2
viewName=
"websitechannelcontenttreeview"
viewTitle=
"频道内容"
class=
'detreeexpview web-site-channel-content-tree-view'
>
<template
slot=
'title'
>
<span
class=
'caption-info'
>
{{$t(model.srfTitle)}}
</span>
</template>
<view
_treeexpbar
:viewState=
"viewState"
:viewparams=
"viewparams"
...
...
app_WebSite/src/widgets/web-site-channel/channel-content-treeview/channel-content-treeview-base.tsx
0 → 100644
浏览文件 @
d0bd61bd
import
{
Prop
,
Provide
,
Emit
,
Model
}
from
'vue-property-decorator'
;
import
{
Subject
,
Subscription
}
from
'rxjs'
;
import
{
Watch
,
MainControlBase
}
from
'@/studio-core'
;
import
WebSiteChannelService
from
'@/service/web-site-channel/web-site-channel-service'
;
import
ChannelContentService
from
'./channel-content-treeview-service'
;
/**
* treeexpbar_tree部件基类
*
* @export
* @class MainControlBase
* @extends {ChannelContentTreeBase}
*/
export
class
ChannelContentTreeBase
extends
MainControlBase
{
/**
* 建构部件服务对象
*
* @type {ChannelContentService}
* @memberof ChannelContentTreeBase
*/
public
service
:
ChannelContentService
=
new
ChannelContentService
({
$store
:
this
.
$store
});
/**
* 实体服务对象
*
* @type {WebSiteChannelService}
* @memberof ChannelContentTreeBase
*/
public
appEntityService
:
WebSiteChannelService
=
new
WebSiteChannelService
({
$store
:
this
.
$store
});
/**
* 应用实体名称
*
* @protected
* @type {string}
* @memberof ChannelContentTreeBase
*/
protected
appDeName
:
string
=
'websitechannel'
;
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof ChannelContent
*/
public
getDatas
():
any
[]
{
return
[
this
.
currentselectedNode
];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof ChannelContent
*/
public
getData
():
any
{
return
this
.
currentselectedNode
;
}
/**
* 是否单选
*
* @type {boolean}
* @memberof ChannelContent
*/
@
Prop
({
default
:
true
})
public
isSingleSelect
!
:
boolean
;
/**
* 是否默认选中第一条数据
*
* @type {boolean}
* @memberof ChannelContent
*/
@
Prop
({
default
:
false
})
public
isSelectFirstDefault
!
:
boolean
;
/**
* 枝干节点是否可用(具有数据能力,可抛出)
*
* @type {string}
* @memberof ChannelContent
*/
@
Prop
({
default
:
true
})
public
isBranchAvailable
!
:
boolean
;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof ChannelContent
*/
@
Prop
({
default
:
true
})
public
showBusyIndicator
?:
boolean
;
/**
* 初始化完成
*
* @type {boolean}
* @memberof ChannelContent
*/
public
inited
:
boolean
=
false
;
/**
* 已选中数据集合
*
* @type {*}
* @memberof ChannelContent
*/
public
selectedNodes
:
any
=
[];
/**
* 当前选中数据项
*
* @type {*}
* @memberof ChannelContent
*/
public
currentselectedNode
:
any
=
{};
/**
* 选中数据字符串
*
* @type {string}
* @memberof ChannelContent
*/
@
Prop
()
public
selectedData
?:
string
;
/**
* 选中值变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof ChannelContent
*/
@
Watch
(
'selectedData'
)
public
onValueChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
echoselectedNodes
=
newVal
?
this
.
isSingleSelect
?
JSON
.
parse
(
newVal
)[
0
]
:
JSON
.
parse
(
newVal
)
:
[];
this
.
selectedNodes
=
[];
if
(
this
.
echoselectedNodes
.
length
>
0
){
let
AllnodesObj
=
(
this
.
$refs
.
treeexpbar_tree
as
any
).
store
.
nodesMap
;
let
AllnodesArray
:
any
[]
=
[];
for
(
const
key
in
AllnodesObj
)
{
if
(
AllnodesObj
.
hasOwnProperty
(
key
))
{
AllnodesArray
.
push
(
AllnodesObj
[
key
].
data
);
}
}
this
.
setDefaultSelection
(
AllnodesArray
);
}
}
/**
* 回显选中数据集合
*
* @type {*}
* @memberof ChannelContent
*/
public
echoselectedNodes
:
any
[]
=
this
.
selectedData
?
(
this
.
isSingleSelect
?
[
JSON
.
parse
(
this
.
selectedData
)[
0
]]
:
JSON
.
parse
(
this
.
selectedData
))
:
[];
/**
* 部件行为--update
*
* @type {string}
* @memberof ChannelContent
*/
@
Prop
()
public
updateAction
!
:
string
;
/**
* 部件行为--fetch
*
* @type {string}
* @memberof ChannelContent
*/
@
Prop
()
public
fetchAction
!
:
string
;
/**
* 部件行为--remove
*
* @type {string}
* @memberof ChannelContent
*/
@
Prop
()
public
removeAction
!
:
string
;
/**
* 部件行为--load
*
* @type {string}
* @memberof ChannelContent
*/
@
Prop
()
public
loadAction
!
:
string
;
/**
* 部件行为--create
*
* @type {string}
* @memberof ChannelContent
*/
@
Prop
()
public
createAction
!
:
string
;
/**
* 过滤属性
*
* @type {string}
* @memberof ChannelContent
*/
public
srfnodefilter
:
string
=
''
;
/**
* 默认输出图标
*
* @type {boolean}
* @memberof ChannelContent
*/
public
isOutputIconDefault
:
boolean
=
true
;
/**
* 数据展开主键
*
* @type {string[]}
* @memberof ChannelContent
*/
@
Provide
()
public
expandedKeys
:
string
[]
=
[];
/**
* 选中数据变更事件
*
* @public
* @param {*} data
* @param {*} data 当前节点对应传入对象
* @param {*} checkedState 树目前选中状态对象
* @memberof ChannelContent
*/
public
onCheck
(
data
:
any
,
checkedState
:
any
)
{
// 处理多选数据
if
(
!
this
.
isSingleSelect
){
let
leafNodes
=
checkedState
.
checkedNodes
.
filter
((
item
:
any
)
=>
item
.
leaf
);
this
.
selectedNodes
=
JSON
.
parse
(
JSON
.
stringify
(
leafNodes
));
this
.
$emit
(
'selectionchange'
,
this
.
selectedNodes
);
}
}
/**
* 选中数据变更事件
*
* @public
* @param {*} data 节点对应传入对象
* @param {*} node 节点对应node对象
* @memberof ChannelContent
*/
public
selectionChange
(
data
:
any
,
node
:
any
)
{
// 禁用项处理
if
(
data
.
disabled
){
node
.
isCurrent
=
false
;
return
;
}
// 只处理最底层子节点
if
(
this
.
isBranchAvailable
||
data
.
leaf
){
this
.
currentselectedNode
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
// 单选直接替换
if
(
this
.
isSingleSelect
){
this
.
selectedNodes
=
[
this
.
currentselectedNode
];
this
.
$emit
(
'selectionchange'
,
this
.
selectedNodes
);
}
// 多选用check方法
}
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof ChannelContent
*/
public
created
()
{
this
.
afterCreated
();
}
/**
* 执行created后的逻辑
*
* @memberof ChannelContent
*/
public
afterCreated
(){
if
(
this
.
viewState
)
{
this
.
viewStateEvent
=
this
.
viewState
.
subscribe
(({
tag
,
action
,
data
})
=>
{
if
(
!
Object
.
is
(
tag
,
this
.
name
))
{
return
;
}
if
(
Object
.
is
(
'load'
,
action
))
{
this
.
inited
=
false
;
this
.
$nextTick
(()
=>
{
this
.
inited
=
true
;
});
}
if
(
Object
.
is
(
'filter'
,
action
))
{
this
.
srfnodefilter
=
data
.
srfnodefilter
;
this
.
refresh_all
();
}
if
(
Object
.
is
(
'refresh_parent'
,
action
))
{
this
.
refresh_parent
();
}
});
}
}
/**
* 对树节点进行筛选操作
* @memberof OrderTree
*/
public
filterNode
(
value
:
any
,
data
:
any
)
{
if
(
!
value
)
return
true
;
return
data
.
text
.
indexOf
(
value
)
!==
-
1
;
}
/**
* vue 生命周期
*
* @memberof ChannelContent
*/
public
destroyed
()
{
this
.
afterDestroy
();
}
/**
* 执行destroyed后的逻辑
*
* @memberof ChannelContent
*/
public
afterDestroy
()
{
if
(
this
.
viewStateEvent
)
{
this
.
viewStateEvent
.
unsubscribe
();
}
}
/**
* 刷新数据
*
* @memberof ChannelContent
*/
public
refresh_all
():
void
{
this
.
inited
=
false
;
this
.
$nextTick
(()
=>
{
this
.
inited
=
true
;
});
}
/**
* 刷新父节点
*
* @memberof ChannelContent
*/
public
refresh_parent
():
void
{
if
(
Object
.
keys
(
this
.
currentselectedNode
).
length
===
0
)
{
return
;
}
const
tree
:
any
=
this
.
$refs
.
treeexpbar_tree
;
const
node
:
any
=
tree
.
getNode
(
this
.
currentselectedNode
.
id
);
if
(
!
node
||
!
node
.
parent
)
{
return
;
}
let
curNode
:
any
=
{};
const
{
parent
:
_parent
}
=
node
;
curNode
=
this
.
$util
.
deepObjectMerge
(
curNode
,
_parent
);
let
tempContext
:
any
=
{};
if
(
curNode
.
data
&&
curNode
.
data
.
srfappctx
){
Object
.
assign
(
tempContext
,
curNode
.
data
.
srfappctx
);
}
else
{
Object
.
assign
(
tempContext
,
this
.
context
);
}
const
id
:
string
=
_parent
.
key
?
_parent
.
key
:
'#'
;
const
param
:
any
=
{
srfnodeid
:
id
};
this
.
refresh_node
(
tempContext
,
param
,
true
);
}
/**
* 数据加载
*
* @param {*} node
* @memberof ChannelContent
*/
public
load
(
node
:
any
=
{},
resolve
?:
any
)
{
if
(
node
.
data
&&
node
.
data
.
children
)
{
resolve
(
node
.
data
.
children
);
return
;
}
const
params
:
any
=
{
srfnodeid
:
node
.
data
&&
node
.
data
.
id
?
node
.
data
.
id
:
"#"
,
srfnodefilter
:
this
.
srfnodefilter
};
let
tempViewParams
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
viewparams
));
let
curNode
:
any
=
{};
curNode
=
this
.
$util
.
deepObjectMerge
(
curNode
,
node
);
let
tempContext
:
any
=
this
.
computecurNodeContext
(
curNode
);
if
(
curNode
.
data
&&
curNode
.
data
.
srfparentdename
){
Object
.
assign
(
tempContext
,{
srfparentdename
:
curNode
.
data
.
srfparentdename
});
Object
.
assign
(
tempViewParams
,{
srfparentdename
:
curNode
.
data
.
srfparentdename
});
}
if
(
curNode
.
data
&&
curNode
.
data
.
srfparentkey
){
Object
.
assign
(
tempContext
,{
srfparentkey
:
curNode
.
data
.
srfparentkey
});
Object
.
assign
(
tempViewParams
,{
srfparentkey
:
curNode
.
data
.
srfparentkey
});
}
Object
.
assign
(
params
,{
viewparams
:
tempViewParams
});
this
.
service
.
getNodes
(
tempContext
,
params
).
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
response
.
info
});
resolve
([]);
return
;
}
const
_items
=
response
.
data
;
this
.
formatExpanded
(
_items
);
resolve
([...
_items
]);
let
isRoot
=
Object
.
is
(
node
.
level
,
0
);
let
isSelectedAll
=
node
.
checked
;
this
.
setDefaultSelection
(
_items
,
isRoot
,
isSelectedAll
);
this
.
$emit
(
"load"
,
_items
);
}).
catch
((
response
:
any
)
=>
{
resolve
([]);
if
(
response
&&
response
.
status
===
401
)
{
return
;
}
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
response
.
info
});
});
}
/**
* 计算当前节点的上下文
*
* @param {*} curNode 当前节点
* @memberof ChannelContent
*/
public
computecurNodeContext
(
curNode
:
any
){
let
tempContext
:
any
=
{};
if
(
curNode
&&
curNode
.
data
&&
curNode
.
data
.
srfappctx
){
tempContext
=
JSON
.
parse
(
JSON
.
stringify
(
curNode
.
data
.
srfappctx
));
}
else
{
tempContext
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
));
}
return
tempContext
;
}
/**
* 刷新功能
*
* @param {any[]} args
* @memberof ChannelContent
*/
public
refresh
(
args
:
any
[]):
void
{
this
.
refresh_all
();
}
/**
* 刷新节点
*
* @public
* @param {*} [curContext] 当前节点上下文
* @param {*} [arg={}] 当前节点附加参数
* @param {boolean} parentnode 是否是刷新父节点
* @memberof ChannelContent
*/
public
refresh_node
(
curContext
:
any
,
arg
:
any
=
{},
parentnode
:
boolean
):
void
{
const
{
srfnodeid
:
id
}
=
arg
;
Object
.
assign
(
arg
,{
viewparams
:
this
.
viewparams
});
const
get
:
Promise
<
any
>
=
this
.
service
.
getNodes
(
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
arg
);
get
.
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
info
});
return
;
}
const
_items
=
[...
response
.
data
];
this
.
formatExpanded
(
_items
);
const
tree
:
any
=
this
.
$refs
.
treeexpbar_tree
;
tree
.
updateKeyChildren
(
id
,
_items
);
if
(
parentnode
)
{
this
.
currentselectedNode
=
{};
}
this
.
setDefaultSelection
(
_items
);
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
===
401
)
{
return
;
}
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
info
});
});
}
/**
* 默认展开节点
*
* @public
* @param {any[]} items
* @returns {any[]}
* @memberof ChannelContent
*/
public
formatExpanded
(
items
:
any
[]):
any
[]
{
const
data
:
any
[]
=
[];
items
.
forEach
((
item
)
=>
{
if
(
item
.
expanded
||
(
item
.
children
&&
item
.
children
.
length
>
0
))
{
this
.
expandedKeys
.
push
(
item
.
id
);
}
});
return
data
;
}
/**
* 设置默认选中,回显数项,选中所有子节点
*
* @param {any[]} items 当前节点所有子节点集合
* @param {boolean} isRoot 是否是加载根节点
* @param {boolean} isSelectedAll 是否选中所有子节点
* @memberof MainTree
*/
public
setDefaultSelection
(
items
:
any
[],
isRoot
:
boolean
=
false
,
isSelectedAll
:
boolean
=
false
):
void
{
if
(
items
.
length
==
0
){
return
;
}
let
defaultData
:
any
;
// 导航中选中第一条配置的默认选中,没有选中第一条
if
(
this
.
isSelectFirstDefault
){
if
(
this
.
isSingleSelect
){
let
index
=
items
.
findIndex
((
item
:
any
)
=>
item
.
selected
);
if
(
index
===
-
1
)
{
if
(
isRoot
){
index
=
0
;
}
else
{
return
;
}
}
defaultData
=
items
[
index
];
this
.
setTreeNodeHighLight
(
defaultData
);
this
.
currentselectedNode
=
JSON
.
parse
(
JSON
.
stringify
(
defaultData
));
if
(
this
.
isBranchAvailable
||
defaultData
.
leaf
){
this
.
selectedNodes
=
[
this
.
currentselectedNode
];
this
.
$emit
(
'selectionchange'
,
this
.
selectedNodes
);
}
}
}
// 已选数据的回显
if
(
this
.
echoselectedNodes
&&
this
.
echoselectedNodes
.
length
>
0
){
let
checkedNodes
=
items
.
filter
((
item
:
any
)
=>
{
return
this
.
echoselectedNodes
.
some
((
val
:
any
)
=>
{
if
(
Object
.
is
(
item
.
srfkey
,
val
.
srfkey
)
&&
Object
.
is
(
item
.
srfmajortext
,
val
.
srfmajortext
)){
val
.
used
=
true
;
return
true
;
}
});
});
if
(
checkedNodes
.
length
>
0
){
this
.
echoselectedNodes
=
this
.
echoselectedNodes
.
filter
((
item
:
any
)
=>
!
item
.
used
);
// 父节点选中时,不需要执行这段,会选中所有子节点
if
(
!
isSelectedAll
){
if
(
this
.
isSingleSelect
){
this
.
setTreeNodeHighLight
(
checkedNodes
[
0
]);
this
.
currentselectedNode
=
JSON
.
parse
(
JSON
.
stringify
(
checkedNodes
[
0
]));
this
.
selectedNodes
=
[
this
.
currentselectedNode
];
}
else
{
this
.
selectedNodes
=
this
.
selectedNodes
.
concat
(
checkedNodes
);
const
tree
:
any
=
this
.
$refs
.
treeexpbar_tree
;
tree
.
setCheckedNodes
(
this
.
selectedNodes
);
}
}
}
}
// 父节点选中时,选中所有子节点
if
(
isSelectedAll
){
let
leafNodes
=
items
.
filter
((
item
:
any
)
=>
item
.
leaf
);
this
.
selectedNodes
=
this
.
selectedNodes
.
concat
(
leafNodes
);
this
.
$emit
(
'selectionchange'
,
this
.
selectedNodes
);
}
}
/**
* 绘制右击菜单
*
* @param {*} node
* @returns
* @memberof ChannelContent
*/
public
renderContextMenu
(
node
:
any
)
{
let
content
;
if
(
node
&&
node
.
data
)
{
const
data
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
node
.
data
));
this
.
currentselectedNode
=
{
...
data
};
const
tags
:
string
[]
=
data
.
id
.
split
(
';'
);
}
return
content
;
}
/**
* 设置选中高亮
*
* @param {*} data
* @memberof ChannelContent
*/
public
setTreeNodeHighLight
(
data
:
any
):
void
{
const
tree
:
any
=
this
.
$refs
.
treeexpbar_tree
;
tree
.
setCurrentKey
(
data
.
id
);
}
/**
* 执行默认界面行为
*
* @param {*} node
* @memberof AppView
*/
public
doDefaultAction
(
node
:
any
)
{
if
(
node
&&
node
.
data
)
{
const
data
:
any
=
node
.
data
;
const
tags
:
string
[]
=
data
.
id
.
split
(
';'
);
}
this
.
$emit
(
'nodedblclick'
,
this
.
selectedNodes
);
}
}
\ No newline at end of file
app_WebSite/src/widgets/web-site-channel/channel-content-treeview/channel-content-treeview-model.ts
0 → 100644
浏览文件 @
d0bd61bd
/**
* ChannelContent 部件模型
*
* @export
* @class ChannelContentModel
*/
export
default
class
ChannelContentModel
{
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof ChannelContentModel
*/
public
getDataItems
():
any
[]
{
return
[
{
name
:
'websitechannel'
,
prop
:
'websitechannelid'
,
},
{
name
:
'createman'
,
},
{
name
:
'websitechannelname'
,
},
{
name
:
'updatedate'
,
},
{
name
:
'createdate'
,
},
{
name
:
'updateman'
,
},
{
name
:
'websiteid'
,
},
{
name
:
'pwebsitechannelid'
,
},
{
name
:
'pwebsitechannelname'
,
},
{
name
:
'websitename'
,
},
{
name
:
'channeltype'
,
},
{
name
:
'channelcode'
,
},
{
name
:
'sn'
,
},
{
name
:
'memo'
,
},
{
name
:
'validflag'
,
},
]
}
}
\ No newline at end of file
app_WebSite/src/widgets/web-site-channel/channel-content-treeview/channel-content-treeview-service.ts
0 → 100644
浏览文件 @
d0bd61bd
import
{
Http
,
Util
,
Errorlog
}
from
'@/utils'
;
import
ControlService
from
'@/widgets/control-service'
;
import
WebSiteChannelService
from
'@/service/web-site-channel/web-site-channel-service'
;
import
ChannelContentModel
from
'./channel-content-treeview-model'
;
import
CodeListService
from
'@service/app/codelist-service'
;
import
i18n
from
'@/locale'
;
import
WebSiteService
from
'@service/web-site/web-site-service'
;
/**
* ChannelContent 部件服务对象
*
* @export
* @class ChannelContentService
*/
export
default
class
ChannelContentService
extends
ControlService
{
/**
* 站点频道服务对象
*
* @type {WebSiteChannelService}
* @memberof ChannelContentService
*/
public
appEntityService
:
WebSiteChannelService
=
new
WebSiteChannelService
({
$store
:
this
.
getStore
()
});
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof ChannelContentService
*/
public
setTempMode
(){
this
.
isTempMode
=
false
;
}
/**
* Creates an instance of ChannelContentService.
*
* @param {*} [opts={}]
* @memberof ChannelContentService
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
this
.
model
=
new
ChannelContentModel
();
}
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof ChannelContentService
*/
public
codeListService
:
CodeListService
=
new
CodeListService
({
$store
:
this
.
getStore
()
});
/**
* 网站服务对象
*
* @type {WebSiteService}
* @memberof ChannelContentService
*/
public
websiteService
:
WebSiteService
=
new
WebSiteService
({
$store
:
this
.
getStore
()
});
/**
* 节点分隔符号
*
* @public
* @type {string}
* @memberof ChannelContentService
*/
public
TREENODE_SEPARATOR
:
string
=
';'
;
/**
* 子频道节点分隔符号
*
* @public
* @type {string}
* @memberof ChannelContentService
*/
public
TREENODE_CHILDCHANNEL
:
string
=
'ChildChannel'
;
/**
* 站点频道节点分隔符号
*
* @public
* @type {string}
* @memberof ChannelContentService
*/
public
TREENODE_ROOTCHANNEL
:
string
=
'RootChannel'
;
/**
* 站点节点分隔符号
*
* @public
* @type {string}
* @memberof ChannelContentService
*/
public
TREENODE_WEBSITE
:
string
=
'WEBSITE'
;
/**
* 默认根节点节点分隔符号
*
* @public
* @type {string}
* @memberof ChannelContentService
*/
public
TREENODE_ROOT
:
string
=
'ROOT'
;
/**
* 获取节点数据
*
* @param {string} action
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof ChannelContentService
*/
@
Errorlog
public
async
getNodes
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
{
srfparentkey
,
srfcat
,
srfnodeid
,
srfnodefilter
,
query
}:
{
srfparentkey
:
string
,
srfcat
:
string
,
srfnodeid
:
string
,
srfnodefilter
:
string
,
query
:
string
}
=
data
;
srfnodefilter
=
query
?
query
:
srfnodefilter
;
let
list
:
any
[]
=
[];
let
filter
:
any
=
{};
if
(
!
srfnodeid
||
Object
.
is
(
srfnodeid
,
'#'
))
{
srfnodeid
=
this
.
TREENODE_ROOT
;
}
let
strTreeNodeId
:
string
=
srfnodeid
;
let
strRealNodeId
:
string
=
''
;
let
bRootSelect
:
boolean
=
false
;
let
strNodeType
:
string
|
null
=
null
;
let
strRootSelectNode
:
string
=
''
;
if
(
Object
.
is
(
strTreeNodeId
,
this
.
TREENODE_ROOT
))
{
strNodeType
=
this
.
TREENODE_ROOT
;
if
(
srfparentkey
)
{
strRealNodeId
=
srfparentkey
;
}
}
else
{
let
nPos
=
strTreeNodeId
.
indexOf
(
this
.
TREENODE_SEPARATOR
);
if
(
nPos
===
-
1
)
{
return
Promise
.
reject
({
status
:
500
,
data
:
{
title
:
'失败'
,
message
:
`树节点
${
strTreeNodeId
}
标识无效`
}
});
}
strNodeType
=
strTreeNodeId
.
substring
(
0
,
nPos
);
strRealNodeId
=
strTreeNodeId
.
substring
(
nPos
+
1
);
}
Object
.
assign
(
filter
,
{
srfparentkey
:
srfparentkey
,
srfcat
:
srfcat
,
srfnodefilter
:
srfnodefilter
,
strRealNodeId
:
strRealNodeId
,
srfnodeid
:
srfnodeid
,
strNodeType
:
strNodeType
,
viewparams
:
JSON
.
parse
(
JSON
.
stringify
(
data
)).
viewparams
}
);
// 分解节点标识
let
nodeid
:
string
[]
=
strRealNodeId
.
split
(
this
.
TREENODE_SEPARATOR
);
for
(
let
i
=
0
;
i
<
nodeid
.
length
;
i
++
)
{
switch
(
i
)
{
case
0
:
Object
.
assign
(
filter
,
{
nodeid
:
nodeid
[
0
]
});
break
;
case
1
:
Object
.
assign
(
filter
,
{
nodeid2
:
nodeid
[
1
]
});
break
;
case
2
:
Object
.
assign
(
filter
,
{
nodeid3
:
nodeid
[
2
]
});
break
;
case
3
:
Object
.
assign
(
filter
,
{
nodeid4
:
nodeid
[
3
]
});
break
;
default
:
break
;
}
}
if
(
Object
.
is
(
strNodeType
,
this
.
TREENODE_CHILDCHANNEL
))
{
await
this
.
fillChildchannelNodeChilds
(
context
,
filter
,
list
);
return
Promise
.
resolve
({
status
:
200
,
data
:
list
});
}
if
(
Object
.
is
(
strNodeType
,
this
.
TREENODE_ROOTCHANNEL
))
{
await
this
.
fillRootchannelNodeChilds
(
context
,
filter
,
list
);
return
Promise
.
resolve
({
status
:
200
,
data
:
list
});
}
if
(
Object
.
is
(
strNodeType
,
this
.
TREENODE_WEBSITE
))
{
await
this
.
fillWebsiteNodeChilds
(
context
,
filter
,
list
);
return
Promise
.
resolve
({
status
:
200
,
data
:
list
});
}
if
(
Object
.
is
(
strNodeType
,
this
.
TREENODE_ROOT
))
{
await
this
.
fillRootNodeChilds
(
context
,
filter
,
list
);
return
Promise
.
resolve
({
status
:
200
,
data
:
list
});
}
return
Promise
.
resolve
({
status
:
500
,
data
:
{
title
:
'失败'
,
message
:
`树节点
${
strTreeNodeId
}
标识无效`
}
});
}
/**
* 填充 树视图节点[子频道]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof ChannelContentService
*/
@
Errorlog
public
fillChildchannelNodes
(
context
:
any
=
{},
filter
:
any
,
list
:
any
[],
rsNavContext
?:
any
,
rsNavParams
?:
any
,
rsParams
?:
any
):
Promise
<
any
>
{
context
=
this
.
handleResNavContext
(
context
,
filter
,
rsNavContext
);
filter
=
this
.
handleResNavParams
(
context
,
filter
,
rsNavParams
,
rsParams
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
searchFilter
:
any
=
{};
if
(
Object
.
is
(
filter
.
strNodeType
,
this
.
TREENODE_ROOTCHANNEL
))
{
Object
.
assign
(
searchFilter
,
{
n_pwebsitechannelid_eq
:
filter
.
nodeid
});
}
Object
.
assign
(
searchFilter
,
{
total
:
false
});
let
bFirst
:
boolean
=
true
;
let
records
:
any
[]
=
[];
try
{
this
.
searchChildchannel
(
context
,
searchFilter
,
filter
).
then
((
records
:
any
)
=>
{
if
(
records
&&
records
.
length
>
0
){
records
.
forEach
((
entity
:
any
)
=>
{
let
treeNode
:
any
=
{};
// 整理context
let
strId
:
string
=
entity
.
websitechannelid
;
let
strText
:
string
=
entity
.
websitechannelname
;
Object
.
assign
(
treeNode
,{
srfparentdename
:
'WebSiteChannel'
,
srfparentkey
:
entity
.
websitechannelid
});
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
Object
.
assign
(
tempContext
,{
srfparentdename
:
'WebSiteChannel'
,
srfparentkey
:
entity
.
websitechannelid
,
websitechannel
:
strId
})
Object
.
assign
(
treeNode
,{
srfappctx
:
tempContext
});
Object
.
assign
(
treeNode
,{
'websitechannel'
:
strId
});
Object
.
assign
(
treeNode
,
{
srfkey
:
strId
});
Object
.
assign
(
treeNode
,
{
text
:
strText
,
srfmajortext
:
strText
});
let
strNodeId
:
string
=
'ChildChannel'
;
strNodeId
+=
this
.
TREENODE_SEPARATOR
;
strNodeId
+=
strId
;
Object
.
assign
(
treeNode
,
{
id
:
strNodeId
});
Object
.
assign
(
treeNode
,
{
expanded
:
filter
.
isautoexpand
});
Object
.
assign
(
treeNode
,
{
leaf
:
true
});
Object
.
assign
(
treeNode
,
{
curData
:
entity
});
Object
.
assign
(
treeNode
,
{
nodeid
:
treeNode
.
srfkey
});
Object
.
assign
(
treeNode
,
{
nodeid2
:
filter
.
strRealNodeId
});
list
.
push
(
treeNode
);
resolve
(
list
);
bFirst
=
false
;
});
}
else
{
resolve
(
list
);
}
});
}
catch
(
error
)
{
console
.
error
(
error
);
}
});
}
/**
* 获取查询集合
*
* @public
* @param {any{}} context
* @param {*} searchFilter
* @param {*} filter
* @returns {any[]}
* @memberof TestEnetityDatasService
*/
@
Errorlog
public
searchChildchannel
(
context
:
any
=
{},
searchFilter
:
any
,
filter
:
any
):
Promise
<
any
>
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
if
(
filter
.
viewparams
){
Object
.
assign
(
searchFilter
,
filter
.
viewparams
);
}
if
(
!
searchFilter
.
page
){
Object
.
assign
(
searchFilter
,{
page
:
0
});
}
if
(
!
searchFilter
.
size
){
Object
.
assign
(
searchFilter
,{
size
:
1000
});
}
if
(
context
&&
context
.
srfparentdename
){
Object
.
assign
(
searchFilter
,{
srfparentdename
:
JSON
.
parse
(
JSON
.
stringify
(
context
)).
srfparentdename
});
}
if
(
context
&&
context
.
srfparentkey
){
Object
.
assign
(
searchFilter
,{
srfparentkey
:
JSON
.
parse
(
JSON
.
stringify
(
context
)).
srfparentkey
});
}
const
_appEntityService
:
any
=
this
.
appEntityService
;
let
list
:
any
[]
=
[];
if
(
_appEntityService
[
'FetchDefault'
]
&&
_appEntityService
[
'FetchDefault'
]
instanceof
Function
)
{
const
response
:
Promise
<
any
>
=
_appEntityService
[
'FetchDefault'
](
context
,
searchFilter
,
false
);
response
.
then
((
response
:
any
)
=>
{
if
(
!
response
.
status
||
response
.
status
!==
200
)
{
resolve
([]);
console
.
log
(
JSON
.
stringify
(
context
));
console
.
error
(
'查询FetchDefault数据集异常!'
);
}
const
data
:
any
=
response
.
data
;
if
(
Object
.
keys
(
data
).
length
>
0
)
{
list
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
resolve
(
list
);
}
else
{
resolve
([]);
}
}).
catch
((
response
:
any
)
=>
{
resolve
([]);
console
.
log
(
JSON
.
stringify
(
context
));
console
.
error
(
'查询FetchDefault数据集异常!'
);
});
}
})
}
/**
* 填充 树视图节点[子频道]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof ChannelContentService
*/
@
Errorlog
public
async
fillChildchannelNodeChilds
(
context
:
any
=
{},
filter
:
any
,
list
:
any
[]):
Promise
<
any
>
{
if
(
filter
.
srfnodefilter
&&
!
Object
.
is
(
filter
.
srfnodefilter
,
""
))
{
}
else
{
}
}
/**
* 填充 树视图节点[站点频道]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof ChannelContentService
*/
@
Errorlog
public
fillRootchannelNodes
(
context
:
any
=
{},
filter
:
any
,
list
:
any
[],
rsNavContext
?:
any
,
rsNavParams
?:
any
,
rsParams
?:
any
):
Promise
<
any
>
{
context
=
this
.
handleResNavContext
(
context
,
filter
,
rsNavContext
);
filter
=
this
.
handleResNavParams
(
context
,
filter
,
rsNavParams
,
rsParams
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
searchFilter
:
any
=
{};
if
(
Object
.
is
(
filter
.
strNodeType
,
this
.
TREENODE_WEBSITE
))
{
Object
.
assign
(
searchFilter
,
{
n_websiteid_eq
:
filter
.
nodeid
});
}
Object
.
assign
(
searchFilter
,
{
total
:
false
});
let
bFirst
:
boolean
=
true
;
let
records
:
any
[]
=
[];
try
{
this
.
searchRootchannel
(
context
,
searchFilter
,
filter
).
then
((
records
:
any
)
=>
{
if
(
records
&&
records
.
length
>
0
){
records
.
forEach
((
entity
:
any
)
=>
{
let
treeNode
:
any
=
{};
// 整理context
let
strId
:
string
=
entity
.
websitechannelid
;
let
strText
:
string
=
entity
.
websitechannelname
;
Object
.
assign
(
treeNode
,{
srfparentdename
:
'WebSiteChannel'
,
srfparentkey
:
entity
.
websitechannelid
});
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
Object
.
assign
(
tempContext
,{
srfparentdename
:
'WebSiteChannel'
,
srfparentkey
:
entity
.
websitechannelid
,
websitechannel
:
strId
})
Object
.
assign
(
treeNode
,{
srfappctx
:
tempContext
});
Object
.
assign
(
treeNode
,{
'websitechannel'
:
strId
});
Object
.
assign
(
treeNode
,
{
srfkey
:
strId
});
Object
.
assign
(
treeNode
,
{
text
:
strText
,
srfmajortext
:
strText
});
let
strNodeId
:
string
=
'RootChannel'
;
strNodeId
+=
this
.
TREENODE_SEPARATOR
;
strNodeId
+=
strId
;
Object
.
assign
(
treeNode
,
{
id
:
strNodeId
});
Object
.
assign
(
treeNode
,
{
expanded
:
filter
.
isautoexpand
});
Object
.
assign
(
treeNode
,
{
leaf
:
false
});
Object
.
assign
(
treeNode
,
{
curData
:
entity
});
Object
.
assign
(
treeNode
,
{
nodeid
:
treeNode
.
srfkey
});
Object
.
assign
(
treeNode
,
{
nodeid2
:
filter
.
strRealNodeId
});
list
.
push
(
treeNode
);
resolve
(
list
);
bFirst
=
false
;
});
}
else
{
resolve
(
list
);
}
});
}
catch
(
error
)
{
console
.
error
(
error
);
}
});
}
/**
* 获取查询集合
*
* @public
* @param {any{}} context
* @param {*} searchFilter
* @param {*} filter
* @returns {any[]}
* @memberof TestEnetityDatasService
*/
@
Errorlog
public
searchRootchannel
(
context
:
any
=
{},
searchFilter
:
any
,
filter
:
any
):
Promise
<
any
>
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
if
(
filter
.
viewparams
){
Object
.
assign
(
searchFilter
,
filter
.
viewparams
);
}
if
(
!
searchFilter
.
page
){
Object
.
assign
(
searchFilter
,{
page
:
0
});
}
if
(
!
searchFilter
.
size
){
Object
.
assign
(
searchFilter
,{
size
:
1000
});
}
if
(
context
&&
context
.
srfparentdename
){
Object
.
assign
(
searchFilter
,{
srfparentdename
:
JSON
.
parse
(
JSON
.
stringify
(
context
)).
srfparentdename
});
}
if
(
context
&&
context
.
srfparentkey
){
Object
.
assign
(
searchFilter
,{
srfparentkey
:
JSON
.
parse
(
JSON
.
stringify
(
context
)).
srfparentkey
});
}
const
_appEntityService
:
any
=
this
.
appEntityService
;
let
list
:
any
[]
=
[];
if
(
_appEntityService
[
'FetchRoot'
]
&&
_appEntityService
[
'FetchRoot'
]
instanceof
Function
)
{
const
response
:
Promise
<
any
>
=
_appEntityService
[
'FetchRoot'
](
context
,
searchFilter
,
false
);
response
.
then
((
response
:
any
)
=>
{
if
(
!
response
.
status
||
response
.
status
!==
200
)
{
resolve
([]);
console
.
log
(
JSON
.
stringify
(
context
));
console
.
error
(
'查询FetchRoot数据集异常!'
);
}
const
data
:
any
=
response
.
data
;
if
(
Object
.
keys
(
data
).
length
>
0
)
{
list
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
resolve
(
list
);
}
else
{
resolve
([]);
}
}).
catch
((
response
:
any
)
=>
{
resolve
([]);
console
.
log
(
JSON
.
stringify
(
context
));
console
.
error
(
'查询FetchRoot数据集异常!'
);
});
}
})
}
/**
* 填充 树视图节点[站点频道]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof ChannelContentService
*/
@
Errorlog
public
async
fillRootchannelNodeChilds
(
context
:
any
=
{},
filter
:
any
,
list
:
any
[]):
Promise
<
any
>
{
if
(
filter
.
srfnodefilter
&&
!
Object
.
is
(
filter
.
srfnodefilter
,
""
))
{
// 填充子频道
let
ChildchannelRsNavContext
:
any
=
{};
let
ChildchannelRsNavParams
:
any
=
{};
let
ChildchannelRsParams
:
any
=
{};
await
this
.
fillChildchannelNodes
(
context
,
filter
,
list
,
ChildchannelRsNavContext
,
ChildchannelRsNavParams
,
ChildchannelRsParams
);
}
else
{
// 填充子频道
let
ChildchannelRsNavContext
:
any
=
{};
let
ChildchannelRsNavParams
:
any
=
{};
let
ChildchannelRsParams
:
any
=
{};
await
this
.
fillChildchannelNodes
(
context
,
filter
,
list
,
ChildchannelRsNavContext
,
ChildchannelRsNavParams
,
ChildchannelRsParams
);
}
}
/**
* 填充 树视图节点[站点]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof ChannelContentService
*/
@
Errorlog
public
fillWebsiteNodes
(
context
:
any
=
{},
filter
:
any
,
list
:
any
[],
rsNavContext
?:
any
,
rsNavParams
?:
any
,
rsParams
?:
any
):
Promise
<
any
>
{
context
=
this
.
handleResNavContext
(
context
,
filter
,
rsNavContext
);
filter
=
this
.
handleResNavParams
(
context
,
filter
,
rsNavParams
,
rsParams
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
searchFilter
:
any
=
{};
Object
.
assign
(
searchFilter
,
{
total
:
false
});
let
bFirst
:
boolean
=
true
;
let
records
:
any
[]
=
[];
try
{
this
.
searchWebsite
(
context
,
searchFilter
,
filter
).
then
((
records
:
any
)
=>
{
if
(
records
&&
records
.
length
>
0
){
records
.
forEach
((
entity
:
any
)
=>
{
let
treeNode
:
any
=
{};
// 整理context
let
strId
:
string
=
entity
.
websiteid
;
let
strText
:
string
=
entity
.
websitename
;
Object
.
assign
(
treeNode
,{
srfparentdename
:
'WebSite'
,
srfparentkey
:
entity
.
websiteid
});
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
Object
.
assign
(
tempContext
,{
srfparentdename
:
'WebSite'
,
srfparentkey
:
entity
.
websiteid
,
website
:
strId
})
Object
.
assign
(
treeNode
,{
srfappctx
:
tempContext
});
Object
.
assign
(
treeNode
,{
'website'
:
strId
});
Object
.
assign
(
treeNode
,
{
srfkey
:
strId
});
Object
.
assign
(
treeNode
,
{
text
:
strText
,
srfmajortext
:
strText
});
let
strNodeId
:
string
=
'WEBSITE'
;
strNodeId
+=
this
.
TREENODE_SEPARATOR
;
strNodeId
+=
strId
;
Object
.
assign
(
treeNode
,
{
id
:
strNodeId
});
Object
.
assign
(
treeNode
,
{
expanded
:
filter
.
isautoexpand
});
Object
.
assign
(
treeNode
,
{
leaf
:
false
});
Object
.
assign
(
treeNode
,
{
curData
:
entity
});
Object
.
assign
(
treeNode
,
{
nodeid
:
treeNode
.
srfkey
});
Object
.
assign
(
treeNode
,
{
nodeid2
:
filter
.
strRealNodeId
});
list
.
push
(
treeNode
);
resolve
(
list
);
bFirst
=
false
;
});
}
else
{
resolve
(
list
);
}
});
}
catch
(
error
)
{
console
.
error
(
error
);
}
});
}
/**
* 获取查询集合
*
* @public
* @param {any{}} context
* @param {*} searchFilter
* @param {*} filter
* @returns {any[]}
* @memberof TestEnetityDatasService
*/
@
Errorlog
public
searchWebsite
(
context
:
any
=
{},
searchFilter
:
any
,
filter
:
any
):
Promise
<
any
>
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
if
(
filter
.
viewparams
){
Object
.
assign
(
searchFilter
,
filter
.
viewparams
);
}
if
(
!
searchFilter
.
page
){
Object
.
assign
(
searchFilter
,{
page
:
0
});
}
if
(
!
searchFilter
.
size
){
Object
.
assign
(
searchFilter
,{
size
:
1000
});
}
if
(
context
&&
context
.
srfparentdename
){
Object
.
assign
(
searchFilter
,{
srfparentdename
:
JSON
.
parse
(
JSON
.
stringify
(
context
)).
srfparentdename
});
}
if
(
context
&&
context
.
srfparentkey
){
Object
.
assign
(
searchFilter
,{
srfparentkey
:
JSON
.
parse
(
JSON
.
stringify
(
context
)).
srfparentkey
});
}
const
_appEntityService
:
any
=
this
.
websiteService
;
let
list
:
any
[]
=
[];
if
(
_appEntityService
[
'FetchDefault'
]
&&
_appEntityService
[
'FetchDefault'
]
instanceof
Function
)
{
const
response
:
Promise
<
any
>
=
_appEntityService
[
'FetchDefault'
](
context
,
searchFilter
,
false
);
response
.
then
((
response
:
any
)
=>
{
if
(
!
response
.
status
||
response
.
status
!==
200
)
{
resolve
([]);
console
.
log
(
JSON
.
stringify
(
context
));
console
.
error
(
'查询FetchDefault数据集异常!'
);
}
const
data
:
any
=
response
.
data
;
if
(
Object
.
keys
(
data
).
length
>
0
)
{
list
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
resolve
(
list
);
}
else
{
resolve
([]);
}
}).
catch
((
response
:
any
)
=>
{
resolve
([]);
console
.
log
(
JSON
.
stringify
(
context
));
console
.
error
(
'查询FetchDefault数据集异常!'
);
});
}
})
}
/**
* 填充 树视图节点[站点]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof ChannelContentService
*/
@
Errorlog
public
async
fillWebsiteNodeChilds
(
context
:
any
=
{},
filter
:
any
,
list
:
any
[]):
Promise
<
any
>
{
if
(
filter
.
srfnodefilter
&&
!
Object
.
is
(
filter
.
srfnodefilter
,
""
))
{
// 填充站点频道
let
RootchannelRsNavContext
:
any
=
{};
let
RootchannelRsNavParams
:
any
=
{};
let
RootchannelRsParams
:
any
=
{};
await
this
.
fillRootchannelNodes
(
context
,
filter
,
list
,
RootchannelRsNavContext
,
RootchannelRsNavParams
,
RootchannelRsParams
);
}
else
{
// 填充站点频道
let
RootchannelRsNavContext
:
any
=
{};
let
RootchannelRsNavParams
:
any
=
{};
let
RootchannelRsParams
:
any
=
{};
await
this
.
fillRootchannelNodes
(
context
,
filter
,
list
,
RootchannelRsNavContext
,
RootchannelRsNavParams
,
RootchannelRsParams
);
}
}
/**
* 填充 树视图节点[默认根节点]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof ChannelContentService
*/
@
Errorlog
public
fillRootNodes
(
context
:
any
=
{},
filter
:
any
,
list
:
any
[],
rsNavContext
?:
any
,
rsNavParams
?:
any
,
rsParams
?:
any
):
Promise
<
any
>
{
context
=
this
.
handleResNavContext
(
context
,
filter
,
rsNavContext
);
filter
=
this
.
handleResNavParams
(
context
,
filter
,
rsNavParams
,
rsParams
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
treeNode
:
any
=
{};
Object
.
assign
(
treeNode
,
{
text
:
'entities.websitechannel.channelcontent_treeview.nodes.root'
});
Object
.
assign
(
treeNode
,
{
isUseLangRes
:
true
});
Object
.
assign
(
treeNode
,{
srfappctx
:
context
});
Object
.
assign
(
treeNode
,
{
srfmajortext
:
treeNode
.
text
});
let
strNodeId
:
string
=
'ROOT'
;
Object
.
assign
(
treeNode
,
{
srfkey
:
'root'
});
strNodeId
+=
this
.
TREENODE_SEPARATOR
;
strNodeId
+=
'root'
;
Object
.
assign
(
treeNode
,
{
id
:
strNodeId
});
Object
.
assign
(
treeNode
,
{
expanded
:
filter
.
isAutoexpand
});
Object
.
assign
(
treeNode
,
{
leaf
:
true
});
Object
.
assign
(
treeNode
,
{
nodeid
:
treeNode
.
srfkey
});
Object
.
assign
(
treeNode
,
{
nodeid2
:
filter
.
strRealNodeId
});
list
.
push
(
treeNode
);
resolve
(
list
);
});
}
/**
* 填充 树视图节点[默认根节点]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof ChannelContentService
*/
@
Errorlog
public
async
fillRootNodeChilds
(
context
:
any
=
{},
filter
:
any
,
list
:
any
[]):
Promise
<
any
>
{
if
(
filter
.
srfnodefilter
&&
!
Object
.
is
(
filter
.
srfnodefilter
,
""
))
{
}
else
{
}
}
/**
* 处理代码表返回数据(树状结构)
*
* @param result 返回数组
* @param context 应用上下文
* @param callBack 回调
* @memberof ChannelContentService
*/
public
handleDataSet
(
result
:
Array
<
any
>
,
context
:
any
,
callBack
:
any
){
let
list
:
Array
<
any
>
=
[];
if
(
result
.
length
===
0
){
return
list
;
}
result
.
forEach
((
codeItem
:
any
)
=>
{
if
(
!
codeItem
.
pvalue
){
let
valueField
:
string
=
codeItem
.
value
;
this
.
setChildCodeItems
(
valueField
,
result
,
codeItem
);
list
.
push
(
codeItem
);
}
})
this
.
setNodeData
(
list
,
context
,
callBack
);
return
list
;
}
/**
* 处理非根节点数据
*
* @param result 返回数组
* @param context 应用上下文
* @param callBack 回调
* @memberof ChannelContentService
*/
public
setChildCodeItems
(
pValue
:
string
,
result
:
Array
<
any
>
,
codeItem
:
any
){
result
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
pvalue
==
pValue
){
let
valueField
:
string
=
item
.
value
;
this
.
setChildCodeItems
(
valueField
,
result
,
item
);
if
(
!
codeItem
.
children
){
codeItem
.
children
=
[];
}
codeItem
.
children
.
push
(
item
);
}
})
}
/**
* 设置节点UI数据
*
* @param result 返回数组
* @param context 应用上下文
* @param callBack 回调
* @memberof ChannelContentService
*/
public
setNodeData
(
result
:
Array
<
any
>
,
context
:
any
,
callBack
:
any
){
result
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
children
){
item
.
leaf
=
false
;
this
.
setNodeData
(
item
.
children
,
context
,
callBack
);
}
else
{
item
.
leaf
=
true
;
}
callBack
(
context
,
item
);
})
}
/**
* 处理节点关系导航上下文
*
* @param context 应用上下文
* @param filter 参数
* @param resNavContext 节点关系导航上下文
*
* @memberof ChannelContentService
*/
public
handleResNavContext
(
context
:
any
,
filter
:
any
,
resNavContext
:
any
){
if
(
resNavContext
&&
Object
.
keys
(
resNavContext
).
length
>
0
){
let
tempContextData
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
tempViewParams
:
any
=
{};
if
(
filter
&&
filter
.
viewparams
){
tempViewParams
=
filter
.
viewparams
;
}
Object
.
keys
(
resNavContext
).
forEach
((
item
:
any
)
=>
{
let
curDataObj
:
any
=
resNavContext
[
item
];
this
.
handleCustomDataLogic
(
context
,
tempViewParams
,
curDataObj
,
tempContextData
,
item
);
})
return
tempContextData
;
}
else
{
return
context
;
}
}
/**
* 处理关系导航参数
*
* @param context 应用上下文
* @param filter 参数
* @param resNavParams 节点关系导航参数
* @param resParams 节点关系参数
*
* @memberof ChannelContentService
*/
public
handleResNavParams
(
context
:
any
,
filter
:
any
,
resNavParams
:
any
,
resParams
:
any
){
if
((
resNavParams
&&
Object
.
keys
(
resNavParams
).
length
>
0
)
||
(
resParams
&&
Object
.
keys
(
resParams
).
length
>
0
)){
let
tempViewParamData
:
any
=
{};
let
tempViewParams
:
any
=
{};
if
(
filter
&&
filter
.
viewparams
){
tempViewParams
=
filter
.
viewparams
;
tempViewParamData
=
JSON
.
parse
(
JSON
.
stringify
(
filter
.
viewparams
));
}
if
(
Object
.
keys
(
resNavParams
).
length
>
0
){
Object
.
keys
(
resNavParams
).
forEach
((
item
:
any
)
=>
{
let
curDataObj
:
any
=
resNavParams
[
item
];
this
.
handleCustomDataLogic
(
context
,
tempViewParams
,
curDataObj
,
tempViewParamData
,
item
);
})
}
if
(
Object
.
keys
(
resParams
).
length
>
0
){
Object
.
keys
(
resParams
).
forEach
((
item
:
any
)
=>
{
let
curDataObj
:
any
=
resParams
[
item
];
tempViewParamData
[
item
.
toLowerCase
()]
=
curDataObj
.
value
;
})
}
Object
.
assign
(
filter
,{
viewparams
:
tempViewParamData
});
return
filter
;
}
else
{
return
filter
;
}
}
/**
* 处理自定义节点关系导航数据
*
* @param context 应用上下文
* @param viewparams 参数
* @param curNavData 节点关系导航参数对象
* @param tempData 返回数据
* @param item 节点关系导航参数键值
*
* @memberof ChannelContentService
*/
public
handleCustomDataLogic
(
context
:
any
,
viewparams
:
any
,
curNavData
:
any
,
tempData
:
any
,
item
:
string
){
// 直接值直接赋值
if
(
curNavData
.
isRawValue
){
if
(
Object
.
is
(
curNavData
.
value
,
"null"
)
||
Object
.
is
(
curNavData
.
value
,
""
)){
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
null
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
}
else
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
curNavData
.
value
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
}
}
else
{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if
(
context
[(
curNavData
.
value
).
toLowerCase
()]){
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
context
[(
curNavData
.
value
).
toLowerCase
()],
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
}
else
{
if
(
viewparams
[(
curNavData
.
value
).
toLowerCase
()]){
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
viewparams
[(
curNavData
.
value
).
toLowerCase
()],
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
}
else
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
null
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
}
}
}
}
}
\ No newline at end of file
app_WebSite/src/widgets/web-site-channel/channel-content-treeview/channel-content-treeview.html
0 → 100644
浏览文件 @
d0bd61bd
<div
class=
"design-tree-container"
>
<context-menu-container>
<el-tree
v-if=
"inited"
ref=
"treeexpbar_tree"
class=
"design-tree"
node-key=
"id"
lazy
:show-checkbox=
"!isSingleSelect"
:check-on-click-node=
"!isSingleSelect"
:default-expanded-keys=
"expandedKeys"
:props=
"{
label: 'text',
isLeaf: 'leaf',
children: 'children'
}"
:load=
"load.bind(_self)"
:highlight-current=
"true"
:expand-on-click-node=
"false"
@
check=
"onCheck.apply(_self, arguments)"
@
current-change=
"selectionChange.apply(_self, arguments)"
:filter-node-method=
"filterNode"
>
<template
slot-scope=
"{ node, data }"
>
<context-menu
:contextMenuStyle=
"{width: '100%'}"
:data=
"node"
:renderContent=
"renderContextMenu.bind(_self)"
>
<tooltip
transfer
style=
"width: 100%;"
max-width=
"2000"
placement=
"right"
>
<div
class=
"tree-node"
@
dblclick=
"doDefaultAction(node)"
>
<span
class=
"icon"
>
<i
v-if=
" data.iconcls && !Object.is(data.iconcls, '')"
:class=
"data.iconcls"
></i>
<img
v-else-if=
"data.icon && !Object.is(data.icon, '')"
:src=
"data.icon"
/>
<icon
v-else-if=
"isOutputIconDefault"
type=
"ios-paper-outline"
></icon>
</span>
<span
class=
"text"
>
<span
v-if=
"data.html"
v-html=
"data.html"
></span>
<span
v-else
>
{{ data.isUseLangRes ? $t(data.text) : data.text }}
</span>
</span>
</div>
<template
slot=
"content"
>
<span
v-if=
"data.html"
v-html=
"data.html"
></span>
<span
v-else
>
{{ data.isUseLangRes ? $t(data.text) : data.text }}
</span>
</template>
</tooltip>
</context-menu>
</template>
</el-tree>
</context-menu-container>
</div>
\ No newline at end of file
app_WebSite/src/widgets/web-site-channel/channel-content-treeview/channel-content-treeview.vue
0 → 100644
浏览文件 @
d0bd61bd
<
template
src=
"./channel-content-treeview.html"
/>
<script
lang=
'tsx'
>
import
{ Component } from 'vue-property-decorator';
import { VueLifeCycleProcessing } from '@/studio-core';
import { ChannelContentTreeBase } from './channel-content-treeview-base';
/**
* treeexpbar_tree部件
*
* @export
* @class ChannelContentTree
* @extends {ChannelContentTreeBase}
*/
@Component({
components: {
}
})
@VueLifeCycleProcessing()
export default class ChannelContentTree extends ChannelContentTreeBase { }
</script>
app_WebSite/src/widgets/web-site-channel/content-tree-viewtreeexpbar-treeexpbar/content-tree-viewtreeexpbar-treeexpbar.vue
浏览文件 @
d0bd61bd
...
...
@@ -3,7 +3,7 @@
import
{ Component } from 'vue-property-decorator';
import { VueLifeCycleProcessing } from '@/studio-core';
import { ContentTreeViewtreeexpbarTreeExpBarBase } from './content-tree-viewtreeexpbar-treeexpbar-base';
import view_treeexpbar_tree from '@widgets/web-site-channel/channel-
tree-treeview/channel-tree
-treeview.vue';
import view_treeexpbar_tree from '@widgets/web-site-channel/channel-
content-treeview/channel-content
-treeview.vue';
/**
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录