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
306bad43
Commit
306bad43
authored
Jul 24, 2023
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '选件反馈怎加异常事件反馈配置'
parent
e9233875
Pipeline
#76519
passed with stages
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
133 additions
and
118 deletions
+133
-118
AddModal.jsx
...ages/bsmanager/patrolMaintenance/maintenance/AddModal.jsx
+7
-2
AddModal.jsx
...s/bsmanager/patrolMaintenance/patrolFeedback/AddModal.jsx
+122
-116
api.js
src/services/PatrolFeedback/api.js
+4
-0
No files found.
src/pages/bsmanager/patrolMaintenance/maintenance/AddModal.jsx
View file @
306bad43
...
...
@@ -154,7 +154,11 @@ const AddModal = props => {
setType2
(
''
);
setFiled1
({});
}
else
if
(
type
===
'edit'
)
{
onChangeFeed
(
formObj
.
feedbackName
,
''
,
JSON
.
parse
(
formObj
.
mappingFields
));
onChangeFeed
(
formObj
.
feedbackName
,
''
,
formObj
.
mappingFields
&&
JSON
.
parse
(
formObj
.
mappingFields
),
);
CM_XWBPlan_DataList
({
id
:
formObj
.
id
}).
then
(
res
=>
{
let
data
=
res
.
data
[
0
];
if
(
data
.
isSubmit
===
'是'
)
{
...
...
@@ -790,7 +794,8 @@ const AddModal = props => {
<
Select
placeholder=
"选择业务类型"
onSearch=
{
inputType
}
showSearch
>
<
Option
value=
"巡检"
>
巡检
</
Option
>
<
Option
value=
"保养"
>
保养
</
Option
>
<
Option
value=
"水厂"
>
水厂
</
Option
>
<
Option
value=
"水箱清洗"
>
水箱清洗
</
Option
>
<
Option
value=
"扫码巡检"
>
扫码巡检
</
Option
>
</
Select
>
</
Item
>
</
Col
>
...
...
src/pages/bsmanager/patrolMaintenance/patrolFeedback/AddModal.jsx
View file @
306bad43
...
...
@@ -31,6 +31,7 @@ import {
CM_Feedback_QueryPatrolFeedback
,
GetTaskSyncField
,
GetGisPatrolObject
,
GetGisFeedbackTableFields
,
}
from
'@/services/PatrolFeedback/api'
;
import
{
GetCM_Event_LoadEventTable
,
...
...
@@ -66,7 +67,7 @@ const AddModal = props => {
const
[
keepFiled
,
setKeepFiled
]
=
useState
([]);
const
[
eventData
,
setEventData
]
=
useState
([]);
const
[
keepData
,
setKeepData
]
=
useState
(
''
);
const
[
keep
,
set
k
eep
]
=
useState
([]);
// 保存初始完整任务同步事件字段
const
[
keep
,
set
K
eep
]
=
useState
([]);
// 保存初始完整任务同步事件字段
const
[
keepAllData
,
setKeepAllData
]
=
useState
([]);
// 保存所有关联事件类型数据
const
[
keepTree
,
setKeepTree
]
=
useState
([]);
const
[
keepAll
,
setKeepAll
]
=
useState
([]);
// 保存所选关联事件下完整的字段值
...
...
@@ -85,6 +86,7 @@ const AddModal = props => {
getGisPatrolObject
();
if
(
visible
)
{
if
(
type
===
'edit'
)
{
onChangeTableName
(
formObj
.
tableName
,
''
);
CM_Feedback_QueryPatrolFeedback
({
id
:
formObj
.
id
}).
then
(
res
=>
{
form
.
setFieldsValue
({
...
res
.
data
});
console
.
log
(
res
.
data
);
...
...
@@ -122,46 +124,47 @@ const AddModal = props => {
form
.
resetFields
();
setKeepTree
([]);
setKeepData
(
''
);
set
k
eep
([]);
set
K
eep
([]);
setKeepAll
([]);
}
},
[
visible
]);
// 获取字段名数据
const
getGetTaskSyncField
=
e
=>
{
GetTaskSyncField
().
then
(
res
=>
{
if
(
res
.
code
===
'0'
)
{
// 编辑时处理数据为下拉框过滤调已选数据
const
getGetTaskSyncField
=
(
e
,
newKeep
)
=>
{
let
dataList
=
newKeep
?
newKeep
:
keep
;
if
(
e
)
{
// 编辑时
let
datalist
=
[...
e
];
datalist
.
map
(
i
=>
{
res
.
data
.
map
(
j
=>
{
if
(
j
.
value
===
i
.
fromField
)
{
i
.
fromField
=
j
.
key
;
}
});
});
formAdd
.
setFieldsValue
({
parmars
:
datalist
});
// 处理数据让下拉框回显title值
let
aa
=
e
;
let
from
=
[];
aa
.
map
(
i
=>
{
aa
.
forEach
(
i
=>
{
if
(
i
&&
i
.
fromField
)
{
from
.
push
(
i
.
fromField
);
from
.
push
(
`
${
i
.
fromField
}
%
${
i
.
fromTable
}
`
);
}
});
let
lastFrom
=
[];
res
.
data
.
map
(
j
=>
{
if
(
from
.
indexOf
(
j
.
key
)
==
-
1
)
{
dataList
.
forEach
(
j
=>
{
if
(
from
.
indexOf
(
j
)
=
==
-
1
)
{
lastFrom
.
push
(
j
);
}
});
setKeepData
(
lastFrom
);
// let bb = detailData(dataList, from);
// setKeepData(lastFrom);
// setKeep(lastFrom);
let
arr
=
[];
datalist
.
forEach
(
i
=>
{
if
(
i
.
fromTable
)
{
arr
.
push
({
fromField
:
`
${
i
.
fromField
}
%
${
i
.
fromTable
}
`
,
toField
:
i
.
toField
});
}
else
{
setKeepData
(
res
.
data
);
}
setkeep
(
res
.
data
);
arr
.
push
({
fromField
:
i
.
fromField
,
toField
:
i
.
toField
});
}
});
setTimeout
(()
=>
{
formAdd
.
setFieldsValue
({
parmars
:
arr
});
// 处理数据让下拉框回显title值
},
0
);
}
else
{
setKeepData
(
dataList
);
}
};
const
getGisPatrolObject
=
()
=>
{
...
...
@@ -354,14 +357,12 @@ const AddModal = props => {
form
.
validateFields
().
then
(
validate
=>
{
if
(
validate
)
{
let
obj
=
form
.
getFieldsValue
();
let
objaa
=
formAdd
.
getFieldValue
(
'parmars'
);
objaa
&&
objaa
.
map
(
i
=>
{
keep
.
map
(
j
=>
{
if
(
j
.
key
===
i
.
fromField
)
{
i
.
fromField
=
j
.
value
;
}
});
let
mappingFields
=
formAdd
.
getFieldValue
(
'parmars'
);
mappingFields
&&
mappingFields
.
forEach
(
i
=>
{
let
data
=
i
.
fromField
.
split
(
'%'
);
i
.
fromField
=
data
[
0
];
i
.
fromTable
=
data
[
1
];
});
obj
.
businessGroup
=
obj
.
businessGroup
.
toString
();
let
list
=
[];
...
...
@@ -375,7 +376,7 @@ const AddModal = props => {
CM_Feedback_OperatePatrolFeedback
({
...
obj
,
gisServerName
:
groupNameSever
,
mappingFields
:
objaa
&&
JSON
.
stringify
(
objaa
),
mappingFields
:
mappingFields
&&
JSON
.
stringify
(
mappingFields
),
}).
then
(
res
=>
{
if
(
res
.
msg
==
''
)
{
callBackSubmit
();
...
...
@@ -397,7 +398,7 @@ const AddModal = props => {
...
obj
,
gisServerName
:
groupNameSever
,
id
:
formObj
.
id
,
mappingFields
:
objaa
&&
JSON
.
stringify
(
objaa
),
mappingFields
:
mappingFields
&&
JSON
.
stringify
(
mappingFields
),
}).
then
(
res
=>
{
if
(
res
.
msg
==
''
)
{
callBackSubmit
();
...
...
@@ -477,8 +478,22 @@ const AddModal = props => {
}
};
const
onChangeTableName
=
e
=>
{
const
onChangeTableName
=
(
e
,
flag
,
str
)
=>
{
getFields
(
e
);
GetGisFeedbackTableFields
({
feedbackTableName
:
e
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
let
newData
=
[
res
.
data
.
DeviceData
];
res
.
data
.
FeedbackData
.
length
>
0
&&
res
.
data
.
FeedbackData
.
forEach
(
i
=>
{
newData
.
push
(
i
);
});
setKeepData
(
newData
);
setKeep
(
newData
);
}
});
if
(
flag
)
{
formAdd
.
setFieldsValue
({
parmars
:
[]
});
}
};
const
formateArrDataA
=
(
initialArr
,
name
)
=>
{
...
...
@@ -524,78 +539,9 @@ const AddModal = props => {
return
tempObj
;
};
const
formateArrDataA1
=
(
initialArr
,
name
)
=>
{
let
aa
=
[];
let
a1
=
[];
let
a2
;
let
a3
=
[];
initialArr
.
data
.
map
(
i
=>
{
// console.log(i.groupType)
a2
=
i
.
groupType
;
// console.log(a2)
// console.log(i.root)
a1
=
i
.
root
;
a1
.
map
(
j
=>
{
j
.
group
=
a2
;
// console.log(j)
});
aa
.
push
(
i
.
root
);
});
// console.log(aa)
aa
.
map
(
p
=>
{
// console.log(p)
p
.
map
(
o
=>
{
// console.log(o)
a3
.
push
(
o
);
});
});
console
.
log
(
a3
);
// 判定传参是否符合规则
if
(
!
(
a3
instanceof
Array
))
{
return
'请传入正确格式的数组'
;
}
if
(
!
name
)
{
return
'请传入对象属性'
;
}
// 先获取一下这个数组中有多少个"name"
let
nameArr
=
[];
a3
.
map
(
i
=>
{
if
(
nameArr
.
indexOf
(
i
.
group
)
===
-
1
)
{
nameArr
.
push
(
i
.
group
);
}
});
console
.
log
(
nameArr
);
// 新建一个包含多个list的结果对象
let
tempObj
=
{};
// 根据不同的"name"生成多个数组
for
(
let
k
in
nameArr
)
{
for
(
let
j
in
a3
)
{
if
(
a3
[
j
].
group
==
nameArr
[
k
])
{
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj
[
nameArr
[
k
]]
=
tempObj
[
nameArr
[
k
]]
||
[];
tempObj
[
nameArr
[
k
]].
push
(
a3
[
j
]);
}
}
}
for
(
let
key
in
tempObj
)
{
let
arr
=
[];
tempObj
[
key
].
map
(
item
=>
{
tempObj
[
key
]
=
arr
;
arr
.
push
(
item
.
Name
);
});
}
console
.
log
(
tempObj
);
return
tempObj
;
};
const
onOK
=
prop
=>
{
console
.
log
(
prop
);
setIsVisibleRoles
(
false
);
let
inputText
=
{};
console
.
log
(
inputText
);
console
.
log
(
inputText
[
prop
.
pickItem
]);
inputText
[
prop
.
pickItem
]
=
prop
.
str
;
setCheckedList1
(
prop
.
stt
);
form
.
setFieldsValue
(
inputText
);
...
...
@@ -609,11 +555,6 @@ const AddModal = props => {
form
.
setFieldsValue
(
inputText
);
};
const
changTable
=
(
value
,
e
)
=>
{
console
.
log
(
value
);
console
.
log
(
e
.
key
);
};
// 改变关联事件类型
const
onChangeEvent
=
(
e
,
i
)
=>
{
if
(
!
i
||
!
e
)
{
...
...
@@ -638,10 +579,8 @@ const AddModal = props => {
};
const
changeValue
=
()
=>
{
console
.
log
(
formAdd
.
getFieldsValue
().
parmars
);
let
aa
=
formAdd
.
getFieldsValue
().
parmars
;
if
(
aa
)
{
console
.
log
(
aa
);
let
from
=
[];
let
to
=
[];
aa
.
map
(
i
=>
{
...
...
@@ -655,14 +594,11 @@ const AddModal = props => {
let
lastFrom
=
[];
let
lastTo
=
[];
console
.
log
(
from
);
console
.
log
(
keep
);
keep
.
map
(
j
=>
{
if
(
from
.
indexOf
(
j
.
key
)
==
-
1
)
{
lastFrom
.
push
(
j
);
}
});
console
.
log
(
lastFrom
);
setKeepData
(
lastFrom
);
keepAll
.
map
(
j
=>
{
...
...
@@ -701,6 +637,19 @@ const AddModal = props => {
setShowRule
(
true
);
};
const
mapTreeFiled
=
(
org
,
parent
)
=>
{
if
(
org
.
TableFields
)
{
return
(
<
TreeNode
value=
{
org
.
TableName
}
title=
{
org
.
TableName
}
disabled
>
{
org
.
TableFields
.
map
(
item
=>
mapTreeFiled
(
item
,
org
.
TableName
))
}
</
TreeNode
>
);
}
return
(
<
TreeNode
value=
{
`${org.FieldName}%${parent}`
}
title=
{
org
.
FieldName
}
key=
{
org
.
FieldName
}
/>
);
};
return
(
<
Drawer
title=
"反馈配置"
...
...
@@ -903,6 +852,31 @@ const AddModal = props => {
</
div
>
</
Item
>
</
Col
>
{
form
.
getFieldsValue
().
feedbackRule
!==
''
?
(
<
Col
span=
{
23
}
>
<
Item
label=
"关联事件"
name=
"relationEvent"
labelCol=
{
{
span
:
4
}
}
rules=
{
[{
required
:
true
,
message
:
'请选择关联事件类型'
}]
}
>
<
Select
placeholder=
"选择关联事件类型"
onChange=
{
e
=>
onChangeEvent
(
e
)
}
showSearch
allowClear
>
{
eventData
?
eventData
.
map
((
item
,
index
)
=>
(
<
Option
key=
{
index
}
value=
{
item
}
>
{
item
}
</
Option
>
))
:
''
}
</
Select
>
</
Item
>
</
Col
>
)
:
(
<
Col
span=
{
23
}
>
<
Item
label=
"关联事件"
name=
"relationEvent"
labelCol=
{
{
span
:
4
}
}
>
<
Select
...
...
@@ -921,6 +895,8 @@ const AddModal = props => {
</
Select
>
</
Item
>
</
Col
>
)
}
<
Col
span=
{
23
}
>
<
span
style=
{
{
fontSize
:
'12px'
,
color
:
'#bfbcbc'
,
marginLeft
:
'80px'
}
}
>
当配置了关联事件后,可配置字段映射规则
...
...
@@ -953,9 +929,24 @@ const AddModal = props => {
name=
{
[
name
,
'fromField'
]
}
fieldKey=
{
[
fieldKey
,
'key'
]
}
validateTrigger=
{
[
'onChange'
,
'onBlur'
]
}
rules=
{
[{
required
:
true
,
message
:
'请填写字段名'
}]
}
rules=
{
[
{
required
:
true
,
message
:
'请填写字段名'
},
{
validator
:
(
rule
,
value
)
=>
{
if
(
value
)
{
let
filterValue
=
formAdd
.
getFieldsValue
().
parmars
;
let
num
=
filterValue
.
findIndex
(
i
=>
i
.
fromField
===
value
);
let
index
=
rule
.
field
.
split
(
'.'
)[
1
];
if
(
num
!==
undefined
&&
num
!==
Number
(
index
))
{
return
Promise
.
reject
(
'字段重复'
);
}
}
return
Promise
.
resolve
();
},
},
]
}
>
<
Select
{
/*
<Select
placeholder="选择字段名"
// onSelect={changTable}
// optionLabelProp="key"
...
...
@@ -969,7 +960,23 @@ const AddModal = props => {
</Option>
))
: ''}
</
Select
>
</Select> */
}
<
TreeSelect
showSearch
dropdownStyle=
{
{
maxHeight
:
400
,
overflow
:
'auto'
}
}
placeholder=
"请选择字段名"
treeDefaultExpandAll
style=
{
{
width
:
'159px'
}
}
showCheckedStrategy
onFocus=
{
()
=>
{
let
obj
=
form
.
getFieldsValue
().
tableName
;
if
(
!
obj
)
{
message
.
warning
(
'请先选择反馈名称!'
);
}
}
}
>
{
keepData
.
length
>
0
&&
keepData
.
map
(
i
=>
mapTreeFiled
(
i
))
}
</
TreeSelect
>
</
Form
.
Item
>
<
img
src=
{
logo
}
style=
{
{
height
:
'24px'
}
}
alt=
""
/>
<
Form
.
Item
...
...
@@ -1008,7 +1015,6 @@ const AddModal = props => {
block
icon=
{
<
PlusOutlined
/>
}
style=
{
{
marginLeft
:
'-2px'
}
}
disabled=
{
keepData
&&
!
(
keepData
.
length
>
0
)
}
>
添加映射
</
Button
>
...
...
src/services/PatrolFeedback/api.js
View file @
306bad43
...
...
@@ -49,3 +49,7 @@ export const GetTaskSyncField = query =>
get
(
`
${
PANDA_GIS
}
/PatrolInspection/GetTaskSyncField`
,
query
);
export
const
GetGisPatrolObject
=
query
=>
get
(
`
${
PANDA_GIS
}
/MapLayer/GetGisPatrolObject`
,
query
);
// 获取GIS反馈表字段
export
const
GetGisFeedbackTableFields
=
query
=>
get
(
`
${
PUBLISH_SERVICE
}
/WorkOrderCenter/GetGisFeedbackTableFields`
,
query
);
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