Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzrt
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzrt
提交
f11e7696
提交
f11e7696
编写于
11月 16, 2020
作者:
laizhilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
解决打开角色表单直接保存,保存按钮变灰的bug
上级
a55fa6b6
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
565 行增加
和
561 行删除
+565
-561
sys-role-edit-view.vue
...b/src/pages/uaa/sys-role-edit-view/sys-role-edit-view.vue
+56
-56
sys-role-permission-custom-view.vue
...ermission-custom-view/sys-role-permission-custom-view.vue
+509
-505
未找到文件。
app_Web/src/pages/uaa/sys-role-edit-view/sys-role-edit-view.vue
浏览文件 @
f11e7696
<
script
lang=
'tsx'
>
<
script
lang=
'tsx'
>
import
{
Component
}
from
"vue-property-decorator"
;
import
{
Component
}
from
"vue-property-decorator"
;
import
SysRoleEditViewBase
from
"./sys-role-edit-view-base.vue"
;
import
SysRoleEditViewBase
from
"./sys-role-edit-view-base.vue"
;
import
view_form
from
"@widgets/sys-role/main-form/main-form.vue"
;
import
view_form
from
"@widgets/sys-role/main-form/main-form.vue"
;
@
Component
({
@
Component
({
components
:
{
components
:
{
view_form
,
view_form
,
},
},
beforeRouteEnter
:
(
to
:
any
,
from
:
any
,
next
:
any
)
=>
{
beforeRouteEnter
:
(
to
:
any
,
from
:
any
,
next
:
any
)
=>
{
next
((
vm
:
any
)
=>
{
next
((
vm
:
any
)
=>
{
if
(
!
Object
.
is
(
vm
.
navModel
,
"route"
))
{
if
(
!
Object
.
is
(
vm
.
navModel
,
"route"
))
{
vm
.
initNavDataWithTab
(
vm
.
viewCacheData
);
vm
.
initNavDataWithTab
(
vm
.
viewCacheData
);
}
}
vm
.
$store
.
commit
(
"addCurPageViewtag"
,
{
vm
.
$store
.
commit
(
"addCurPageViewtag"
,
{
fullPath
:
to
.
fullPath
,
fullPath
:
to
.
fullPath
,
viewtag
:
vm
.
viewtag
,
viewtag
:
vm
.
viewtag
,
});
});
});
});
},
},
})
})
export
default
class
SysRoleEditView
extends
SysRoleEditViewBase
{
export
default
class
SysRoleEditView
extends
SysRoleEditViewBase
{
/**
/**
* 保存
* 保存
*
*
* @param {any[]} args 当前数据
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditViewBase
* @memberof SysRoleEditViewBase
*/
*/
public
Save
(
public
Save
(
args
:
any
[],
args
:
any
[],
contextJO
?:
any
,
contextJO
?:
any
,
params
?:
any
,
params
?:
any
,
$event
?:
any
,
$event
?:
any
,
xData
?:
any
,
xData
?:
any
,
actionContext
?:
any
,
actionContext
?:
any
,
srfParentDeName
?:
string
srfParentDeName
?:
string
)
{
)
{
// 界面行为容器对象 _this
// 界面行为容器对象 _this
const
_this
:
any
=
this
;
const
_this
:
any
=
this
;
if
(
xData
&&
xData
.
save
instanceof
Function
)
{
if
(
xData
&&
xData
.
save
instanceof
Function
)
{
// 禁用保存按钮
// 禁用保存按钮
_this
.
toolBarModels
.
tbitem3
.
disabled
=
true
;
_this
.
toolBarModels
.
tbitem3
.
disabled
=
true
;
xData
.
save
().
then
((
response
:
any
)
=>
{
xData
.
save
().
then
((
response
:
any
)
=>
{
// 启用保存按钮
// 启用保存按钮
_this
.
toolBarModels
.
tbitem3
.
disabled
=
false
;
_this
.
toolBarModels
.
tbitem3
.
disabled
=
false
;
if
(
!
response
||
response
.
status
!==
200
)
{
if
(
!
response
||
response
.
status
!==
200
)
{
return
;
return
;
}
_this
.
$emit
(
"viewdataschange"
,
[{
...
response
.
data
}]);
});
}
else
if
(
_this
.
save
&&
_this
.
save
instanceof
Function
)
{
_this
.
save
();
}
}
}
_this
.
$emit
(
"viewdataschange"
,
[{
...
response
.
data
}]);
});
}
else
if
(
_this
.
save
&&
_this
.
save
instanceof
Function
)
{
_this
.
save
();
}
}
}
}
</
script
>
</
script
>
\ No newline at end of file
app_Web/src/pages/uaa/sys-role-permission-custom-view/sys-role-permission-custom-view.vue
浏览文件 @
f11e7696
...
@@ -63,562 +63,566 @@
...
@@ -63,562 +63,566 @@
</
template
>
</
template
>
<
script
lang=
'tsx'
>
<
script
lang=
'tsx'
>
import
{
Component
,
Prop
,
Vue
,
Watch
}
from
"vue-property-decorator"
;
import
{
Component
,
Prop
,
Vue
,
Watch
}
from
"vue-property-decorator"
;
import
view_pickupviewpanel
from
"@widgets/sys-permission/mpickup-viewpickupviewpanel-pickupviewpanel/mpickup-viewpickupviewpanel-pickupviewpanel.vue"
;
import
view_pickupviewpanel
from
"@widgets/sys-permission/mpickup-viewpickupviewpanel-pickupviewpanel/mpickup-viewpickupviewpanel-pickupviewpanel.vue"
;
import
ContextMenuContainer
from
"@components/context-menu-container/context-menu-container.vue"
;
import
ContextMenuContainer
from
"@components/context-menu-container/context-menu-container.vue"
;
import
{
Subject
}
from
"rxjs"
;
import
{
Subject
}
from
"rxjs"
;
@
Component
({
@
Component
({
components
:
{
components
:
{
ContextMenuContainer
,
ContextMenuContainer
,
view_pickupviewpanel
,
view_pickupviewpanel
,
},
},
beforeRouteEnter
:
(
to
:
any
,
from
:
any
,
next
:
any
)
=>
{
beforeRouteEnter
:
(
to
:
any
,
from
:
any
,
next
:
any
)
=>
{
next
((
vm
:
any
)
=>
{
next
((
vm
:
any
)
=>
{
vm
.
$store
.
commit
(
"addCurPageViewtag"
,
{
vm
.
$store
.
commit
(
"addCurPageViewtag"
,
{
fullPath
:
to
.
fullPath
,
fullPath
:
to
.
fullPath
,
viewtag
:
vm
.
viewtag
,
viewtag
:
vm
.
viewtag
,
});
});
});
});
},
},
})
})
export
default
class
SYS_ROLE_PERMISSIONCustomView
extends
Vue
{
export
default
class
SYS_ROLE_PERMISSIONCustomView
extends
Vue
{
// 应用菜单树搜索文本
// 应用菜单树搜索文本
public
CDtreefilterText
:
any
=
""
;
public
CDtreefilterText
:
any
=
""
;
// 数据能力树搜索文本
// 数据能力树搜索文本
public
QXtreefilterText
:
any
=
""
;
public
QXtreefilterText
:
any
=
""
;
// 自定义资源树搜索文本
// 自定义资源树搜索文本
public
ZYtreefilterText
:
any
=
""
;
public
ZYtreefilterText
:
any
=
""
;
/**
/**
* 过滤节点
* 过滤节点
*/
*/
public
fiterNode
(
value
:
any
,
data
:
any
)
{
public
fiterNode
(
value
:
any
,
data
:
any
)
{
if
(
!
value
)
return
true
;
if
(
!
value
)
return
true
;
return
data
.
label
.
indexOf
(
value
)
!==
-
1
;
return
data
.
label
.
indexOf
(
value
)
!==
-
1
;
}
/**
* 应用菜单树搜索触发
*/
public
filterChangeCDtree
()
{
const
CDtree
:
any
=
this
.
$refs
.
CDtree
;
CDtree
.
filter
(
this
.
CDtreefilterText
);
}
/**
* 数据能力树搜索触发
*/
public
filterChangeQXtree
()
{
const
QXtree
:
any
=
this
.
$refs
.
QXtree
;
QXtree
.
filter
(
this
.
QXtreefilterText
);
}
/**
* 自定义资源树搜索触发
*/
public
filterChangeZYtree
()
{
const
ZYtree
:
any
=
this
.
$refs
.
ZYtree
;
ZYtree
.
filter
(
this
.
ZYtreefilterText
);
}
/*应用菜单数据*/
protected
CDdata
:
any
=
[];
/*数据能力数据*/
protected
QXdata
:
any
=
[];
/*自定义资源数据*/
protected
ZYdata
:
any
=
[];
/*默认选中节点*/
protected
defaultCheckedNodes
:
any
=
[];
/*应用菜单数据默认展开节点*/
protected
CDdataexpandedKeys
:
any
=
[];
/*数据能力数据默认展开节点*/
protected
QXdataexpandedKeys
:
any
=
[];
/*自定义资源数据默认展开节点*/
protected
ZYdataexpandedKeys
:
any
=
[];
/**
* 树显示说明:子树为节点对象的children,节点标签为节点对象的label
*/
protected
defaultProps
:
any
=
{
children
:
"children"
,
label
:
"label"
,
};
/**
* 选中数据
*/
protected
selectData
:
any
=
{};
/**
* 初始选中的数据
*/
protected
ininselectData
:
any
=
{};
/**
* 视图选中数据
*/
public
viewSelections
:
any
[]
=
[];
/**
* 父数据
*/
protected
parentData
:
any
=
{};
/**
* 父数据主键
*/
protected
srfparentkey
:
any
;
/**
* 视图标识
*
* @type {string}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
public
viewtag
:
string
=
"e791be173ed0f4bbe9cce942b6edde63"
;
/**
* 是否嵌入关系界面
*
* @type {boolean}
* @memberof SYS_USER_ROLEGridViewBase
*/
@
Prop
({
default
:
false
})
public
isformDruipart
?:
boolean
;
/**
* 界面关系通讯对象
*
* @type {Subject<ViewState>}
* @memberof SYS_USER_ROLEGridViewBase
*/
@
Prop
()
public
formDruipart
?:
Subject
<
ViewState
>
;
/**
* 应用上下文
*
* @type {*}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
public
context
:
any
=
{};
/**
* 视图参数
*
* @type {*}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
public
viewparams
:
any
=
{};
/**
* 传入视图上下文
*
* @type {string}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
@
Prop
()
public
viewdata
!
:
string
;
@
Watch
(
"viewdata"
)
public
watchViewData
()
{
if
(
!
this
.
viewdata
||
Object
.
is
(
this
.
viewdata
,
""
))
{
return
;
}
}
this
.
parseViewParam
();
/**
const
_this
:
any
=
this
;
* 应用菜单树搜索触发
// 获取父数据
*/
if
(
_this
&&
_this
.
viewdata
)
{
public
filterChangeCDtree
()
{
_this
.
parentData
=
JSON
.
parse
(
_this
.
viewdata
);
const
CDtree
:
any
=
this
.
$refs
.
CDtree
;
CDtree
.
filter
(
this
.
CDtreefilterText
);
}
}
if
(
_this
.
parentData
&&
_this
.
parentData
.
sysrole
)
{
/**
// console.log("当前角色id:" + _this.parentData.sysrole);
* 数据能力树搜索触发
_this
.
srfparentkey
=
_this
.
parentData
.
sysrole
;
*/
public
filterChangeQXtree
()
{
const
QXtree
:
any
=
this
.
$refs
.
QXtree
;
QXtree
.
filter
(
this
.
QXtreefilterText
);
}
}
this
.
initTree
();
/**
}
* 自定义资源树搜索触发
*/
/**
public
filterChangeZYtree
()
{
* 视图默认使用
const
ZYtree
:
any
=
this
.
$refs
.
ZYtree
;
*
ZYtree
.
filter
(
this
.
ZYtreefilterText
);
* @type {boolean}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
@
Prop
({
default
:
true
})
public
viewDefaultUsage
!
:
boolean
;
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
public
customViewNavContexts
:
any
=
{};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
public
customViewParams
:
any
=
{};
/**
* 解析视图参数
*
* @public
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
public
parseViewParam
():
void
{
for
(
let
key
in
this
.
context
)
{
delete
this
.
context
[
key
];
}
}
if
(
!
this
.
viewDefaultUsage
&&
/*应用菜单数据*/
this
.
viewdata
&&
protected
CDdata
:
any
=
[];
!
Object
.
is
(
this
.
viewdata
,
""
)
/*数据能力数据*/
)
{
protected
QXdata
:
any
=
[];
Object
.
assign
(
this
.
context
,
JSON
.
parse
(
this
.
viewdata
));
/*自定义资源数据*/
if
(
this
.
context
&&
this
.
context
.
srfparentdename
)
{
protected
ZYdata
:
any
=
[];
Object
.
assign
(
this
.
viewparams
,
{
/*默认选中节点*/
srfparentdename
:
this
.
context
.
srfparentdename
,
protected
defaultCheckedNodes
:
any
=
[];
});
/*应用菜单数据默认展开节点*/
protected
CDdataexpandedKeys
:
any
=
[];
/*数据能力数据默认展开节点*/
protected
QXdataexpandedKeys
:
any
=
[];
/*自定义资源数据默认展开节点*/
protected
ZYdataexpandedKeys
:
any
=
[];
/**
* 树显示说明:子树为节点对象的children,节点标签为节点对象的label
*/
protected
defaultProps
:
any
=
{
children
:
"children"
,
label
:
"label"
,
};
/**
* 选中数据
*/
protected
selectData
:
any
=
{};
/**
* 初始选中的数据
*/
protected
ininselectData
:
any
=
{};
/**
* 视图选中数据
*/
public
viewSelections
:
any
[]
=
[];
/**
* 父数据
*/
protected
parentData
:
any
=
{};
/**
* 父数据主键
*/
protected
srfparentkey
:
any
;
/**
* 视图标识
*
* @type {string}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
public
viewtag
:
string
=
"e791be173ed0f4bbe9cce942b6edde63"
;
/**
* 是否嵌入关系界面
*
* @type {boolean}
* @memberof SYS_USER_ROLEGridViewBase
*/
@
Prop
({
default
:
false
})
public
isformDruipart
?:
boolean
;
/**
* 界面关系通讯对象
*
* @type {Subject<ViewState>}
* @memberof SYS_USER_ROLEGridViewBase
*/
@
Prop
()
public
formDruipart
?:
Subject
<
ViewState
>
;
/**
* 应用上下文
*
* @type {*}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
public
context
:
any
=
{};
/**
* 视图参数
*
* @type {*}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
public
viewparams
:
any
=
{};
/**
* 传入视图上下文
*
* @type {string}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
@
Prop
()
public
viewdata
!
:
string
;
@
Watch
(
"viewdata"
)
public
watchViewData
()
{
if
(
!
this
.
viewdata
||
Object
.
is
(
this
.
viewdata
,
""
))
{
return
;
}
}
if
(
this
.
context
&&
this
.
context
.
srfparentkey
)
{
this
.
parseViewParam
();
Object
.
assign
(
this
.
viewparams
,
{
const
_this
:
any
=
this
;
srfparentkey
:
this
.
context
.
srfparentkey
,
// 获取父数据
});
if
(
_this
&&
_this
.
viewdata
)
{
_this
.
parentData
=
JSON
.
parse
(
_this
.
viewdata
);
}
}
this
.
handleCustomViewData
();
if
(
_this
.
parentData
&&
_this
.
parentData
.
sysrole
)
{
return
;
// console.log("当前角色id:" + _this.parentData.sysrole);
}
_this
.
srfparentkey
=
_this
.
parentData
.
sysrole
;
const
path
=
this
.
$route
.
matched
[
this
.
$route
.
matched
.
length
-
1
].
path
;
}
const
keys
:
Array
<
any
>
=
[];
this
.
initTree
();
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
(
this
.
$store
.
getters
.
getAppData
()
&&
this
.
$store
.
getters
.
getAppData
().
context
)
{
Object
.
assign
(
this
.
context
,
this
.
$store
.
getters
.
getAppData
().
context
);
}
//初始化视图唯一标识
Object
.
assign
(
this
.
context
,
{
srfsessionid
:
this
.
$util
.
createUUID
()
});
this
.
handleCustomViewData
();
}
/**
* 处理自定义视图数据
*
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
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 SYS_ROLE_PERMISSIONCustomViewBase
* @type {boolean}
*/
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
public
handleCustomDataLogic
(
curNavData
:
any
,
tempData
:
any
,
item
:
string
)
{
*/
// 直接值直接赋值
@
Prop
({
default
:
true
})
public
viewDefaultUsage
!
:
boolean
;
if
(
curNavData
.
isRawValue
)
{
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
public
customViewNavContexts
:
any
=
{};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
public
customViewParams
:
any
=
{};
/**
* 解析视图参数
*
* @public
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
public
parseViewParam
():
void
{
for
(
let
key
in
this
.
context
)
{
delete
this
.
context
[
key
];
}
if
(
if
(
Object
.
is
(
curNavData
.
value
,
"null"
)
||
!
this
.
viewDefaultUsage
&&
Object
.
is
(
curNavData
.
value
,
""
)
this
.
viewdata
&&
!
Object
.
is
(
this
.
viewdata
,
""
)
)
{
)
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
Object
.
assign
(
this
.
context
,
JSON
.
parse
(
this
.
viewdata
));
value
:
null
,
if
(
this
.
context
&&
this
.
context
.
srfparentdename
)
{
writable
:
true
,
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
,
enumerable
:
true
,
configurable
:
true
,
value
:
matchArray
[
index
+
1
]
,
});
});
}
else
{
});
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
this
.
$viewTool
.
formatRouteParams
(
value
:
curNavData
.
value
,
tempValue
,
writable
:
true
,
this
.
$route
,
enumerable
:
true
,
this
.
context
,
configurable
:
true
,
this
.
viewparams
);
if
(
this
.
$store
.
getters
.
getAppData
()
&&
this
.
$store
.
getters
.
getAppData
().
context
)
{
Object
.
assign
(
this
.
context
,
this
.
$store
.
getters
.
getAppData
().
context
);
}
//初始化视图唯一标识
Object
.
assign
(
this
.
context
,
{
srfsessionid
:
this
.
$util
.
createUUID
()
});
this
.
handleCustomViewData
();
}
/**
* 处理自定义视图数据
*
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
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
);
});
});
}
}
}
else
{
if
(
Object
.
keys
(
this
.
customViewParams
).
length
>
0
)
{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
Object
.
keys
(
this
.
customViewParams
).
forEach
((
item
:
any
)
=>
{
if
(
this
.
context
[
curNavData
.
value
.
toLowerCase
()])
{
let
tempParam
:
any
=
{};
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
let
curNavParam
:
any
=
this
.
customViewParams
[
item
];
value
:
this
.
context
[
curNavData
.
value
.
toLowerCase
()],
this
.
handleCustomDataLogic
(
curNavParam
,
tempParam
,
item
);
writable
:
true
,
Object
.
assign
(
this
.
viewparams
,
tempParam
);
enumerable
:
true
,
configurable
:
true
,
});
});
}
else
{
}
if
(
this
.
viewparams
[
curNavData
.
value
.
toLowerCase
()])
{
}
/**
* 处理自定义视图数据逻辑
*
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
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
(),
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
this
.
viewparams
[
curNavData
.
value
.
toLowerCase
()]
,
value
:
null
,
writable
:
true
,
writable
:
true
,
enumerable
:
true
,
enumerable
:
true
,
configurable
:
true
,
configurable
:
true
,
});
});
}
else
{
}
else
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
null
,
value
:
curNavData
.
value
,
writable
:
true
,
writable
:
true
,
enumerable
:
true
,
enumerable
:
true
,
configurable
:
true
,
configurable
:
true
,
});
});
}
}
}
}
else
{
}
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
}
if
(
this
.
context
[
curNavData
.
value
.
toLowerCase
()])
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
/**
value
:
this
.
context
[
curNavData
.
value
.
toLowerCase
()],
* vue 创建
writable
:
true
,
*/
enumerable
:
true
,
public
created
()
{
configurable
:
true
,
this
.
afterCreated
();
});
}
}
else
{
if
(
this
.
viewparams
[
curNavData
.
value
.
toLowerCase
()])
{
/**
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
* 执行created后的逻辑
value
:
this
.
viewparams
[
curNavData
.
value
.
toLowerCase
()],
*
writable
:
true
,
* @memberof SYS_USER_ROLEGridViewBase
enumerable
:
true
,
*/
configurable
:
true
,
public
afterCreated
()
{
});
const
secondtag
=
this
.
$util
.
createUUID
();
this
.
$store
.
commit
(
"viewaction/createdView"
,
{
viewtag
:
this
.
viewtag
,
secondtag
:
secondtag
,
});
this
.
viewtag
=
secondtag
;
// this.parseViewParam();
const
_this
:
any
=
this
;
// 获取父数据
// if (_this && _this.viewdata) {
// _this.parentData = JSON.parse(_this.viewdata);
// }
// if (_this.parentData && _this.parentData.sysrole) {
// // console.log("当前角色id:" + _this.parentData.sysrole);
// _this.srfparentkey = _this.parentData.sysrole;
// }
// 监听父页面
if
(
this
.
formDruipart
)
{
this
.
formDruipart
.
subscribe
((
res
:
any
)
=>
{
// 如果是新建角色保存,需要从res中获取父数据主键
if
(
!
this
.
srfparentkey
&&
res
.
data
)
{
let
parentData
=
res
.
data
;
this
.
srfparentkey
=
parentData
.
srfparentkey
;
}
// 父页面的保存前,先进行树数据的更新处理
if
(
Object
.
is
(
res
.
action
,
"save"
))
{
if
(
this
.
selectData
.
length
>
0
)
{
// 选中了数据
this
.
onClickOk
();
}
else
{
}
else
{
// 没选中数据
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
this
.
onClear
();
value
:
null
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
,
});
}
}
}
}
}
);
}
}
}
}
/**
/**
* vue 挂载
* vue 创建
*/
*/
public
moun
ted
()
{
public
crea
ted
()
{
// this.initTree
();
this
.
afterCreated
();
}
}
/**
/**
* 初始化树
* 执行created后的逻辑
*/
*
private
initTree
()
{
* @memberof SYS_USER_ROLEGridViewBase
const
_this
=
this
;
*/
// get全部菜单和数据能力和自定义资源的请求路径
public
afterCreated
()
{
const
url
=
`sysroles/`
+
_this
.
srfparentkey
+
`/sysrolepermissions/tree`
;
const
secondtag
=
this
.
$util
.
createUUID
();
this
.
$http
this
.
$store
.
commit
(
"viewaction/createdView"
,
{
.
get
(
url
)
viewtag
:
this
.
viewtag
,
.
then
((
response
:
any
)
=>
{
secondtag
:
secondtag
,
if
(
!
response
||
response
.
status
!==
200
)
{
});
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
response
.
message
});
this
.
viewtag
=
secondtag
;
return
;
// this.parseViewParam();
}
else
{
// 给树赋值,数据结构在后台已经按照eltree格式化
const
_this
:
any
=
this
;
_this
.
CDdata
=
response
.
data
.
APPMENU
;
// 获取父数据
_this
.
QXdata
=
response
.
data
.
OPPRIV
;
// if (_this && _this.viewdata) {
_this
.
ZYdata
=
response
.
data
.
UNIRES
;
// _this.parentData = JSON.parse(_this.viewdata);
_this
.
defaultCheckedNodes
=
response
.
data
.
SELECTED
;
// }
// if (_this.parentData && _this.parentData.sysrole) {
// 设置默认第一级展开
// // console.log("当前角色id:" + _this.parentData.sysrole);
for
(
let
i
=
0
;
i
<
_this
.
CDdata
.
length
;
i
++
)
{
// _this.srfparentkey = _this.parentData.sysrole;
_this
.
CDdataexpandedKeys
.
push
(
_this
.
CDdata
[
i
].
id
);
// }
}
for
(
let
i
=
0
;
i
<
_this
.
QXdata
.
length
;
i
++
)
{
// 监听父页面
_this
.
QXdataexpandedKeys
.
push
(
_this
.
QXdata
[
i
].
id
);
if
(
this
.
formDruipart
)
{
this
.
formDruipart
.
subscribe
((
res
:
any
)
=>
{
// 如果是新建角色保存,需要从res中获取父数据主键
if
(
!
this
.
srfparentkey
&&
res
.
data
)
{
let
parentData
=
res
.
data
;
this
.
srfparentkey
=
parentData
.
srfparentkey
;
}
}
for
(
let
i
=
0
;
i
<
_this
.
ZYdata
.
length
;
i
++
)
{
// 父页面的保存前,先进行树数据的更新处理
_this
.
ZYdataexpandedKeys
.
push
(
_this
.
ZYdata
[
i
].
id
);
if
(
Object
.
is
(
res
.
action
,
"save"
))
{
if
(
this
.
selectData
.
length
>
0
)
{
// 选中了数据
this
.
onClickOk
();
}
else
{
// 没选中数据
this
.
onClear
();
}
}
}
});
}
}
// 设置默认选中节点,即当前角色所有权限
/**
this
.
$nextTick
(()
=>
{
* vue 挂载
const
CDtree
:
any
=
this
.
$refs
.
CDtree
;
*/
const
QXtree
:
any
=
this
.
$refs
.
QXtree
;
public
mounted
()
{
const
ZYtree
:
any
=
this
.
$refs
.
ZYtree
;
// this.initTree();
}
CDtree
.
setCheckedNodes
(
_this
.
defaultCheckedNodes
);
/**
QXtree
.
setCheckedNodes
(
_this
.
defaultCheckedNodes
);
* 初始化树
ZYtree
.
setCheckedNodes
(
_this
.
defaultCheckedNodes
);
*/
private
initTree
()
{
const
_this
=
this
;
// get全部菜单和数据能力和自定义资源的请求路径
const
url
=
`sysroles/`
+
_this
.
srfparentkey
+
`/sysrolepermissions/tree`
;
this
.
$http
.
get
(
url
)
.
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
response
.
message
});
return
;
}
else
{
// 给树赋值,数据结构在后台已经按照eltree格式化
_this
.
CDdata
=
response
.
data
.
APPMENU
;
_this
.
QXdata
=
response
.
data
.
OPPRIV
;
_this
.
ZYdata
=
response
.
data
.
UNIRES
;
_this
.
defaultCheckedNodes
=
response
.
data
.
SELECTED
;
// 设置默认第一级展开
for
(
let
i
=
0
;
i
<
_this
.
CDdata
.
length
;
i
++
)
{
_this
.
CDdataexpandedKeys
.
push
(
_this
.
CDdata
[
i
].
id
);
}
for
(
let
i
=
0
;
i
<
_this
.
QXdata
.
length
;
i
++
)
{
_this
.
QXdataexpandedKeys
.
push
(
_this
.
QXdata
[
i
].
id
);
}
for
(
let
i
=
0
;
i
<
_this
.
ZYdata
.
length
;
i
++
)
{
_this
.
ZYdataexpandedKeys
.
push
(
_this
.
ZYdata
[
i
].
id
);
}
// 设置默认选中节点,即当前角色所有权限
this
.
$nextTick
(()
=>
{
const
CDtree
:
any
=
this
.
$refs
.
CDtree
;
const
QXtree
:
any
=
this
.
$refs
.
QXtree
;
const
ZYtree
:
any
=
this
.
$refs
.
ZYtree
;
CDtree
.
setCheckedNodes
(
_this
.
defaultCheckedNodes
);
QXtree
.
setCheckedNodes
(
_this
.
defaultCheckedNodes
);
ZYtree
.
setCheckedNodes
(
_this
.
defaultCheckedNodes
);
// 保存初始选中的节点数据,便于后续保存时比较
const
arr
=
CDtree
.
getCheckedNodes
()
.
concat
(
QXtree
.
getCheckedNodes
())
.
concat
(
ZYtree
.
getCheckedNodes
());
this
.
ininselectData
=
arr
;
});
}
})
.
catch
((
e
)
=>
{
console
.
log
(
e
);
});
}
/**
* 销毁之前
*
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
public
beforeDestroy
()
{
// 清空选中数据
this
.
selectData
=
{};
// 清空视图选中数据
this
.
viewSelections
=
[];
this
.
$store
.
commit
(
"viewaction/removeView"
,
this
.
viewtag
);
}
// 保存初始选中的节点数据,便于后续保存时比较
/**
const
arr
=
CDtree
.
getCheckedNodes
()
* 处理选中节点
*/
protected
handleCheckChange
()
{
// console.log("SYS_PERMISSIONMPickupView执行了handleCheckChange")
// 获取当前三棵树
const
CDtree
:
any
=
this
.
$refs
.
CDtree
;
const
QXtree
:
any
=
this
.
$refs
.
QXtree
;
const
ZYtree
:
any
=
this
.
$refs
.
ZYtree
;
// 获取选中状态的节点
const
arr
=
CDtree
.
getCheckedNodes
()
.
concat
(
QXtree
.
getCheckedNodes
())
.
concat
(
QXtree
.
getCheckedNodes
())
.
concat
(
ZYtree
.
getCheckedNodes
());
.
concat
(
ZYtree
.
getCheckedNodes
());
this
.
ininselectData
=
arr
;
this
.
selectData
=
arr
;
});
// console.log("选中的node:" + JSON.stringify(this.selectData));
}
}
})
.
catch
((
e
)
=>
{
console
.
log
(
e
);
});
}
/**
* 销毁之前
*
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
public
beforeDestroy
()
{
// 清空选中数据
this
.
selectData
=
{};
// 清空视图选中数据
this
.
viewSelections
=
[];
this
.
$store
.
commit
(
"viewaction/removeView"
,
this
.
viewtag
);
}
/**
* 处理选中节点
*/
protected
handleCheckChange
()
{
// console.log("SYS_PERMISSIONMPickupView执行了handleCheckChange")
// 获取当前三棵树
const
CDtree
:
any
=
this
.
$refs
.
CDtree
;
const
QXtree
:
any
=
this
.
$refs
.
QXtree
;
const
ZYtree
:
any
=
this
.
$refs
.
ZYtree
;
// 获取选中状态的节点
const
arr
=
CDtree
.
getCheckedNodes
()
.
concat
(
QXtree
.
getCheckedNodes
())
.
concat
(
ZYtree
.
getCheckedNodes
());
this
.
selectData
=
arr
;
// console.log("选中的node:" + JSON.stringify(this.selectData));
}
/**
/**
* 容器模型
* 容器模型
*/
*/
public
containerModel
:
any
=
{
public
containerModel
:
any
=
{
view_okbtn
:
{
name
:
"okbtn"
,
type
:
"button"
,
text
:
"确定"
,
disabled
:
true
},
view_okbtn
:
{
name
:
"okbtn"
,
type
:
"button"
,
text
:
"确定"
,
disabled
:
true
},
};
};
/**
/**
* 确定
* 确定
*/
*/
public
onClickOk
():
void
{
public
onClickOk
()
{
// 处理选中的数据
// 处理选中的数据
if
(
this
.
selectData
&&
this
.
selectData
.
length
>
0
)
{
if
(
this
.
selectData
&&
this
.
selectData
.
length
>
0
)
{
// 判断选中的数据和初始数据
// 判断选中的数据和初始数据
if
(
if
(
JSON
.
stringify
(
this
.
selectData
)
==
JSON
.
stringify
(
this
.
ininselectData
)
JSON
.
stringify
(
this
.
selectData
)
==
JSON
.
stringify
(
this
.
ininselectData
)
)
{
)
{
return
;
// 抛出事件,通知父页面进行表单保存
}
return
this
.
$emit
(
"drdatasaved"
,
{});
this
.
selectData
.
forEach
((
item
:
any
)
=>
{
let
_itemTemp
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
item
));
let
_item
:
any
=
{};
if
(
_itemTemp
.
type
)
{
_item
.
permissionid
=
_itemTemp
.
id
;
_item
.
permissiontype
=
_itemTemp
.
type
;
_item
.
permissionname
=
_itemTemp
.
fullName
;
Object
.
assign
(
_item
,
{
_select
:
false
});
this
.
viewSelections
.
push
(
_item
);
}
}
});
this
.
selectData
.
forEach
((
item
:
any
)
=>
{
let
_itemTemp
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
item
));
// 保存选中的权限信息
let
_item
:
any
=
{};
let
url
=
if
(
_itemTemp
.
type
)
{
"/sysroles/"
+
this
.
srfparentkey
+
"/sysrolepermissions/refreshbatch"
;
_item
.
permissionid
=
_itemTemp
.
id
;
this
.
$http
_item
.
permissiontype
=
_itemTemp
.
type
;
.
post
(
url
,
this
.
viewSelections
)
_item
.
permissionname
=
_itemTemp
.
fullName
;
.
then
((
response
:
any
)
=>
{
Object
.
assign
(
_item
,
{
_select
:
false
});
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
viewSelections
.
push
(
_item
);
return
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
response
.
message
,
});
}
else
{
// 抛出事件,通知父页面进行表单保存
return
this
.
$emit
(
"drdatasaved"
,
{});
}
}
})
.
catch
((
e
)
=>
{
return
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
e
});
});
});
// 保存选中的权限信息
let
url
=
"/sysroles/"
+
this
.
srfparentkey
+
"/sysrolepermissions/refreshbatch"
;
this
.
$http
.
post
(
url
,
this
.
viewSelections
)
.
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
return
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
response
.
message
,
});
}
else
{
// 抛出事件,通知父页面进行表单保存
return
this
.
$emit
(
"drdatasaved"
,
{});
}
})
.
catch
((
e
)
=>
{
return
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
e
});
});
}
// 清空视图选中数据,避免重复添加
this
.
viewSelections
=
[];
}
}
// 清空视图选中数据,避免重复添加
this
.
viewSelections
=
[];
}
/**
/**
* 清除
* 清除
*/
*/
private
onClear
()
{
private
onClear
()
{
// 未选中数据,即没有赋予任何权限,需要清除当前角色的所有权限
// 未选中数据,即没有赋予任何权限,需要清除当前角色的所有权限
if
(
this
.
selectData
.
length
==
0
)
{
if
(
this
.
selectData
.
length
==
0
)
{
// 保存选中的权限信息
// 保存选中的权限信息
let
url
=
let
url
=
"/sysroles/"
+
this
.
srfparentkey
+
"/sysrolepermissions/refreshbatch"
;
"/sysroles/"
+
this
.
srfparentkey
+
"/sysrolepermissions/refreshbatch"
;
this
.
$http
this
.
$http
.
post
(
url
,
[])
.
post
(
url
,
[])
.
then
((
response
:
any
)
=>
{
.
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
if
(
!
response
||
response
.
status
!==
200
)
{
return
this
.
$Notice
.
error
({
return
this
.
$Notice
.
error
({
title
:
"错误"
,
title
:
"错误"
,
desc
:
response
.
message
,
desc
:
response
.
message
,
});
});
}
else
{
}
else
{
// 抛出事件,通知父页面进行表单保存
// 抛出事件,通知父页面进行表单保存
return
this
.
$emit
(
"drdatasaved"
,
{});
return
this
.
$emit
(
"drdatasaved"
,
{});
}
}
})
})
.
catch
((
e
)
=>
{
.
catch
((
e
)
=>
{
return
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
e
});
return
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
e
});
});
});
}
else
{
// 抛出事件,通知父页面进行表单保存
return
this
.
$emit
(
"drdatasaved"
,
{});
}
}
}
}
}
}
</
script
>
</
script
>
<
style
lang=
'less'
>
<
style
lang=
'less'
>
@import "./sys-role-permission-custom-view";
@import "./sys-role-permission-custom-view";
</
style
>
</
style
>
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录