Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
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
CivManage
Commits
4060c07f
Commit
4060c07f
authored
May 20, 2021
by
mayongxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'master' of
https://g.civnet.cn:8443/ReactWeb5/maintenance
parent
dcbc9618
Pipeline
#27937
passed with stages
in 25 minutes 45 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
145 additions
and
97 deletions
+145
-97
index.tsx
src/components/Upload/index.tsx
+123
-87
WebDic.js
src/pages/dataCenter/dictionary/WebDic.js
+5
-0
BaseConfig.jsx
...ages/platformCenter/hostmanager/baseConfig/BaseConfig.jsx
+10
-3
UserManage.js
src/pages/userCenter/userManage/UserManage.js
+2
-2
config.js
src/routes/config.js
+5
-5
No files found.
src/components/Upload/index.tsx
View file @
4060c07f
...
...
@@ -9,22 +9,25 @@ import { get, PUBLISH_SERVICE } from '@/services';
import
styles
from
'./index.less'
;
import
{
getImageBases
}
from
'@/services/common/api'
;
import
UploadContext
from
'./context.js'
import
_
,
{
clone
}
from
'lodash'
const
{
TabPane
}
=
Tabs
;
const
{
TabPane
}
=
Tabs
;
const
{
Search
}
=
Input
;
// 维护图片分类映射
const
wallCateName
:
any
=
{
icon
:
'图标'
,
bg
:
'背景'
,
uploaded
:
'上传'
,
};
const
tabNames
:
any
=
{
const
tabNames
:
any
=
{
CityTemp
:
'用户上传'
,
icon
:
'icon图标'
,
androidMenu
:
'移动应用图标'
,
menuNew
:
'应用图标'
,
logo
:
'项目logo'
,
menu
:
'菜单图标'
logo
:
'项目logo'
,
menu
:
'菜单图标'
}
function
getBase64
(
file
:
File
|
Blob
)
{
...
...
@@ -45,7 +48,7 @@ interface PicturesWallType {
onChange
?:
(
v
:
any
)
=>
void
;
cropRate
?:
number
|
boolean
;
isCrop
?:
boolean
;
type
?:
'CityTemp'
|
'icon'
|
'androidMenu'
|
'menuNew'
,
type
?:
'CityTemp'
|
'icon'
|
'androidMenu'
|
'menuNew'
,
value
?:
string
|
string
[],
uploadContext
:
any
,
search
:
string
,
...
...
@@ -61,8 +64,8 @@ class PicturesWall extends React.Component<PicturesWallType> {
previewTitle
:
''
,
imgBed
:
this
.
props
.
uploadContext
?.
imgBed
||
[],
curSelectedImg
:
''
,
baseUrl
:
''
,
prevProps
:{},
baseUrl
:
''
,
prevProps
:
{},
search
:
''
,
actives
:
{},
fileList
:
this
.
props
.
value
?
Array
.
isArray
(
this
.
props
.
value
)
?
this
.
props
.
value
.
map
((
v
)
=>
({
...
...
@@ -70,13 +73,13 @@ class PicturesWall extends React.Component<PicturesWallType> {
uid
:
uuid
(
8
,
16
),
name
:
'熊猫运维中台系统'
,
status
:
'done'
,
}))
as
UploadFile
<
any
>
[]:
[{
}))
as
UploadFile
<
any
>
[]
:
[{
url
:
this
.
props
.
value
,
uid
:
uuid
(
8
,
16
),
name
:
'熊猫运维中台系统'
,
status
:
'done'
,
}]
as
UploadFile
<
any
>
[]
:
[],
};
};
/**
* 判断value是否更新,若更新则更新state.fileList
...
...
@@ -85,19 +88,19 @@ class PicturesWall extends React.Component<PicturesWallType> {
* @param state
*/
static
getDerivedStateFromProps
=
(
props
,
state
)
=>
{
const
{
value
,
uploadContext
=
{}
}
=
props
;
const
{
value
,
uploadContext
=
{}
}
=
props
;
const
{
imgBed
,
update
}
=
uploadContext
;
const
fileList
=
state
.
fileList
;
const
shouldUpdate
=
fileList
.
every
(
f
=>
Array
.
isArray
(
value
)
?
!
value
.
some
(
v
=>
f
.
url
===
v
)
:
f
.
url
!==
value
)
if
(
value
!==
state
.
prevProps
.
value
&&
shouldUpdate
)
{
if
(
value
!==
state
.
prevProps
.
value
&&
shouldUpdate
)
{
return
{
prevProps
:
props
,
fileList
:
Array
.
isArray
(
value
)
?
value
.
map
((
v
)
=>
({
fileList
:
Array
.
isArray
(
value
)
?
value
.
map
((
v
)
=>
({
url
:
v
,
uid
:
uuid
(
8
,
16
),
name
:
'熊猫运维中台系统'
,
status
:
'done'
,
}))
as
UploadFile
<
any
>
[]
:
value
?
[{
}))
as
UploadFile
<
any
>
[]
:
value
?
[{
url
:
value
,
uid
:
uuid
(
8
,
16
),
name
:
'熊猫运维中台系统'
,
...
...
@@ -105,7 +108,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
}]
as
UploadFile
<
any
>
[]
:
[]
}
}
if
(
imgBed
!=
state
.
prevProps
.
uploadContext
?.
imgBed
)
{
if
(
imgBed
!=
state
.
prevProps
.
uploadContext
?.
imgBed
)
{
const
activeKeys
=
{};
imgBed
.
forEach
(
item
=>
activeKeys
[
item
.
moduleName
]
=
item
.
child
.
map
(
c
=>
c
.
moduleName
));
return
{
...
...
@@ -119,15 +122,15 @@ class PicturesWall extends React.Component<PicturesWallType> {
};
}
update
=
()
=>
{
if
(
this
.
props
.
value
)
{
update
=
()
=>
{
if
(
this
.
props
.
value
)
{
this
.
setState
({
fileList
:
Array
.
isArray
(
this
.
props
.
value
)
?
this
.
props
.
value
.
map
((
v
)
=>
({
fileList
:
Array
.
isArray
(
this
.
props
.
value
)
?
this
.
props
.
value
.
map
((
v
)
=>
({
url
:
v
,
uid
:
uuid
(
8
,
16
),
name
:
'熊猫运维中台系统'
,
status
:
'done'
,
}))
as
UploadFile
<
any
>
[]:
[{
}))
as
UploadFile
<
any
>
[]
:
[{
url
:
this
.
props
.
value
,
uid
:
uuid
(
8
,
16
),
name
:
'熊猫运维中台系统'
,
...
...
@@ -159,10 +162,10 @@ class PicturesWall extends React.Component<PicturesWallType> {
});
};
handleImgSelected
=
(
url
:
string
,
baseUrl
:
any
)
=>
{
handleImgSelected
=
(
url
:
string
,
baseUrl
:
any
)
=>
{
this
.
setState
({
curSelectedImg
:
url
,
baseUrl
:
baseUrl
baseUrl
:
baseUrl
});
};
...
...
@@ -174,7 +177,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
handleModalOk
=
()
=>
{
const
{
maxLen
=
1
}
=
this
.
props
;
const
{
baseUrl
,
curSelectedImg
}
=
this
.
state
const
{
baseUrl
,
curSelectedImg
}
=
this
.
state
const
fileList
=
[
{
uid
:
uuid
(
8
,
16
),
...
...
@@ -183,20 +186,20 @@ class PicturesWall extends React.Component<PicturesWallType> {
url
:
curSelectedImg
,
},
];
if
(
!
curSelectedImg
)
{
if
(
!
curSelectedImg
)
{
message
.
warn
({
duration
:
2
,
content
:
'请先选择图片'
duration
:
2
,
content
:
'请先选择图片'
})
return
}
if
(
curSelectedImg
.
includes
(
'CityTemp'
))
{
localStorage
.
setItem
(
'pd-baseUrl'
,
baseUrl
)
}
else
{
localStorage
.
setItem
(
'pd2-baseUrl'
,
baseUrl
)
if
(
curSelectedImg
.
includes
(
'CityTemp'
))
{
localStorage
.
setItem
(
'pd-baseUrl'
,
baseUrl
)
}
else
{
localStorage
.
setItem
(
'pd2-baseUrl'
,
baseUrl
)
}
console
.
log
(
fileList
[
0
].
url
)
this
.
props
.
onChange
&&
this
.
props
.
onChange
(
maxLen
===
1
?
fileList
[
0
].
url
.
replace
(
'Web4
\
\'
, '') : fileList.map(f => f.url.replace('
Web4
\\
', '')));
this
.
props
.
onChange
&&
this
.
props
.
onChange
(
maxLen
===
1
?
fileList
[
0
].
url
.
replace
(
'Web4
\
\'
, '') : fileList.map(f => f.url.replace('
Web4
\\
', '')));
this.setState({ fileList, wallModalVisible: false });
};
...
...
@@ -206,11 +209,11 @@ class PicturesWall extends React.Component<PicturesWallType> {
if (file.status === '
done
') {
const files = fileList.map(item => {
const { status, name, thumbUrl } = item;
const url =
item.response && item.response.data || thumbUrl
;
const url =
item.response && item.response.data || thumbUrl
;
return { uid: uuid(8, 16), name, status, url };
});
this.setState({
fileList: files
})
this.props.onChange && this.props.onChange(
maxLen === 1 ? files[0].url : files.map(f => f.url));
this.setState({
fileList: files
})
this.props.onChange && this.props.onChange(maxLen === 1 ? files[0].url : files.map(f => f.url));
uploadContext?.update && uploadContext.update()
}
};
...
...
@@ -240,46 +243,46 @@ class PicturesWall extends React.Component<PicturesWallType> {
// })
// }
getImageUrl(path){
if
(path&&path.indexOf('
http
') === 0)
{
getImageUrl(path)
{
if
(path && path.indexOf('
http
') === 0)
{
return path
}
if
(path&&
path.indexOf('
data
:
') === 0) {
}
if
(path &&
path.indexOf('
data
:
') === 0) {
return path
}
if(path && path.indexOf('
assets
') === 0) {
if
(path && path.indexOf('
assets
') === 0) {
return `${window.location.origin}/Web4/${path}`.replace(/
\\
/g, '
/
')
}
return `${window.location.origin}/${path}`.replace(/
\\
/g, '
/
')
}
getFileName(path:
string)
{
getFileName(path:
string)
{
const match = path.match(/(?<=[
\
/
\\
])([^
\\\
/
\
.]*)(
\
.?
\
w*)$/)
return match
&&match[1]||
''
return match
&& match[1] ||
''
}
renderImgItem(url,
baseUrl)
{
renderImgItem(url,
baseUrl)
{
const fileName = this.getFileName(url)
const {
curSelectedImg, search
} = this.state;
const {
curSelectedImg, search
} = this.state;
return (
<div
<div
className={classnames({
[styles.imgItem]:
true,
[styles.imgItem]:
true,
[styles.hide]: !fileName.includes(search)
})}
})}
key={url}
onClick={() => this.handleImgSelected(url,baseUrl)}>
onClick={() => this.handleImgSelected(url,
baseUrl)}>
<div
className={classnames(
curSelectedImg === url ? styles.seleted : '',
)}
>
<img
<img
className={classnames({
[styles.svgGray]: /
\
.svg$/.test(url)
})}
src={this.getImageUrl(url)}
title={url}
})}
src={this.getImageUrl(url)}
title={url}
alt="熊猫运维中台系统" />
<span className={styles.iconBtn}>
<CheckCircleFilled />
...
...
@@ -290,19 +293,19 @@ class PicturesWall extends React.Component<PicturesWallType> {
);
}
renderCollapse(module){
renderCollapse(module)
{
const { Panel } = Collapse;
const items = module.fileUrls.map(url =>
this.renderImgItem(url,
module.baseUrl))
return items.length
>0&&
<Panel
forceRender
header={module.moduleName}
key={module.moduleName}>
{items}
</Panel>
const items = module.fileUrls.map(url =>
this.renderImgItem(url,
module.baseUrl))
return items.length
> 0 &&
<Panel
forceRender
header={module.moduleName}
key={module.moduleName}>
{items}
</Panel>
}
handleCollapseChange(v, moduleName){
const activeKeys = {
...this.state.actives
}
handleCollapseChange(v, moduleName)
{
const activeKeys = {
...this.state.actives
}
activeKeys[moduleName] = v;
this.setState({
actives: activeKeys
...
...
@@ -321,7 +324,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
curSelectedImg,
} = this.state;
const {
action = `${window.location.origin}${PUBLISH_SERVICE}/FileCenter/UploadSingleFile`
,
action = `${window.location.origin}${PUBLISH_SERVICE}/FileCenter/UploadSingleFile`,
headers,
withCredentials = true,
maxLen = 1,
...
...
@@ -336,6 +339,38 @@ class PicturesWall extends React.Component<PicturesWallType> {
<div className="ant-upload-text">上传</div>
</div>
);
const onSearch = (key) => {
const bed = this.props.uploadContext.imgBed
const nodes = _.cloneDeep(bed)
for(const node of nodes){
arrayTreeFilter(node,key)
}
console.log(nodes)
this.setState({imgBed:nodes})
}
const arrayTreeFilter = (node,key) => {
let reg = new RegExp(`/${key}/g`)
for (const nodeItem of node.child) {
if ( nodeItem.child.length < 1) {
if(!reg.test(nodeItem.moduleName)){
node.child.splice(nodeItem,1)
console.log(nodeItem.moduleName,"--------------------移除图包-----------------")
}
}else{
arrayTreeFilter(nodeItem,key);
}
}
}
return (
<>
...
...
@@ -348,7 +383,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
aspect={cropRate as number}
>
<Upload
fileList={fileList.map(f => ({...f, url: this.getImageUrl(f.url) }))}
fileList={fileList.map(f => ({
...f, url: this.getImageUrl(f.url) }))}
onPreview={this.handlePreview}
onChange={this.handleChange}
name="singleFile"
...
...
@@ -368,7 +403,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
</ImgCrop>
) : (
<Upload
fileList={fileList.map(f => ({...f, url: this.getImageUrl(f.url) }))}
fileList={fileList.map(f => ({
...f, url: this.getImageUrl(f.url) }))}
onPreview={this.handlePreview}
onChange={this.handleChange}
name="singleFile"
...
...
@@ -407,38 +442,39 @@ class PicturesWall extends React.Component<PicturesWallType> {
onOk={this.handleModalOk}
className={styles.modal}
>
<Search onSearch={onSearch} />
<Tabs defaultActiveKey={imgBed[0]?.moduleName} tabPosition="left" style={{ height: 520 }}>
{imgBed.map((item, i) => {
if
(item.moduleName==picType || item.moduleName=='
CityTemp
'){
const child = [...item.child] || [];
if(item.fileUrls.length > 0)
{
child.push({
moduleName: item.moduleName,
fileUrls: item.fileUrls,
child: [],
baseUrl:
item.baseUrl
})
}
return (
<TabPane tab={tabNames[item.moduleName]||
item.moduleName} key={item.moduleName}>
{/* <Input
if
(item.moduleName == picType || item.moduleName == '
CityTemp
') {
const child = [...item.child] || [];
if (item.fileUrls.length > 0)
{
child.push({
moduleName: item.moduleName,
fileUrls: item.fileUrls,
child: [],
baseUrl:
item.baseUrl
})
}
return (
<TabPane tab={tabNames[item.moduleName] ||
item.moduleName} key={item.moduleName}>
{/* <Input
placeholder="搜索图库"
className={styles.search}
size="middle"
value={this.state.search}
onChange={e => this.setState({search: e.target.value})}
allowClear/> */}
<div className={styles.imgBox}>
<Collapse
bordered
activeKey={actives[item.moduleName]}
onChange={(v) => this.handleCollapseChange(v, item.moduleName)}>
{child.map(child => this.renderCollapse(child))}
</Collapse>
</div>
</TabPane>
);
}
<div className={styles.imgBox}>
<Collapse
bordered
activeKey={actives[item.moduleName]}
onChange={(v) => this.handleCollapseChange(v, item.moduleName)}>
{child.map(child => this.renderCollapse(child))}
</Collapse>
</div>
</TabPane>
);
}
})}
{/* <TabPane tab="更多" key="more">
<Result status="500" title="温馨提示" subTitle="更多素材, 正在筹备中..." />
...
...
@@ -452,7 +488,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
const PicturesWallWrapper = (props: any) => {
return <UploadContext.Consumer>
{(uploadContext) => <PicturesWall {...props} uploadContext={uploadContext}/>}
{(uploadContext) => <PicturesWall {...props} uploadContext={uploadContext}
/>}
</UploadContext.Consumer>
}
export default PicturesWallWrapper;
src/pages/dataCenter/dictionary/WebDic.js
View file @
4060c07f
...
...
@@ -18,6 +18,7 @@ import { EditTwoTone, DeleteOutlined } from '@ant-design/icons';
import
{
get
,
CITY_SERVICE
}
from
'@/services'
;
import
styles
from
'./WebDic.less'
;
const
{
Search
}
=
Input
;
const
WebDic
=
()
=>
{
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
level
,
setLevel
]
=
useState
(
0
);
// 设置级别,一级1,二级2,添加条目时使用
...
...
@@ -272,6 +273,9 @@ const WebDic = () => {
showQuickJumper
:
true
,
showSizeChanger
:
true
,
};
const
onSearch
=
(
key
)
=>
{
}
return
(
<
div
className
=
{
styles
.
WebDic
}
>
...
...
@@ -283,6 +287,7 @@ const WebDic = () => {
<
Button
type
=
"primary"
size
=
"small"
onClick
=
{()
=>
setItem
(
1
)}
>
添加
<
/Button
>
<
Search
style
=
{{
width
:
"300px"
,
marginLeft
:
"10px"
}}
onSearch
=
{
onSearch
}
/
>
<
/div
>
{
/* 一级条目 表格 */
}
<
Table
...
...
src/pages/platformCenter/hostmanager/baseConfig/BaseConfig.jsx
View file @
4060c07f
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
Descriptions
}
from
'antd'
import
{
Button
,
Descriptions
,
Input
}
from
'antd'
import
styles
from
'./BaseConfig.less'
import
{
S_GetDataBaseConfig
,
GetTCPConfigInfo
,
GetDataBaseConfig
,
GetBasicInfo
}
from
'@/services/platform/hostmanager'
...
...
@@ -72,9 +72,16 @@ const BaseConfig = () => {
}
return
(
<
div
className=
{
styles
.
base_container
}
>
<
div
style=
{
{
backgroundColor
:
"white"
,
padding
:
"10px"
,
width
:
"
400px
"
}
}
>
<
div
style=
{
{
backgroundColor
:
"white"
,
padding
:
"10px"
,
width
:
"
100%
"
}
}
>
<
Descriptions
title=
""
bordered
>
<
Descriptions
.
Item
label=
"站点编号"
span=
{
3
}
>
{
currentSiteInfo
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"站点编号"
span=
{
3
}
>
{
!
currentSiteInfo
?<
Input
value=
{
currentSiteInfo
}
disabled=
{
true
}
style=
{
{
with
:
"200px"
}
}
/>:<
div
>
<
Input
value=
{
currentSiteInfo
}
style=
{
{
with
:
"200px"
}
}
disabled=
{
true
}
/>
<
Button
>
生成编号
</
Button
>
</
div
>
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"服务器IP"
span=
{
3
}
>
{
currentDataBase
.
ip
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"数据库名称"
span=
{
3
}
>
{
currentDataBase
.
dbName
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"登录名"
span=
{
1
}
>
{
currentDataBase
.
userName
}
</
Descriptions
.
Item
>
...
...
src/pages/userCenter/userManage/UserManage.js
View file @
4060c07f
...
...
@@ -871,8 +871,8 @@ const UserManage = () => {
// message.error(err);
// });
DeleteUserNew
({
userID
:
`"
${
currentUser
.
userID
}
"`
,
ouID
:
`"
${
currentUser
.
OUID
}
"`
userID
:
currentUser
.
userID
,
ouID
:
currentUser
.
OUID
}).
then
(
res
=>
{
if
(
res
.
code
==
0
)
{
setDeleteUserVisible
(
false
);
...
...
src/routes/config.js
View file @
4060c07f
...
...
@@ -199,11 +199,11 @@ export default {
},
],
},
{
path
:
'/platformCenter/order'
,
name
:
'业务平台'
,
component
:
JumpContainer
,
},
//
{
//
path: '/platformCenter/order',
//
name: '业务平台',
//
component: JumpContainer,
//
},
{
path
:
'/platformCenter/notify'
,
name
:
'消息平台'
,
...
...
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