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
11992942
Commit
11992942
authored
Dec 08, 2023
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '权限配置界面报错修复,修复删除默认方案数据不刷新bug'
parent
241d1ae8
Pipeline
#82889
passed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
289 deletions
+81
-289
solutionConfig.jsx
...Center/gis/schemeConfig/solutionConfig/solutionConfig.jsx
+81
-289
No files found.
src/pages/platformCenter/gis/schemeConfig/solutionConfig/solutionConfig.jsx
View file @
11992942
/* eslint-disable no-unneeded-ternary */
/* eslint-disable no-return-assign */
import
{
Space
,
Table
,
Button
,
Popconfirm
,
notification
,
Divider
,
Checkbox
,
Spin
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
,
useCallback
}
from
'react'
;
import
VisibleRoleModal
from
'@/pages/platformCenter/messageManage/projectManage/components/RolseSelect/VisibleRoleModal'
;
import
{
PlusOutlined
,
UserAddOutlined
}
from
'@ant-design/icons'
;
import
RoleModal
from
'./RoleModal'
;
import
RMSComponents
from
'@/components/RolePmSite/index'
;
import
styles
from
'../SchemeConfig.less'
;
import
{
deleteConfig
,
setServiceType
,
SetServiceConfig
,
GetMaplayerByTerminalType
,
SetDefaultsSchemeName
,
}
from
'@/services/webConfig/api'
;
import
{
RoleGroupList
}
from
'@/services/messagemanage/messagemanage'
;
import
AddModal
from
'./AddModal'
;
const
VectorData
=
props
=>
{
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
// 弹窗显示
const
[
schemename
,
setSchemename
]
=
useState
([]);
const
[
record
,
setRecord
]
=
useState
({});
// 选中关联角色的方案名
const
[
webCurrent
,
setWebCurrent
]
=
useState
(
0
);
// web列表下标
...
...
@@ -31,8 +26,6 @@ const VectorData = props => {
const
[
type
,
setType
]
=
useState
(
''
);
// 弹窗类型
const
[
checkLoading
,
setCheckLoading
]
=
useState
(
false
);
const
[
formObj
,
setFormObj
]
=
useState
({
user
:
'admin'
,
password
:
'geoserver'
});
const
[
tree
,
setTree
]
=
useState
([]);
const
[
leafs
,
setLeafs
]
=
useState
([]);
const
[
addVisible
,
setAddVisible
]
=
useState
(
false
);
const
[
checkValue
,
setCheckValue
]
=
useState
([]);
const
[
gisType
,
setGisType
]
=
useState
(
''
);
...
...
@@ -47,7 +40,7 @@ const VectorData = props => {
<
Checkbox
checked=
{
webStatus
[
index
+
webCurrent
*
5
]
}
onChange=
{
e
=>
{
onChangeCheck
(
e
,
record
,
index
+
webCurrent
*
5
);
onChangeCheck
(
record
,
index
+
webCurrent
*
5
);
}
}
/>
</
Space
>
...
...
@@ -109,7 +102,7 @@ const VectorData = props => {
<
Checkbox
checked=
{
handStatus
[
index
+
handCurrent
*
5
]
}
onChange=
{
e
=>
{
onChangeHand
(
e
,
record
,
index
+
handCurrent
*
5
);
onChangeHand
(
record
,
index
+
handCurrent
*
5
);
}
}
/>
</
Space
>
...
...
@@ -161,9 +154,9 @@ const VectorData = props => {
),
},
];
// 获取选中的角色
const
onPushSubmit
=
value
=>
{
console
.
log
(
value
,
'value'
);
setAddVisible
(
false
);
let
query
=
{
...
...
@@ -187,293 +180,113 @@ const VectorData = props => {
prompt
(
'fail'
,
'网络请求失败'
);
});
};
const
rolCallBack
=
useCallback
(
list
=>
{
let
strList
=
[];
console
.
log
(
list
,
'list'
);
onPushSubmit
(
list
.
ids
);
// if (list.length > 0) {
// list.forEach(item => {
// console.log(item, 'item');
// Object.keys(item.last).forEach(i => {
// strList.push(i);
// });
// });
// console.log(strList);
// onPushSubmit(strList);
// }
});
// 获取
角色
// 获取
站点
const
pickRole
=
e
=>
{
setRecord
(
e
);
setAddVisible
(
true
);
console
.
log
(
tree
);
console
.
log
(
leafs
);
let
arr
=
e
.
roles
!=
null
?
e
.
roles
.
split
(
','
)
:
[];
console
.
log
(
arr
);
setCheckValue
(
arr
);
};
// 设置web方案
const
onChangeCheck
=
(
e
,
record
,
index
)
=>
{
console
.
log
(
e
);
console
.
log
(
record
);
console
.
log
(
index
);
const
onChangeCheck
=
(
record
,
index
,
aa
,
newData
)
=>
{
setCheckLoading
(
true
);
cons
ole
.
log
(
webStatus
)
;
const
newLoadings
=
[...
webStatus
];
newLoadings
.
map
((
item
,
loadIndex
)
=>
loadIndex
==
index
?
(
newLoadings
[
loadIndex
]
=
!
newLoadings
[
loadIndex
])
:
(
newLoadings
[
loadIndex
]
=
false
),
);
console
.
log
(
newLoadings
);
setWebStatus
(
newLoadings
);
cons
t
newLoadings
=
aa
?
[...
aa
]
:
[...
webStatus
]
;
if
(
!
aa
)
{
newLoadings
.
map
((
item
,
loadIndex
)
=>
loadIndex
==
index
?
(
newLoadings
[
loadIndex
]
=
!
newLoadings
[
loadIndex
])
:
(
newLoadings
[
loadIndex
]
=
false
),
);
setWebStatus
(
newLoadings
);
}
let
query
=
{
schemename
:
record
.
schemename
,
type
:
'web'
,
uncheck
:
tru
e
,
uncheck
:
!
newLoadings
[
index
]
?
true
:
fals
e
,
};
// 取消默认
if
(
!
newLoadings
[
index
])
{
SetDefaultsSchemeName
(
query
)
.
then
(
res
=>
{
SetDefaultsSchemeName
(
query
)
.
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
code
==
'0'
)
{
const
changehandData
=
[...
webData
];
changehandData
[
index
].
type
=
'dynamic'
;
console
.
log
(
changehandData
);
const
changehandData
=
newData
?
[...
newData
]
:
[...
webData
];
changehandData
[
index
].
type
=
!
newLoadings
[
index
]
?
'dynamic'
:
'pipenet'
;
setWebData
(
changehandData
);
prompt
(
'success'
,
'设置成功'
);
}
else
{
prompt
(
'fail'
,
`
${
record
.
schemename
}
默认设置时遇到错误:
${
res
.
message
}
`
);
}
});
return
;
}
// 设置默认
let
beforeDefault
=
webData
.
findIndex
(
item
=>
item
.
type
==
'pipenet'
);
SetDefaultsSchemeName
({
schemename
:
record
.
schemename
,
type
:
'web'
,
uncheck
:
false
,
}).
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
code
==
'0'
)
{
const
changehandData
=
[...
webData
];
changehandData
[
index
].
type
=
'pipenet'
;
console
.
log
(
changehandData
);
setWebData
(
changehandData
);
// 设置默认的同时取消另一个默认
// if (beforeDefault != -1) {
// SetDefaultsSchemeName({
// schemename: changehandData[beforeDefault].schemename,
// type: 'web',
// uncheck: true,
// }).then(resdata => {
// setCheckLoading(false);
// if (resdata.code == 0) {
// const changehandData1 = [...webData];
// changehandData1[beforeDefault].type = 'dynamic';
// console.log(changehandData1);
// setWebData(changehandData1);
// prompt('success', '设置成功');
// // return;
// } else {
// prompt('fail', `${record.schemename}默认设置时遇到错误:${res.message}`);
// }
// });
// } else {
// prompt('success', '设置成功');
// }
prompt
(
'success'
,
'设置成功'
);
}
});
};
// 无选中值时的默认值
const
onChangeCheck1
=
(
e
,
record
,
index
,
aa
)
=>
{
console
.
log
(
aa
);
console
.
log
(
webStatus
);
setCheckLoading
(
true
);
const
newLoadings
=
[...
aa
];
let
query
=
{
schemename
:
record
.
schemename
,
type
:
'web'
,
uncheck
:
true
,
};
if
(
!
newLoadings
[
index
])
{
SetDefaultsSchemeName
(
query
).
then
(
res
=>
{
})
.
catch
(
err
=>
{
setCheckLoading
(
false
);
if
(
res
.
code
==
'0'
)
{
const
changehandData
=
[...
webData
];
changehandData
[
index
].
type
=
'dynamic'
;
// setWebData(changehandData);
prompt
(
'success'
,
'设置成功'
);
if
(
err
.
message
.
indexOf
(
'timeout'
)
!==
-
1
)
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'请求超时'
,
});
}
else
{
prompt
(
'fail'
,
`
${
record
.
schemename
}
默认设置时遇到错误:
${
res
.
message
}
`
);
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
err
.
message
,
});
}
});
return
;
}
let
beforeDefault
=
webData
.
findIndex
(
item
=>
item
.
type
==
'pipenet'
);
SetDefaultsSchemeName
({
schemename
:
record
.
schemename
,
type
:
'web'
,
uncheck
:
false
,
}).
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
code
==
'0'
)
{
const
changehandData
=
[...
webData
];
changehandData
[
index
].
type
=
'pipenet'
;
// setWebData(changehandData);
// if (beforeDefault != -1) {
// SetDefaultsSchemeName({
// schemename: changehandData[beforeDefault].schemename,
// type: 'web',
// uncheck: true,
// }).then(resdata => {
// setCheckLoading(false);
// if (resdata.code == 0) {
// const changehandData1 = [...webData];
// changehandData1[beforeDefault].type = 'dynamic';
// // setWebData(changehandData1);
// prompt('success', '设置成功');
// } else {
// prompt('fail', `${record.schemename}默认设置时遇到错误:${res.message}`);
// }
// });
// } else {
// prompt('success', '设置成功');
// }
prompt
(
'success'
,
'设置成功'
);
}
});
};
// 选择手持方案
const
onChangeHand
=
(
e
,
record
,
index
)
=>
{
const
onChangeHand
=
(
record
,
index
,
aa
,
newData
)
=>
{
setCheckLoading
(
true
);
const
newLoadings
=
[...
handStatus
];
newLoadings
.
map
((
item
,
loadIndex
)
=>
loadIndex
==
index
?
(
newLoadings
[
loadIndex
]
=
!
newLoadings
[
loadIndex
])
:
(
newLoadings
[
loadIndex
]
=
false
),
);
setHandStatus
(
newLoadings
);
const
newLoadings
=
aa
?
[...
aa
]
:
[...
handStatus
];
if
(
!
aa
)
{
newLoadings
.
map
((
item
,
loadIndex
)
=>
loadIndex
==
index
?
(
newLoadings
[
loadIndex
]
=
!
newLoadings
[
loadIndex
])
:
(
newLoadings
[
loadIndex
]
=
false
),
);
setHandStatus
(
newLoadings
);
}
let
query
=
{
schemename
:
record
.
schemename
,
type
:
'phone'
,
uncheck
:
tru
e
,
uncheck
:
!
newLoadings
[
index
]
?
true
:
fals
e
,
};
if
(
!
newLoadings
[
index
])
{
SetDefaultsSchemeName
(
query
)
.
then
(
res
=>
{
SetDefaultsSchemeName
(
query
)
.
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
code
==
'0'
)
{
const
changehandData
=
[...
handData
];
changehandData
[
index
].
isDefault
=
fals
e
;
const
changehandData
=
newData
?
[...
newData
]
:
[...
handData
];
changehandData
[
index
].
isDefault
=
!
newLoadings
[
index
]
?
false
:
tru
e
;
setHandData
(
changehandData
);
prompt
(
'success'
,
'设置成功'
);
}
else
{
prompt
(
'fail'
,
`
${
record
.
schemename
}
默认设置时遇到错误:
${
res
.
message
}
`
);
}
});
return
;
}
let
beforeDefault
=
handData
.
findIndex
(
item
=>
item
.
isDefault
);
SetDefaultsSchemeName
({
schemename
:
record
.
schemename
,
type
:
'phone'
,
uncheck
:
false
,
}).
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
code
==
'0'
)
{
const
changehandData
=
[...
handData
];
changehandData
[
index
].
isDefault
=
true
;
setHandData
(
changehandData
);
// if (beforeDefault != -1) {
// SetDefaultsSchemeName({
// schemename: changehandData[beforeDefault].schemename,
// type: 'phone',
// uncheck: true,
// }).then(resdata => {
// setCheckLoading(false);
// if (resdata.code == 0) {
// const changehandData1 = [...handData];
// changehandData1[beforeDefault].isDefault = false;
// setHandData(changehandData1);
// prompt('success', '设置成功');
// // return;
// } else {
// prompt('fail', `${record.schemename}默认设置时遇到错误:${res.message}`);
// }
// });
// } else {
// prompt('success', '设置成功');
// }
prompt
(
'success'
,
'设置成功'
);
}
});
};
// 选择手持方案
const
onChangeHand1
=
(
e
,
record
,
index
,
aa
)
=>
{
setCheckLoading
(
true
);
const
newLoadings
=
[...
aa
];
let
query
=
{
schemename
:
record
.
schemename
,
type
:
'phone'
,
uncheck
:
true
,
};
if
(
!
newLoadings
[
index
])
{
SetDefaultsSchemeName
(
query
).
then
(
res
=>
{
})
.
catch
(
err
=>
{
setCheckLoading
(
false
);
if
(
res
.
code
==
'0'
)
{
const
changehandData
=
[...
handData
];
changehandData
[
index
].
isDefault
=
false
;
// setHandData(changehandData);
prompt
(
'success'
,
'设置成功'
);
if
(
err
.
message
.
indexOf
(
'timeout'
)
!==
-
1
)
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'请求超时'
,
});
}
else
{
prompt
(
'fail'
,
`
${
record
.
schemename
}
默认设置时遇到错误:
${
res
.
message
}
`
);
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
err
.
message
,
});
}
});
return
;
}
let
beforeDefault
=
handData
.
findIndex
(
item
=>
item
.
isDefault
);
SetDefaultsSchemeName
({
schemename
:
record
.
schemename
,
type
:
'phone'
,
uncheck
:
false
,
}).
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
code
==
'0'
)
{
const
changehandData
=
[...
handData
];
changehandData
[
index
].
isDefault
=
true
;
// setHandData(changehandData);
// if (beforeDefault != -1) {
// SetDefaultsSchemeName({
// schemename: changehandData[beforeDefault].schemename,
// type: 'phone',
// uncheck: true,
// }).then(resdata => {
// setCheckLoading(false);
// if (resdata.code == 0) {
// const changehandData1 = [...handData];
// changehandData1[beforeDefault].isDefault = false;
// // setHandData(changehandData1);
// prompt('success', '设置成功');
// // return;
// } else {
// prompt('fail', `${record.schemename}默认设置时遇到错误:${res.message}`);
// }
// });
// } else {
// prompt('success', '设置成功');
// }
prompt
(
'success'
,
'设置成功'
);
}
});
};
const
prompt
=
(
type
,
content
)
=>
{
if
(
type
==
'success'
)
{
notification
.
success
({
...
...
@@ -489,6 +302,7 @@ const VectorData = props => {
});
}
};
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
if
(
type
==
'add'
)
{
...
...
@@ -498,6 +312,7 @@ const VectorData = props => {
}
// setFlag(flag + 1);
};
// 删除web配置方案
const
delWebConfirm
=
record
=>
{
deleteConfig
({
...
...
@@ -513,6 +328,7 @@ const VectorData = props => {
}
});
};
// 删除手持配置方案
const
delhandConfirm
=
e
=>
{
setCheckLoading
(
true
);
...
...
@@ -530,6 +346,7 @@ const VectorData = props => {
}
});
};
// 添加方案
const
addType
=
type
=>
{
setType
(
type
);
...
...
@@ -537,14 +354,12 @@ const VectorData = props => {
type
==
'add'
?
(
listData
=
webData
)
:
(
listData
=
handData
);
let
webSchemenameArr
=
[];
let
schemeArr
=
[];
setTreeLoading
(
true
);
GetMaplayerByTerminalType
({
terminalType
:
'scheme'
,
isBaseMap
:
false
,
})
.
then
(
res
=>
{
if
(
res
.
data
&&
res
.
data
.
length
>
0
)
{
setTreeLoading
(
false
);
listData
.
map
(
item
=>
{
webSchemenameArr
.
push
(
item
.
schemename
);
});
...
...
@@ -555,7 +370,6 @@ const VectorData = props => {
if
(
schemeArr
.
length
)
{
setVisible
(
true
);
}
else
{
console
.
log
(
12
);
notification
.
warning
({
message
:
'提示'
,
duration
:
3
,
...
...
@@ -563,8 +377,6 @@ const VectorData = props => {
});
}
}
else
{
console
.
log
(
34
);
setTreeLoading
(
false
);
notification
.
warning
({
message
:
'提示'
,
duration
:
3
,
...
...
@@ -586,14 +398,14 @@ const VectorData = props => {
description
:
err
.
message
,
});
}
setTreeLoading
(
false
);
});
};
useEffect
(()
=>
{
console
.
log
(
flag
);
renderTile
();
renderTileWeb
();
},
[
flag
]);
// 获取瓦片数据配置数据
const
renderTile
=
()
=>
{
setCheckLoading
(
true
);
...
...
@@ -604,6 +416,7 @@ const VectorData = props => {
});
Promise
.
all
([
schemeConfigQueryRequest
])
.
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
[
0
].
code
==
'0'
)
{
let
arr
=
[];
res
[
0
].
data
.
optionalLayer
.
layers
.
map
((
item
,
index
)
=>
{
...
...
@@ -616,22 +429,22 @@ const VectorData = props => {
return
item
;
});
setHandData
(
res
[
0
].
data
.
optionalLayer
.
layers
);
if
(
arr
.
indexOf
(
true
)
==
-
1
)
{
if
(
arr
.
indexOf
(
true
)
==
-
1
&&
arr
.
length
>
0
)
{
arr
[
arr
.
length
-
1
]
=
true
;
setHandStatus
(
arr
);
onChangeHand1
(
''
,
onChangeHand
(
res
[
0
].
data
.
optionalLayer
.
layers
[
arr
.
length
-
1
],
arr
.
length
-
1
,
arr
,
res
[
0
].
data
.
optionalLayer
.
layers
,
);
}
else
{
setHandStatus
(
arr
);
}
}
setCheckLoading
(
false
);
})
.
catch
(
err
=>
{
setCheckLoading
(
false
);
if
(
err
.
message
.
indexOf
(
'timeout'
)
!==
-
1
)
{
notification
.
error
({
message
:
'提示'
,
...
...
@@ -645,7 +458,6 @@ const VectorData = props => {
description
:
err
.
message
,
});
}
setTreeLoading
(
false
);
});
};
...
...
@@ -659,6 +471,7 @@ const VectorData = props => {
});
Promise
.
all
([
webSchemeQueryRequest
])
.
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
[
0
].
code
==
'0'
)
{
let
arr
=
[];
res
[
0
].
data
.
optionalLayer
.
layers
.
map
((
item
,
index
)
=>
{
...
...
@@ -671,22 +484,22 @@ const VectorData = props => {
return
item
;
});
setWebData
(
res
[
0
].
data
.
optionalLayer
.
layers
);
if
(
arr
.
indexOf
(
true
)
==
-
1
)
{
if
(
arr
.
indexOf
(
true
)
==
-
1
&&
arr
.
length
>
0
)
{
arr
[
arr
.
length
-
1
]
=
true
;
setWebStatus
(
arr
);
onChangeCheck1
(
''
,
onChangeCheck
(
res
[
0
].
data
.
optionalLayer
.
layers
[
arr
.
length
-
1
],
arr
.
length
-
1
,
arr
,
res
[
0
].
data
.
optionalLayer
.
layers
,
);
}
else
{
setWebStatus
(
arr
);
}
}
setCheckLoading
(
false
);
})
.
catch
(
err
=>
{
setCheckLoading
(
false
);
if
(
err
.
message
.
indexOf
(
'timeout'
)
!==
-
1
)
{
notification
.
error
({
message
:
'提示'
,
...
...
@@ -700,7 +513,6 @@ const VectorData = props => {
description
:
err
.
message
,
});
}
setTreeLoading
(
false
);
});
};
...
...
@@ -714,8 +526,7 @@ const VectorData = props => {
<
div
className=
{
styles
.
tableContent
}
>
<
Divider
orientation=
"left"
>
<
div
className=
{
styles
.
divider
}
>
{
' '
}
Web
{
' '
}
Web
<
PlusOutlined
onClick=
{
()
=>
{
addType
(
'add'
);
...
...
@@ -728,7 +539,6 @@ const VectorData = props => {
columns=
{
columns
}
dataSource=
{
webData
}
bordered
// style={{ height: 'calc(100vh - 610px)' }}
pagination=
{
false
}
rowKey=
"schemename"
scroll=
{
{
y
:
600
}
}
...
...
@@ -737,7 +547,7 @@ const VectorData = props => {
<
div
className=
{
styles
.
tableContent
}
>
<
Divider
orientation=
"left"
>
<
div
className=
{
styles
.
divider
}
>
Moblie
{
' '
}
Moblie
<
PlusOutlined
onClick=
{
()
=>
{
addType
(
'addHand'
);
...
...
@@ -752,7 +562,6 @@ const VectorData = props => {
bordered
rowKey=
"schemename"
scroll=
{
{
y
:
600
}
}
// style={{ height: 'calc(100vh - 610px)' }}
pagination=
{
false
}
/>
</
div
>
...
...
@@ -766,15 +575,6 @@ const VectorData = props => {
formObj=
{
formObj
}
listData=
{
schemename
}
/>
{
/* <VisibleRoleModal
visible={addVisible}
onCancel={() => setAddVisible(false)}
onSubmit={onPushSubmit}
title="关联角色"
initValues={checkValue}
tree={tree}
leafs={leafs}
/> */
}
<
RMSComponents
visible=
{
addVisible
}
onCancel=
{
()
=>
{
...
...
@@ -789,14 +589,6 @@ const VectorData = props => {
gisType=
{
gisType
}
// isRadio={true} // 站点单选
/>
{
/* <RoleModal
selectValue={checkValue.toString()}
visible={addVisible}
rolCallBack={roleList => rolCallBack(roleList)}
onCancel={() => {
setAddVisible(false);
}}
/> */
}
</
div
>
);
};
...
...
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