Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
48681e5e
提交
48681e5e
authored
5月 13, 2020
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
一站式app应用权限.可以在学工里面进行配置
上级
fa77557e
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
408 行增加
和
0 行删除
+408
-0
Services.js
Services.js
+17
-0
AppTypeTree.js
zyd_private/OneStopAppManage/AppTypeTree.js
+116
-0
index.js
zyd_private/OneStopAppManage/index.js
+114
-0
pageButton.js
zyd_private/OneStopAppManage/pageButton.js
+76
-0
pageSearch.js
zyd_private/OneStopAppManage/pageSearch.js
+72
-0
pageSetting.js
zyd_private/OneStopAppManage/pageSetting.js
+13
-0
没有找到文件。
Services.js
浏览文件 @
48681e5e
...
...
@@ -99,6 +99,23 @@ export const getHistoryFormDetail = ({ id, code }) => {
return
uaaRequest
(
'/UnifiedAppFormApi/getFormDetail'
,
{
id
,
code
});
};
/**
* 获取一站式应用列表
* 用于授权
*/
export
const
getAppList
=
(
params
=
{}
)
=>
{
return
uaaRequest
(
'/UnifiedAppApi/getListByTree'
,
params
);
};
/**
*
* 用于一站式 应用分类列表 tree
*/
export
const
getAppTypeList
=
()
=>
{
return
uaaRequest
(
'/UnifiedAppGroupApi/getList'
,
{
});
};
export
function
getOnestopKey
(
key
=
''
,
formKey
=
'key_list'
,
formValue
=
'value_list'
)
{
return
fetchTableData
({
...
...
zyd_private/OneStopAppManage/AppTypeTree.js
0 → 100644
浏览文件 @
48681e5e
/**
* 钟是志
* 2019年3月29日
* 一个年份加上校区-学院-专业的树
* */
import
{
Tree
}
from
'antd'
;
import
React
,
{
Component
,
Fragment
}
from
'react'
;
import
Shell
from
'@/baseComponent/Shell'
;
import
{
getAppTypeList
}
from
'@/webPublic/Services'
;
import
{
getPermInfo
}
from
'@/highOrderComponent/Service'
;
import
{
connect
}
from
'dva'
;
const
{
TreeNode
}
=
Tree
;
@
connect
(({
global
})
=>
({
sysCode
:
global
.
system
.
sysCode
,
}))
export
default
class
AppTypeTree
extends
Component
{
constructor
()
{
super
();
this
.
state
=
{
treeListData
:
[],
initYear
:
0
,
};
}
handleChange
=
(
newSearch
)
=>
{
this
.
props
.
changeSearch
(
newSearch
);
};
getList
=
()
=>
{
getPermInfo
({
sysCode
:
this
.
props
.
sysCode
,
},
'/PermApi/getRoleList'
).
then
((
treeListData
)
=>
{
if
(
!
treeListData
||
!
treeListData
.
length
)
{
this
.
setState
({
treeListData
:
[],
loading
:
false
,
});
this
.
handleChange
({
selectKey
:
''
,
});
}
else
{
this
.
handleChange
({
selectKey
:
treeListData
[
0
].
id
+
''
,
});
this
.
handleChange
({
selectKey
:
treeListData
[
0
].
id
+
''
,
});
this
.
setState
({
treeListData
,
loading
:
false
,
});
}
});
};
componentDidMount
()
{
this
.
getList
();
setTimeout
(()
=>
{
if
(
document
.
getElementById
(
'list-table-dom'
))
{
let
tableDom
=
document
.
getElementById
(
'list-table-dom'
);
this
.
setState
({
heightSet
:
document
.
body
.
clientHeight
-
150
>
tableDom
.
offsetHeight
+
164
?
document
.
body
.
clientHeight
-
150
:
tableDom
.
offsetHeight
+
164
,
});
}
},
1000
);
}
onSelect
=
(
selectedKeys
,
info
)
=>
{
this
.
handleChange
({
year
:
this
.
props
.
year
,
selectKey
:
selectedKeys
[
0
],
});
};
treeNodeList
=
(
data
)
=>
{
let
dom
=
data
.
map
((
item
)
=>
{
return
(
<
TreeNode
title
=
{
item
.
title
}
key
=
{
item
.
id
}
>
<
/TreeNode
>
);
});
return
dom
;
};
render
()
{
const
{
treeListData
,
loading
,
heightSet
}
=
this
.
state
;
const
{
selectKey
}
=
this
.
props
;
return
(
<
Fragment
>
<
Shell
styleShell
=
{{
borderRight
:
'1px solid rgba(210,210,210,1)'
,
minHeight
:
heightSet
||
document
.
body
.
clientHeight
-
150
,
backgroundColor
:
'#fff'
,
overflowX
:
'auto'
,
marginTop
:
0
,
}}
>
<
Tree
onSelect
=
{
this
.
onSelect
}
selectedKeys
=
{[
selectKey
]}
style
=
{{
minHeight
:
'400px,'
}}
disabled
=
{
loading
}
>
{
this
.
treeNodeList
(
treeListData
)}
<
/Tree
>
<
/Shell
>
<
/Fragment
>
);
}
}
zyd_private/OneStopAppManage/index.js
0 → 100644
浏览文件 @
48681e5e
/**
* 钟是志
* 2020年5月13日 17:38:51
* 一站式应用 学工角色授权
* */
import
pageSetting
from
'./pageSetting'
;
import
pageSearch
from
'./pageSearch'
;
import
pageButton
from
'./pageButton'
;
import
PageHeaderWrapper
from
'@/components/PageHeaderWrapper'
;
import
{
Row
,
Col
}
from
'antd'
;
import
React
from
'react'
;
import
List
from
'@/highOrderComponent/List'
;
import
AppTypeTree
from
'./AppTypeTree'
;
import
{
getAppTypeList
}
from
'@/webPublic/Services'
;
import
{
getInfo
}
from
'@/highOrderComponent/Service'
;
const
Index
=
(
WrappedComponent
)
=>
class
extends
WrappedComponent
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
search
:
{
selectKey
:
''
,
},
typeList
:
[],
authorizedApp
:
[],
};
}
getAuthorizedApp
=
()
=>
{
const
{
selectKey
}
=
this
.
state
.
search
;
if
(
selectKey
)
{
getInfo
(
{
roleId
:
selectKey
,
cacheKey
:
Math
.
random
(),
},
'/CommonApi/queryRoleApply'
,
).
then
((
x
)
=>
{
if
(
x
)
{
this
.
setState
({
authorizedApp
:
x
,
});
}
});
this
.
instanceComponent
.
getPage
();
}
};
changeSearch
=
(
search
)
=>
{
this
.
setState
(
{
search
,
},
()
=>
{
this
.
getAuthorizedApp
();
},
);
};
componentDidMount
()
{
getAppTypeList
().
then
((
treeListData
)
=>
{
if
(
!
treeListData
)
{
return
false
;
}
this
.
setState
({
typeList
:
treeListData
.
map
((
x
)
=>
{
return
{
key
:
x
.
id
,
name
:
x
.
name
+
`(
${
x
.
appNum
}
)`
,
};
}),
});
});
return
true
;
}
render
()
{
const
{
search
,
typeList
,
authorizedApp
}
=
this
.
state
;
if
(
!
typeList
.
length
)
{
return
null
;
}
const
pageS
=
pageSearch
({
typeList
,
authorizedApp
});
const
pageB
=
pageButton
({
roleId
:
search
.
selectKey
,
authorizedApp
,
getAuthorizedApp
:
this
.
getAuthorizedApp
,
});
return
(
<
PageHeaderWrapper
title
=
""
>
<
Row
>
<
Col
xl
=
{
5
}
xxl
=
{
4
}
>
<
AppTypeTree
changeSearch
=
{
this
.
changeSearch
}
selectKey
=
{
search
.
selectKey
}
year
=
{
search
.
year
}
/
>
<
/Col
>
<
Col
xl
=
{
19
}
xxl
=
{
20
}
>
<
WrappedComponent
listConfig
=
{
pageSetting
.
listConfig
}
pageButton
=
{
pageB
}
ref
=
{(
instanceComponent
)
=>
(
this
.
instanceComponent
=
instanceComponent
)}
pageSearch
=
{
pageS
}
/
>
<
/Col
>
<
/Row
>
<
/PageHeaderWrapper
>
);
}
};
export
default
Index
(
List
);
// 高阶组件
zyd_private/OneStopAppManage/pageButton.js
0 → 100644
浏览文件 @
48681e5e
import
React
from
'react'
;
import
{
message
}
from
'antd'
;
import
{
getInfo
}
from
'@/highOrderComponent/Service'
;
const
submitData
=
(
selectRows
,
roleId
)
=>
{
if
(
!
selectRows
.
length
)
{
message
.
warning
(
'请先选择一个应用'
);
return
false
;
}
else
{
let
content
=
selectRows
.
map
((
x
)
=>
{
return
{
appId
:
x
.
id
,
roleId
,
};
});
content
=
JSON
.
stringify
(
content
);
const
data
=
{
roleId
,
op
:
'add'
,
content
,
};
return
getInfo
(
data
,
'/CommonApi/configRoleApply'
);
}
};
const
deleteData
=
(
ids
,
roleId
)
=>
{
const
data
=
{
ids
,
roleId
,
op
:
'delete'
,
};
return
getInfo
(
data
,
'/CommonApi/configRoleApply'
);
};
const
handleButton
=
(
props
)
=>
{
const
buttonConfig
=
[
{
name
:
'批量授权'
,
type
:
'Normal'
,
component
:
'Normal'
,
handleClick
:
(
selectRows
,
formValues
,
getPage
,
search
)
=>
{
submitData
(
selectRows
,
props
.
roleId
).
then
((
x
)
=>
{
props
.
getAuthorizedApp
();
});
},
},
{
name
:
'批量取消授权'
,
type
:
'Normal222'
,
component
:
'Normal'
,
handleClick
:
(
selectRows
,
formValues
,
getPage
,
search
)
=>
{
if
(
!
selectRows
.
length
)
{
message
.
warning
(
'请先选择一个应用'
);
return
false
;
}
const
deleteIds
=
[];
for
(
let
item
of
selectRows
)
{
for
(
let
x
of
props
.
authorizedApp
){
if
(
x
.
appId
===
item
.
id
){
deleteIds
.
push
(
x
.
id
);
}
}
}
deleteData
(
deleteIds
,
props
.
roleId
).
then
((
x
)
=>
{
props
.
getAuthorizedApp
();
});
},
},
];
return
buttonConfig
;
};
export
default
handleButton
;
zyd_private/OneStopAppManage/pageSearch.js
0 → 100644
浏览文件 @
48681e5e
import
moment
from
'moment'
;
import
{
Link
}
from
'react-router-dom'
;
import
React
,
{
Fragment
}
from
'react'
;
import
{
getAppList
}
from
'@/webPublic/Services'
;
import
{
redText
}
from
'@/pages/zydxg/CheckManage/PiciSetting/publicFunc'
;
const
width
=
110
;
const
handlePageSearch
=
(
props
)
=>
{
const
pageSearch
=
{
search
:
{
url
:
'/asdasd/asdgggki'
,
field
:
{
groupId
:
{
//
required
:
true
,
defaultValue
:
props
.
typeList
[
0
].
key
,
},
},
getInfo
:
(
data
,
url
)
=>
{
return
getAppList
(
data
);
},
giveFieldsToFormValues
:
true
,
afterFormValuesChange
:
(
key
,
oldValue
,
getPage
)
=>
{
getPage
();
},
responseCallBack
:
(
response
)
=>
{
return
response
;
},
condition
:
[
{
key
:
'groupId'
,
name
:
'类别'
,
type
:
'radioGroup'
,
options
:
props
.
typeList
,
},
],
nameSpan
:
{
big
:
2
,
small
:
4
},
fileSpan
:
{
big
:
2
,
small
:
2
},
},
tableRowKey
:
'id'
,
columns
:
[
{
dataIndex
:
'groupName'
,
title
:
'类别'
,
width
,
},
{
dataIndex
:
'name'
,
title
:
'应用名'
,
width
:
width
+
150
,
},
{
dataIndex
:
'isAuthorized'
,
title
:
'是否已授权'
,
render
:
(
text
,
record
)
=>
{
// return '未授权';
const
includesIds
=
props
.
authorizedApp
.
map
((
x
)
=>
{
return
x
.
appId
;
});
if
(
record
&&
record
.
id
&&
includesIds
.
includes
(
record
.
id
))
{
return
redText
(
'已授权'
);
}
else
{
return
'未授权'
;
}
},
},
],
};
return
pageSearch
;
};
export
default
handlePageSearch
;
zyd_private/OneStopAppManage/pageSetting.js
0 → 100644
浏览文件 @
48681e5e
const
pageSetting
=
{
type
:
'list'
,
// 页面类型 list列表 可能包含有其他类型的 比如 detail 详情 add 新增 update 更新 等等 ....
listConfig
:{
selectRows
:
true
,
// 是否可以行选择,
paging
:
false
,
// 是否可以分页,
searchArea
:
true
,
// 是否拥有 搜索区dom,
buttonArea
:
true
,
// 是否拥有 按钮区,
},
};
export
default
pageSetting
;
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论