Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-convertor-view
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
station
amos-convertor-view
Commits
1d6d1687
Commit
1d6d1687
authored
Mar 13, 2020
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
换流站升级
parent
c1597939
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
53 changed files
with
1972 additions
and
155 deletions
+1972
-155
amos.config.js
amos.config.js
+4
-3
report.20200311.173644.21048.0.001.json
report.20200311.173644.21048.0.001.json
+0
-0
report.20200311.181020.24232.0.001.json
report.20200311.181020.24232.0.001.json
+0
-0
report.20200312.114330.4224.0.001.json
report.20200312.114330.4224.0.001.json
+0
-0
index.js
server/index.js
+1
-1
urlConsts.js
src/consts/urlConsts.js
+46
-26
wsUrlConsts.js
src/consts/wsUrlConsts.js
+7
-2
index.js
src/entry/index.js
+48
-5
index.prod.js
src/entry/index.prod.js
+49
-8
index.js
src/model/reducers/index.js
+0
-2
asyncRoutes.js
src/routes/asyncRoutes.js
+6
-13
asyncView.js
src/routes/asyncView.js
+1
-6
calcRoutes.js
src/routes/calcRoutes.js
+4
-2
index.js
src/routes/index.js
+10
-11
view.js
src/routes/view.js
+0
-7
securityService.js
src/services/securityService.js
+33
-5
index.scss
src/styles/view/region/index.scss
+18
-4
FileUtils.js
src/utils/FileUtils.js
+4
-1
payload.js
src/utils/payload.js
+26
-0
request.js
src/utils/request.js
+97
-4
UserSetting.js
src/view/3dview/datapane/setting/UserSetting.js
+23
-12
AutoLogin.js
src/view/autoLogin/AutoLogin.js
+35
-17
EquipmentModel.js
src/view/bizview/equipmentLedger/Equipment/EquipmentModel.js
+4
-1
index.js
src/view/bizview/equipmentLedger/Equipment/index.js
+4
-1
FireEquipmentToolBar.js
...edger/FireResources/FireEquipment/FireEquipmentToolBar.js
+4
-1
PointToolBar.js
...uipmentLedger/FireResources/FireEquipment/PointToolBar.js
+4
-1
fireStation.js
.../equipmentLedger/FireResources/FireStation/fireStation.js
+4
-1
FireTruckDetailInfo.js
...mentLedger/FireResources/FireTruck/FireTruckDetailInfo.js
+4
-1
fireFoam.js
...izview/equipmentLedger/FireResources/fireFoam/fireFoam.js
+4
-1
FireWaterToolBar.js
...w/equipmentLedger/FireResources/water/FireWaterToolBar.js
+4
-1
index.js
src/view/bizview/equipmentLedger/Monitor/index.js
+4
-1
NavList.js
src/view/common/header/NavList.js
+3
-2
ExtraTools.js
src/view/common/mainframe/ExtraTools.js
+113
-0
Header.js
src/view/common/mainframe/Header.js
+88
-0
LevelMenu.js
src/view/common/mainframe/LevelMenu.js
+60
-0
Logo.js
src/view/common/mainframe/Logo.js
+32
-0
MainFrameView.js
src/view/common/mainframe/MainFrameView.js
+175
-0
MenuItem.js
src/view/common/mainframe/MenuItem.js
+190
-0
MenuList.js
src/view/common/mainframe/MenuList.js
+113
-0
SubMenuItem.js
src/view/common/mainframe/SubMenuItem.js
+117
-0
connectMenu.js
src/view/common/mainframe/connectMenu.js
+60
-0
index.js
src/view/common/mainframe/index.js
+12
-0
index.scss
src/view/common/mainframe/style/index.scss
+2
-0
main.scss
src/view/common/mainframe/style/main.scss
+426
-0
vars.scss
src/view/common/mainframe/style/vars.scss
+74
-0
BizFrame.js
src/view/mainframe/BizFrame.js
+4
-4
Root3DView.js
src/view/mainframe/Root3DView.js
+41
-3
RootBizView.js
src/view/mainframe/RootBizView.js
+8
-2
index.js
src/view/mainframe/index.js
+1
-1
index.js
src/view/planMgmt/cusVizLib/index.js
+4
-1
index.js
src/view/region/index.js
+0
-0
index.js
src/view/userInfo/index.js
+0
-3
webpack.config.js
webpack.config.js
+1
-1
No files found.
amos.config.js
View file @
1d6d1687
...
...
@@ -7,10 +7,11 @@
Amos
.
config
=
{
// 普通http
httpURI
:
{
baseURI
:
'http://172.16.10.91:8083/'
,
patrolURI
:
'http://172.16.10.91:8082/'
,
// baseURI: 'http://172.16.3.41:8083/',
baseURI
:
'http://172.16.3.41:10005/'
,
//patrolURI: 'http://172.16.10.91:8082/',
// 安全模块api地址
securityBaseURI
:
'http://172.16.10.
91:8800
/'
,
securityBaseURI
:
'http://172.16.10.
72:10005
/'
,
rulesConfigURI
:
'http://172.16.10.91:8080/'
,
// 监控视图 url
view3dURI
:
'http://172.16.10.91:9000/'
,
...
...
report.20200311.173644.21048.0.001.json
0 → 100644
View file @
1d6d1687
This diff is collapsed.
Click to expand it.
report.20200311.181020.24232.0.001.json
0 → 100644
View file @
1d6d1687
This diff is collapsed.
Click to expand it.
report.20200312.114330.4224.0.001.json
0 → 100644
View file @
1d6d1687
This diff is collapsed.
Click to expand it.
server/index.js
View file @
1d6d1687
...
...
@@ -22,7 +22,7 @@ const transCommonResponse = (data) => {
app
.
all
(
'*'
,
(
req
,
res
,
next
)
=>
{
console
.
log
(
req
.
headers
.
origin
);
res
.
header
(
'Access-Control-Allow-Origin'
,
req
.
headers
.
origin
);
res
.
header
(
'Access-Control-Allow-Headers'
,
'Content-Type,Content-Length, X-Access-Token, X-Api-Key, Authorization, Accept,X-Requested-With'
);
res
.
header
(
'Access-Control-Allow-Headers'
,
'Content-Type,Content-Length, X-Access-Token, X-Api-Key, Authorization, Accept,X-Requested-With
,appKey, product, token
'
);
res
.
header
(
'Access-Control-Allow-Methods'
,
'PUT,POST,GET,DELETE,OPTIONS'
);
res
.
header
(
'Access-Control-Allow-Credentials'
,
'true'
);
res
.
header
(
'X-Powered-By'
,
' 3.2.1'
);
...
...
src/consts/urlConsts.js
View file @
1d6d1687
import
*
as
endConf
from
'amos-processor/lib/config/endconf'
;
import
completeSecurityUrl
,
{
completeSecurityWsUrl
}
from
'amos-security/lib/consts/securityUrl'
;
const
completePrefix
=
endConf
.
completePrefix
;
...
...
@@ -9,7 +8,8 @@ const securityBaseWsURI = AmosConfig.wsURI.securityBaseURI;
// 三维视图
const
view3dURI
=
AmosConfig
.
httpURI
.
view3dURI
;
export
const
baseURI
=
AmosConfig
.
httpURI
.
baseURI
;
const
patrolURI
=
AmosConfig
.
httpURI
.
patrolURI
;
//const patrolURI = AmosConfig.httpURI.patrolURI;
const
patrolURI
=
AmosConfig
.
httpURI
.
baseURI
;
//规则
const
ruleURI
=
AmosConfig
.
httpURI
.
rulesConfigURI
;
...
...
@@ -20,7 +20,7 @@ export const getOutterURL = (key) => {
export
const
SecurityUrl
=
securityBaseURI
;
export
const
SecurityWsUrl
=
securityBaseWsURI
;
export
const
XJBaseURI
=
patrolURI
;
const
secExVerson
=
'v1'
;
/**
* 安全模块 URL 集合
*/
...
...
@@ -34,7 +34,20 @@ export const secExtUrl = {
opSearchBizMenusUrl
:
completePrefix
(
securityBaseURI
,
'permissionItem/searchSubmenuPermission/{code}'
),
// 获取厂区集合 get
regionListUrl
:
completePrefix
(
patrolURI
,
'api/group/queryAuthCompanyLeaves'
)
regionListUrl
:
completePrefix
(
patrolURI
,
'api/group/queryAuthCompanyLeaves'
),
//======================================新加
// 获取当前系统所有菜单(新)
systemMenusUrl
:
completePrefix
(
securityBaseURI
,
`privilege/
${
secExVerson
}
/permission/tree`
),
// 获取当前登陆用户信息(新)
currentUserUrl
:
completePrefix
(
securityBaseURI
,
`privilege/
${
secExVerson
}
/agencyuser/me`
),
// 登陆用户系统权限菜单-
permissionsMenusUrl
:
completePrefix
(
securityBaseURI
,
`privilege/
${
secExVerson
}
/permission/tree/role?roleSeq={roleSeq}`
),
};
export
const
FscSerUrl
=
{
...
...
@@ -44,7 +57,7 @@ export const FscSerUrl = {
view3dInitUrl
:
completePrefix
(
view3dURI
,
'view3d/initViewNode?type={type}'
),
// 初始化三维视图 get
view3dInitLinkUrl
:
completePrefix
(
view3dURI
,
'view3d/initViewLink'
),
// 初始化三维视图 获取link get
searchRegionListUrl
:
completePrefix
(
patrolURI
,
'api/group/queryDept'
),
//右侧菜单-检索-区域集合
searchViewUrl
:
completePrefix
(
view3dURI
,
'
/
view3d/3ddata/all?inputText={inputText}&dataLevel={dataLevel}&orgCode={orgCode}&nodeState={nodeState}&type={type}¤t={page}&pageSize={pageSize}&routeName={routeName}&protectObjName={protectObjName}'
),
// 右侧菜单-检索
searchViewUrl
:
completePrefix
(
view3dURI
,
'view3d/3ddata/all?inputText={inputText}&dataLevel={dataLevel}&orgCode={orgCode}&nodeState={nodeState}&type={type}¤t={page}&pageSize={pageSize}&routeName={routeName}&protectObjName={protectObjName}'
),
// 右侧菜单-检索
searchLinkUrl
:
completePrefix
(
view3dURI
,
'view3d/link/searchView?linkId={linkId}'
),
// 根据单条巡检线 检索节点与线路 get
monitorRegionListUrl
:
completePrefix
(
view3dURI
,
'monitorRegionListUrl'
),
//右侧菜单-监控-区域集合
monitorUrl
:
completePrefix
(
view3dURI
,
'monitorUrl?current={page}&pageSize={size}'
),
//右侧菜单-监控
...
...
@@ -76,7 +89,7 @@ export const FscSerUrl = {
fetchPointStatistics
:
completePrefix
(
patrolURI
,
'api/spc/countPoint'
),
//巡检点统计
fetchChkExecuteInfo
:
completePrefix
(
patrolURI
,
'api/spc/checkExecute/list'
),
//某日巡检执行情况
fetchMonthCountChk
:
completePrefix
(
patrolURI
,
'api/spc/countMonth'
),
//月巡检情况统计
fetchTaskList
:
completePrefix
(
patrolURI
,
'
/
api/task/queryTaskByPage'
),
//月巡检情况统计
fetchTaskList
:
completePrefix
(
patrolURI
,
'api/task/queryTaskByPage'
),
//月巡检情况统计
fetchHidDangerCount
:
completePrefix
(
patrolURI
,
'api/task/hiddenDanger/count'
),
//隐患治理统计
fetchPointDetail
:
completePrefix
(
patrolURI
,
'api/spc/queryPointById'
),
//风险点
...
...
@@ -84,11 +97,11 @@ export const FscSerUrl = {
fetchPointDetailById
:
completePrefix
(
patrolURI
,
'api/point/queryPointById'
),
//巡检点明细
detelPointMeasures
:
completePrefix
(
patrolURI
,
'
/
measures/delete'
),
//删除巡检点措施
detelPointMeasures
:
completePrefix
(
patrolURI
,
'measures/delete'
),
//删除巡检点措施
batchDeletePointMeasuresAction
:
completePrefix
(
patrolURI
,
'/measures/delete/batch'
),
//批量删除巡检点措施
addPointMeasures
:
completePrefix
(
patrolURI
,
'
/
measures/add'
),
//新增巡检点措施
batchAddPointMeasuresAction
:
completePrefix
(
patrolURI
,
'
/
measures/add/batch'
),
//批量新增巡检点措施
updatePointMeasuresAction
:
completePrefix
(
patrolURI
,
'
/
measures/update'
),
//修改巡检点措施
addPointMeasures
:
completePrefix
(
patrolURI
,
'measures/add'
),
//新增巡检点措施
batchAddPointMeasuresAction
:
completePrefix
(
patrolURI
,
'measures/add/batch'
),
//批量新增巡检点措施
updatePointMeasuresAction
:
completePrefix
(
patrolURI
,
'measures/update'
),
//修改巡检点措施
fetchCalCountPanelUrl
:
completePrefix
(
patrolURI
,
'api/spc/check-info/count'
),
//查询日历对应巡检记录数量
fetchTaskQueryCriteria
:
completePrefix
(
patrolURI
,
'api/task/queryCriteria/init'
),
//巡检点列表查询
...
...
@@ -99,6 +112,13 @@ export const FscSerUrl = {
};
export
const
FasSerUrl
=
{
//====================================新加
regionSelectUrl
:
completePrefix
(
baseURI
,
'safeuser/save/curCompany'
),
//保存登录用户信息
selectedOrgInfoUrl
:
completePrefix
(
baseURI
,
'api/region/current'
),
//获取选择的公司
//*******************************************************************************
// 换流站视图
//*******************************************************************************
...
...
@@ -157,16 +177,16 @@ export const FasSerUrl = {
equipmentDeleteUrl
:
completePrefix
(
baseURI
,
'api/impEquip/{ids}'
),
//删除重点设备
equipmentGetUrl
:
completePrefix
(
baseURI
,
'api/impEquip/{id}'
),
//获取重点设备
fireStationGetUrl
:
completePrefix
(
baseURI
,
'api/firestation/list'
),
//获取消防小室信息
fireStationPageUrl
:
completePrefix
(
baseURI
,
'
/
api/firestation/page?pageNumber={page}&pageSize={size}'
),
//消防小室
fireStationDetailUrl
:
completePrefix
(
baseURI
,
'
/
api/firestation/{id}'
),
// 消防小室
fireStationDeleteUrl
:
completePrefix
(
baseURI
,
'
/
api/firestation/{ids}'
),
// 消防小室删除
fireStationNewUrl
:
completePrefix
(
baseURI
,
'
/
api/firestation'
),
// 消防小室新增
fireStationEditUrl
:
completePrefix
(
baseURI
,
'
/
api/firestation/{id}'
),
// 消防小室修改
fireWaterPageUrl
:
completePrefix
(
baseURI
,
'
/
api/waterresource/page?pageNumber={page}&pageSize={size}'
),
//消防水资源
fireWaterDetailUrl
:
completePrefix
(
baseURI
,
'
/
api/waterresource/{id}'
),
// 消防水资源
fireWaterDeleteUrl
:
completePrefix
(
baseURI
,
'
/
api/waterresource/{ids}'
),
// 消防水资源
fireWaterNewUrl
:
completePrefix
(
baseURI
,
'
/
api/waterresource'
),
// 消防水资源
fireWaterEditUrl
:
completePrefix
(
baseURI
,
'
/
api/waterresource/{id}'
),
//消防水资源
fireStationPageUrl
:
completePrefix
(
baseURI
,
'api/firestation/page?pageNumber={page}&pageSize={size}'
),
//消防小室
fireStationDetailUrl
:
completePrefix
(
baseURI
,
'api/firestation/{id}'
),
// 消防小室
fireStationDeleteUrl
:
completePrefix
(
baseURI
,
'api/firestation/{ids}'
),
// 消防小室删除
fireStationNewUrl
:
completePrefix
(
baseURI
,
'api/firestation'
),
// 消防小室新增
fireStationEditUrl
:
completePrefix
(
baseURI
,
'api/firestation/{id}'
),
// 消防小室修改
fireWaterPageUrl
:
completePrefix
(
baseURI
,
'api/waterresource/page?pageNumber={page}&pageSize={size}'
),
//消防水资源
fireWaterDetailUrl
:
completePrefix
(
baseURI
,
'api/waterresource/{id}'
),
// 消防水资源
fireWaterDeleteUrl
:
completePrefix
(
baseURI
,
'api/waterresource/{ids}'
),
// 消防水资源
fireWaterNewUrl
:
completePrefix
(
baseURI
,
'api/waterresource'
),
// 消防水资源
fireWaterEditUrl
:
completePrefix
(
baseURI
,
'api/waterresource/{id}'
),
//消防水资源
fireWaterMatchesAddUrl
:
completePrefix
(
baseURI
,
'api/waterresource/fireEquipmenet'
),
//水资源添加配套消防装备
fireWaterMatchesListUrl
:
completePrefix
(
baseURI
,
'api/waterresource/{waterResourceId}/fireEquipmenet/page?pageNumber={page}&pageSize={size}'
),
//获取水资源的配套装备列表
fireWaterMatchesDeleteUrl
:
completePrefix
(
baseURI
,
'api/waterresource/fireEquipmenet'
),
//删除水资源绑定的消防装备
...
...
@@ -198,13 +218,13 @@ export const FasSerUrl = {
getVideoTreeUrl
:
completePrefix
(
baseURI
,
'api/impEquip/videos'
),
//获取设备视频树
getImpEquipDetailUrl
:
completePrefix
(
baseURI
,
'api/impEquip/detail/{id}'
),
//预案获取重点设备信息
startTestPrecontrolUrl
:
completePrefix
(
baseURI
,
'
/
api/risksource/data/fireqeuiment/soe'
),
startTestPrecontrolUrl
:
completePrefix
(
baseURI
,
'api/risksource/data/fireqeuiment/soe'
),
xiaofangxiaoshiUrl
:
completePrefix
(
baseURI
,
'
/
api/firestation/fireEquipments/{id}'
),
dictListUrl
:
completePrefix
(
baseURI
,
'
/
api/dict/list?dictCode={code}'
),
riskSourceSecondLevelUrl
:
completePrefix
(
baseURI
,
'
/
api/risksource/riskSourceSecondLevel'
),
view3DStatisticsUrl
:
completePrefix
(
baseURI
,
'
/
api/risksource/query3DStatistics/{markerType}'
),
contingencyWaterUrl
:
completePrefix
(
baseURI
,
'
/
api/risksource/contingency/water'
),
xiaofangxiaoshiUrl
:
completePrefix
(
baseURI
,
'api/firestation/fireEquipments/{id}'
),
dictListUrl
:
completePrefix
(
baseURI
,
'api/dict/list?dictCode={code}'
),
riskSourceSecondLevelUrl
:
completePrefix
(
baseURI
,
'api/risksource/riskSourceSecondLevel'
),
view3DStatisticsUrl
:
completePrefix
(
baseURI
,
'api/risksource/query3DStatistics/{markerType}'
),
contingencyWaterUrl
:
completePrefix
(
baseURI
,
'api/risksource/contingency/water'
),
configPointEquipmentUrl
:
completePrefix
(
baseURI
,
'api/firequment/point/batch/bindToEquipment?deviceId={deviceId}&pointIds={pointIds}'
),
getPlanTreeUrl
:
completePrefix
(
baseURI
,
'api/visual/plan/tree'
),
//获取预案树url
importExcelFireEquipmentUrl
:
completePrefix
(
baseURI
,
'api/excel/import/fireEquipment'
),
//导入消防设备
...
...
src/consts/wsUrlConsts.js
View file @
1d6d1687
import
*
as
endConf
from
'amos-processor/lib/config/endconf'
;
import
formatUrl
from
'amos-processor/lib/utils/urlFormat'
;
import
{
getToken
}
from
'amos-security/lib/utils/tokenUtils'
;
import
{
Store
}
from
'amos-tool'
;
import
SysConsts
from
'amos-processor/lib/config/consts'
;
const
lsTool
=
Store
.
lsTool
;
const
completePrefix
=
endConf
.
completePrefix
;
const
AmosConfig
=
endConf
.
AmosConfig
;
const
baseURI
=
AmosConfig
.
wsURI
.
baseURI
;
const
view3dURI
=
AmosConfig
.
wsURI
.
view3dURI
;
const
planProruptionURI
=
AmosConfig
.
wsURI
.
planProruptionURI
;
const
getToken
=
()
=>
{
return
lsTool
.
read
(
SysConsts
.
token
);
};
export
default
{
rulews
:
completePrefix
(
view3dURI
,
'rule.ws?token={token}'
),
...
...
src/entry/index.js
View file @
1d6d1687
...
...
@@ -13,18 +13,19 @@ import { Router, browserHistory } from 'amos-react-router';
import
{
syncHistoryWithStore
}
from
'react-router-redux'
;
import
{
browerSupport
,
consts
}
from
'amos-tool'
;
import
{
DownloadBrowsers
,
AmosAlert
}
from
'amos-framework'
;
import
{
opMenusAction
}
from
'amos-security/lib/services'
;
import
'amos-security/lib/style'
;
import
rootRoutes
from
'./../routes'
;
import
{
configureStoreWithDev
}
from
'./../store'
;
import
beforeRender
from
'./beforeRender'
;
import
{
Store
,
LocationParam
}
from
'amos-tool'
;
import
{
getSystemAllMenu
}
from
'../services/securityService'
;
import
SysConsts
from
'amos-processor/lib/config/consts'
;
// 引入主体样式文件
import
'./../styles'
;
beforeRender
();
const
store
=
configureStoreWithDev
();
const
lsTool
=
Store
.
lsTool
;
const
history
=
syncHistoryWithStore
(
browserHistory
,
store
);
const
support
=
browerSupport
([
'firefox/'
,
'chrome/'
],
{
...
...
@@ -42,21 +43,63 @@ class App extends Component {
}
componentWillMount
()
{
opMenusAction
().
then
(
debugger
let
token
=
LocationParam
.
getLocationParamByName
(
'token'
);
if
(
!
token
)
{
// let systemMenu = JSON.parse(lsTool.read(sessionConsts.systemMenu));
// if (!systemMenu) {
// window.location.href = loginURI;
// return;
// }
// this.setState({ rootRoutes: rootRoutes(systemMenu), visible: true });
// return;
}
else
{
lsTool
.
write
(
SysConsts
.
token
,
token
);
}
getSystemAllMenu
().
then
(
menus
=>
{
this
.
setState
({
rootRoutes
:
rootRoutes
(
menus
),
visible
:
true
});
debugger
let
systemMuens
=
this
.
filterSystemMenus
(
menus
);
let
routeMenus
=
[];
systemMuens
.
forEach
(
item
=>
{
if
(
item
.
children
&&
item
.
children
.
length
>
0
)
{
routeMenus
=
[...
routeMenus
,
...
item
.
children
];
}
});
this
.
setState
({
rootRoutes
:
rootRoutes
(
routeMenus
),
visible
:
true
});
},
err
=>
{
AmosAlert
.
error
(
'警告'
,
err
||
'获取初始化菜单失败!'
);
}
);
// opMenusAction().then(
// menus => {
// this.setState({ rootRoutes: rootRoutes(menus), visible: true });
// },
// err => {
// AmosAlert.error('警告', err || '获取初始化菜单失败!');
// }
// );
}
filterSystemMenus
=
(
menus
=
[])
=>
{
return
menus
.
filter
(
menu
=>
menu
.
permissionType
===
'MENU'
);
}
onUpdate
=
()
=>
{
RProgress
.
done
();
window
.
scrollTo
(
0
,
0
);
};
filterSystemMenus
=
(
menus
=
[])
=>
{
return
menus
.
filter
(
menu
=>
menu
.
permissionType
===
'MENU'
);
}
render
()
{
if
(
this
.
state
.
visible
)
{
return
(
...
...
src/entry/index.prod.js
View file @
1d6d1687
...
...
@@ -13,18 +13,19 @@ import { Router, browserHistory } from 'amos-react-router';
import
{
syncHistoryWithStore
}
from
'react-router-redux'
;
import
{
browerSupport
,
consts
}
from
'amos-tool'
;
import
{
DownloadBrowsers
,
AmosAlert
}
from
'amos-framework'
;
import
{
opMenusAction
}
from
'amos-security/lib/services'
;
import
'amos-security/lib/style'
;
import
rootRoutes
from
'./../routes/asyncRoutes'
;
import
configureStore
from
'./../store'
;
import
rootRoutes
from
'./../routes'
;
import
{
configureStoreWithDev
}
from
'./../store'
;
import
beforeRender
from
'./beforeRender'
;
import
{
Store
,
LocationParam
}
from
'amos-tool'
;
import
{
getSystemAllMenu
}
from
'../services/securityService'
;
import
SysConsts
from
'amos-processor/lib/config/consts'
;
// 引入主体样式文件
import
'./../styles'
;
beforeRender
();
const
store
=
configureStore
();
const
store
=
configureStoreWithDev
();
const
lsTool
=
Store
.
lsTool
;
const
history
=
syncHistoryWithStore
(
browserHistory
,
store
);
const
support
=
browerSupport
([
'firefox/'
,
'chrome/'
],
{
...
...
@@ -42,16 +43,51 @@ class App extends Component {
}
componentWillMount
()
{
opMenusAction
().
then
(
debugger
let
token
=
LocationParam
.
getLocationParamByName
(
'token'
);
if
(
!
token
)
{
AmosAlert
.
error
(
'警告'
,
err
||
'toke已失效!'
);
}
else
{
lsTool
.
write
(
SysConsts
.
token
,
token
);
}
getSystemAllMenu
().
then
(
menus
=>
{
this
.
setState
({
rootRoutes
:
rootRoutes
(
menus
),
visible
:
true
});
debugger
let
systemMuens
=
this
.
filterSystemMenus
(
menus
);
let
routeMenus
=
[];
systemMuens
.
forEach
(
item
=>
{
if
(
item
.
children
&&
item
.
children
.
length
>
0
)
{
routeMenus
=
[...
routeMenus
,
...
item
.
children
];
}
});
this
.
setState
({
rootRoutes
:
rootRoutes
(
routeMenus
),
visible
:
true
});
lsTool
.
write
(
sessionConsts
.
systemMenu
,
JSON
.
stringify
(
routeMenus
));
},
err
=>
{
AmosAlert
.
error
(
'警告'
,
err
||
'获取初始化菜单失败!'
);
}
);
// opMenusAction().then(
// menus => {
// this.setState({ rootRoutes: rootRoutes(menus), visible: true });
// },
// err => {
// AmosAlert.error('警告', err || '获取初始化菜单失败!');
// }
// );
}
filterSystemMenus
=
(
menus
=
[])
=>
{
return
menus
.
filter
(
menu
=>
menu
.
permissionType
===
'MENU'
);
}
onUpdate
=
()
=>
{
RProgress
.
done
();
window
.
scrollTo
(
0
,
0
);
...
...
@@ -73,3 +109,8 @@ class App extends Component {
const
main
=
support
?
<
App
/>
:
<
DownloadBrowsers
/>
;
render
(
main
,
document
.
getElementById
(
'app'
));
// 开发模式下开启 热加载 (不需要开启时,屏蔽一下代码即可)
if
(
module
.
hot
)
{
module
.
hot
.
accept
();
}
src/model/reducers/index.js
View file @
1d6d1687
...
...
@@ -4,11 +4,9 @@
*/
import
{
combineReducers
}
from
'redux'
;
import
{
routerReducer
}
from
'react-router-redux'
;
import
securityReducers
from
'amos-security/lib/model/rootReducers'
;
// 结合 react-router-redux
const
rootReducers
=
combineReducers
({
...
securityReducers
,
routing
:
routerReducer
});
...
...
src/routes/asyncRoutes.js
View file @
1d6d1687
...
...
@@ -2,17 +2,11 @@
import
React
from
'react'
;
import
{
Store
}
from
'amos-tool'
;
import
RProgress
from
'ray-progress'
;
import
notFound
from
'amos-security/lib/routes/notfound'
;
import
redirect
from
'amos-security/lib/routes/notfound/redirect'
;
import
SysConsts
from
'amos-security/lib/consts'
;
import
calcRoutes
from
'./calcRoutes'
;
import
addCustomRoutes
,
{
customRoutes
}
from
'./customRoutes'
;
import
pageCompontent
,
{
AsyncRootView
,
AsyncLogin
,
AsyncUserInfo
,
AsyncRootBizView
,
AsyncConsoleView
,
AsyncRegionList
}
from
'./asyncView'
;
import
routerFilter
,
{
checkLogin
}
from
'amos-security/lib/routes/validateRouter'
;
import
signUp
,
{
signupRouters
}
from
'amos-security/lib/routes/signUp'
;
import
AutoLogin
from
'./../view/autoLogin/AutoLogin'
;
const
apiKey
=
SysConsts
.
api_key
;
const
groups
=
[
'main'
,
'biz'
,
'console'
...
...
@@ -27,7 +21,7 @@ const injectRoutes = menus => {
{
path
:
'login'
,
component
:
AsyncLogin
},
{
path
:
'autologin'
,
component
:
AutoLogin
},
{
path
:
'region'
,
component
:
AsyncRegionList
},
// 区域选择
...
signUp
,
{
path
:
'main'
,
component
:
AsyncRootView
,
...
...
@@ -42,9 +36,7 @@ const injectRoutes = menus => {
path
:
'console'
,
component
:
AsyncConsoleView
,
childRoutes
:
consoleChilds
},
notFound
,
redirect
}
];
return
routes
;
};
...
...
@@ -57,11 +49,12 @@ const onEnterValidate = (next, replace, callback) => {
progressStart
();
const
pathname
=
next
.
location
.
pathname
;
const
flag
=
routerFilter
({
filterPath
:
[].
concat
(
signupRouters
,
'login'
,
'autologin'
),
filterPath
:
[].
concat
(
'login'
,
'autologin'
),
pathname
});
console
.
log
(
'pathname|flag'
,
pathname
,
flag
);
if
(
!
checkLogin
()
&&
flag
)
{
debugger
if
(
!
flag
)
{
replace
(
'/login'
);
}
callback
();
...
...
@@ -70,7 +63,7 @@ const onEnterValidate = (next, replace, callback) => {
const
rootRoutes
=
menus
=>
{
return
{
path
:
'/'
,
onEnter
:
onEnterValidate
,
//
onEnter: onEnterValidate,
onChange
:
progressStart
,
indexRedirect
:
AsyncLogin
,
indexRoute
:
{
...
...
src/routes/asyncView.js
View file @
1d6d1687
...
...
@@ -20,12 +20,7 @@ const AsyncRootBizView = props => <AsyncLoader load={import('./../view/mainframe
const
AsyncSubConsoleView
=
props
=>
<
AsyncLoader
load
=
{
import
(
'./../view/mainframe/SubConsoleView'
)}
componentProps
=
{
props
}
/>
;
const
AsyncConsoleView
=
props
=>
<
AsyncLoader
load
=
{
import
(
'./../view/console'
)}
componentProps
=
{
props
}
/>
;
const
AsyncCompany
=
props
=>
<
AsyncLoader
load
=
{
import
(
'amos-security/lib/view/company'
)}
componentProps
=
{
props
}
/>
;
const
AsyncDepartment
=
props
=>
<
AsyncLoader
load
=
{
import
(
'amos-security/lib/view/department'
)}
componentProps
=
{
props
}
/>
;
const
AsyncMenu
=
props
=>
<
AsyncLoader
load
=
{
import
(
'amos-security/lib/view/menu'
)}
componentProps
=
{
props
}
/>
;
const
AsyncRole
=
props
=>
<
AsyncLoader
load
=
{
import
(
'amos-security/lib/view/role'
)}
componentProps
=
{
props
}
/>
;
const
AsyncSystemDic
=
props
=>
<
AsyncLoader
load
=
{
import
(
'amos-security/lib/view/systemdic'
)}
componentProps
=
{
props
}
/>
;
const
AsyncUser
=
props
=>
<
AsyncLoader
load
=
{
import
(
'amos-security/lib/view/user'
)}
componentProps
=
{
props
}
/>
;
const
AsyncConfig
=
props
=>
<
AsyncLoader
load
=
{
import
(
'./../view/config'
)}
componentProps
=
{
props
}
/>
;
const
AsyncAutoLogin
=
props
=>
<
AsyncLoader
load
=
{
import
(
'./../view/autoLogin/AutoLogin'
)}
componentProps
=
{
props
}
/>
;
...
...
src/routes/calcRoutes.js
View file @
1d6d1687
const
compeleteMenus
=
(
pageCompontent
)
=>
{
debugger
return
function
convertMenus
(
menus
,
resRoutes
,
level
)
{
menus
.
map
(
menu
=>
{
if
(
menu
.
url
)
{
const
urlList
=
menu
.
url
.
split
(
'/'
);
if
(
menu
.
path
)
{
const
urlList
=
menu
.
path
.
split
(
'/'
);
const
path
=
urlList
[
level
+
1
];
if
(
urlList
.
length
>
2
)
{
const
itemRoutes
=
{
path
,
component
:
pageCompontent
(
path
),
childRoutes
:
[],
group
:
urlList
[
1
]
};
...
...
@@ -46,6 +47,7 @@ const filterGroupMenus = (routes, groups) => {
* @return {object|array} group存在: { main: [...], other: [...] }, group 不存在: []
*/
export
default
function
calcRoutes
(
menus
=
[],
pageCompontent
,
groups
)
{
debugger
const
_routes
=
[];
if
(
menus
&&
menus
.
length
>
0
)
{
compeleteMenus
(
pageCompontent
)(
menus
,
_routes
,
1
);
...
...
src/routes/index.js
View file @
1d6d1687
// @author ilex.h
import
RProgress
from
'ray-progress'
;
import
notFound
from
'amos-security/lib/routes/notfound'
;
import
redirect
from
'amos-security/lib/routes/notfound/redirect'
;
import
signUp
,
{
signupRouters
}
from
'amos-security/lib/routes/signUp'
;
import
routerFilter
,
{
checkLogin
}
from
'amos-security/lib/routes/validateRouter'
;
import
PublishView
from
'./../view/planMgmt/view'
;
import
AutoLogin
from
'./../view/autoLogin/AutoLogin'
;
import
calcRoutes
from
'./calcRoutes'
;
...
...
@@ -26,6 +22,7 @@ const groups = [
];
const
injectRoutes
=
menus
=>
{
debugger
const
{
main
=
[],
biz
=
[],
console
:
consoleRoutes
=
[]
}
=
calcRoutes
(
menus
,
pageCompontent
,
groups
)
||
{};
const
mainChilds
=
addCustomRoutes
(
main
);
const
bizChilds
=
addCustomRoutes
(
biz
);
...
...
@@ -39,7 +36,6 @@ const injectRoutes = menus => {
{
path
:
'autologin'
,
component
:
AutoLogin
},
{
path
:
'region'
,
component
:
RegionList
},
// 区域选择
{
path
:
'shareTextPlan'
,
component
:
ShareTextPlan
},
...
signUp
,
{
path
:
'main'
,
component
:
RootView
,
...
...
@@ -57,9 +53,7 @@ const injectRoutes = menus => {
path
:
'console'
,
component
:
ConsoleView
,
childRoutes
:
consoleChilds
},
notFound
,
redirect
}
];
return
routes
;
};
...
...
@@ -69,23 +63,28 @@ const progressStart = () => {
};
const
onEnterValidate
=
(
next
,
replace
,
callback
)
=>
{
debugger
progressStart
();
const
pathname
=
next
.
location
.
pathname
;
const
flag
=
routerFilter
({
filterPath
:
[].
concat
(
signupRouters
,
'login'
,
'
autologin'
,
'conver/patrol
'
),
filterPath
:
[].
concat
(
signupRouters
,
'login'
,
'
/autologin'
,
'conver/patrol'
,
'/biz/assessment/
'
),
pathname
});
console
.
log
(
'pathname|flag'
,
pathname
,
flag
);
if
(
!
checkLogin
()
&&
flag
)
{
// if (!checkLogin() && flag ) {
// replace('/login');
// }
if
(
!
flag
)
{
replace
(
'/login'
);
}
callback
();
};
const
rootRoutes
=
menus
=>
{
debugger
return
{
path
:
'/'
,
onEnter
:
onEnterValidate
,
//
onEnter: onEnterValidate,
onChange
:
progressStart
,
indexRedirect
:
Login
,
indexRoute
:
{
...
...
src/routes/view.js
View file @
1d6d1687
import
{
Company
,
Department
,
Menu
,
Role
,
SystemDic
,
User
}
from
'amos-security/lib'
;
import
{
viewRoutesMapping
}
from
'amos-rules-config'
;
import
parsePlugin
from
'./parsePlugin'
;
...
...
@@ -65,12 +64,6 @@ const Routes = {
biz
:
RootBizView
,
console
:
ConsoleView
,
company
:
Company
,
department
:
Department
,
menu
:
Menu
,
role
:
Role
,
systemdic
:
SystemDic
,
user
:
User
,
// config: Config,
config
:
SubConsoleView
,
'3dview'
:
Three3dView
,
...
...
src/services/securityService.js
View file @
1d6d1687
...
...
@@ -2,14 +2,16 @@ import {
opSearchMenusAction
,
userInfoAction
}
from
'amos-security/lib/services'
;
import
formatUrl
from
'amos-processor/lib/utils/urlFormat'
;
import
formatUrl
from
'amos-processor/lib/utils/urlFormat'
;
import
{
secExtUrl
}
from
'./../consts/urlConsts'
;
import
{
commonGet
,
commonPost
}
from
'./../utils/request'
;
import
{
FasSerUrl
}
from
'./../consts/urlConsts'
;
export
const
getMenusAction
=
()
=>
{
const
url
=
formatUrl
(
secExtUrl
.
opSearchMenusUrl
,
{
nodeName
:
''
,
type
:
window
.
V3DpermissionType
});
return
opSearchMenusAction
(
url
);
};
//
export const getMenusAction = () => {
//
const url = formatUrl(secExtUrl.opSearchMenusUrl, { nodeName: '', type: window.V3DpermissionType });
//
return opSearchMenusAction(url);
//
};
export
const
getBizMenusAction
=
(
parentKey
)
=>
{
const
url
=
formatUrl
(
secExtUrl
.
opSearchBizMenusUrl
,
{
code
:
parentKey
});
...
...
@@ -19,3 +21,28 @@ export const getBizMenusAction = (parentKey) => {
export
const
getUserInfoById
=
(
userId
)
=>
{
return
userInfoAction
(
userId
);
};
//=====================================================新加
export
const
getSystemAllMenu
=
()
=>
{
return
commonGet
(
formatUrl
(
secExtUrl
.
systemMenusUrl
));
};
export
const
getCurrentUser
=
()
=>
{
return
commonGet
(
secExtUrl
.
currentUserUrl
);
};
export
const
regionSelectAction
=
(
body
)
=>
{
let
url
=
formatUrl
(
FasSerUrl
.
regionSelectUrl
);
return
commonPost
(
url
,
body
);
};
export
const
getSelectedOrgInfoAction
=
(
id
)
=>
{
return
commonGet
(
FasSerUrl
.
selectedOrgInfoUrl
);
};
/**
* 获取当前角色权限菜单
* @param {*} roleSeq 角色Id
*/
export
const
getPermissionsMenus
=
(
roleSeq
)
=>
{
return
commonGet
(
formatUrl
(
secExtUrl
.
permissionsMenusUrl
,
{
roleSeq
}));
};
\ No newline at end of file
src/styles/view/region/index.scss
View file @
1d6d1687
...
...
@@ -3,7 +3,7 @@
width
:
100%
;
height
:
100%
;
text-align
:
center
;
background
:
url('../../assets/region/region-bg.png')
no-repeat
$core-border-color
;
background
:
url('../../assets/region/region-bg.png')
no-repeat
rgb
(
222
,
221
,
222
);
//$core-border-color
flex-wrap
:
wrap
;
justify-content
:
center
;
align-items
:
center
;
...
...
@@ -12,7 +12,7 @@
position
:
relative
;
display
:
inline-block
;
width
:
320px
;
height
:
40
0px
;
height
:
34
0px
;
margin
:
1rem
;
font-size
:
40px
;
font-weight
:
bold
;
...
...
@@ -20,10 +20,10 @@
cursor
:
pointer
;
background-color
:
#282828
;
//$core-tint-color;
border
:
3px
solid
#222
;
//$core-border-color;
border-radius
:
$core-border-radius
;
//
border-radius: $core-border-radius;
&
:hover
{
border
:
3px
solid
$danger-color
;
border
:
3px
solid
#f94242
;
}
img
{
...
...
@@ -31,6 +31,20 @@
height
:
250px
;
}
.form-item
{
width
:
70%
;
}
.region-form
{
margin-top
:
60px
;
}
.regoin-button
{
width
:
200px
;
height
:
40px
;
font-size
:
19px
;
}
.region-item-label
{
position
:
absolute
;
bottom
:
1rem
;
...
...
src/utils/FileUtils.js
View file @
1d6d1687
...
...
@@ -64,7 +64,10 @@ export const downLoadFilePost = (url,searchParam)=>{
Accept
:
'application/vnd.ms-excel'
,
'Content-Type'
:
'application/json; charset=utf-8'
,
'X-Api-Key'
:
_amosTool
.
Store
.
getCookieByName
(
apiKey
),
'X-Access-Token'
:
ls
.
read
(
token
)
'X-Access-Token'
:
ls
.
read
(
token
),
'appKey'
:
'CONVERTER_STATION'
,
'product'
:
'CONVERTER_STATION_WEB'
,
'token'
:
ls
.
read
(
token
)
},
body
:
JSON
.
stringify
(
searchParam
)
}).
then
(
e
=>
{
...
...
src/utils/payload.js
0 → 100644
View file @
1d6d1687
export
default
function
(
data
,
delRequest
){
window
.
setLoading
&&
window
.
setLoading
(
false
);
return
new
Promise
((
resolve
,
reject
)
=>
{
debugger
if
(
data
)
{
if
(
data
.
dataList
||
data
.
dataList
===
null
){
if
(
data
.
result
===
'SUCCESS'
){
resolve
(
data
.
dataList
);
}
else
{
resolve
(
data
.
result
);
}
}
else
if
(
data
.
result
||
data
.
result
===
null
){
resolve
(
data
.
result
);
}
else
{
resolve
(
data
);
}
}
else
{
if
(
data
)
{
reject
(
data
.
message
);
}
else
{
reject
(
data
);
}
}
});
}
src/utils/request.js
View file @
1d6d1687
import
amosRequest
,
{
singleFetch
,
commonGet
,
commonPost
,
commonPut
,
commonDelete
}
from
'amos-processor/lib/fetch/amosRequest'
;
import
{
utils
}
from
'amos-tool'
;
import
amosRequest
,
{
singleFetch
}
from
'amos-processor/lib/fetch/amosRequest'
;
import
{
utils
,
Store
}
from
'amos-tool'
;
import
{
message
}
from
'amos-framework'
;
import
formatUrl
from
'amos-processor/lib/utils/urlFormat'
;
import
{
getToken
}
from
'amos-security/lib/utils/tokenUtils'
;
import
SysConsts
from
'amos-processor/lib/config/consts'
;
import
payload
from
'./payload'
;
const
lsTool
=
Store
.
lsTool
;
const
defaultPageable
=
{
page
:
0
,
size
:
10
};
const
defaultHeaders
=
{
appKey
:
'CONVERTER_STATION'
,
product
:
'CONVERTER_STATION_WEB'
,
};
const
compleHeaders
=
()
=>
{
return
{
...
defaultHeaders
,
token
:
getToken
()
};
};
/**
* 获取 token
*/
const
getToken
=
()
=>
{
debugger
return
lsTool
.
read
(
SysConsts
.
token
);
}
/**
* 删除全局变量requests中的地址
* @param {*} url
* @param {*} method
*/
const
delRequest
=
(
url
,
method
)
=>
{
if
(
window
.
requests
&&
window
.
requests
.
length
>
0
)
{
window
.
requests
=
window
.
requests
.
filter
(
e
=>
e
.
url
!==
url
&&
e
.
method
!==
method
);
}
};
/**
* 构建分页
*/
...
...
@@ -31,10 +66,68 @@ const convertDatalist = (dataList = [], key = 'content') => {
return
newDL
;
};
export
function
commonGet
(
url
)
{
window
.
setLoading
&&
window
.
setLoading
(
true
);
return
amosRequest
(
url
,
{
timeout
:
10000000
,
method
:
'GET'
,
headers
:
compleHeaders
(),
reject
(
error
){
window
.
setLoading
&&
window
.
setLoading
(
false
);
delRequest
(
url
,
'GET'
);
//message.danger(error.message || '请求失败,服务器错误!');
}
}).
then
(
data
=>
payload
(
data
));
}
export
function
commonPost
(
url
,
data
,
params
)
{
window
.
setLoading
&&
window
.
setLoading
(
true
);
return
amosRequest
(
url
,
{
timeout
:
10000000
,
method
:
'POST'
,
headers
:
compleHeaders
(),
body
:
data
,
reject
(
error
){
delRequest
(
url
,
'POST'
);
window
.
setLoading
&&
window
.
setLoading
(
false
);
//message.danger(error.message || '请求失败,服务器错误!');
}
}).
then
(
data
=>
payload
(
data
));
}
export
function
commonPut
(
url
,
data
,
params
)
{
window
.
setLoading
&&
window
.
setLoading
(
true
);
return
amosRequest
(
url
,
{
timeout
:
10000000
,
method
:
'PUT'
,
headers
:
compleHeaders
(),
body
:
data
,
reject
(
error
){
delRequest
(
url
,
'PUT'
);
window
.
setLoading
&&
window
.
setLoading
(
false
);
//message.danger(error.message || '请求失败,服务器错误!');
}
}).
then
(
data
=>
payload
(
data
));
}
export
function
commonDelete
(
url
,
data
,
params
)
{
window
.
setLoading
&&
window
.
setLoading
(
true
);
return
amosRequest
(
url
,
{
timeout
:
10000000
,
method
:
'DELETE'
,
headers
:
compleHeaders
(),
body
:
data
,
reject
(
error
){
window
.
setLoading
&&
window
.
setLoading
(
false
);
//message.danger(error.message || '请求失败,服务器错误!');
}
}).
then
(
data
=>
payload
(
data
));
}
export
const
getWithCookie
=
(
url
)
=>
{
return
commonGet
(
url
,
{
hasCookie
:
true
});
};
export
{
amosRequest
,
singleFetch
,
co
mmonGet
,
commonPost
,
commonPut
,
commonDelete
,
convertDatalist
,
buildPageable
,
formatUrl
,
getToken
};
export
{
amosRequest
,
singleFetch
,
co
nvertDatalist
,
buildPageable
,
formatUrl
};
src/view/3dview/datapane/setting/UserSetting.js
View file @
1d6d1687
...
...
@@ -5,10 +5,9 @@ import { Button } from 'amos-framework';
import
imgStatic
from
'CONSTS/imgStatic'
;
import
{
CONSTS
}
from
'CONSTS/storageConsts'
;
import
{
SecurityUrl
}
from
'CONSTS/urlConsts'
;
import
{
currentUser
}
from
'amos-security/lib/model/auth'
;
import
enhanceAuthorization
from
'amos-security/lib/view/auth/enhanceAuthorization'
;
import
{
tirggerTransTopic
}
from
'./../../dataProcessor'
;
import
{
getUserInfoById
}
from
'SERVICES/securityService'
;
import
{
getCurrentUser
}
from
'SERVICES/securityService'
;
import
{
getSelectedOrgInfoAction
}
from
'SERVICES/securityService'
;
/**
* 设置-账户设置
...
...
@@ -40,19 +39,31 @@ class UserSetting extends Component {
}
componentDidMount
()
{
this
.
onInit
();
this
.
getSelectedOrgInfo
();
}
componentWillReceiveProps
(
nextProps
)
{
debugger
if
(
nextProps
.
isLoginout
)
{
browserHistory
.
push
(
'/login'
);
}
}
getSelectedOrgInfo
=
()
=>
{
debugger
getSelectedOrgInfoAction
().
then
(
data
=>
{
const
{
user
}
=
this
.
state
;
user
.
company
=
data
.
company
;
user
.
department
=
data
.
department
;
this
.
setState
(
{
user
}
);
});
}
onInit
=
function
()
{
let
userInfo
=
currentUser
()
||
{};
let
userId
=
(
userInfo
||
{}).
userId
;
getUserInfoById
(
userId
).
then
(
data
=>
{
let
userName
=
(
data
.
user
||
{}).
user
Name
;
let
departmentInfo
=
(
data
.
user
||
{}).
department
;
let
companyInfo
=
(
data
.
user
||
{}).
company
;
//let userInfo = currentUser
currentUser() || {};
//
let userId = (userInfo || {}).userId;
getCurrentUser
(
).
then
(
data
=>
{
let
userName
=
data
.
real
Name
;
let
departmentInfo
=
{}
;
let
companyInfo
=
{}
;
this
.
setState
(
{
user
:
{
nickName
:
userName
,
company
:
companyInfo
,
department
:
departmentInfo
}
}
);
});
...
...
@@ -62,9 +73,9 @@ class UserSetting extends Component {
*/
onLogOut
=
()
=>
{
const
{
logout
,
sweepReducers
}
=
this
.
props
;
const
user
=
currentUser
();
//
const user = currentUser();
tirggerTransTopic
(
CONSTS
.
control
,
{
control
:
{
logOut
:
true
}
});
logout
&&
logout
(
SecurityUrl
.
loginOutUrl
,
user
.
userId
);
logout
&&
logout
(
SecurityUrl
.
loginOutUrl
);
sweepReducers
&&
sweepReducers
();
}
...
...
@@ -89,4 +100,4 @@ class UserSetting extends Component {
}
}
export
default
enhanceAuthorization
(
UserSetting
)
;
export
default
UserSetting
;
src/view/autoLogin/AutoLogin.js
View file @
1d6d1687
import
React
,
{
Component
}
from
'react'
;
import
BaseAutoLogin
,
{
updateLoginOptions
}
from
'amos-security/lib/view/login/AutoLogin
'
;
import
*
as
endConf
from
'amos-processor/lib/config/endconf
'
;
import
{
browserHistory
}
from
'amos-react-router
'
;
import
{
Store
,
LocationParam
}
from
'amos-tool
'
;
const
AmosConfig
=
endConf
.
AmosConfig
;
const
pwd
=
AmosConfig
.
autoLoginConf
.
pwd
;
const
lsTool
=
Store
.
lsTool
;
// const AmosConfig = endConf.AmosConfig;
// const pwd = AmosConfig.autoLoginConf.pwd;
// 提前注入登录后的路由,更新登录成功后跳转的页面
updateLoginOptions
({
mainPath
:
'region'
// 默认是 main,此处可以更改登录成功后跳转的默认路由
});
//
updateLoginOptions({
//
mainPath: 'region' // 默认是 main,此处可以更改登录成功后跳转的默认路由
//
});
// 可注入的属性有:loginUrl/loginOutUrl/permissionsUrl/websocketHeartBeatUrl/mainPath
...
...
@@ -19,18 +23,31 @@ updateLoginOptions({
* @extends {Component}
*/
class
AutoLogin
extends
Component
{
// render() {
// const username = this.props.location.query.username;
// const accessToken = this.props.location.query.accessToken;
// const effectiveTime = this.props.location.query.effectiveTime;
// const authParams = {
// userName: username,
// password: pwd,
// accessToken:accessToken,
// effectiveTime:effectiveTime
// };
// return <BaseAutoLogin authParams={authParams} />;
// }
componentWillMount
()
{
debugger
let
token
=
LocationParam
.
getLocationParamByName
(
'token'
);
if
(
token
)
{
browserHistory
.
push
(
'/region'
);
}
}
render
()
{
const
username
=
this
.
props
.
location
.
query
.
username
;
const
accessToken
=
this
.
props
.
location
.
query
.
accessToken
;
const
effectiveTime
=
this
.
props
.
location
.
query
.
effectiveTime
;
const
authParams
=
{
userName
:
username
,
password
:
pwd
,
accessToken
:
accessToken
,
effectiveTime
:
effectiveTime
};
return
<
BaseAutoLogin
authParams
=
{
authParams
}
/>
;
return
null
;
}
}
export
default
AutoLogin
;
\ No newline at end of file
src/view/bizview/equipmentLedger/Equipment/EquipmentModel.js
View file @
1d6d1687
...
...
@@ -292,7 +292,10 @@ class EquipmentModel extends Component {
'
Accept
': '
application
/
json
;
charset
=
UTF
-
8
',
'
X
-
Api
-
Key
': _amosTool.Store.getCookieByName(apiKey),
'
Content
-
Type
': '
application
/
json
;
charset
=
utf
-
8
',
'
X
-
Access
-
Token
': ls.read(token)
'
X
-
Access
-
Token
': ls.read(token),
'
appKey
': '
CONVERTER_STATION
',
'
product
': '
CONVERTER_STATION_WEB
',
'
token
':ls.read(token)
}
}).then(res => {
return res.json();
...
...
src/view/bizview/equipmentLedger/Equipment/index.js
View file @
1d6d1687
...
...
@@ -291,7 +291,10 @@ class Equipment extends Component {
headers
:
{
'Accept'
:
'application/json;charset=UTF-8'
,
'X-Api-Key'
:
_amosTool
.
Store
.
getCookieByName
(
apiKey
),
'X-Access-Token'
:
ls
.
read
(
token
)
'X-Access-Token'
:
ls
.
read
(
token
),
'appKey'
:
'CONVERTER_STATION'
,
'product'
:
'CONVERTER_STATION_WEB'
,
'token'
:
ls
.
read
(
token
)
},
body
:
formData
}).
then
(
e
=>
{
...
...
src/view/bizview/equipmentLedger/FireResources/FireEquipment/FireEquipmentToolBar.js
View file @
1d6d1687
...
...
@@ -67,7 +67,10 @@ class FireEquipmentToolBar extends Component {
showUploadList
:
false
,
headers
:
{
'Accept'
:
'application/json;charset=UTF-8'
,
'X-Access-Token'
:
lsTool
.
read
(
SysConsts
.
token
)
'X-Access-Token'
:
lsTool
.
read
(
SysConsts
.
token
),
'appKey'
:
'CONVERTER_STATION'
,
'product'
:
'CONVERTER_STATION_WEB'
,
'token'
:
lsTool
.
read
(
SysConsts
.
token
)
},
onChange
(
info
)
{
if
(
info
.
file
.
status
!==
'uploading'
)
{
...
...
src/view/bizview/equipmentLedger/FireResources/FireEquipment/PointToolBar.js
View file @
1d6d1687
...
...
@@ -65,7 +65,10 @@ class PointToolBar extends Component {
showUploadList
:
false
,
headers
:
{
'Accept'
:
'application/json;charset=UTF-8'
,
'X-Access-Token'
:
lsTool
.
read
(
SysConsts
.
token
)
'X-Access-Token'
:
lsTool
.
read
(
SysConsts
.
token
),
'appKey'
:
'CONVERTER_STATION'
,
'product'
:
'CONVERTER_STATION_WEB'
,
'token'
:
lsTool
.
read
(
SysConsts
.
token
)
},
onChange
(
info
)
{
if
(
info
.
file
.
status
!==
'uploading'
)
{
...
...
src/view/bizview/equipmentLedger/FireResources/FireStation/fireStation.js
View file @
1d6d1687
...
...
@@ -342,7 +342,10 @@ class FireStationTableView extends Component {
headers
:
{
Accept
:
'application/json;charset=UTF-8'
,
'X-Api-Key'
:
_amosTool
.
Store
.
getCookieByName
(
apiKey
),
'X-Access-Token'
:
ls
.
read
(
token
)
'X-Access-Token'
:
ls
.
read
(
token
),
'appKey'
:
'CONVERTER_STATION'
,
'product'
:
'CONVERTER_STATION_WEB'
,
'token'
:
ls
.
read
(
token
)
},
body
:
formData
})
...
...
src/view/bizview/equipmentLedger/FireResources/FireTruck/FireTruckDetailInfo.js
View file @
1d6d1687
...
...
@@ -197,7 +197,10 @@ class FireTruckDetailInfo extends Component {
headers: {
Accept: '
application
/
json
;
charset
=
UTF
-
8
',
'
X
-
Api
-
Key
': _amosTool.Store.getCookieByName(apiKey),
'
X
-
Access
-
Token
': ls.read(token)
'
X
-
Access
-
Token
': ls.read(token),
'
appKey
': '
CONVERTER_STATION
',
'
product
': '
CONVERTER_STATION_WEB
',
'
token
':ls.read(token)
},
body: formData
})
...
...
src/view/bizview/equipmentLedger/FireResources/fireFoam/fireFoam.js
View file @
1d6d1687
...
...
@@ -341,7 +341,10 @@ class FireFoamable extends Component {
headers
:
{
Accept
:
'application/json;charset=UTF-8'
,
'X-Api-Key'
:
_amosTool
.
Store
.
getCookieByName
(
apiKey
),
'X-Access-Token'
:
ls
.
read
(
token
)
'X-Access-Token'
:
ls
.
read
(
token
),
'appKey'
:
'CONVERTER_STATION'
,
'product'
:
'CONVERTER_STATION_WEB'
,
'token'
:
ls
.
read
(
token
)
},
body
:
formData
})
...
...
src/view/bizview/equipmentLedger/FireResources/water/FireWaterToolBar.js
View file @
1d6d1687
...
...
@@ -49,7 +49,10 @@ class FireWaterToolBar extends Component {
showUploadList
:
false
,
headers
:
{
'Accept'
:
'application/json;charset=UTF-8'
,
'X-Access-Token'
:
lsTool
.
read
(
SysConsts
.
token
)
'X-Access-Token'
:
lsTool
.
read
(
SysConsts
.
token
),
'appKey'
:
'CONVERTER_STATION'
,
'product'
:
'CONVERTER_STATION_WEB'
,
'token'
:
lsTool
.
read
(
SysConsts
.
token
)
},
onChange
(
info
)
{
if
(
info
.
file
.
status
!==
'uploading'
)
{
...
...
src/view/bizview/equipmentLedger/Monitor/index.js
View file @
1d6d1687
...
...
@@ -283,7 +283,10 @@ class Monitor extends Component {
showUploadList
:
false
,
headers
:
{
'Accept'
:
'application/json;charset=UTF-8'
,
'X-Access-Token'
:
lsTool
.
read
(
SysConsts
.
token
)
'X-Access-Token'
:
lsTool
.
read
(
SysConsts
.
token
),
'appKey'
:
'CONVERTER_STATION'
,
'product'
:
'CONVERTER_STATION_WEB'
,
'token'
:
lsTool
.
read
(
SysConsts
.
token
)
},
onChange
(
info
)
{
if
(
info
.
file
.
status
!==
'uploading'
)
{
...
...
src/view/common/header/NavList.js
View file @
1d6d1687
...
...
@@ -5,12 +5,13 @@ import { Nav, NavItem, IndexNavItem } from 'amos-framework';
class
NavList
extends
Component
{
renderNavItem
=
()
=>
{
debugger
const
{
menus
=
[],
onMenuItemClick
}
=
this
.
props
;
return
menus
.
map
((
es
,
index
)
=>
{
const
params
=
{
icon
:
es
.
icon
,
title
:
es
.
n
ame
,
href
:
es
.
url
title
:
es
.
permissionN
ame
,
href
:
es
.
path
};
if
(
es
.
isBlank
){
...
...
src/view/common/mainframe/ExtraTools.js
0 → 100644
View file @
1d6d1687
import
React
,
{
Component
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
classnames
from
'classnames'
;
import
{
utils
}
from
'amos-tool'
;
import
{
browserHistory
}
from
'amos-react-router'
;
import
{
Menu
,
User
}
from
'amos-framework'
;
import
{
getCurrentUser
}
from
'./../../../services/securityService'
;
class
ExtraTools
extends
Component
{
static
propTypes
=
{
userPic
:
PropTypes
.
string
,
loginOutUrl
:
PropTypes
.
string
,
showText
:
PropTypes
.
bool
,
isLoginout
:
PropTypes
.
bool
,
// 权限相关,主要封装注销、清理reducer
authProps
:
PropTypes
.
shape
({
logout
:
PropTypes
.
func
,
sweepReducers
:
PropTypes
.
func
}),
onNavItemClick
:
PropTypes
.
func
,
// 用户按钮额外内容
userExtra
:
PropTypes
.
oneOfType
([
PropTypes
.
node
,
PropTypes
.
element
,
PropTypes
.
bool
]),
userInfoLink
:
PropTypes
.
string
,
// [MenuItem, MenuItem, ... ]
extraTools
:
PropTypes
.
arrayOf
(
PropTypes
.
oneOfType
([
PropTypes
.
node
,
PropTypes
.
element
]))
};
static
defaultProps
=
{
userInfoLink
:
'/main/userinfo'
};
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
userInfo
:
{}
};
}
componentDidMount
()
{
this
.
loadUserInfo
();
}
loadUserInfo
=
()
=>
{
getCurrentUser
().
then
(
d
=>
{
this
.
setState
({
userInfo
:
d
});
});
}
handleClickUser
=
()
=>
{
const
{
userInfo
}
=
this
.
state
;
const
{
userInfoLink
,
onNavItemClick
,
userPic
}
=
this
.
props
;
onNavItemClick
&&
onNavItemClick
({});
browserHistory
.
push
({
pathname
:
userInfoLink
,
state
:
{
userId
:
userInfo
.
userId
,
userPic
}
});
};
handleLogOut
=
()
=>
{
const
{
userInfo
}
=
this
.
state
;
const
{
loginOutUrl
,
authProps
}
=
this
.
props
;
const
{
logout
,
sweepReducers
}
=
authProps
;
logout
&&
logout
(
loginOutUrl
,
userInfo
.
userId
);
sweepReducers
&&
sweepReducers
();
window
.
localStorage
.
removeItem
(
'cityLine'
);
};
render
()
{
const
{
userInfo
}
=
this
.
state
;
const
{
showText
,
userPic
,
userExtra
,
extraTools
}
=
this
.
props
;
const
cls
=
classnames
(
'sys-tools'
,
{
'sys-tools-min'
:
!
showText
});
let
userContent
;
if
(
userExtra
)
{
userContent
=
utils
.
isBoolean
(
userExtra
)
?
(
<
ul
>
<
li
className
=
"modify-pwd"
onClick
=
{
this
.
handleClickUser
}
>
修改密码
<
/li
>
<
/ul
>
)
:
userExtra
;
}
const
basicInfo
=
{
userName
:
userInfo
.
userName
,
subInfo
:
userInfo
.
nickName
};
return
(
<
div
className
=
{
cls
}
>
<
Menu
direction
=
"horizontal"
>
{
extraTools
&&
extraTools
}
<
/Menu
>
<
User
userPic
=
{
userPic
}
basicInfo
=
{
basicInfo
}
handleLogOut
=
{
this
.
handleLogOut
}
extra
=
{
userContent
}
onAvatarClick
=
{
this
.
handleClickUser
}
/
>
<
/div
>
);
}
}
export
default
ExtraTools
;
src/view/common/mainframe/Header.js
0 → 100644
View file @
1d6d1687
import
React
,
{
Component
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
RayMediaquery
from
'ray-mediaquery'
;
import
Logo
from
'./Logo'
;
import
MenuList
from
'./MenuList'
;
import
ExtraTools
from
'./ExtraTools'
;
/**
* 通用header
*
* @class Header
* @extends {Component}
*/
class
Header
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
activeHeight
:
0
,
showText
:
true
};
this
.
expanded
=
false
;
}
componentDidMount
()
{
RayMediaquery
.
register
(
'only screen and (min-width: 0) and (max-width: 992px)'
,
{
match
:
()
=>
{
this
.
setState
({
showText
:
false
});
},
unmatch
:
()
=>
{
this
.
setState
({
showText
:
true
});
}
});
}
onMouseOver
=
()
=>
{
// 未打开
if
(
!
this
.
expanded
){
this
.
expanded
=
true
;
this
.
toggleSubMenu
(
this
.
expanded
);
}
}
onMouseOut
=
()
=>
{
if
(
this
.
expanded
){
this
.
expanded
=
false
;
this
.
toggleSubMenu
(
this
.
expanded
);
}
}
toggleSubMenu
=
(
flag
)
=>
{
const
{
height
}
=
this
.
props
;
const
activeHeight
=
flag
?
height
:
0
;
this
.
setState
({
activeHeight
});
}
render
()
{
const
{
activeHeight
,
showText
}
=
this
.
state
;
return
(
<
div
className
=
"header"
>
<
div
className
=
"header-navs"
>
<
Logo
{...
this
.
props
}
showText
=
{
showText
}
/
>
<
MenuList
{...
this
.
props
}
height
=
{
activeHeight
}
showText
=
{
showText
}
toggleSubMenu
=
{
this
.
toggleSubMenu
}
onMenuOpen
=
{
this
.
onMouseOver
}
onMenuClosed
=
{
this
.
onMouseOut
}
/
>
<
ExtraTools
{...
this
.
props
}
showText
=
{
showText
}
/
>
<
/div
>
<
/div
>
);
}
}
Header
.
defaultProps
=
{
height
:
250
};
Header
.
propTypes
=
{
height
:
PropTypes
.
number
};
export
default
Header
;
src/view/common/mainframe/LevelMenu.js
0 → 100644
View file @
1d6d1687
import
React
,
{
Component
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
{
Link
}
from
'amos-react-router'
;
import
Icon
from
'amos-icon'
;
import
{
Icon
as
AFIcon
}
from
'amos-framework'
;
import
connectMenu
from
'./connectMenu'
;
/**
* 级别 menu
* @class LevelMenu
* @extends {Component}
*/
@
connectMenu
export
default
class
LevelMenu
extends
Component
{
renderItemLink
=
(
item
)
=>
{
const
{
iconPrefix
}
=
this
.
props
;
const
{
icon
,
label
,
isBlank
,
path
,
permissionName
}
=
item
;
const
NavIcon
=
icon
&&
<
Icon
icon
=
{
icon
}
prefix
=
{
iconPrefix
}
className
=
"menu-item-icon"
/>
;
let
Item
;
if
(
isBlank
)
{
Item
=
(
<
a
href
=
{
path
}
target
=
"_blank"
rel
=
"noopener noreferrer"
className
=
"menu-item-link"
>
{
NavIcon
}
{
permissionName
}
<
/a
>
);
}
else
{
Item
=
(
<
Link
to
=
{
path
}
className
=
"menu-item-link"
>
{
NavIcon
}
{
permissionName
}
<
/Link
>
);
}
return
Item
;
}
render
()
{
const
{
className
,
onClick
,
nonChild
,
children
}
=
this
.
props
;
return
(
<
li
className
=
{
className
}
onClick
=
{
onClick
}
>
{
this
.
renderItemLink
(
this
.
props
)}
{
!
nonChild
&&
<
AFIcon
icon
=
"right"
className
=
"menu-subitem-icon"
/>
}
{
!
nonChild
&&
children
}
<
/li
>
);
}
}
LevelMenu
.
propTypes
=
{
nonChild
:
PropTypes
.
bool
,
className
:
PropTypes
.
string
,
iconPrefix
:
PropTypes
.
string
,
onClick
:
PropTypes
.
func
,
children
:
PropTypes
.
node
};
src/view/common/mainframe/Logo.js
0 → 100644
View file @
1d6d1687
import
React
,
{
Component
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
/**
* logo 组件,支持扩展额外按钮功能
* @class Logo
* @extends {Component}
*/
class
Logo
extends
Component
{
render
()
{
const
{
logoImg
,
onLogoClick
}
=
this
.
props
;
return
(
<
div
className
=
"logo-wrapper"
>
<
div
className
=
"header-logo"
onClick
=
{
onLogoClick
}
>
{
/* <img className="header-logo-pic" src={logoImg} alt="" /> */
}
<
div
className
=
"logo-text"
>
安全预控执行系统
<
/div
>
<
/div
>
<
/div
>
);
}
}
Logo
.
propTypes
=
{
logoImg
:
PropTypes
.
string
,
onLogoClick
:
PropTypes
.
func
,
logoExtra
:
PropTypes
.
oneOfType
([
PropTypes
.
node
,
PropTypes
.
bool
])
};
export
default
Logo
;
src/view/common/mainframe/MainFrameView.js
0 → 100644
View file @
1d6d1687
import
React
,
{
Component
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
{
browserHistory
}
from
'amos-react-router'
;
import
{
Layout
}
from
'amos-framework'
;
import
{
Store
,
utils
}
from
'amos-tool'
;
import
SysConsts
from
'amos-processor/lib/config/consts'
;
import
{
getPermissionsMenus
}
from
'../../../services/securityService'
;
import
Header
from
'./Header'
;
import
'./style/index.scss'
;
import
{
isArray
}
from
'amos-pluggable/lib/_utils'
;
const
{
Content
}
=
Layout
;
const
lsTool
=
Store
.
lsTool
;
/**
* root
*
* @class MainFrame
* @extends {Component}
*/
class
MainFrame
extends
Component
{
static
propTypes
=
{
children
:
PropTypes
.
node
,
logoImg
:
PropTypes
.
string
,
logoExtra
:
PropTypes
.
oneOfType
([
PropTypes
.
node
,
PropTypes
.
bool
]),
opSearchMenusUrl
:
PropTypes
.
string
,
// 菜单获取完成之后的操作[可进行打开默认页面] (menus) => {}
onMenuLoadCompleted
:
PropTypes
.
func
,
defaultLink
:
PropTypes
.
string
,
// 执行注销是跳转的路由,或者注销之后手动执行的方法
loginLink
:
PropTypes
.
oneOfType
([
PropTypes
.
func
]),
sysToolPorps
:
PropTypes
.
object
,
isLoginout
:
PropTypes
.
bool
,
logout
:
PropTypes
.
func
,
sweepReducers
:
PropTypes
.
func
,
selectedSubMenuKey
:
PropTypes
.
string
,
onLogoClick
:
PropTypes
.
func
,
renderSubmenu
:
PropTypes
.
func
,
// 菜单宽度
menuWidth
:
PropTypes
.
oneOfType
([
PropTypes
.
string
,
PropTypes
.
number
]),
// 系统中使用到的 amos-icon组件,设置统一的 prefix,默认为 `amosicon`
iconPrefix
:
PropTypes
.
string
};
static
defaultProps
=
{
iconPrefix
:
'amosicon'
,
defaultLink
:
'/main'
,
loginLink
:
()
=>
{},
onMenuLoadCompleted
:
()
=>
{},
menuWidth
:
'160px'
,
logoImg
:
require
(
'./../../../assets/logo/amos-logo.png'
)
};
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
collapsed
:
false
,
extendSystem
:
[],
defaultHomeUrl
:
''
};
this
.
selectedSubMenuKey
=
''
;
}
componentDidMount
()
{
this
.
onPermissionFetch
();
}
componentWillReceiveProps
(
nextProps
)
{
const
{
loginLink
}
=
this
.
props
;
if
(
nextProps
.
isLoginout
)
{
if
(
utils
.
isFunction
(
loginLink
)){
loginLink
();
}
}
}
onPermissionFetch
=
()
=>
{
debugger
const
{
onMenuLoadCompleted
}
=
this
.
props
;
let
role
=
lsTool
.
read
(
'selectedRole'
);
getPermissionsMenus
(
role
).
then
((
menus
=
[])
=>
{
let
userMenus
=
[];
isArray
(
menus
)
&&
menus
.
forEach
(
element
=>
{
if
(
element
.
permissionType
===
'MENU'
&&
element
.
path
===
'biz'
)
{
userMenus
.
push
(
element
.
children
);
}
else
if
(
element
.
permissionType
===
'MENU'
&&
element
.
path
===
'main'
)
{
userMenus
.
push
(
element
.
children
);
}
});
const
lsTool
=
Store
.
lsTool
;
lsTool
.
write
(
SysConsts
.
permissions
,
JSON
.
stringify
(
menus
));
let
bizMenus
=
[];
let
allMenus
=
[];
for
(
let
i
=
0
;
i
<
userMenus
.
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
userMenus
[
i
].
length
;
j
++
)
{
allMenus
.
push
(
userMenus
[
i
][
j
])
}
}
bizMenus
=
this
.
filterMenusButton
(
allMenus
);
this
.
setState
({
extendSystem
:
bizMenus
},
()
=>
onMenuLoadCompleted
(
bizMenus
));
});
};
onLogoClick
=
()
=>
{
const
{
defaultLink
}
=
this
.
props
;
// if (defaultLink){
// this.context.router ? this.context.router.push(defaultLink) : browserHistory.push(defaultLink);
// }
browserHistory
.
push
(
'/main/3dview'
);
this
.
props
.
onLogoClick
&&
this
.
props
.
onLogoClick
();
}
filterMenusButton
=
(
menus
)
=>
{
debugger
return
menus
.
filter
(
menu
=>
{
if
(
menu
.
children
&&
menu
.
permissionType
===
'SUBMENU'
)
{
menu
.
children
=
this
.
filterMenusButton
(
menu
.
children
);
return
true
;
}
if
(
!
menu
.
children
&&
menu
.
permissionType
===
'SUBMENU'
)
{
return
true
;
}
if
(
!
menu
.
children
||
menu
.
permissionType
===
'BUTTON'
)
{
return
false
;
}
}
);
}
render
()
{
const
{
children
,
logoImg
,
sysToolPorps
,
logout
,
sweepReducers
,
logoExtra
,
renderSubmenu
,
menuWidth
,
iconPrefix
}
=
this
.
props
;
const
{
extendSystem
}
=
this
.
state
;
const
authProps
=
{
logout
,
sweepReducers
};
return
(
<
div
className
=
"view-port"
>
<
Header
navs
=
{
extendSystem
}
logoText
=
{
'安全预控执行系统'
}
onLogoClick
=
{
this
.
onLogoClick
}
onNavItemClick
=
{
this
.
handleMenuClick
}
renderSubmenu
=
{
renderSubmenu
}
authProps
=
{
authProps
}
logoExtra
=
{
logoExtra
}
menuWidth
=
{
menuWidth
}
iconPrefix
=
{
iconPrefix
}
{...
sysToolPorps
}
/
>
<
div
className
=
"content-body"
>
<
Layout
style
=
{{
height
:
'100%'
}}
>
<
Content
style
=
{{
height
:
'100%'
}}
>
<
div
className
=
"amos-main-content"
style
=
{{
width
:
'100%'
,
height
:
'100%'
}}
>
{
children
}
<
/div
>
<
/Content
>
<
/Layout
>
<
/div
>
<
/div
>
);
}
}
export
default
MainFrame
;
src/view/common/mainframe/MenuItem.js
0 → 100644
View file @
1d6d1687
import
React
,
{
PureComponent
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
{
Link
}
from
'amos-react-router'
;
import
{
utils
}
from
'amos-tool'
;
import
Icon
from
'amos-icon'
;
import
{
Icon
as
AFIcon
}
from
'amos-framework'
;
import
classNames
from
'classnames'
;
import
SubMenuItem
from
'./SubMenuItem'
;
import
connectMenu
from
'./connectMenu'
;
/**
* 菜单 Item
*
* @class MenuItem
* @extends {PureComponent}
*/
@
connectMenu
class
MenuItem
extends
PureComponent
{
constructor
(
props
)
{
super
(
props
);
}
isActive
=
()
=>
{
const
{
menuKey
,
activeKey
}
=
this
.
props
;
return
menuKey
===
activeKey
;
}
genHiddenStyle
=
()
=>
{
const
{
height
=
0
}
=
this
.
props
;
if
(
height
>
0
){
return
{};
}
return
{
display
:
'none'
};
}
genStyle
=
()
=>
{
const
{
menuWidth
}
=
this
.
props
;
if
(
menuWidth
){
return
{
width
:
menuWidth
};
}
return
{};
}
renderItemLink
=
(
item
)
=>
{
const
{
iconPrefix
}
=
this
.
props
;
const
NavIcon
=
item
.
icon
&&
<
Icon
icon
=
{
item
.
icon
}
prefix
=
{
iconPrefix
}
className
=
"menu-item-icon"
/>
;
let
Item
;
if
(
item
.
isBlank
)
{
Item
=
(
<
a
href
=
{
item
.
path
}
target
=
"_blank"
rel
=
"noopener noreferrer"
className
=
"menu-item-link"
>
{
NavIcon
}
{
item
.
permissionName
}
<
/a
>
);
}
else
{
Item
=
(
<
Link
to
=
{
item
.
path
}
className
=
"menu-item-link"
>
{
NavIcon
}
{
item
.
permissionName
}
<
/Link
>
);
}
return
Item
;
}
renderSub
=
()
=>
{
const
{
menuKey
,
children
,
onSubMenuClick
,
activeSubKey
,
setSubMenuActive
,
renderSubmenu
,
menuWidth
,
iconPrefix
}
=
this
.
props
;
const
hiddenStyle
=
this
.
genHiddenStyle
();
return
(
<
ul
className
=
"menu-sublist"
>
{
children
.
map
(
c
=>
{
const
cls
=
classNames
(
'menu-subitem'
,
{
'active'
:
c
.
sequenceNbr
===
activeSubKey
});
if
(
renderSubmenu
){
return
renderSubmenu
({
...
c
,
className
:
cls
,
onSubMenuClick
,
setSubMenuActive
});
}
return
(
<
SubMenuItem
{...
c
}
key
=
{
c
.
sequenceNbr
}
className
=
{
cls
}
iconPrefix
=
{
iconPrefix
}
menuKey
=
{
c
.
sequenceNbr
}
rootMenuKey
=
{
menuKey
}
subItems
=
{
c
.
children
}
onClick
=
{()
=>
onSubMenuClick
(
menuKey
,
c
.
sequenceNbr
)}
onSubMenuClick
=
{
onSubMenuClick
}
setMenuActive
=
{
setSubMenuActive
}
menuWidth
=
{
menuWidth
}
>
{
this
.
renderItemLink
(
c
)}
{
c
.
children
&&
c
.
children
.
length
>
0
&&
<
AFIcon
icon
=
"right"
className
=
"menu-subitem-icon"
style
=
{
hiddenStyle
}
/>
}
<
/SubMenuItem
>
);
})
}
<
/ul
>
);
}
/** 渲染一个没有二级菜单的块,用于颜色分布 */
renderNonSub
=
()
=>
{
return
(
<
ul
className
=
"menu-sublist"
/>
);
}
renderFooter
=
()
=>
{
const
{
footerIcon
,
extraIcon
,
icon
,
iconPrefix
}
=
this
.
props
;
const
hiddenStyle
=
this
.
genHiddenStyle
();
const
_icon
=
footerIcon
||
extraIcon
||
icon
;
const
imgContent
=
utils
.
isImageSrc
(
_icon
)
?
<
img
src
=
{
_icon
}
alt
=
""
/>
:
<
Icon
prefix
=
{
iconPrefix
}
icon
=
{
_icon
}
/>
;
return
(
<
div
className
=
"nav-menu-item-footer"
style
=
{
hiddenStyle
}
>
<
div
className
=
"footer-icon"
>
{
imgContent
}
<
/div
>
<
span
className
=
"footer-line"
/>
<
/div
>
);
}
render
()
{
const
{
menuKey
,
permissionName
,
children
,
activeKey
,
height
=
0
,
...
rest
}
=
this
.
props
;
let
itemContent
;
if
(
children
){
itemContent
=
<
div
className
=
"nav-menu-item-label"
>
{
permissionName
}
<
/div>
;
}
else
{
itemContent
=
<
div
className
=
"nav-menu-item-label nav-menu-nonchild-item"
>
{
this
.
renderItemLink
({
permissionName
,
...
rest
})}
<
/div>
;
}
const
cls
=
classNames
(
'nav-menu-item'
,
{
'active'
:
menuKey
===
activeKey
});
const
style
=
this
.
genStyle
();
return
(
<
li
className
=
{
cls
}
style
=
{
style
}
>
{
itemContent
}
{
children
&&
<
AFIcon
icon
=
"caretdown"
className
=
"nav-menu-item-icon"
/>
}
<
div
className
=
"menusub-wrapper"
style
=
{{
height
,
...
style
}}
>
{
children
&&
this
.
renderSub
()}
{
!
children
&&
this
.
renderNonSub
()}
{
this
.
renderFooter
()}
<
/div
>
<
/li
>
);
}
}
MenuItem
.
propTypes
=
{
height
:
PropTypes
.
number
,
menuKey
:
PropTypes
.
string
,
permissionName
:
PropTypes
.
string
.
isRequired
,
iconPrefix
:
PropTypes
.
string
,
icon
:
PropTypes
.
string
,
footerIcon
:
PropTypes
.
string
,
extraIcon
:
PropTypes
.
string
,
path
:
PropTypes
.
string
,
children
:
PropTypes
.
arrayOf
(
PropTypes
.
shape
({
sequenceNbr
:
PropTypes
.
string
.
isRequired
,
permissionName
:
PropTypes
.
string
,
icon
:
PropTypes
.
string
,
path
:
PropTypes
.
string
,
isBlank
:
PropTypes
.
bool
})),
activeKey
:
PropTypes
.
string
,
activeSubKey
:
PropTypes
.
string
,
setMenuActive
:
PropTypes
.
func
,
setSubMenuActive
:
PropTypes
.
func
,
onSubMenuClick
:
PropTypes
.
func
,
onMenuClosed
:
PropTypes
.
func
,
toggleSubMenu
:
PropTypes
.
func
,
renderSubmenu
:
PropTypes
.
func
,
menuWidth
:
PropTypes
.
oneOfType
([
PropTypes
.
string
,
PropTypes
.
number
])
};
export
default
MenuItem
;
src/view/common/mainframe/MenuList.js
0 → 100644
View file @
1d6d1687
import
React
,
{
PureComponent
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
MenuItem
from
'./MenuItem'
;
/**
* 菜单 列表
*
* @class MenuList
* @extends {PureComponent}
*/
class
MenuList
extends
PureComponent
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
/** 当前选中一级菜单 key */
activeKey
:
''
,
/** 当前选中的二级菜单 key */
activeSubKey
:
''
};
}
onSubMenuClick
=
(
key
,
subKey
)
=>
{
this
.
setState
({
activeKey
:
key
,
activeSubKey
:
subKey
});
this
.
props
.
onMenuClosed
();
}
setMenuActive
=
(
key
)
=>
{
const
{
activeKey
}
=
this
.
state
;
if
(
activeKey
!==
key
){
this
.
setState
({
activeKey
:
key
});
}
}
setSubMenuActive
=
(
key
)
=>
{
const
{
activeSubKey
}
=
this
.
state
;
if
(
activeSubKey
!==
key
){
this
.
setState
({
activeSubKey
:
key
});
}
}
render
()
{
const
{
activeKey
,
activeSubKey
}
=
this
.
state
;
const
{
height
,
navs
,
onMenuOpen
,
onMenuClosed
,
toggleSubMenu
,
renderSubmenu
,
menuWidth
,
iconPrefix
}
=
this
.
props
;
const
cls
=
height
>
0
?
'nav-menu-box menu-expanded'
:
'nav-menu-box'
;
//业务屏菜单
// debugger;
return
(
<
div
className
=
"nav-menu-wrapper"
>
<
div
className
=
{
cls
}
>
<
div
className
=
"nav-menu-bg"
style
=
{{
height
}}
onMouseOver
=
{
this
.
onMouseOver
}
onMouseOut
=
{
this
.
onMouseOut
}
/
>
<
ul
className
=
"nav-menu-list"
onMouseOver
=
{
onMenuOpen
}
onMouseOut
=
{
onMenuClosed
}
>
{
(
navs
||
[]).
map
(
n
=>
{
const
{
sequenceNbr
,
...
rest
}
=
n
;
return
(
<
MenuItem
key
=
{
sequenceNbr
}
{...
rest
}
iconPrefix
=
{
iconPrefix
}
menuKey
=
{
sequenceNbr
}
height
=
{
height
}
activeKey
=
{
activeKey
}
activeSubKey
=
{
activeSubKey
}
setMenuActive
=
{
this
.
setMenuActive
}
setSubMenuActive
=
{
this
.
setSubMenuActive
}
onSubMenuClick
=
{
this
.
onSubMenuClick
}
onMenuClosed
=
{
onMenuClosed
}
toggleSubMenu
=
{
toggleSubMenu
}
renderSubmenu
=
{
renderSubmenu
}
menuWidth
=
{
menuWidth
}
/>
)
;
})
}
<
/ul
>
<
/div
>
<
/div
>
);
}
}
MenuList
.
propTypes
=
{
height
:
PropTypes
.
number
,
navs
:
PropTypes
.
arrayOf
(
PropTypes
.
shape
({
sequenceNbr
:
PropTypes
.
string
.
isRequired
,
permissionName
:
PropTypes
.
string
.
isRequired
,
icon
:
PropTypes
.
string
,
path
:
PropTypes
.
string
,
children
:
PropTypes
.
array
})),
toggleSubMenu
:
PropTypes
.
func
,
onMenuOpen
:
PropTypes
.
func
,
onMenuClosed
:
PropTypes
.
func
,
renderSubmenu
:
PropTypes
.
func
,
menuWidth
:
PropTypes
.
oneOfType
([
PropTypes
.
string
,
PropTypes
.
number
])
};
export
default
MenuList
;
src/view/common/mainframe/SubMenuItem.js
0 → 100644
View file @
1d6d1687
/* eslint-disable no-plusplus */
import
React
,
{
PureComponent
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
{
utils
}
from
'amos-tool'
;
import
classNames
from
'classnames'
;
import
connectMenu
from
'./connectMenu'
;
import
LevelMenu
from
'./LevelMenu'
;
const
calcHtmlSize
=
(
value
,
ratio
)
=>
{
if
(
!
utils
.
isNil
(
value
)
&&
!
utils
.
isNull
(
value
)){
if
(
utils
.
isNumber
(
value
)){
return
parseFloat
(
value
)
*
ratio
;
}
else
if
(
utils
.
isString
(
value
)){
const
numVal
=
parseFloat
(
value
);
const
unit
=
value
.
replace
(
numVal
,
''
);
return
`
${
numVal
*
ratio
}${
unit
}
`
;
}
}
return
0
;
};
/**
* 子菜单
*
* @class SubMenuItem
* @extends {PureComponent}
*/
@
connectMenu
class
SubMenuItem
extends
PureComponent
{
genRecursiveStyle
=
(
level
)
=>
{
const
{
menuWidth
}
=
this
.
props
;
return
{
width
:
menuWidth
,
left
:
calcHtmlSize
(
menuWidth
,
level
)
};
}
/** 每一个 subitem 均是其父节点的内容,所以只需要 left 其父节点的宽即可 */
genRecursiveStyle2
=
()
=>
{
const
{
menuWidth
}
=
this
.
props
;
return
{
width
:
menuWidth
,
left
:
menuWidth
};
}
recursiveRender
=
(
subItems
,
level
=
1
)
=>
{
const
{
onSubMenuClick
,
rootMenuKey
,
iconPrefix
}
=
this
.
props
;
const
cls
=
`recursive-level-menu content-level
${
level
}
`
;
const
style
=
this
.
genRecursiveStyle2
();
return
(
<
ul
className
=
{
cls
}
style
=
{
style
}
>
{
subItems
.
map
(
si
=>
{
const
cls
=
classNames
(
'menu-subitem'
,
{
// 'active': si.key === activeRecursiveKey
});
const
nonChild
=
utils
.
isEmpty
(
si
.
children
);
let
newLevel
=
level
;
if
(
!
nonChild
){
newLevel
+=
1
;
}
return
(
<
LevelMenu
{...
si
}
key
=
{
si
.
sequenceNbr
}
menuKey
=
{
si
.
sequenceNbr
}
className
=
{
cls
}
iconPrefix
=
{
iconPrefix
}
nonChild
=
{
nonChild
}
onClick
=
{()
=>
onSubMenuClick
(
rootMenuKey
,
si
.
sequenceNbr
)}
>
{
!
nonChild
&&
this
.
recursiveRender
(
si
.
children
,
newLevel
)
}
<
/LevelMenu
>
);
})
}
<
/ul
>
);
}
render
()
{
const
{
className
,
children
,
onClick
,
subItems
}
=
this
.
props
;
return
(
<
li
className
=
{
className
}
onClick
=
{
onClick
}
>
{
children
}
{
subItems
&&
subItems
.
length
>
0
&&
this
.
recursiveRender
(
subItems
)}
<
/li
>
);
}
}
SubMenuItem
.
propTypes
=
{
className
:
PropTypes
.
string
,
iconPrefix
:
PropTypes
.
string
,
// 菜单 key,此处是 subMenuKey
menuKey
:
PropTypes
.
string
,
// 根节点菜单 key
rootMenuKey
:
PropTypes
.
string
,
onClick
:
PropTypes
.
func
,
onSubMenuClick
:
PropTypes
.
func
,
children
:
PropTypes
.
node
,
subItems
:
PropTypes
.
array
,
menuWidth
:
PropTypes
.
oneOfType
([
PropTypes
.
string
,
PropTypes
.
number
])
};
export
default
SubMenuItem
;
src/view/common/mainframe/connectMenu.js
0 → 100644
View file @
1d6d1687
import
React
,
{
Component
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
/**
* 菜单增强,主要是用于刷新时,自动 active 当前菜单
* @export
* @param {Component} WrappedComponent
* @returns
*/
export
default
function
connectMenu
(
WrappedComponent
){
return
class
MenuComponent
extends
Component
{
static
propTypes
=
{
url
:
PropTypes
.
string
,
index
:
PropTypes
.
bool
,
isBlank
:
PropTypes
.
bool
,
// 设置菜单 active key
setMenuActive
:
PropTypes
.
func
,
// 当前菜单的 key值
menuKey
:
PropTypes
.
string
};
componentDidMount
()
{
this
.
refreshActive
(
this
.
props
);
}
getHref
(
props
)
{
let
href
=
props
.
url
;
if
(
props
.
isBlank
)
{
return
href
;
}
if
(
!
props
.
index
&&
!
href
)
{
return
''
;
}
const
baseURL
=
'/'
;
href
=
`
${
baseURL
}
/
${
href
||
''
}
`
;
return
href
.
replace
(
/
\/
+/g
,
'/'
).
replace
(
/
(
.+
)\/
$/
,
'$1'
);
}
isActive
(
props
,
href
)
{
if
(
props
.
index
)
{
return
href
===
(
location
.
pathname
||
'/'
);
}
else
{
return
href
&&
new
RegExp
(
`
${
href
}
(?=/|$|\\?|#)`
).
test
(
location
.
href
);
}
}
refreshActive
=
(
props
)
=>
{
const
href
=
this
.
getHref
(
props
);
const
active
=
this
.
isActive
(
props
,
href
);
if
(
active
){
props
.
setMenuActive
&&
props
.
setMenuActive
(
props
.
menuKey
);
}
}
render
()
{
return
<
WrappedComponent
{...
this
.
props
}
/>
;
}
};
}
src/view/common/mainframe/index.js
0 → 100644
View file @
1d6d1687
import
React
,
{
Component
}
from
'react'
;
import
MainFrameView
from
'./MainFrameView'
;
class
RootView
extends
Component
{
render
()
{
return
(
<
MainFrameView
{...
this
.
props
}
/
>
);
}
}
export
default
RootView
;
src/view/common/mainframe/style/index.scss
0 → 100644
View file @
1d6d1687
@import
'./vars.scss'
;
@import
'./main.scss'
;
src/view/common/mainframe/style/main.scss
0 → 100644
View file @
1d6d1687
// --root
.view-port
{
.content-body
{
position
:
absolute
;
top
:
$top-height
;
left
:
0
;
width
:
100%
;
height
:
$content-height
;
overflow
:
hidden
;
opacity
:
1
;
transition
:
opacity
;
transition-duration
:
0
.45s
;
backface-visibility
:
hidden
;
}
}
.main-view
{
width
:
100%
;
height
:
100%
;
background
:
$main-content-bg-color
;
>
.main-content
{
overflow
:
auto
;
}
}
.amos-main-content
{
background
:
$main-content-bg-color
;
}
.menu-item-link
{
text-decoration
:
none
;
&
:active
,
&
:focus
,
&
:hover
{
color
:
$menu-common-color
;
text-decoration
:
none
;
}
}
.active
{
color
:
$menu-active-color
;
}
// submenu footer
.nav-menu-item-footer
{
position
:
absolute
;
left
:
0
;
display
:
flex
;
width
:
100%
;
height
:
$submenu-item-footer-height
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
.footer-icon
{
width
:
40px
;
height
:
40px
;
}
.footer-line
{
display
:
none
;
width
:
50%
;
height
:
3px
;
margin-bottom
:
-3px
;
background
:
#345fa6
;
}
}
// menu-wrapper
.menusub-wrapper
{
position
:
absolute
;
left
:
0
;
width
:
100%
;
cursor
:
pointer
;
border-left
:
1px
solid
#dce2ed
;
transition
:
height
0
.3s
;
&
:hover
{
.nav-menu-item-footer
{
.footer-line
{
display
:
inline-block
;
}
}
}
}
// item 隔行颜色变化
.nav-menu-list
{
.nav-menu-item
{
&
:nth-of-type
(
odd
)
{
.menusub-wrapper
{
background
:
white
;
}
}
&
:nth-of-type
(
even
)
{
.menusub-wrapper
{
background
:
#f3f3f3
;
}
}
}
}
.menu-subitem
a
,
.nav-menu-item-label
a
{
color
:
$menu-color
;
}
.nav-menu-nonchild-item
a
{
color
:
#fff
;
}
.nav-menu-nonchild-item
a
:hover
{
color
:
#fff
;
}
// 递归 menu
.recursive-level-menu
{
position
:
absolute
;
top
:
0
;
left
:
$menu-item-width
;
z-index
:
3
;
display
:
none
;
width
:
$menu-item-width
;
height
:
100%
;
background
:
$submenu-item-active
;
border-left
:
1px
solid
#dce2ed
;
.menu-subitem
{
&
:hover
{
background
:
$submenu-item-active2
;
}
}
&
.content-level1
{
border-left
:
none
;
}
}
// 通用 menu subitem hover等
.menu-subitem
{
&
:hover
{
background
:
$submenu-item-active
;
>
.recursive-level-menu
{
display
:
block
;
}
}
&
.active
{
background
:
$submenu-item-active
;
}
.menu-subitem-icon
{
position
:
absolute
;
right
:
5px
;
display
:
none
;
font-size
:
12px
;
transition
:
display
0
.3s
;
}
}
// header menu
.nav-menu-wrapper
{
position
:
relative
;
z-index
:
3
;
height
:
$top-height
;
.nav-menu-box
{
position
:
relative
;
height
:
100%
;
.nav-menu-list
{
height
:
100%
;
.nav-menu-item
{
position
:
relative
;
float
:
left
;
width
:
$menu-item-width
;
padding
:
0
1rem
;
text-align
:
center
;
cursor
:
pointer
;
.nav-menu-item-label
{
display
:
inline-block
;
color
:
$menu-common-color
;
}
.nav-triangle
{
position
:
absolute
;
bottom
:
0
;
left
:
50%
;
z-index
:
1
;
display
:
none
;
margin-left
:
-8px
;
border
:
8px
solid
;
border-color
:
transparent
transparent
$menu-common-color
;
}
.nav-menu-item-icon
{
position
:
absolute
;
top
:
0
;
right
:
0
;
font-size
:
12px
;
transform
:
rotate
(
0
);
transition
:
transform
0
.2s
ease-in
;
}
.menu-sublist
{
display
:
block
;
height
:
$menu-sublist-height
;
overflow
:
hidden
;
.menu-subitem
{
z-index
:
2
;
padding
:
0
.5rem
0
;
clear
:
both
;
line-height
:
2
;
cursor
:
pointer
;
&
:first-child
{
margin-top
:
0
.5rem
;
}
}
}
&
.active
{
.nav-menu-item-label
{
color
:
$menu-active-color
;
}
}
&
:hover
{
.nav-triangle
{
display
:
block
;
}
.nav-menu-item-label
{
color
:
$menu-active-color
;
}
.nav-menu-item-icon
{
color
:
$menu-active-color
;
transform
:
rotate
(
180deg
);
}
}
}
}
}
}
// --header
.header
{
position
:
relative
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
$top-height
;
line-height
:
$top-height
;
color
:
$head-color
;
background
:
$head-bg-color
;
border-bottom
:
1px
solid
;
border-color
:
transparent
;
box-shadow
:
0
2px
8px
rgba
(
47
,
53
,
87
,
0
.2
);
.logo-wrapper
{
position
:
relative
;
display
:
flex
;
.header-logo-extra
{
width
:
3rem
;
text-align
:
center
;
}
.header-logo
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
height
:
$top-height
;
padding-right
:
1rem
;
background
:
$head-logo-bg
;
border-right
:
1px
solid
$head-logo-brr-color
;
&
:
:
before
{
position
:
absolute
;
bottom
:
0
;
left
:
0
;
width
:
0
;
border-bottom
:
1px
solid
$head-logo-brb-color
;
content
:
''
;
transition
:
width
0
.3s
ease-in
;
}
&
:hover::before
{
width
:
100%
;
}
.logo-img
{
width
:
4rem
;
height
:
$top-height
;
&
:hover
{
transform
:
scaleX
(
-1
);
transition
:
transform
1s
;
}
}
}
}
.nav-menu-bg
{
position
:
absolute
;
top
:
$top-height
;
left
:
0
;
display
:
block
;
width
:
100%
;
height
:
0
;
background
:
white
;
box-shadow
:
0
2px
3px
#bbb
;
transition
:
height
0
.3s
;
}
.header-navs
{
position
:
relative
;
display
:
flex
;
z-index
:
300
;
}
.sys-tools
{
position
:
absolute
;
right
:
0
;
display
:
flex
;
margin-right
:
2rem
;
border-left
:
1px
solid
$head-menu-border-color
;
align-items
:
center
;
.ui-menu
{
.ui-menu-item
{
display
:
flex
;
height
:
$top-height
;
padding
:
0
0
.5rem
;
margin
:
0
;
color
:
$head-color
;
border-right
:
1px
solid
$head-menu-border-color
;
justify-content
:
center
;
align-items
:
center
;
&
.amos-nav-item-active
{
border-bottom
:
1px
solid
$head-menu-border-color
;
}
&
:hover
{
color
:
$head-color
;
background
:
$head-menu-background
;
}
&
:last-child
{
border-right
:
0
;
}
}
&
.horizontal
{
display
:
flex
;
justify-content
:
flex-end
;
align-items
:
center
;
}
}
&
.sys-tools-min
{
.ui-menu
{
&
.horizontal
{
display
:
flex
;
justify-content
:
flex-end
;
align-items
:
center
;
padding-right
:
0
;
border-right
:
1px
solid
$head-menu-border-color
;
.ui-menu-item
{
padding
:
0
0
.5rem
;
border-right
:
1px
solid
transparent
;
&
:last-child
{
border-right
:
0
;
}
}
}
}
}
}
}
.user-area
{
.amos-single-pop-trigger
{
height
:
$top-height
;
line-height
:
$top-height
+
2
;
}
.amos-single-pop-content
{
.user-profile
{
padding
:
1
.5rem
;
line-height
:
1
;
.user-profile-detail
{
line-height
:
1
.5
;
}
}
.profile-divider
{
margin
:
0
1
.5rem
;
}
}
}
.amos-jump-spiner
{
position
:
absolute
;
top
:
50%
;
left
:
50%
;
z-index
:
999
;
transform
:
translate
(
-50%
,
-50%
);
}
// icon display toggle
.menu-expanded
{
.menu-subitem
.menu-subitem-icon
{
display
:
inline-block
;
}
}
src/view/common/mainframe/style/vars.scss
0 → 100644
View file @
1d6d1687
/**
* 默认主题
*/
$parent
:
plant
;
//********************************************
// 顶部head区
//********************************************
$head-bg-color
:
linear-gradient
(
#fefefe
,
#efefef
);
// 顶部字体颜色
$head-color
:
black
;
// 顶部所有边框颜色
$head-border-color
:
#ddd
;
// 顶部logo背景色
$head-logo-bg
:
linear-gradient
(
#fefefe
,
#efefef
);
// 顶部logo右侧边框色
$head-logo-brr-color
:
#eee
;
// 顶部logo下侧边框色
$head-logo-brb-color
:
#629ede
;
// 菜单字体色
$menu-color
:
#333
;
// 菜单选中状态颜色
$menu-active-color
:
#1577d9
;
// 菜单 icon 颜色
$menu-iconcolor
:
black
;
// 菜单选中时子菜单颜色
$sub-menu-active-bgcolor
:
linear-gradient
(
#dedede
,
#d7d7d7
);
// 子菜单 悬浮颜色
$menu-bgcolor
:
linear-gradient
(
to
right
,
#fbfbfb
,
#eee
);
// 顶部菜单边框颜色
$head-menu-border-color
:
transparent
;
// 顶部菜单鼠标移动和点击后背景色
$head-menu-background
:
linear-gradient
(
#dedede
,
#d7d7d7
);
// 顶部菜单字体图标颜色
$head-menu-icon-color
:
black
;
//logo
//一级菜单
$nav-text-color
:
white
;
$nav-active-bottom-color
:
#8ac249
;
$nav-width
:
8rem
;
//********************************************
// 系统主内容区
//********************************************
$main-content-bg-color
:
#f6f6f6
;
// sys
$top-height
:
3
.5rem
;
$content-height
:
calc
(
100%
-
3
.5rem
);
$background-color
:
#203957
;
$font-family
:
'Microsoft YaHei'
;
$font-size
:
12px
;
$tab-width
:
12rem
;
$text-shadow-color
:
#badfff
;
// menu color
// 二级菜单 active 颜色 (三级菜单背景色)
$submenu-item-active
:
#e7edf8
;
// 三级菜单 active 颜色
$submenu-item-active2
:
#cfdbf1
;
$submenu-item-footer-height
:
46px
;
$menu-sublist-height
:
calc
(
100%
-
46px
);
// 默认菜单宽度
$menu-item-width
:
8rem
;
// 菜单字体颜色
$menu-common-color
:
#333
;
src/view/mainframe/BizFrame.js
View file @
1d6d1687
import
React
,
{
Component
}
from
'react'
;
import
{
browserHistory
}
from
'amos-react-router'
;
import
{
utils
,
Store
}
from
'amos-tool'
;
import
MainFrame
from
'amos-security/lib/view/mainframe3'
;
import
enhancePermission
from
'amos-security/lib/view/enhancePermission'
;
import
{
formatUrl
}
from
'amos-security/lib/utils/request'
;
import
MainFrame
from
'../common/mainframe'
;
import
formatUrl
from
'amos-processor/lib/utils/urlFormat'
;
import
{
Connect
,
IFrame
}
from
'amos-framework'
;
import
PropTypes
from
'prop-types'
;
import
storageConsts
,
{
CONSTS
}
from
'./../../consts/storageConsts'
;
...
...
@@ -16,7 +15,7 @@ const enhanceStorage = Connect.enhanceStorage;
const
lsTool
=
Store
.
lsTool
;
@
enhancePermission
()
@
enhanceStorage
({
storageItems
:
storageConsts
(
CONSTS
)
})
...
...
@@ -148,6 +147,7 @@ class BizFrame extends Component {
getFrameConfig
=
()
=>
{
debugger
return
{
opSearchMenusUrl
:
formatUrl
(
secExtUrl
.
opSearchMenusUrl
,
{
nodeName
:
''
,
type
:
window
.
BizPermissionType
}),
defaultLink
:
'/biz'
,
...
...
src/view/mainframe/Root3DView.js
View file @
1d6d1687
import
React
,
{
Component
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
{
Connect
as
UIConnect
,
Animate
}
from
'amos-framework'
;
import
{
getMenusAction
}
from
'./../../services/securityService'
;
import
Header
from
'./../common/header'
;
import
{
header3dConf
,
triggerMenuChange
,
is3dView
,
getAddress
}
from
'./headerConf'
;
import
{
eventTopics
}
from
'./../3dview/consts'
;
import
{
getPermissionsMenus
}
from
'../../services/securityService'
;
import
{
Store
}
from
'amos-tool'
;
const
lsTool
=
Store
.
lsTool
;
@
UIConnect
.
eventConnect
class
Root3DView
extends
Component
{
...
...
@@ -28,13 +30,49 @@ class Root3DView extends Component {
}
initMenus
=
()
=>
{
getMenusAction
().
then
(
d
=>
{
// getMenusAction().then(d => {
// this.setState({
// menus: d
// });
// });
let
role
=
lsTool
.
read
(
'selectedRole'
);
getPermissionsMenus
(
role
).
then
((
menus
=
[])
=>
{
let
userMenus
=
[];
menus
.
forEach
(
element
=>
{
if
(
element
.
permissionType
===
'MENU'
&&
element
.
path
===
'main'
)
{
userMenus
=
element
.
children
;
}
});
if
(
!
userMenus
||
userMenus
.
length
<
1
)
{
return
;
}
const
lsTool
=
Store
.
lsTool
;
//lsTool.write(SysConsts.permissions, JSON.stringify(menus));
let
view3dMenus
=
[...
userMenus
];
view3dMenus
=
this
.
filterMenusButton
(
view3dMenus
);
this
.
setState
({
menus
:
d
menus
:
view3dMenus
});
});
}
filterMenusButton
=
(
menus
)
=>
{
return
menus
.
filter
(
menu
=>
{
if
(
menu
.
children
&&
menu
.
permissionType
===
'SUBMENU'
)
{
menu
.
children
=
this
.
filterMenusButton
(
menu
.
children
);
return
true
;
}
if
(
!
menu
.
children
&&
menu
.
permissionType
===
'SUBMENU'
)
{
return
true
;
}
if
(
!
menu
.
children
||
menu
.
permissionType
===
'BUTTON'
)
{
return
false
;
}
}
);
}
handleMenuClick
=
(
item
)
=>
{
const
{
permissionCode
}
=
item
;
if
(
!
is3dView
(
permissionCode
)){
...
...
src/view/mainframe/RootBizView.js
View file @
1d6d1687
import
React
,
{
Component
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
{
getBizMenusAction
}
from
'../../services/securityService'
;
import
{
getPermissionsMenus
}
from
'../../services/securityService'
;
import
Header
from
'../common/header'
;
import
BusinessStorage
from
'./../bizview'
;
import
PointView
from
'./../bizview/point/PointView'
;
...
...
@@ -26,7 +26,13 @@ class RootBizView extends Component {
initMenus
=
()
=>
{
const
{
parentMenuKey
}
=
this
.
state
;
getBizMenusAction
(
parentMenuKey
).
then
(
d
=>
{
// getBizMenusAction(parentMenuKey).then(d => {
// this.setState({
// menus: d
// });
// });
let
role
=
lsTool
.
read
(
'selectedRole'
);
getPermissionsMenus
(
role
).
then
(
d
=>
{
this
.
setState
({
menus
:
d
});
...
...
src/view/mainframe/index.js
View file @
1d6d1687
import
React
,
{
Component
}
from
'react'
;
import
{
browserHistory
}
from
'amos-react-router'
;
import
{
utils
}
from
'amos-tool'
;
import
MainFrame
from
'amos-security/lib/view/mainframe'
;
import
formatUrl
from
'amos-processor/lib/utils/urlFormat'
;
import
{
Menu
}
from
'amos-framework'
;
import
{
secExtUrl
,
SecurityUrl
}
from
'./../../consts/urlConsts'
;
...
...
@@ -35,6 +34,7 @@ class RootView extends Component {
};
getFrameConfig
=
()
=>
{
debugger
return
{
opSearchMenusUrl
:
formatUrl
(
secExtUrl
.
opSearchMenusUrl
,
{
nodeName
:
''
,
type
:
window
.
V3DpermissionType
}),
//logoImg: require('./../../assets/logo/amos-logo.png'),
...
...
src/view/planMgmt/cusVizLib/index.js
View file @
1d6d1687
...
...
@@ -71,7 +71,10 @@ class CusVizLib extends Component {
headers
:
{
'Accept'
:
'application/json;charset=UTF-8'
,
'X-Api-Key'
:
_amosTool
.
Store
.
getCookieByName
(
apiKey
),
'X-Access-Token'
:
ls
.
read
(
token
)
'X-Access-Token'
:
ls
.
read
(
token
),
'appKey'
:
'CONVERTER_STATION'
,
'product'
:
'CONVERTER_STATION_WEB'
,
'token'
:
ls
.
read
(
token
)
},
body
:
formData
}).
then
(
e
=>
{
...
...
src/view/region/index.js
View file @
1d6d1687
This diff is collapsed.
Click to expand it.
src/view/userInfo/index.js
View file @
1d6d1687
import
React
,
{
Component
}
from
'react'
;
import
{
UserInfo
}
from
'amos-security/lib'
;
import
{
currentUser
}
from
'amos-security/lib/model/auth'
;
class
UserInfoComponent
extends
Component
{
constructor
(
props
)
{
super
(
props
);
...
...
webpack.config.js
View file @
1d6d1687
...
...
@@ -44,7 +44,7 @@ const config = {
toFile
:
'index.html'
,
entry
:
__ENV__
===
'production'
?
prodEntry
:
devEntry
,
useHot
:
true
,
port
:
3
3
00
,
port
:
3
5
00
,
favicon
:
null
,
alias
,
// 启动 WebWorker
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment