Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
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
ReactWeb5
wisdom-components
Commits
63ab00d7
Commit
63ab00d7
authored
Dec 22, 2022
by
陈龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复文件缺失问题
parent
730bdb4d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
217 additions
and
66 deletions
+217
-66
NormChart.js
...components/AlarmScrollAssembly/src/NormChart/NormChart.js
+0
-64
index.js
packages/base-components/AlarmScrollAssembly/src/index.js
+2
-2
utils.js
packages/base-components/AlarmScrollAssembly/src/utils.js
+215
-0
No files found.
packages/base-components/AlarmScrollAssembly/src/NormChart/NormChart.js
View file @
63ab00d7
...
...
@@ -32,77 +32,13 @@ const NormChart = (props) => {
setNormListLoading
(
false
);
});
};
/* const getPumpConfig = () => {
monitorService.getDeviceConfig({
showAll: true,
deviceType: deviceType,
}).then(res => {
if (res.code === 0) {
let _data = res.data[0];
let _list = ['cardPoints', 'cardMainPoints', 'listPoints', 'tablePoints', 'sTipPoints', 'lTipPoints']; // WARNING: 当前指标取值是将所有指标取交集;需要确认具体方案。
let _allNorm = _list.reduce((final, curr) => {
let _item = _data[curr].split(',');
return final.concat(_item);
}, []);
let _set = new Set(_allNorm);
setNormList([..._set]);
} else {
setNormList([]);
}
});
};*/
/* const getNormList = () => {
monitorService.GetQutaList({
accountName: deviceType,
}).then(res => {
if (res.code === 0) {
setNormList(res.data);
} else {
setNormList([]);
}
});
};*/
/* const getData = () => {
monitorService.GetSensorsDataForStation({}).then(res => {
if (res.code === 0) {
}
}).catch(err => {
console.log(err);
});
};*/
const
onChange
=
(
e
)
=>
{
setCheckedList
(
e
);
};
const
search
=
(
e
)
=>
{
setSearchStr
(
e
.
target
.
value
);
};
const
onChangeParams
=
(
value
=
[])
=>
{
return
false
;
/* let params = initialParams;
const { dateRange, ignoreOutliers, zoom, unit } = value;
let requestArr = [];
dateRange.forEach((item) => {
let param = {
...params,
stream: params.stream.map((child) => ({
...child,
dateFrom: item.dateFrom,
dateTo: item.dateTo,
})),
ignoreOutliers,
zoom,
unit,
};
requestArr.push(fetchData(param));
});
Promise.all(requestArr).then((values) => {
console.log(values);
});*/
};
useEffect
(()
=>
{
// getNormList();
// getData();
getPumpConfig
();
},
[]);
return
(
...
...
packages/base-components/AlarmScrollAssembly/src/index.js
View file @
63ab00d7
...
...
@@ -6,8 +6,8 @@ import { RightOutlined, EnvironmentOutlined } from '@ant-design/icons';
import
{
monitorService
}
from
'./api'
;
import
moment
from
'moment'
;
import
classnames
from
'classnames'
;
import
{
switchTimeToPeriod
}
from
'.
./../../../utils
/utils'
;
import
NormChart
from
'.
./../../monitoring/Overview
/NormChart/NormChart'
;
import
{
switchTimeToPeriod
}
from
'./utils'
;
import
NormChart
from
'./NormChart/NormChart'
;
import
{
Swiper
,
SwiperSlide
}
from
'swiper/react'
;
import
'swiper/swiper.min.css'
;
import
'swiper/components/pagination/pagination.min.css'
;
...
...
packages/base-components/AlarmScrollAssembly/src/utils.js
0 → 100644
View file @
63ab00d7
import
Cookies
from
'js-cookie'
;
import
pathRegexp
from
'path-to-regexp'
;
import
{
parse
}
from
'querystring'
;
import
moment
from
'moment'
;
import
pkg
from
'../../package.json'
;
const
{
toString
}
=
Object
.
prototype
;
/* eslint no-useless-escape:0 import/prefer-default-export:0 */
const
reg
=
/
(((
^https
?
:
(?:\/\/)?)(?:[
-;:&=
\+\$
,
\w]
+@
)?[
A-Za-z0-9.-
]
+
(?:
:
\d
+
)?
|
(?:
www.|
[
-;:&=
\+\$
,
\w]
+@
)[
A-Za-z0-9.-
]
+
)((?:\/[\+
~%
\/
.
\w
-_
]
*
)?\??(?:[
-
\+
=&;%@.
\w
_
]
*
)
#
?(?:[\w]
*
))?)
$/
;
export
const
isUrl
=
(
path
)
=>
reg
.
test
(
path
);
export
const
getPageQuery
=
()
=>
parse
(
window
.
location
.
href
.
split
(
'?'
)[
1
]);
export
const
getAuthorityFromRouter
=
(
router
,
pathname
)
=>
{
const
authority
=
router
.
find
(
({
routes
,
path
=
'/'
,
target
=
'_self'
})
=>
(
path
&&
target
!==
'_blank'
&&
pathRegexp
(
path
).
exec
(
pathname
))
||
(
routes
&&
getAuthorityFromRouter
(
routes
,
pathname
)),
);
if
(
authority
)
return
authority
;
return
undefined
;
};
export
const
getRouteAuthority
=
(
path
,
routeData
)
=>
{
let
authorities
;
routeData
.
forEach
((
route
)
=>
{
if
(
pathRegexp
(
`
${
route
.
path
}
/(.*)`
).
test
(
`
${
path
}
/`
))
{
if
(
route
.
authority
)
{
authorities
=
route
.
authority
;
}
if
(
route
.
path
===
path
)
{
authorities
=
route
.
authority
||
authorities
;
}
if
(
route
.
routes
)
{
authorities
=
getRouteAuthority
(
path
,
route
.
routes
)
||
authorities
;
}
}
});
return
authorities
;
};
export
function
isPromise
(
obj
)
{
return
(
!!
obj
&&
// 有实际含义的变量才执行方法,变量null,undefined和''空串都为false
(
typeof
obj
===
'object'
||
typeof
obj
===
'function'
)
&&
// 初始promise 或 promise.then返回的
typeof
obj
.
then
===
'function'
);
}
export
function
getBaseName
()
{
return
pkg
.
name
.
toLocaleLowerCase
();
}
const
cache
=
{};
export
function
findPathByLeafId
(
leafId
,
nodes
,
path
,
key
)
{
if
(
path
===
undefined
)
{
path
=
{};
}
let
tmpPath
=
path
;
if
(
cache
[
leafId
])
{
return
cache
[
leafId
];
}
// eslint-disable-next-line no-plusplus
for
(
let
i
=
0
;
i
<
nodes
.
length
;
i
++
)
{
if
(
nodes
[
i
]
&&
nodes
[
i
][
key
]
&&
leafId
===
nodes
[
i
][
key
])
{
tmpPath
=
nodes
[
i
];
cache
[
leafId
]
=
tmpPath
;
return
tmpPath
;
}
if
(
nodes
[
i
]
&&
nodes
[
i
].
routes
)
{
const
findResult
=
findPathByLeafId
(
leafId
,
nodes
[
i
].
routes
,
tmpPath
,
key
,
// eslint-disable-next-line no-restricted-globals
location
,
);
if
(
findResult
)
{
cache
[
leafId
]
=
findResult
;
return
findResult
;
}
}
}
}
export
function
transformURL
(
path
)
{
// path = path.replace(/[(\\|)|(&)]widget=[0-9]*/, '');
const
el
=
document
.
createElement
(
'input'
);
el
.
value
=
path
;
String
.
fromCharCode
(
92
);
return
el
.
value
.
replace
(
/
\\
/g
,
'/'
);
}
export
function
findPathByWidget
(
leafId
,
nodes
,
path
,
key
)
{
if
(
path
===
undefined
)
{
path
=
{};
}
let
tmpPath
=
path
;
// eslint-disable-next-line no-plusplus
for
(
let
i
=
0
;
i
<
nodes
.
length
;
i
++
)
{
if
(
nodes
[
i
]
&&
nodes
[
i
][
key
]
&&
nodes
[
i
][
key
].
indexOf
(
leafId
)
>
-
1
)
{
tmpPath
=
nodes
[
i
];
return
tmpPath
;
}
if
(
nodes
[
i
]
&&
nodes
[
i
].
widgets
)
{
const
findResult
=
findPathByWidget
(
leafId
,
nodes
[
i
].
widgets
,
tmpPath
,
key
,
// eslint-disable-next-line no-restricted-globals
location
,
);
if
(
findResult
)
{
return
findResult
;
}
}
}
return
tmpPath
;
}
export
function
isJSON
(
str
)
{
if
(
typeof
str
===
'string'
)
{
try
{
const
obj
=
JSON
.
parse
(
str
);
if
(
typeof
obj
===
'object'
&&
obj
)
{
return
true
;
}
return
false
;
}
catch
(
e
)
{
return
false
;
}
}
}
export
function
isString
(
str
)
{
return
toString
.
call
(
str
)
===
'[object String]'
;
}
export
const
getKeyName
=
(
path
)
=>
{
const
truePath
=
path
.
split
(
'?'
)[
0
];
const
curRoute
=
[].
filter
((
item
)
=>
item
.
path
.
includes
(
truePath
));
if
(
!
curRoute
[
0
])
{
return
{
title
:
'暂无权限'
,
tabKey
:
'403'
,
};
}
const
{
name
,
key
,
component
}
=
curRoute
[
0
];
return
{
title
:
name
,
tabKey
:
key
,
component
};
};
export
const
asyncAction
=
(
action
)
=>
{
const
wait
=
new
Promise
((
resolve
)
=>
resolve
(
action
));
return
(
callback
)
=>
{
wait
.
then
(()
=>
setTimeout
(()
=>
callback
()));
};
};
export
function
getToken
()
{
return
Cookies
.
get
(
'token'
);
}
export
function
setToken
(
token
)
{
Cookies
.
set
(
token
);
}
export
const
closeTabAction
=
(
history
,
returnUrl
,
callback
)
=>
{};
const
requireContext
=
require
.
context
(
'../assets/images'
,
true
,
/^
\.\/
.*
\.(
svg|png
)
$/
);
const
localMap
=
{};
requireContext
.
keys
().
map
((
item
)
=>
{
localMap
[
item
]
=
requireContext
(
item
);
});
/**
* @param context
* @param name
* @returns {any} Example: getLocalImages('device', '二供.svg')
*/
export
const
getLocalImages
=
(
context
,
name
)
=>
localMap
[
`./
${
context
}
/
${
name
}
`
];
/**
* @param {any} path 文件路径
* @param {any} filename 下载提升文件名
*/
export
const
downLoadFile
=
(
path
,
filename
=
''
)
=>
{
const
a
=
document
.
createElement
(
'a'
);
a
.
href
=
`/CityInterface/rest/services/FileDownload.svc/download/
${
path
}
?_site=
${
window
.
globalConfig
.
userInfo
.
site
}
`
;
a
.
download
=
filename
;
document
.
body
.
appendChild
(
a
);
a
.
click
();
document
.
body
.
removeChild
(
a
);
};
export
const
switchTimeToPeriod
=
(
time
)
=>
{
if
(
!
time
)
return
''
;
let
_day
=
0
;
let
_hour
=
0
;
let
_minutes
=
0
;
_day
=
moment
().
diff
(
moment
(
time
),
'days'
);
_hour
=
moment
().
diff
(
moment
(
time
),
'hours'
);
_minutes
=
moment
().
diff
(
moment
(
time
),
'minutes'
);
return
(
`
${
_day
?
_day
+
'天'
:
''
}${
_hour
?
_hour
-
_day
*
24
+
'小时'
:
''
}${
_minutes
?
_minutes
-
_hour
*
60
+
'分钟'
:
''
}
`
||
'刚刚'
);
};
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