Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
功
功能演示系统
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
示例
功能演示系统
提交
24aff043
提交
24aff043
编写于
11月 26, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Mosher 发布系统代码 [后台服务,演示应用]
上级
d709454e
变更
10
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
1890 行增加
和
0 行删除
+1890
-0
ibizbooktree-grid-ex-view-base.vue
...zbooktree-grid-ex-view/ibizbooktree-grid-ex-view-base.vue
+633
-0
ibizbooktree-grid-ex-view.less
.../ibizbooktree-grid-ex-view/ibizbooktree-grid-ex-view.less
+19
-0
ibizbooktree-grid-ex-view.vue
...e/ibizbooktree-grid-ex-view/ibizbooktree-grid-ex-view.vue
+22
-0
router.ts
app_Web/src/pages/sample/index/router.ts
+13
-0
state.ts
app_Web/src/store/modules/view-action/state.ts
+10
-0
tree-table-treegridex-base.vue
...book/tree-table-treegridex/tree-table-treegridex-base.vue
+491
-0
tree-table-treegridex-model.ts
...book/tree-table-treegridex/tree-table-treegridex-model.ts
+73
-0
tree-table-treegridex-service.ts
...ok/tree-table-treegridex/tree-table-treegridex-service.ts
+608
-0
tree-table-treegridex.less
...ibizbook/tree-table-treegridex/tree-table-treegridex.less
+7
-0
tree-table-treegridex.vue
.../ibizbook/tree-table-treegridex/tree-table-treegridex.vue
+14
-0
未找到文件。
app_Web/src/pages/sample/ibizbooktree-grid-ex-view/ibizbooktree-grid-ex-view-base.vue
0 → 100644
浏览文件 @
24aff043
<
template
>
<div
class=
'view-container detreegridexview ibizbooktree-grid-ex-view'
>
<app-studioaction
:viewTitle=
"$t(model.srfCaption)"
viewName=
"ibizbooktreegridexview"
></app-studioaction>
<card
class=
'view-card '
:dis-hover=
"true"
:bordered=
"false"
>
<div
slot=
'title'
class=
"header-container"
>
<span
class=
'caption-info'
>
{{
$t
(
model
.
srfCaption
)
}}
</span>
</div>
<div
class=
'view-top-messages'
>
</div>
<div
class=
'content-container'
>
<div
style=
'margin-bottom: 6px;'
>
<div
class=
'pull-right'
>
<div
class=
'toolbar-container'
>
</div>
</div>
</div>
<div
class=
'view-body-messages'
>
</div>
<view
_treegridex
:viewState=
"viewState"
:viewparams=
"viewparams"
:context=
"context"
:showBusyIndicator=
"true"
name=
"treegridex"
ref=
'treegridex'
@
closeview=
"closeView($event)"
>
</view
_treegridex
>
</div>
<div
class=
'view-bottom-messages'
>
</div>
</card>
</div>
</
template
>
<
script
lang=
'tsx'
>
import
{
Vue
,
Component
,
Prop
,
Provide
,
Emit
,
Watch
,
Inject
}
from
'vue-property-decorator'
;
import
{
UIActionTool
,
Util
}
from
'@/utils'
;
import
NavDataService
from
'@/service/app/navdata-service'
;
import
{
Subject
,
Subscription
}
from
'rxjs'
;
import
IBIZBOOKService
from
'@/service/ibizbook/ibizbook-service'
;
import
IBIZBOOKAuthService
from
'@/authservice/ibizbook/ibizbook-auth-service'
;
import
IBIZBOOKUIService
from
'@/uiservice/ibizbook/ibizbook-ui-service'
;
@
Component
({
components
:
{
},
})
export
default
class
IBIZBOOKTreeGridExViewBase
extends
Vue
{
/**
* 实体服务对象
*
* @type {IBIZBOOKService}
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
appEntityService
:
IBIZBOOKService
=
new
IBIZBOOKService
;
/**
* 实体UI服务对象
*
* @type IBIZBOOKUIService
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
appUIService
:
IBIZBOOKUIService
=
new
IBIZBOOKUIService
(
this
.
$store
);
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof IBIZBOOKTreeGridExViewBase
*/
@
Emit
()
public
viewDatasChange
(
val
:
any
):
any
{
return
val
;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof IBIZBOOKTreeGridExViewBase
*/
@
Prop
()
public
viewdata
!
:
string
;
/**
* 传入视图参数
*
* @type {string}
* @memberof IBIZBOOKTreeGridExViewBase
*/
@
Prop
()
public
viewparam
!
:
string
;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof IBIZBOOKTreeGridExViewBase
*/
@
Prop
({
default
:
true
})
public
viewDefaultUsage
!
:
boolean
;
/**
* 视图默认使用
*
* @type {string}
* @memberof IBIZBOOKTreeGridExViewBase
*/
@
Inject
({
from
:
'navModel'
,
default
:
'tab'
})
public
navModel
!
:
string
;
/**
* 视图标识
*
* @type {string}
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
viewtag
:
string
=
'2ccd29eeaeded3ea5a713a19cd67a83e'
;
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
customViewNavContexts
:
any
=
{
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
customViewParams
:
any
=
{
};
/**
* 视图模型数据
*
* @type {*}
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
model
:
any
=
{
srfCaption
:
'entities.ibizbook.views.treegridexview.caption'
,
srfTitle
:
'entities.ibizbook.views.treegridexview.title'
,
srfSubTitle
:
'entities.ibizbook.views.treegridexview.subtitle'
,
dataInfo
:
''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBIZBOOKTreeGridExViewBase
*/
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
if
(
newVal
){
this
.
viewparams
=
{};
if
(
typeof
newVal
==
'string'
)
{
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
}
else
{
this
.
viewparams
=
Util
.
deepCopy
(
this
.
viewparam
);
}
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBIZBOOKTreeGridExViewBase
*/
@
Watch
(
'viewdata'
)
onViewData
(
newVal
:
any
,
oldVal
:
any
)
{
const
_this
:
any
=
this
;
if
(
!
Object
.
is
(
newVal
,
oldVal
)
&&
_this
.
engine
)
{
this
.
$nextTick
(()
=>
{
_this
.
parseViewParam
();
_this
.
engine
.
load
();
});
}
else
if
(
!
Object
.
is
(
newVal
,
oldVal
)
&&
_this
.
refresh
&&
_this
.
refresh
instanceof
Function
)
{
_this
.
refresh
();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
containerModel
:
any
=
{
view_toolbar
:
{
name
:
'toolbar'
,
type
:
'TOOLBAR'
},
view_treegridex
:
{
name
:
'treegridex'
,
type
:
'TREEGRIDEX'
},
};
/**
* 视图刷新
*
* @param {*} args
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
refresh
(
args
?:
any
):
void
{
const
refs
:
any
=
this
.
$refs
;
if
(
refs
&&
refs
.
treegridex
)
{
refs
.
treegridex
.
refresh
();
}
}
/**
* 计数器刷新
*
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
counterRefresh
(){
const
_this
:
any
=
this
;
if
(
_this
.
counterServiceArray
&&
_this
.
counterServiceArray
.
length
>
0
){
_this
.
counterServiceArray
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
refreshData
&&
item
.
refreshData
instanceof
Function
){
item
.
refreshData
();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
viewState
:
Subject
<
ViewState
>
=
new
Subject
();
/**
* 工具栏模型
*
* @type {*}
* @memberof IBIZBOOKTreeGridExView
*/
public
toolBarModels
:
any
=
{
};
/**
* 引擎初始化
*
* @public
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
engineInit
():
void
{
}
/**
* 应用导航服务
*
* @type {*}
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
navDataService
=
NavDataService
.
getInstance
(
this
.
$store
);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
serviceStateEvent
:
Subscription
|
undefined
;
/**
* 门户部件状态对象
*
* @type {*}
* @memberof IBIZBOOKTreeGridExViewBase
*/
@
Prop
()
public
portletState
?:
any
;
/**
* 门户部件状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
portletStateEvent
:
Subscription
|
undefined
;
/**
* 应用上下文
*
* @type {*}
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
context
:
any
=
{};
/**
* 视图参数
*
* @type {*}
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
viewparams
:
any
=
{};
/**
* 视图缓存数据
*
* @type {*}
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
viewCacheData
:
any
;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
counterServiceArray
:
Array
<
any
>
=
[];
/**
* 解析视图参数
*
* @public
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
parseViewParam
(
inputvalue
:
any
=
null
):
void
{
for
(
let
key
in
this
.
context
){
delete
this
.
context
[
key
];
}
if
(
this
.
$store
.
getters
.
getAppData
()
&&
this
.
$store
.
getters
.
getAppData
().
context
){
Object
.
assign
(
this
.
context
,
this
.
$store
.
getters
.
getAppData
().
context
);
}
if
(
!
this
.
viewDefaultUsage
&&
this
.
viewdata
&&
!
Object
.
is
(
this
.
viewdata
,
''
))
{
if
(
typeof
this
.
viewdata
==
'string'
)
{
Object
.
assign
(
this
.
context
,
JSON
.
parse
(
this
.
viewdata
));
}
if
(
this
.
context
&&
this
.
context
.
srfparentdename
){
Object
.
assign
(
this
.
viewparams
,{
srfparentdename
:
this
.
context
.
srfparentdename
});
}
if
(
this
.
context
&&
this
.
context
.
srfparentkey
){
Object
.
assign
(
this
.
viewparams
,{
srfparentkey
:
this
.
context
.
srfparentkey
});
}
this
.
handleCustomViewData
();
return
;
}
const
path
=
(
this
.
$route
.
matched
[
this
.
$route
.
matched
.
length
-
1
]).
path
;
const
keys
:
Array
<
any
>
=
[];
const
curReg
=
this
.
$pathToRegExp
.
pathToRegexp
(
path
,
keys
);
const
matchArray
=
curReg
.
exec
(
this
.
$route
.
path
);
let
tempValue
:
Object
=
{};
keys
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
.
name
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
this
.
$viewTool
.
formatRouteParams
(
tempValue
,
this
.
$route
,
this
.
context
,
this
.
viewparams
);
if
(
inputvalue
){
Object
.
assign
(
this
.
context
,{
'ibizbook'
:
inputvalue
});
}
//初始化视图唯一标识
Object
.
assign
(
this
.
context
,{
srfsessionid
:
this
.
$util
.
createUUID
()});
this
.
handleCustomViewData
();
//初始化导航数据
this
.
initNavDataWithRoute
();
}
/**
* 处理自定义视图数据
*
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
handleCustomViewData
(){
if
(
Object
.
keys
(
this
.
customViewNavContexts
).
length
>
0
){
Object
.
keys
(
this
.
customViewNavContexts
).
forEach
((
item
:
any
)
=>
{
let
tempContext
:
any
=
{};
let
curNavContext
:
any
=
this
.
customViewNavContexts
[
item
];
this
.
handleCustomDataLogic
(
curNavContext
,
tempContext
,
item
);
Object
.
assign
(
this
.
context
,
tempContext
);
})
}
if
(
Object
.
keys
(
this
.
customViewParams
).
length
>
0
){
Object
.
keys
(
this
.
customViewParams
).
forEach
((
item
:
any
)
=>
{
let
tempParam
:
any
=
{};
let
curNavParam
:
any
=
this
.
customViewParams
[
item
];
this
.
handleCustomDataLogic
(
curNavParam
,
tempParam
,
item
);
Object
.
assign
(
this
.
viewparams
,
tempParam
);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
handleCustomDataLogic
(
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
(
this
.
context
[(
curNavData
.
value
).
toLowerCase
()]
!=
null
){
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
this
.
context
[(
curNavData
.
value
).
toLowerCase
()],
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
}
else
{
if
(
this
.
viewparams
[(
curNavData
.
value
).
toLowerCase
()]
!=
null
){
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
this
.
viewparams
[(
curNavData
.
value
).
toLowerCase
()],
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
}
else
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
null
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
initNavDataWithRoute
(
data
:
any
=
null
,
isNew
:
boolean
=
false
,
isAlways
:
boolean
=
false
){
if
(
isAlways
||
(
this
.
viewDefaultUsage
&&
Object
.
is
(
this
.
navModel
,
"route"
))
){
this
.
navDataService
.
addNavData
({
id
:
'ibizbooktree-grid-ex-view'
,
tag
:
this
.
viewtag
,
srfkey
:
isNew
?
null
:
this
.
context
.
ibizbook
,
title
:
this
.
$t
(
this
.
model
.
srfCaption
),
data
:
data
,
context
:
this
.
context
,
viewparams
:
this
.
viewparams
,
path
:
this
.
$route
.
fullPath
});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
initNavDataWithTab
(
data
:
any
=
null
,
isOnlyAdd
:
boolean
=
true
,
isAlways
:
boolean
=
false
){
if
(
isAlways
||
(
this
.
viewDefaultUsage
&&
!
Object
.
is
(
this
.
navModel
,
"route"
))
){
this
.
navDataService
.
addNavDataByOnly
({
id
:
'ibizbooktree-grid-ex-view'
,
tag
:
this
.
viewtag
,
srfkey
:
this
.
context
.
ibizbook
,
title
:
this
.
$t
(
this
.
model
.
srfCaption
),
data
:
data
,
context
:
this
.
context
,
viewparams
:
this
.
viewparams
,
path
:
this
.
$route
.
fullPath
},
isOnlyAdd
);
}
}
/**
* Vue声明周期
*
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
created
()
{
this
.
afterCreated
();
}
/**
* 执行created后的逻辑
*
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
afterCreated
(){
let
_this
:
any
=
this
;
const
secondtag
=
_this
.
$util
.
createUUID
();
_this
.
$store
.
commit
(
'viewaction/createdView'
,
{
viewtag
:
_this
.
viewtag
,
secondtag
:
secondtag
});
_this
.
viewtag
=
secondtag
;
_this
.
parseViewParam
();
_this
.
serviceStateEvent
=
_this
.
navDataService
.
serviceState
.
subscribe
(({
action
,
name
,
data
}:{
action
:
string
,
name
:
any
,
data
:
any
})
=>
{
if
(
!
Object
.
is
(
name
,
'ibizbooktree-grid-ex-view'
)){
return
;
}
if
(
Object
.
is
(
action
,
'viewrefresh'
))
{
_this
.
$nextTick
(()
=>
{
_this
.
parseViewParam
(
data
);
if
(
_this
.
engine
){
_this
.
engine
.
load
();
}
});
}
});
if
(
_this
.
portletState
){
_this
.
portletStateEvent
=
_this
.
portletState
.
subscribe
((
res
:
any
)
=>
{
if
(
!
Object
.
is
(
res
.
name
,
'IBIZBOOKTreeGridExView'
)){
return
;
}
if
(
Object
.
is
(
res
.
action
,
'refresh'
)
&&
_this
.
refresh
&&
_this
.
refresh
instanceof
Function
){
_this
.
refresh
();
}
})
}
}
/**
* 销毁之前
*
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
beforeDestroy
()
{
this
.
$store
.
commit
(
'viewaction/removeView'
,
this
.
viewtag
);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
mounted
()
{
this
.
afterMounted
();
}
/**
* 执行mounted后的逻辑
*
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
afterMounted
(){
const
_this
:
any
=
this
;
_this
.
engineInit
();
if
(
_this
.
loadModel
&&
_this
.
loadModel
instanceof
Function
)
{
_this
.
loadModel
();
}
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
closeView
(
args
:
any
[]):
void
{
let
_view
:
any
=
this
;
if
(
_view
.
viewdata
)
{
_view
.
$emit
(
'viewdataschange'
,
[
args
]);
_view
.
$emit
(
'close'
,
[
args
]);
}
else
if
(
_view
.
$tabPageExp
)
{
_view
.
$tabPageExp
.
onClose
(
_view
.
$route
.
fullPath
);
}
}
/**
* 销毁视图回调
*
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
destroyed
(){
this
.
afterDestroyed
();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
afterDestroyed
(){
if
(
this
.
viewDefaultUsage
){
let
localStoreLength
=
Object
.
keys
(
localStorage
);
if
(
localStoreLength
.
length
>
0
){
localStoreLength
.
forEach
((
item
:
string
)
=>
{
if
(
item
.
startsWith
(
this
.
context
.
srfsessionid
)){
localStorage
.
removeItem
(
item
);
}
})
}
if
(
Object
.
is
(
this
.
navModel
,
"tab"
)){
this
.
navDataService
.
removeNavDataByTag
(
this
.
viewtag
);
}
if
(
this
.
serviceStateEvent
)
{
this
.
serviceStateEvent
.
unsubscribe
();
}
}
// 销毁计数器定时器
if
(
this
.
counterServiceArray
&&
this
.
counterServiceArray
.
length
>
0
){
this
.
counterServiceArray
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
destroyCounter
&&
item
.
destroyCounter
instanceof
Function
){
item
.
destroyCounter
();
}
})
}
if
(
this
.
portletStateEvent
){
this
.
portletStateEvent
.
unsubscribe
();
}
}
/**
* 打开编辑数据
*
* @memberof IBIZBOOKTreeGridExViewBase
*/
public
opendata
(
args
:
any
[],
params
?:
any
,
$event
?:
any
,
xData
?:
any
)
{
if
(
xData
&&
xData
.
opendata
instanceof
Function
)
{
xData
.
opendata
(
args
);
}
}
}
</
script
>
<
style
lang=
'less'
>
@import './ibizbooktree-grid-ex-view.less';
</
style
>
\ No newline at end of file
app_Web/src/pages/sample/ibizbooktree-grid-ex-view/ibizbooktree-grid-ex-view.less
0 → 100644
浏览文件 @
24aff043
.ibizbooktree-grid-ex-view{
position: relative;
}
.toolbar-container {
button {
margin: 6px 0px 4px 4px;
.caption {
margin-left: 4px;
}
}
.seperator {
color: #dcdee2;
margin: 0 0px 0 4px;
}
}
// this is less
app_Web/src/pages/sample/ibizbooktree-grid-ex-view/ibizbooktree-grid-ex-view.vue
0 → 100644
浏览文件 @
24aff043
<
script
lang=
'tsx'
>
import
{
Component
}
from
'vue-property-decorator'
;
import
IBIZBOOKTreeGridExViewBase
from
'./ibizbooktree-grid-ex-view-base.vue'
;
import
view_treegridex
from
'@widgets/ibizbook/tree-table-treegridex/tree-table-treegridex.vue'
;
@
Component
({
components
:
{
view_treegridex
,
},
beforeRouteEnter
:
(
to
:
any
,
from
:
any
,
next
:
any
)
=>
{
next
((
vm
:
any
)
=>
{
if
(
!
Object
.
is
(
vm
.
navModel
,
"route"
)){
vm
.
initNavDataWithTab
(
vm
.
viewCacheData
);
}
vm
.
$store
.
commit
(
'addCurPageViewtag'
,
{
fullPath
:
to
.
fullPath
,
viewtag
:
vm
.
viewtag
});
});
},
})
export
default
class
IBIZBOOKTreeGridExView
extends
IBIZBOOKTreeGridExViewBase
{
}
</
script
>
\ No newline at end of file
app_Web/src/pages/sample/index/router.ts
浏览文件 @
24aff043
...
...
@@ -2304,6 +2304,19 @@ const router = new Router({
},
component
:
()
=>
import
(
'@pages/sample/ibizbookauto-group-list-view/ibizbookauto-group-list-view.vue'
),
},
{
path
:
'/ibizbooks/:ibizbook?/treegridexview/:treegridexview?'
,
meta
:
{
caption
:
'entities.ibizbook.views.treegridexview.caption'
,
info
:
''
,
parameters
:
[
{
pathName
:
'ibizbooks'
,
parameterName
:
'ibizbook'
},
{
pathName
:
'treegridexview'
,
parameterName
:
'treegridexview'
},
],
requireAuth
:
true
,
},
component
:
()
=>
import
(
'@pages/sample/ibizbooktree-grid-ex-view/ibizbooktree-grid-ex-view.vue'
),
},
{
path
:
'/ibizorders/:ibizorder?/f13editview/:f13editview?'
,
meta
:
{
...
...
app_Web/src/store/modules/view-action/state.ts
浏览文件 @
24aff043
...
...
@@ -292,6 +292,16 @@ export const viewstate: any = {
'b3429ecc4d89a02bc5f5279f1bd7f620'
,
],
},
{
viewtag
:
'2ccd29eeaeded3ea5a713a19cd67a83e'
,
viewmodule
:
'Sample'
,
viewname
:
'IBIZBOOKTreeGridExView'
,
viewaction
:
''
,
viewdatachange
:
false
,
refviews
:
[
'b3429ecc4d89a02bc5f5279f1bd7f620'
,
],
},
{
viewtag
:
'2cd3a77cbd2aad4551b7a6a009419d52'
,
viewmodule
:
'Sample'
,
...
...
app_Web/src/widgets/ibizbook/tree-table-treegridex/tree-table-treegridex-base.vue
0 → 100644
浏览文件 @
24aff043
<
template
>
<el-table
ref=
"treegridex"
:data=
"items"
row-key=
"id"
border
lazy
height=
"100%"
:row-class-name=
"setRowClass"
:load=
"loadTreeNode"
:tree-props=
"
{ children: 'children', hasChildren: 'leaf' }"
:select-on-indeterminate="isSingleSelect"
:highlight-current-row="isSingleSelect"
@current-change="select"
>
<template
slot=
"empty"
>
{{
$t
(
'entities.ibizbook.treetable_treegridex.nodata'
)
}}
</
template
>
</el-table>
</template>
<
script
lang=
'tsx'
>
import
{
Vue
,
Component
,
Prop
,
Provide
,
Emit
,
Watch
,
Model
,
Inject
}
from
'vue-property-decorator'
;
import
{
CreateElement
}
from
'vue'
;
import
{
Subject
,
Subscription
}
from
'rxjs'
;
import
{
ControlInterface
}
from
'@/interface/control'
;
import
{
UIActionTool
,
Util
,
ViewTool
}
from
'@/utils'
;
import
NavDataService
from
'@/service/app/navdata-service'
;
import
AppCenterService
from
"@service/app/app-center-service"
;
import
IBIZBOOKService
from
'@/service/ibizbook/ibizbook-service'
;
import
TreeTableService
from
'./tree-table-treegridex-service'
;
import
IBIZBOOKUIService
from
'@/uiservice/ibizbook/ibizbook-ui-service'
;
@
Component
({
components
:
{
}
})
export
default
class
TreeTableBase
extends
Vue
implements
ControlInterface
{
/**
* 名称
*
* @type {string}
* @memberof TreeTableBase
*/
@
Prop
()
public
name
?:
string
;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof TreeTableBase
*/
@
Prop
()
public
viewState
!
:
Subject
<
ViewState
>
;
/**
* 应用上下文
*
* @type {*}
* @memberof TreeTableBase
*/
@
Prop
()
public
context
:
any
;
/**
* 视图参数
*
* @type {*}
* @memberof TreeTableBase
*/
@
Prop
()
public
viewparams
:
any
;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof TreeTableBase
*/
public
viewStateEvent
:
Subscription
|
undefined
;
/**
* 获取部件类型
*
* @returns {string}
* @memberof TreeTableBase
*/
public
getControlType
():
string
{
return
'TREEGRIDEX'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof TreeTableBase
*/
public
counterServiceArray
:
Array
<
any
>
=
[];
/**
* 建构部件服务对象
*
* @type {TreeTableService}
* @memberof TreeTableBase
*/
public
service
:
TreeTableService
=
new
TreeTableService
({
$store
:
this
.
$store
});
/**
* 实体服务对象
*
* @type {IBIZBOOKService}
* @memberof TreeTableBase
*/
public
appEntityService
:
IBIZBOOKService
=
new
IBIZBOOKService
({
$store
:
this
.
$store
});
/**
* 转化数据
*
* @param {any} args
* @memberof TreeTableBase
*/
public
transformData
(
args
:
any
)
{
let
_this
:
any
=
this
;
if
(
_this
.
service
&&
_this
.
service
.
handleRequestData
instanceof
Function
&&
_this
.
service
.
handleRequestData
(
'transform'
,
_this
.
context
,
args
)){
return
_this
.
service
.
handleRequestData
(
'transform'
,
_this
.
context
,
args
)[
'data'
];
}
}
/**
* 关闭视图
*
* @param {any} args
* @memberof TreeTableBase
*/
public
closeView
(
args
:
any
):
void
{
let
_this
:
any
=
this
;
_this
.
$emit
(
'closeview'
,
[
args
]);
}
/**
* 计数器刷新
*
* @memberof TreeTableBase
*/
public
counterRefresh
(){
const
_this
:
any
=
this
;
if
(
_this
.
counterServiceArray
&&
_this
.
counterServiceArray
.
length
>
0
){
_this
.
counterServiceArray
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
refreshData
&&
item
.
refreshData
instanceof
Function
){
item
.
refreshData
();
}
})
}
}
/**
* 显示处理提示
*
* @type {boolean}
* @memberof TreeTableBase
*/
@
Prop
({
default
:
true
})
public
showBusyIndicator
?:
boolean
;
/**
* 部件行为--load
*
* @type {string}
* @memberof TreeTableBase
*/
@
Prop
()
public
loadAction
!
:
string
;
/**
* 是否单选
*
* @type {boolean}
* @memberof TreeTableBase
*/
@
Prop
({
default
:
true
})
public
isSingleSelect
!
:
boolean
;
/**
* 部件样式名
*
* @public
* @type {any[]}
* @memberof TreeTableBase
*/
public
controlClass
:
string
=
"treegridex"
;
/**
* 数据集合
*
* @public
* @type {any[]}
* @memberof TreeTableBase
*/
public
items
:
any
[]
=
[];
/**
* 默认展开节点集合
*
* @memberof TreeTableBase
*/
public
defExpands
:
any
=
[];
/**
* 行节点下标
*
* @memberof TreeTableBase
*/
public
itemNum
:
any
=
{};
/**
* 计数下标
*
* @memberof TreeTableBase
*/
public
num
:
number
=
0
;
/**
* 获取列属性值
*
* @public
* @memberof TreeTableBase
*/
public
getColumnValue
(
task
:
any
,
field
:
string
)
{
if
(
Object
.
is
(
task
.
id
.
split
(
';'
)[
0
],
'ROOT'
))
{
return
task
[
field
];
}
if
(
Object
.
is
(
task
.
id
.
split
(
';'
)[
0
],
'top1'
))
{
return
task
[
field
];
}
}
/**
* 获取代码项
*
* @public
* @memberof TreeTableBase
*/
public
getCodeListItem
(
codelist
:
any
,
val
:
any
)
{
for
(
let
i
=
0
;
i
<
codelist
.
items
.
length
;
i
++
)
{
if
(
Object
.
is
(
codelist
.
items
[
i
].
value
,
val
))
{
return
codelist
.
items
[
i
].
text
;
}
}
return
codelist
.
emptytext
;
}
/**
* 搜索获取日程事件
*
* @param {*} $event 日期信息
* @memberof TreeTableBase
*/
public
load
(
task
:
any
=
{},
resolve
?:
any
)
{
const
params
:
any
=
{
srfnodeid
:
task
&&
task
.
id
?
task
.
id
:
"#"
,
srfnodefilter
:
''
};
let
tempViewParams
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
viewparams
));
let
curNode
:
any
=
{};
Util
.
deepObjectMerge
(
curNode
,
task
);
let
tempContext
:
any
=
this
.
computecurNodeContext
(
curNode
);
if
(
curNode
&&
curNode
.
srfparentdename
)
{
Object
.
assign
(
tempContext
,{
srfparentdename
:
curNode
.
srfparentdename
});
Object
.
assign
(
tempViewParams
,{
srfparentdename
:
curNode
.
srfparentdename
});
}
if
(
curNode
&&
curNode
.
srfparentkey
)
{
Object
.
assign
(
tempContext
,{
srfparentkey
:
curNode
.
srfparentkey
});
Object
.
assign
(
tempViewParams
,{
srfparentkey
:
curNode
.
srfparentkey
});
}
Object
.
assign
(
params
,{
viewparams
:
tempViewParams
});
this
.
service
.
getNodes
(
tempContext
,
params
).
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
response
.
info
});
return
;
}
response
.
data
.
forEach
((
item
:
any
)
=>
{
this
.
itemNum
[
item
.
id
]
=
this
.
num
++
;
if
(
!
item
.
collapsed
)
{
this
.
defExpands
.
push
(
item
);
}
})
if
(
resolve
&&
resolve
instanceof
Function
)
{
resolve
(
response
.
data
);
}
else
{
this
.
items
=
[...
response
.
data
];
}
this
.
$nextTick
(()
=>
{
this
.
expandDefNode
();
})
this
.
$emit
(
"load"
,
this
.
items
);
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
===
401
)
{
return
;
}
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
response
.
info
});
});
}
/**
* 加载节点
*
* @memberof TreeTable
*/
public
loadTreeNode
(
tree
:
any
,
treeNode
:
any
,
resolve
:
any
)
{
this
.
load
(
tree
,
resolve
);
}
/**
* 计算当前节点的上下文
*
* @param {*} curNode 当前节点
* @memberof TreeTableBase
*/
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 {*} item 当前节点
* @memberof TreeTableBase
*/
public
itemExpand
(
item
:
any
)
{
}
/**
* 刷新
*
* @memberof TreeTableBase
*/
public
refresh
(
args
?:
any
)
{
this
.
load
();
}
/**
* 选中的数据
*
* @returns {any[]}
* @memberof TreeTableBase
*/
public
selections
:
any
[]
=
[];
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof TreeTableBase
*/
public
getDatas
():
any
[]
{
return
this
.
selections
;
}
/**
* 获取单项树
*
* @returns {*}
* @memberof TreeTableBase
*/
public
getData
():
any
{
return
this
.
selections
.
length
>
0
?
this
.
selections
[
0
]
:
null
;
}
/**
* vue 生命周期
*
* @returns
* @memberof TreeTableBase
*/
public
created
()
{
this
.
afterCreated
();
}
/**
* 执行created后的逻辑
*
* @memberof TreeTableBase
*/
public
afterCreated
()
{
this
.
viewStateEvent
=
this
.
viewState
.
subscribe
(({
tag
,
action
,
data
})
=>
{
if
(
!
Object
.
is
(
tag
,
this
.
name
))
{
return
;
}
if
(
Object
.
is
(
'load'
,
action
))
{
this
.
load
(
data
);
}
});
}
/**
* 设置行Class
*
* @returns
* @memberof TreeTableBase
*/
public
setRowClass
({
row
,
rowIndex
}:
{
row
:
any
,
rowIndex
:
number
})
{
return
'treegrid'
+
this
.
itemNum
[
row
.
id
];
}
/**
* 展开默认节点
*
* @returns
* @memberof TreeTableBase
*/
public
expandDefNode
()
{
if
(
this
.
defExpands
.
length
>
0
)
{
let
item
:
any
=
this
.
defExpands
[
0
];
this
.
defExpands
.
splice
(
0
,
1
);
let
trs
:
any
=
this
.
$el
.
getElementsByClassName
(
'treegrid'
+
this
.
itemNum
[
item
.
id
]);
if
(
trs
)
{
let
icons
:
any
=
trs
[
0
].
getElementsByClassName
(
'el-table__expand-icon'
);
icons
[
0
].
click
();
}
}
}
/**
* 选中变化
*
* @returns
* @memberof TreeTableBase
*/
public
select
(
$event
:
any
)
{
if
(
!
$event
)
{
return
;
}
this
.
selections
=
[
JSON
.
parse
(
JSON
.
stringify
(
$event
))];
this
.
$emit
(
'selectionchange'
,
this
.
selections
);
}
/**
* 打开编辑数据
*
* @returns
* @memberof TreeTableBase
*/
public
opendata
(
args
:
any
)
{
if
(
this
.
selections
.
length
===
0
)
{
return
;
}
if
(
Object
.
is
(
this
.
selections
[
0
].
id
.
split
(
';'
)[
0
],
'ROOT'
))
{
}
if
(
Object
.
is
(
this
.
selections
[
0
].
id
.
split
(
';'
)[
0
],
'top1'
))
{
}
}
/**
* vue 生命周期
*
* @memberof TreeTableBase
*/
public
destroyed
()
{
this
.
afterDestroy
();
}
/**
* 执行destroyed后的逻辑
*
* @memberof TreeTableBase
*/
public
afterDestroy
()
{
if
(
this
.
viewStateEvent
)
{
this
.
viewStateEvent
.
unsubscribe
();
}
}
}
</
script
>
<
style
lang=
'less'
>
@import './tree-table-treegridex.less';
</
style
>
\ No newline at end of file
app_Web/src/widgets/ibizbook/tree-table-treegridex/tree-table-treegridex-model.ts
0 → 100644
浏览文件 @
24aff043
/**
* TreeTable 部件模型
*
* @export
* @class TreeTableModel
*/
export
default
class
TreeTableModel
{
/**
* 日历项类型
*
* @returns {any[]}
* @memberof TreeTableTreegridexMode
*/
public
itemType
:
string
=
""
;
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof TreeTableTreegridexMode
*/
public
getDataItems
():
any
[]
{
let
dataItems
:
any
=
[
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name
:
'srffrontuf'
,
prop
:
'srffrontuf'
,
dataType
:
'TEXT'
,
},
{
name
:
'style'
,
},
{
name
:
'textColor'
,
},
{
name
:
'itemType'
,
},
{
name
:
'parentId'
},
{
name
:
'query'
,
prop
:
'query'
,
},
];
switch
(
this
.
itemType
){
case
"top1"
:
dataItems
=
[...
dataItems
,
{
name
:
'id'
,
prop
:
'ibizbookid'
},
{
name
:
'author'
,
prop
:
'author'
},
{
name
:
'srfmajortext'
,
prop
:
'ibizbookname'
},
{
name
:
'subtext'
,
prop
:
'subtext'
},
];
break
;
}
return
dataItems
;
}
}
\ No newline at end of file
app_Web/src/widgets/ibizbook/tree-table-treegridex/tree-table-treegridex-service.ts
0 → 100644
浏览文件 @
24aff043
import
{
Http
,
Util
,
Errorlog
}
from
'@/utils'
;
import
ControlService
from
'@/widgets/control-service'
;
import
IBIZBOOKService
from
'@/service/ibizbook/ibizbook-service'
;
import
TreeTableModel
from
'./tree-table-treegridex-model'
;
import
CodeListService
from
"@/codelist/codelist-service"
;
import
i18n
from
'@/locale'
;
/**
* TreeTable 部件服务对象
*
* @export
* @class TreeTableService
*/
export
default
class
TreeTableService
extends
ControlService
{
/**
* 图书服务对象
*
* @type {IBIZBOOKService}
* @memberof TreeTableService
*/
public
appEntityService
:
IBIZBOOKService
=
new
IBIZBOOKService
({
$store
:
this
.
getStore
()
});
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof TreeTableService
*/
public
setTempMode
(){
this
.
isTempMode
=
false
;
}
/**
* Creates an instance of TreeTableService.
*
* @param {*} [opts={}]
* @memberof TreeTableService
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
this
.
model
=
new
TreeTableModel
();
}
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof TreeTableService
*/
public
codeListService
:
CodeListService
=
new
CodeListService
({
$store
:
this
.
getStore
()
});
/**
* 节点分隔符号
*
* @public
* @type {string}
* @memberof TreeTableService
*/
public
TREENODE_SEPARATOR
:
string
=
';'
;
/**
* 默认根节点节点分隔符号
*
* @public
* @type {string}
* @memberof TreeTableService
*/
public
TREENODE_ROOT
:
string
=
'ROOT'
;
/**
* 一级节点节点分隔符号
*
* @public
* @type {string}
* @memberof TreeTableService
*/
public
TREENODE_TOP1
:
string
=
'top1'
;
/**
* 商品类别节点分隔符号
*
* @public
* @type {*}
* @memberof TreeTableService
*/
public
dataModel
:
any
=
{
ROOT
:
{
},
top1
:
{
author
:
{
prop
:
'author'
,
default
:
null
},
srfmajortext
:
{
prop
:
'ibizbookname'
,
default
:
null
},
subtext
:
{
prop
:
'subtext'
,
default
:
null
},
},
}
/**
* 获取节点数据
*
* @param {string} action
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof TreeTableService
*/
@
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
=
{};
let
srfotherkey
:
string
=
''
;
if
(
!
srfnodeid
||
Object
.
is
(
srfnodeid
,
'#'
))
{
srfnodeid
=
this
.
TREENODE_ROOT
;
}
else
{
srfotherkey
=
srfnodeid
;
srfnodeid
=
srfnodeid
.
split
(
'_#_'
)[
0
];
}
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
,
srfotherkey
:
srfotherkey
,
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_ROOT
))
{
await
this
.
fillRootNodeChilds
(
context
,
filter
,
list
);
return
Promise
.
resolve
({
status
:
200
,
data
:
list
});
}
if
(
Object
.
is
(
strNodeType
,
this
.
TREENODE_TOP1
))
{
await
this
.
fillTop1NodeChilds
(
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 TreeTableService
*/
@
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.ibizbook.treetable_treegridex.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
+
'_#_'
+
filter
.
srfnodeid
});
Object
.
assign
(
treeNode
,
{
collapsed
:
true
});
Object
.
assign
(
treeNode
,
{
leaf
:
false
});
Object
.
assign
(
treeNode
,
{
navparams
:
'{}'
});
Object
.
assign
(
treeNode
,
{
nodeid
:
treeNode
.
srfkey
});
Object
.
assign
(
treeNode
,
{
nodeid2
:
filter
.
strRealNodeId
});
if
(
!
Object
.
is
(
filter
.
srfnodeid
,
this
.
TREENODE_ROOT
))
{
Object
.
assign
(
treeNode
,
{
parentId
:
filter
.
srfotherkey
});
}
list
.
push
(
treeNode
);
resolve
(
list
);
});
}
/**
* 填充 树视图节点[默认根节点]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof TreeTableService
*/
@
Errorlog
public
async
fillRootNodeChilds
(
context
:
any
=
{},
filter
:
any
,
list
:
any
[]):
Promise
<
any
>
{
if
(
filter
.
srfnodefilter
&&
!
Object
.
is
(
filter
.
srfnodefilter
,
""
))
{
// 填充一级节点
let
Top1RsNavContext
:
any
=
{};
let
Top1RsNavParams
:
any
=
{};
let
Top1RsParams
:
any
=
{};
await
this
.
fillTop1Nodes
(
context
,
filter
,
list
,
Top1RsNavContext
,
Top1RsNavParams
,
Top1RsParams
);
}
else
{
// 填充一级节点
let
Top1RsNavContext
:
any
=
{};
let
Top1RsNavParams
:
any
=
{};
let
Top1RsParams
:
any
=
{};
await
this
.
fillTop1Nodes
(
context
,
filter
,
list
,
Top1RsNavContext
,
Top1RsNavParams
,
Top1RsParams
);
}
}
/**
* 填充 树视图节点[一级节点]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof TreeTableService
*/
@
Errorlog
public
fillTop1Nodes
(
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
.
searchTop1
(
context
,
searchFilter
,
filter
).
then
((
records
:
any
)
=>
{
if
(
records
&&
records
.
length
>
0
){
records
.
forEach
((
entity
:
any
)
=>
{
let
treeNode
:
any
=
{};
// 整理context
let
strId
:
string
=
entity
.
ibizbookid
;
let
strText
:
string
=
entity
.
ibizbookname
;
Object
.
assign
(
treeNode
,{
srfparentdename
:
'IBIZBOOK'
,
srfparentkey
:
entity
.
ibizbookid
});
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
Object
.
assign
(
tempContext
,{
srfparentdename
:
'IBIZBOOK'
,
srfparentkey
:
entity
.
ibizbookid
,
ibizbook
:
strId
})
Object
.
assign
(
treeNode
,{
srfappctx
:
tempContext
});
Object
.
assign
(
treeNode
,{
'ibizbook'
:
strId
});
Object
.
assign
(
treeNode
,
{
srfkey
:
strId
});
Object
.
assign
(
treeNode
,
{
text
:
strText
,
srfmajortext
:
strText
});
let
strNodeId
:
string
=
'top1'
;
strNodeId
+=
this
.
TREENODE_SEPARATOR
;
strNodeId
+=
strId
;
Object
.
assign
(
treeNode
,
{
id
:
strNodeId
+
'_#_'
+
filter
.
srfnodeid
});
Object
.
assign
(
treeNode
,
{
collapsed
:
true
});
Object
.
assign
(
treeNode
,
{
leaf
:
false
});
Object
.
assign
(
treeNode
,
{
navparams
:
'{}'
});
Object
.
assign
(
treeNode
,
{
nodeid
:
treeNode
.
srfkey
});
Object
.
assign
(
treeNode
,
{
nodeid2
:
filter
.
strRealNodeId
});
if
(
!
Object
.
is
(
filter
.
srfnodeid
,
this
.
TREENODE_ROOT
))
{
Object
.
assign
(
treeNode
,
{
parentId
:
filter
.
srfotherkey
});
}
for
(
let
key
in
this
.
dataModel
.
top1
)
{
let
item
=
this
.
dataModel
.
top1
[
key
];
let
propVal
:
any
=
entity
[
item
.
prop
];
try
{
let
def
:
any
=
JSON
.
parse
(
item
.
default
);
propVal
=
propVal
!=
null
?
propVal
:
def
.
value
;
if
(
def
.
hasOwnProperty
(
'bkcolor'
))
{
Object
.
assign
(
treeNode
.
style
,
{
base
:
{
fill
:
def
.
bkcolor
,
stroke
:
def
.
bkcolor
}});
}
if
(
def
.
hasOwnProperty
(
'color'
))
{
Object
.
assign
(
treeNode
.
style
,
{
text
:
{
color
:
def
.
color
}});
}
}
catch
(
e
)
{
propVal
=
propVal
!=
null
?
propVal
:
item
.
default
}
treeNode
[
key
]
=
propVal
}
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
searchTop1
(
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 TreeTableService
*/
@
Errorlog
public
async
fillTop1NodeChilds
(
context
:
any
=
{},
filter
:
any
,
list
:
any
[]):
Promise
<
any
>
{
if
(
filter
.
srfnodefilter
&&
!
Object
.
is
(
filter
.
srfnodefilter
,
""
))
{
}
else
{
}
}
/**
* 处理代码表返回数据(树状结构)
*
* @param result 返回数组
* @param context 应用上下文
* @param callBack 回调
* @memberof TreeTableService
*/
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 TreeTableService
*/
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 TreeTableService
*/
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 TreeTableService
*/
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 TreeTableService
*/
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 TreeTableService
*/
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
()]
!=
null
){
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
context
[(
curNavData
.
value
).
toLowerCase
()],
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
}
else
{
if
(
viewparams
[(
curNavData
.
value
).
toLowerCase
()]
!=
null
){
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_Web/src/widgets/ibizbook/tree-table-treegridex/tree-table-treegridex.less
0 → 100644
浏览文件 @
24aff043
.gantt {
height: 100%;
.gantt-elastic__main-view-container {
flex-grow: 1;
}
}
// this is less
app_Web/src/widgets/ibizbook/tree-table-treegridex/tree-table-treegridex.vue
0 → 100644
浏览文件 @
24aff043
<
script
lang=
'tsx'
>
import
{
Component
}
from
'vue-property-decorator'
;
import
TreeTableBase
from
'./tree-table-treegridex-base.vue'
;
@
Component
({
components
:
{
}
})
export
default
class
TreeTable
extends
TreeTableBase
{
}
</
script
>
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录