Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzuaa
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzuaa
提交
a7308226
提交
a7308226
编写于
11月 13, 2020
作者:
laizhilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改视图保存逻辑:在父页面保存之前进行保存
上级
6101fb6e
变更
2
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
604 行增加
和
597 行删除
+604
-597
sys-role-permission-custom-view.vue
...ermission-custom-view/sys-role-permission-custom-view.vue
+603
-596
main-form-base.vue
app_web/src/widgets/sys-role/main-form/main-form-base.vue
+1
-1
未找到文件。
app_web/src/pages/uaa/sys-role-permission-custom-view/sys-role-permission-custom-view.vue
浏览文件 @
a7308226
...
@@ -15,19 +15,7 @@
...
@@ -15,19 +15,7 @@
</el-input>
</el-input>
</div>
</div>
<div
class=
"roll"
>
<div
class=
"roll"
>
<el-tree
<el-tree
:filter-node-method=
"fiterNode"
class=
"tre"
:data=
"this.CDdata"
ref=
"CDtree"
show-checkbox
node-key=
"id"
:default-expand-all=
"false"
highlight-current
:default-expanded-keys=
"this.CDdataexpandedKeys"
:props=
"this.defaultProps"
@
check-change=
"handleCheckChange"
>
:filter-node-method=
"fiterNode"
class=
"tre"
:data=
"this.CDdata"
ref=
"CDtree"
show-checkbox
node-key=
"id"
:default-expand-all=
"false"
highlight-current
:default-expanded-keys=
"this.CDdataexpandedKeys"
:props=
"this.defaultProps"
@
check-change=
"handleCheckChange"
>
</el-tree>
</el-tree>
</div>
</div>
</div>
</div>
...
@@ -44,19 +32,7 @@
...
@@ -44,19 +32,7 @@
</el-input>
</el-input>
</div>
</div>
<div
class=
"roll"
>
<div
class=
"roll"
>
<el-tree
<el-tree
:filter-node-method=
"fiterNode"
class=
"tre"
:data=
"this.QXdata"
ref=
"QXtree"
show-checkbox
node-key=
"id"
:default-expand-all=
"false"
highlight-current
:default-expanded-keys=
"this.QXdataexpandedKeys"
:props=
"this.defaultProps"
@
check-change=
"handleCheckChange"
>
:filter-node-method=
"fiterNode"
class=
"tre"
:data=
"this.QXdata"
ref=
"QXtree"
show-checkbox
node-key=
"id"
:default-expand-all=
"false"
highlight-current
:default-expanded-keys=
"this.QXdataexpandedKeys"
:props=
"this.defaultProps"
@
check-change=
"handleCheckChange"
>
</el-tree>
</el-tree>
</div>
</div>
</div>
</div>
...
@@ -73,19 +49,7 @@
...
@@ -73,19 +49,7 @@
</el-input>
</el-input>
</div>
</div>
<div
class=
"roll"
>
<div
class=
"roll"
>
<el-tree
<el-tree
:filter-node-method=
"fiterNode"
class=
"tre"
:data=
"this.ZYdata"
ref=
"ZYtree"
show-checkbox
node-key=
"id"
:default-expand-all=
"false"
highlight-current
:default-expanded-keys=
"this.ZYdataexpandedKeys"
:props=
"this.defaultProps"
@
check-change=
"handleCheckChange"
>
:filter-node-method=
"fiterNode"
class=
"tre"
:data=
"this.ZYdata"
ref=
"ZYtree"
show-checkbox
node-key=
"id"
:default-expand-all=
"false"
highlight-current
:default-expanded-keys=
"this.ZYdataexpandedKeys"
:props=
"this.defaultProps"
@
check-change=
"handleCheckChange"
>
</el-tree>
</el-tree>
</div>
</div>
</div>
</div>
...
@@ -99,58 +63,59 @@
...
@@ -99,58 +63,59 @@
</
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
import
view_pickupviewpanel
from
"@widgets/sys-permission/mpickup-viewpickupviewpanel-pickupviewpanel/mpickup-viewpickupviewpanel-pickupviewpanel.vue"
;
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'
,
{
fullPath
:
to
.
fullPath
,
viewtag
:
vm
.
viewtag
});
vm
.
$store
.
commit
(
"addCurPageViewtag"
,
{
fullPath
:
to
.
fullPath
,
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
()
{
public
filterChangeCDtree
()
{
const
CDtree
:
any
=
this
.
$refs
.
CDtree
;
const
CDtree
:
any
=
this
.
$refs
.
CDtree
;
CDtree
.
filter
(
this
.
CDtreefilterText
);
CDtree
.
filter
(
this
.
CDtreefilterText
);
}
}
/**
/**
* 数据能力树搜索触发
* 数据能力树搜索触发
*/
*/
public
filterChangeQXtree
()
{
public
filterChangeQXtree
()
{
const
QXtree
:
any
=
this
.
$refs
.
QXtree
;
const
QXtree
:
any
=
this
.
$refs
.
QXtree
;
QXtree
.
filter
(
this
.
QXtreefilterText
);
QXtree
.
filter
(
this
.
QXtreefilterText
);
}
}
/**
/**
* 自定义资源树搜索触发
* 自定义资源树搜索触发
*/
*/
public
filterChangeZYtree
()
{
public
filterChangeZYtree
()
{
const
ZYtree
:
any
=
this
.
$refs
.
ZYtree
;
const
ZYtree
:
any
=
this
.
$refs
.
ZYtree
;
ZYtree
.
filter
(
this
.
ZYtreefilterText
);
ZYtree
.
filter
(
this
.
ZYtreefilterText
);
}
}
...
@@ -173,9 +138,9 @@
...
@@ -173,9 +138,9 @@
* 树显示说明:子树为节点对象的children,节点标签为节点对象的label
* 树显示说明:子树为节点对象的children,节点标签为节点对象的label
*/
*/
protected
defaultProps
:
any
=
{
protected
defaultProps
:
any
=
{
children
:
'children'
,
children
:
"children"
,
label
:
'label'
label
:
"label"
,
}
};
/**
/**
* 选中数据
* 选中数据
*/
*/
...
@@ -205,7 +170,7 @@
...
@@ -205,7 +170,7 @@
* @type {string}
* @type {string}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
*/
public
viewtag
:
string
=
'e791be173ed0f4bbe9cce942b6edde63'
;
public
viewtag
:
string
=
"e791be173ed0f4bbe9cce942b6edde63"
;
/**
/**
* 是否嵌入关系界面
* 是否嵌入关系界面
...
@@ -213,7 +178,7 @@
...
@@ -213,7 +178,7 @@
* @type {boolean}
* @type {boolean}
* @memberof SYS_USER_ROLEGridViewBase
* @memberof SYS_USER_ROLEGridViewBase
*/
*/
@
Prop
({
default
:
false
})
public
isformDruipart
?:
boolean
;
@
Prop
({
default
:
false
})
public
isformDruipart
?:
boolean
;
/**
/**
* 界面关系通讯对象
* 界面关系通讯对象
...
@@ -229,7 +194,7 @@
...
@@ -229,7 +194,7 @@
* @type {*}
* @type {*}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
*/
public
context
:
any
=
{};
public
context
:
any
=
{};
/**
/**
* 视图参数
* 视图参数
...
@@ -237,7 +202,7 @@
...
@@ -237,7 +202,7 @@
* @type {*}
* @type {*}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
*/
public
viewparams
:
any
=
{};
public
viewparams
:
any
=
{};
/**
/**
* 传入视图上下文
* 传入视图上下文
...
@@ -247,9 +212,9 @@
...
@@ -247,9 +212,9 @@
*/
*/
@
Prop
()
public
viewdata
!
:
string
;
@
Prop
()
public
viewdata
!
:
string
;
@
Watch
(
'viewdata'
)
@
Watch
(
"viewdata"
)
public
watchViewData
()
{
public
watchViewData
()
{
if
(
!
this
.
viewdata
||
Object
.
is
(
this
.
viewdata
,
''
))
{
if
(
!
this
.
viewdata
||
Object
.
is
(
this
.
viewdata
,
""
))
{
return
;
return
;
}
}
this
.
parseViewParam
();
this
.
parseViewParam
();
...
@@ -279,14 +244,14 @@
...
@@ -279,14 +244,14 @@
* @type {*}
* @type {*}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
*/
public
customViewNavContexts
:
any
=
{};
public
customViewNavContexts
:
any
=
{};
/**
/**
* 自定义视图导航参数集合
* 自定义视图导航参数集合
*
*
* @type {*}
* @type {*}
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
*/
public
customViewParams
:
any
=
{};
public
customViewParams
:
any
=
{};
/**
/**
* 解析视图参数
* 解析视图参数
...
@@ -295,21 +260,29 @@
...
@@ -295,21 +260,29 @@
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
*/
public
parseViewParam
():
void
{
public
parseViewParam
():
void
{
for
(
let
key
in
this
.
context
)
{
for
(
let
key
in
this
.
context
)
{
delete
this
.
context
[
key
];
delete
this
.
context
[
key
];
}
}
if
(
!
this
.
viewDefaultUsage
&&
this
.
viewdata
&&
!
Object
.
is
(
this
.
viewdata
,
''
))
{
if
(
!
this
.
viewDefaultUsage
&&
this
.
viewdata
&&
!
Object
.
is
(
this
.
viewdata
,
""
)
)
{
Object
.
assign
(
this
.
context
,
JSON
.
parse
(
this
.
viewdata
));
Object
.
assign
(
this
.
context
,
JSON
.
parse
(
this
.
viewdata
));
if
(
this
.
context
&&
this
.
context
.
srfparentdename
){
if
(
this
.
context
&&
this
.
context
.
srfparentdename
)
{
Object
.
assign
(
this
.
viewparams
,{
srfparentdename
:
this
.
context
.
srfparentdename
});
Object
.
assign
(
this
.
viewparams
,
{
srfparentdename
:
this
.
context
.
srfparentdename
,
});
}
}
if
(
this
.
context
&&
this
.
context
.
srfparentkey
){
if
(
this
.
context
&&
this
.
context
.
srfparentkey
)
{
Object
.
assign
(
this
.
viewparams
,{
srfparentkey
:
this
.
context
.
srfparentkey
});
Object
.
assign
(
this
.
viewparams
,
{
srfparentkey
:
this
.
context
.
srfparentkey
,
});
}
}
this
.
handleCustomViewData
();
this
.
handleCustomViewData
();
return
;
return
;
}
}
const
path
=
(
this
.
$route
.
matched
[
this
.
$route
.
matched
.
length
-
1
])
.
path
;
const
path
=
this
.
$route
.
matched
[
this
.
$route
.
matched
.
length
-
1
]
.
path
;
const
keys
:
Array
<
any
>
=
[];
const
keys
:
Array
<
any
>
=
[];
const
curReg
=
this
.
$pathToRegExp
.
pathToRegexp
(
path
,
keys
);
const
curReg
=
this
.
$pathToRegExp
.
pathToRegexp
(
path
,
keys
);
const
matchArray
=
curReg
.
exec
(
this
.
$route
.
path
);
const
matchArray
=
curReg
.
exec
(
this
.
$route
.
path
);
...
@@ -317,15 +290,23 @@
...
@@ -317,15 +290,23 @@
keys
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
keys
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
.
name
,
{
Object
.
defineProperty
(
tempValue
,
item
.
name
,
{
enumerable
:
true
,
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
value
:
matchArray
[
index
+
1
],
});
});
});
});
this
.
$viewTool
.
formatRouteParams
(
tempValue
,
this
.
$route
,
this
.
context
,
this
.
viewparams
);
this
.
$viewTool
.
formatRouteParams
(
if
(
this
.
$store
.
getters
.
getAppData
()
&&
this
.
$store
.
getters
.
getAppData
().
context
){
tempValue
,
Object
.
assign
(
this
.
context
,
this
.
$store
.
getters
.
getAppData
().
context
);
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
()
});
Object
.
assign
(
this
.
context
,
{
srfsessionid
:
this
.
$util
.
createUUID
()
});
this
.
handleCustomViewData
();
this
.
handleCustomViewData
();
}
}
...
@@ -334,22 +315,22 @@
...
@@ -334,22 +315,22 @@
*
*
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
*/
public
handleCustomViewData
()
{
public
handleCustomViewData
()
{
if
(
Object
.
keys
(
this
.
customViewNavContexts
).
length
>
0
)
{
if
(
Object
.
keys
(
this
.
customViewNavContexts
).
length
>
0
)
{
Object
.
keys
(
this
.
customViewNavContexts
).
forEach
((
item
:
any
)
=>
{
Object
.
keys
(
this
.
customViewNavContexts
).
forEach
((
item
:
any
)
=>
{
let
tempContext
:
any
=
{};
let
tempContext
:
any
=
{};
let
curNavContext
:
any
=
this
.
customViewNavContexts
[
item
];
let
curNavContext
:
any
=
this
.
customViewNavContexts
[
item
];
this
.
handleCustomDataLogic
(
curNavContext
,
tempContext
,
item
);
this
.
handleCustomDataLogic
(
curNavContext
,
tempContext
,
item
);
Object
.
assign
(
this
.
context
,
tempContext
);
Object
.
assign
(
this
.
context
,
tempContext
);
})
});
}
}
if
(
Object
.
keys
(
this
.
customViewParams
).
length
>
0
)
{
if
(
Object
.
keys
(
this
.
customViewParams
).
length
>
0
)
{
Object
.
keys
(
this
.
customViewParams
).
forEach
((
item
:
any
)
=>
{
Object
.
keys
(
this
.
customViewParams
).
forEach
((
item
:
any
)
=>
{
let
tempParam
:
any
=
{};
let
tempParam
:
any
=
{};
let
curNavParam
:
any
=
this
.
customViewParams
[
item
];
let
curNavParam
:
any
=
this
.
customViewParams
[
item
];
this
.
handleCustomDataLogic
(
curNavParam
,
tempParam
,
item
);
this
.
handleCustomDataLogic
(
curNavParam
,
tempParam
,
item
);
Object
.
assign
(
this
.
viewparams
,
tempParam
);
Object
.
assign
(
this
.
viewparams
,
tempParam
);
})
});
}
}
}
}
...
@@ -358,47 +339,50 @@
...
@@ -358,47 +339,50 @@
*
*
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
* @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/
*/
public
handleCustomDataLogic
(
curNavData
:
any
,
tempData
:
any
,
item
:
string
)
{
public
handleCustomDataLogic
(
curNavData
:
any
,
tempData
:
any
,
item
:
string
)
{
// 直接值直接赋值
// 直接值直接赋值
if
(
curNavData
.
isRawValue
){
if
(
curNavData
.
isRawValue
)
{
if
(
Object
.
is
(
curNavData
.
value
,
"null"
)
||
Object
.
is
(
curNavData
.
value
,
""
)){
if
(
Object
.
is
(
curNavData
.
value
,
"null"
)
||
Object
.
is
(
curNavData
.
value
,
""
)
)
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
null
,
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
:
curNavData
.
value
,
value
:
curNavData
.
value
,
writable
:
true
,
writable
:
true
,
enumerable
:
true
,
enumerable
:
true
,
configurable
:
true
configurable
:
true
,
});
});
}
}
}
else
{
}
else
{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if
(
this
.
context
[(
curNavData
.
value
).
toLowerCase
()])
{
if
(
this
.
context
[
curNavData
.
value
.
toLowerCase
()])
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
this
.
context
[(
curNavData
.
value
)
.
toLowerCase
()],
value
:
this
.
context
[
curNavData
.
value
.
toLowerCase
()],
writable
:
true
,
writable
:
true
,
enumerable
:
true
,
enumerable
:
true
,
configurable
:
true
configurable
:
true
,
});
});
}
else
{
}
else
{
if
(
this
.
viewparams
[(
curNavData
.
value
).
toLowerCase
()])
{
if
(
this
.
viewparams
[
curNavData
.
value
.
toLowerCase
()])
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
this
.
viewparams
[(
curNavData
.
value
)
.
toLowerCase
()],
value
:
this
.
viewparams
[
curNavData
.
value
.
toLowerCase
()],
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
:
null
,
writable
:
true
,
writable
:
true
,
enumerable
:
true
,
enumerable
:
true
,
configurable
:
true
configurable
:
true
,
});
});
}
}
}
}
...
@@ -417,9 +401,12 @@
...
@@ -417,9 +401,12 @@
*
*
* @memberof SYS_USER_ROLEGridViewBase
* @memberof SYS_USER_ROLEGridViewBase
*/
*/
public
afterCreated
()
{
public
afterCreated
()
{
const
secondtag
=
this
.
$util
.
createUUID
();
const
secondtag
=
this
.
$util
.
createUUID
();
this
.
$store
.
commit
(
'viewaction/createdView'
,
{
viewtag
:
this
.
viewtag
,
secondtag
:
secondtag
});
this
.
$store
.
commit
(
"viewaction/createdView"
,
{
viewtag
:
this
.
viewtag
,
secondtag
:
secondtag
,
});
this
.
viewtag
=
secondtag
;
this
.
viewtag
=
secondtag
;
// this.parseViewParam();
// this.parseViewParam();
...
@@ -432,32 +419,29 @@
...
@@ -432,32 +419,29 @@
// // console.log("当前角色id:" + _this.parentData.sysrole);
// // console.log("当前角色id:" + _this.parentData.sysrole);
// _this.srfparentkey = _this.parentData.sysrole;
// _this.srfparentkey = _this.parentData.sysrole;
// }
// }
// 监听父页面
if
(
this
.
formDruipart
){
this
.
formDruipart
.
subscribe
((
res
:
any
)
=>
{
if
(
Object
.
is
(
res
.
action
,
'load'
)){
// 监听父页面
if
(
this
.
formDruipart
)
{
this
.
formDruipart
.
subscribe
((
res
:
any
)
=>
{
// 如果是新建角色保存,需要从res中获取父数据主键
// 如果是新建角色保存,需要从res中获取父数据主键
if
(
res
.
data
)
{
if
(
!
this
.
srfparentkey
&&
res
.
data
)
{
let
parentData
=
res
.
data
;
let
parentData
=
res
.
data
;
this
.
srfparentkey
=
parentData
.
srfparentkey
;
this
.
srfparentkey
=
parentData
.
srfparentkey
;
}
}
// 父页面的保存前,先进行树数据的更新处理
// 父数据保存时调用当前视图的事件
if
(
Object
.
is
(
res
.
action
,
"save"
))
{
if
(
this
.
selectData
.
length
>
0
)
{
if
(
this
.
selectData
.
length
>
0
)
{
// 选中了数据
// 选中了数据
this
.
onClickOk
();
this
.
onClickOk
();
}
else
{
}
else
{
// 没选中数据
// 没选中数据
this
.
onClear
();
this
.
onClear
();
}
}
}
}
});
});
}
}
}
}
/**
/**
* vue 挂载
* vue 挂载
*/
*/
...
@@ -471,10 +455,12 @@
...
@@ -471,10 +455,12 @@
private
initTree
()
{
private
initTree
()
{
const
_this
=
this
;
const
_this
=
this
;
// get全部菜单和数据能力和自定义资源的请求路径
// get全部菜单和数据能力和自定义资源的请求路径
const
url
=
`sysroles/`
+
_this
.
srfparentkey
+
`/sysrolepermissions/tree`
;
const
url
=
`sysroles/`
+
_this
.
srfparentkey
+
`/sysrolepermissions/tree`
;
this
.
$http
.
get
(
url
).
then
((
response
:
any
)
=>
{
this
.
$http
.
get
(
url
)
.
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
response
.
message
});
return
;
return
;
}
else
{
}
else
{
// 给树赋值,数据结构在后台已经按照eltree格式化
// 给树赋值,数据结构在后台已经按照eltree格式化
...
@@ -495,7 +481,7 @@
...
@@ -495,7 +481,7 @@
}
}
// 设置默认选中节点,即当前角色所有权限
// 设置默认选中节点,即当前角色所有权限
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
const
CDtree
:
any
=
this
.
$refs
.
CDtree
;
const
CDtree
:
any
=
this
.
$refs
.
CDtree
;
const
QXtree
:
any
=
this
.
$refs
.
QXtree
;
const
QXtree
:
any
=
this
.
$refs
.
QXtree
;
const
ZYtree
:
any
=
this
.
$refs
.
ZYtree
;
const
ZYtree
:
any
=
this
.
$refs
.
ZYtree
;
...
@@ -505,13 +491,14 @@
...
@@ -505,13 +491,14 @@
ZYtree
.
setCheckedNodes
(
_this
.
defaultCheckedNodes
);
ZYtree
.
setCheckedNodes
(
_this
.
defaultCheckedNodes
);
// 保存初始选中的节点数据,便于后续保存时比较
// 保存初始选中的节点数据,便于后续保存时比较
const
arr
=
CDtree
.
getCheckedNodes
().
concat
(
QXtree
.
getCheckedNodes
()).
concat
(
ZYtree
.
getCheckedNodes
());
const
arr
=
CDtree
.
getCheckedNodes
()
.
concat
(
QXtree
.
getCheckedNodes
())
.
concat
(
ZYtree
.
getCheckedNodes
());
this
.
ininselectData
=
arr
;
this
.
ininselectData
=
arr
;
});
});
}
}
}).
catch
((
e
)
=>
{
})
.
catch
((
e
)
=>
{
console
.
log
(
e
);
console
.
log
(
e
);
});
});
}
}
...
@@ -526,10 +513,9 @@
...
@@ -526,10 +513,9 @@
this
.
selectData
=
{};
this
.
selectData
=
{};
// 清空视图选中数据
// 清空视图选中数据
this
.
viewSelections
=
[];
this
.
viewSelections
=
[];
this
.
$store
.
commit
(
'viewaction/removeView'
,
this
.
viewtag
);
this
.
$store
.
commit
(
"viewaction/removeView"
,
this
.
viewtag
);
}
}
/**
/**
* 处理选中节点
* 处理选中节点
*/
*/
...
@@ -540,7 +526,9 @@
...
@@ -540,7 +526,9 @@
const
QXtree
:
any
=
this
.
$refs
.
QXtree
;
const
QXtree
:
any
=
this
.
$refs
.
QXtree
;
const
ZYtree
:
any
=
this
.
$refs
.
ZYtree
;
const
ZYtree
:
any
=
this
.
$refs
.
ZYtree
;
// 获取选中状态的节点
// 获取选中状态的节点
const
arr
=
CDtree
.
getCheckedNodes
().
concat
(
QXtree
.
getCheckedNodes
()).
concat
(
ZYtree
.
getCheckedNodes
());
const
arr
=
CDtree
.
getCheckedNodes
()
.
concat
(
QXtree
.
getCheckedNodes
())
.
concat
(
ZYtree
.
getCheckedNodes
());
this
.
selectData
=
arr
;
this
.
selectData
=
arr
;
// console.log("选中的node:" + JSON.stringify(this.selectData));
// console.log("选中的node:" + JSON.stringify(this.selectData));
}
}
...
@@ -549,7 +537,7 @@
...
@@ -549,7 +537,7 @@
* 容器模型
* 容器模型
*/
*/
public
containerModel
:
any
=
{
public
containerModel
:
any
=
{
view_okbtn
:
{
name
:
'okbtn'
,
type
:
'button'
,
text
:
'确定'
,
disabled
:
true
},
view_okbtn
:
{
name
:
"okbtn"
,
type
:
"button"
,
text
:
"确定"
,
disabled
:
true
},
};
};
/**
/**
...
@@ -559,7 +547,9 @@
...
@@ -559,7 +547,9 @@
// 处理选中的数据
// 处理选中的数据
if
(
this
.
selectData
&&
this
.
selectData
.
length
>
0
)
{
if
(
this
.
selectData
&&
this
.
selectData
.
length
>
0
)
{
// 判断选中的数据和初始数据
// 判断选中的数据和初始数据
if
(
JSON
.
stringify
(
this
.
selectData
)
==
JSON
.
stringify
(
this
.
ininselectData
))
{
if
(
JSON
.
stringify
(
this
.
selectData
)
==
JSON
.
stringify
(
this
.
ininselectData
)
)
{
return
;
return
;
}
}
this
.
selectData
.
forEach
((
item
:
any
)
=>
{
this
.
selectData
.
forEach
((
item
:
any
)
=>
{
...
@@ -569,20 +559,29 @@
...
@@ -569,20 +559,29 @@
_item
.
permissionid
=
_itemTemp
.
id
;
_item
.
permissionid
=
_itemTemp
.
id
;
_item
.
permissiontype
=
_itemTemp
.
type
;
_item
.
permissiontype
=
_itemTemp
.
type
;
_item
.
permissionname
=
_itemTemp
.
fullName
;
_item
.
permissionname
=
_itemTemp
.
fullName
;
Object
.
assign
(
_item
,
{
_select
:
false
})
Object
.
assign
(
_item
,
{
_select
:
false
});
this
.
viewSelections
.
push
(
_item
);
this
.
viewSelections
.
push
(
_item
);
}
}
});
});
// 保存选中的权限信息
// 保存选中的权限信息
let
url
=
'/sysroles/'
+
this
.
srfparentkey
+
'/sysrolepermissions/refreshbatch'
;
let
url
=
this
.
$http
.
post
(
url
,
this
.
viewSelections
).
then
((
response
:
any
)
=>
{
"/sysroles/"
+
this
.
srfparentkey
+
"/sysrolepermissions/refreshbatch"
;
if
(
!
(
!
response
||
response
.
status
!==
200
))
{
this
.
$http
.
post
(
url
,
this
.
viewSelections
)
.
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
return
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
response
.
message
,
});
}
else
{
}
else
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
// 抛出事件,通知父页面进行表单保存
return
;
return
this
.
$emit
(
"drdatasaved"
,
{})
;
}
}
}).
catch
((
e
)
=>
{
})
.
catch
((
e
)
=>
{
return
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
e
});
});
});
}
}
// 清空视图选中数据,避免重复添加
// 清空视图选中数据,避免重复添加
...
@@ -592,26 +591,34 @@
...
@@ -592,26 +591,34 @@
/**
/**
* 清除
* 清除
*/
*/
private
onClear
()
{
private
onClear
()
{
// 未选中数据,即没有赋予任何权限,需要清除当前角色的所有权限
// 未选中数据,即没有赋予任何权限,需要清除当前角色的所有权限
if
(
this
.
selectData
.
length
==
0
)
{
if
(
this
.
selectData
.
length
==
0
)
{
// 保存选中的权限信息
// 保存选中的权限信息
let
url
=
'/sysroles/'
+
this
.
srfparentkey
+
'/sysrolepermissions/refreshbatch'
;
let
url
=
this
.
$http
.
post
(
url
,[]).
then
((
response
:
any
)
=>
{
"/sysroles/"
+
this
.
srfparentkey
+
"/sysrolepermissions/refreshbatch"
;
if
(
!
(
!
response
||
response
.
status
!==
200
))
{
this
.
$http
.
post
(
url
,
[])
.
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
return
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
response
.
message
,
});
}
else
{
}
else
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
// 抛出事件,通知父页面进行表单保存
return
;
return
this
.
$emit
(
"drdatasaved"
,
{})
;
}
}
}).
catch
((
e
)
=>
{
})
.
catch
((
e
)
=>
{
return
this
.
$Notice
.
error
({
title
:
"错误"
,
desc
:
e
});
});
});
}
}
}
}
}
}
</
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
app_web/src/widgets/sys-role/main-form/main-form-base.vue
浏览文件 @
a7308226
...
@@ -94,7 +94,7 @@
...
@@ -94,7 +94,7 @@
:localParam ='{}'
:localParam ='{}'
parameterName='sysrole'
parameterName='sysrole'
parentName="SysRole"
parentName="SysRole"
refviewtype='DE
CUSTOMVIEW'
refviewtype='DE
MEDITVIEW9'
refreshitems=''
refreshitems=''
:ignorefieldvaluechange="ignorefieldvaluechange"
:ignorefieldvaluechange="ignorefieldvaluechange"
viewname='sys-role-permission-custom-view'
viewname='sys-role-permission-custom-view'
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录