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
08310f08
Commit
08310f08
authored
Aug 03, 2022
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '权限选择器全局组件'
parent
b9dd692f
Pipeline
#56794
waiting for manual action with stages
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
985 additions
and
222 deletions
+985
-222
index.jsx
src/components/RolePmSite/index.jsx
+684
-0
index.less
src/components/RolePmSite/index.less
+156
-0
AddModal.jsx
...ages/bsmanager/patrolMaintenance/maintenance/AddModal.jsx
+17
-2
ChangeAdd.jsx
...ges/bsmanager/patrolMaintenance/maintenance/ChangeAdd.jsx
+49
-157
AddModal.jsx
...s/bsmanager/patrolMaintenance/patrolFeedback/AddModal.jsx
+14
-1
ChangeFields.jsx
...manager/patrolMaintenance/patrolFeedback/ChangeFields.jsx
+7
-3
AddFlowsModal.jsx
src/pages/bsmanager/workOrder/incident/AddFlowsModal.jsx
+14
-47
AddModal.jsx
src/pages/bsmanager/workOrder/incident/AddModal.jsx
+39
-2
changeEdit.jsx
src/pages/bsmanager/workOrder/incident/changeEdit.jsx
+5
-10
No files found.
src/components/RolePmSite/index.jsx
0 → 100644
View file @
08310f08
/* eslint-disable no-else-return */
/* eslint-disable no-cond-assign */
/* eslint-disable react/no-array-index-key */
/* eslint-disable no-undef */
/* eslint-disable guard-for-in */
/* eslint-disable no-restricted-syntax */
/* eslint-disable camelcase */
/* eslint-disable react/jsx-no-undef */
/* eslint-disable valid-typeof */
/* eslint-disable no-unused-vars */
/* eslint-disable consistent-return */
/* eslint-disable no-shadow */
/* eslint-disable indent */
/* eslint-disable no-unused-expressions */
/* eslint-disable array-callback-return */
/* eslint-disable eqeqeq */
/* eslint-disable no-plusplus */
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Modal
,
Checkbox
,
Tabs
,
Input
,
Button
,
Pagination
,
Empty
,
Tag
}
from
'antd'
;
import
{
CM_Event_LoadDepartmentAndRoles
}
from
'@/services/standingBook/api'
;
import
styles
from
'./index.less'
;
const
CheckboxGroup
=
Checkbox
.
Group
;
const
{
TabPane
}
=
Tabs
;
const
RMSComponents
=
props
=>
{
const
{
callBackSubmit
=
()
=>
{},
pickItem
,
visible
,
filed11
,
newCheckedList
,
groupName
,
chooseGroupName
,
}
=
props
;
const
[
checkedList
,
setCheckedList
]
=
useState
([]);
// 选中复选框内容
const
[
searchWord
,
setSearchWord
]
=
useState
(
''
);
// 关键字
const
{
Search
}
=
Input
;
const
[
total
,
setTotal
]
=
useState
();
const
[
pageSize
,
setPageSize
]
=
useState
(
45
);
const
[
currentPage
,
setCurrentPage
]
=
useState
(
1
);
const
[
roleValue
,
setRoleValue
]
=
useState
([]);
const
[
checkDataRole
,
setCheckDataRole
]
=
useState
([]);
const
[
checkDataPm
,
setCheckDataPm
]
=
useState
([]);
const
[
checkDataSite
,
setCheckDataSite
]
=
useState
([]);
const
[
filed1
,
setFiled1
]
=
useState
([]);
// 角色全部数据
const
[
saveCheckValue
,
setSaveCheckValue
]
=
useState
([]);
// 保存选中值
const
[
keepTabKey
,
setKeepTabKey
]
=
useState
(
0
);
// 保存tabs的key
const
[
list
,
setList
]
=
useState
([]);
const
[
listPm
,
setListPm
]
=
useState
([]);
const
[
listSite
,
setListSite
]
=
useState
([]);
const
[
keyValue
,
setKeyValue
]
=
useState
(
'0'
);
const
[
emptyValue
,
setEmptyValue
]
=
useState
(
0
);
const
[
selected
,
setSelected
]
=
useState
(
new
Map
());
// 已勾选角色列表
const
onSubmit
=
()
=>
{
let
selectData
=
[];
selected
.
forEach
((
val
,
key
)
=>
{
selectData
.
push
(
key
);
});
callBackSubmit
({
str
:
selectData
.
join
(
','
),
pickItem
,
stt
:
selectData
,
});
setKeyValue
(
'0'
);
setSearchWord
(
''
);
};
useEffect
(()
=>
{
if
(
visible
)
{
if
(
groupName
==
'角色'
)
{
setKeyValue
(
'0'
);
setKeepTabKey
(
0
);
}
else
if
(
groupName
==
'部门'
)
{
setKeyValue
(
'1'
);
setKeepTabKey
(
1
);
}
else
if
(
groupName
==
'站点'
)
{
setKeyValue
(
'2'
);
setKeepTabKey
(
2
);
}
getRoles
(
groupName
,
''
,
pageSize
,
1
);
setRoleValue
(
filed1
);
let
arr
=
Object
.
keys
(
filed1
);
let
checkArr
=
[];
// 角色
let
listdata
=
[];
newCheckedList
.
map
(
checkItem
=>
{
if
(
filed11
[
'角色'
].
includes
(
checkItem
))
{
listdata
.
push
(
checkItem
);
}
});
let
cs
=
selected
;
listdata
.
map
(
i
=>
{
cs
.
set
(
i
,
{
type
:
0
,
});
});
setSelected
(
cs
);
setCheckDataRole
(
listdata
);
// 用于设置首次展示已选列表角色数据
checkArr
[
0
]
=
listdata
;
// 部门
let
pmdata
=
[];
newCheckedList
.
map
(
checkItem
=>
{
if
(
filed11
[
'部门'
].
includes
(
checkItem
))
{
pmdata
.
push
(
checkItem
);
}
});
let
cs1
=
selected
;
pmdata
.
map
(
i
=>
{
cs1
.
set
(
i
,
{
type
:
1
,
});
});
setSelected
(
cs1
);
setCheckDataPm
(
pmdata
);
checkArr
[
1
]
=
pmdata
;
// 站点
let
sitedata
=
[];
newCheckedList
.
map
(
checkItem
=>
{
if
(
filed11
[
'站点'
].
includes
(
checkItem
))
{
sitedata
.
push
(
checkItem
);
}
});
let
cs2
=
selected
;
sitedata
.
map
(
i
=>
{
cs2
.
set
(
i
,
{
type
:
2
,
});
});
setSelected
(
cs2
);
setCheckDataSite
(
sitedata
);
checkArr
[
2
]
=
sitedata
;
setSaveCheckValue
(
checkArr
);
setCheckedList
(
checkArr
);
}
else
{
setSelected
(
new
Map
());
setPageSize
(
45
);
setCurrentPage
(
1
);
}
},
[
visible
]);
const
submitSearchUser
=
()
=>
{
if
(
keepTabKey
==
0
)
{
sreachRoles
(
'角色'
,
searchWord
,
pageSize
,
1
);
}
if
(
keepTabKey
==
1
)
{
sreachRoles
(
'部门'
,
searchWord
,
pageSize
,
1
);
}
if
(
keepTabKey
==
2
)
{
sreachRoles
(
'站点'
,
searchWord
,
pageSize
,
1
);
}
};
// 获取搜索框的值
const
handleSearch
=
e
=>
{
setSearchWord
(
e
.
target
.
value
);
};
// 监听分页
const
paginationChange
=
(
page
,
pageSizes
)
=>
{
if
(
keepTabKey
==
0
)
{
getRoles
(
'角色'
,
searchWord
,
pageSizes
,
page
);
}
if
(
keepTabKey
==
1
)
{
getRoles
(
'部门'
,
searchWord
,
pageSizes
,
page
);
}
if
(
keepTabKey
==
2
)
{
getRoles
(
'站点'
,
searchWord
,
pageSizes
,
page
);
}
setCurrentPage
(
page
);
setPageSize
(
pageSizes
);
};
// 搜索时获取数据
const
sreachRoles
=
(
type
,
keywords
,
pageSizes
,
pageIndex
)
=>
{
CM_Event_LoadDepartmentAndRoles
({
type
,
keywords
,
pageSize
:
pageSizes
,
pageIndex
,
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
console
.
log
(
formateArrDataA1
(
res
.
data
,
'groupType'
));
setRoleValue
(
formateArrDataA1
(
res
.
data
,
'groupType'
));
setFiled1
(
formateArrDataA1
(
res
.
data
,
'groupType'
));
setCurrentPage
(
1
);
setTotal
(
res
.
data
.
count
);
if
(
res
.
data
.
count
==
0
)
{
setEmptyValue
(
1
);
}
else
{
setEmptyValue
(
0
);
}
}
});
};
const
getRoles
=
(
type
,
keywords
,
pageSizes
,
pageIndex
)
=>
{
CM_Event_LoadDepartmentAndRoles
({
type
,
keywords
,
pageSize
:
pageSizes
,
pageIndex
,
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
setTotal
(
res
.
data
.
count
);
console
.
log
(
formateArrDataA1
(
res
.
data
,
'groupType'
));
setRoleValue
(
formateArrDataA1
(
res
.
data
,
'groupType'
));
setFiled1
(
formateArrDataA1
(
res
.
data
,
'groupType'
));
if
(
res
.
data
.
count
==
0
)
{
setEmptyValue
(
1
);
}
else
{
setEmptyValue
(
0
);
}
}
});
};
// 页面数据改变重新赋值
useEffect
(()
=>
{
let
arr
=
Object
.
keys
(
filed1
);
let
checkArr
=
[];
let
data
=
[];
saveCheckValue
.
map
((
item
,
index
)
=>
{
data
=
data
.
concat
(
item
);
});
arr
.
forEach
(
item
=>
{
if
(
item
==
'角色'
)
{
checkArr
[
0
]
=
[];
checkDataRole
.
map
(
checkItem
=>
{
if
(
filed1
[
'角色'
].
includes
(
checkItem
))
{
checkArr
[
0
].
push
(
checkItem
);
}
});
setCheckedList
(
checkArr
);
// 按对象数组格式
}
else
if
(
item
==
'部门'
)
{
checkArr
[
1
]
=
[];
checkDataPm
.
map
(
checkItem
=>
{
if
(
filed1
[
'部门'
].
includes
(
checkItem
))
{
checkArr
[
1
].
push
(
checkItem
);
}
});
setCheckedList
(
checkArr
);
}
else
if
(
item
==
'站点'
)
{
checkArr
[
2
]
=
[];
checkDataSite
.
map
(
checkItem
=>
{
if
(
filed1
[
'站点'
].
includes
(
checkItem
))
{
checkArr
[
2
].
push
(
checkItem
);
}
});
setCheckedList
(
checkArr
);
}
});
},
[
filed1
]);
const
formateArrDataA1
=
(
initialArr
,
name
)
=>
{
let
aa
=
[];
let
a1
=
[];
let
a2
;
let
a3
=
[];
initialArr
.
data
.
map
(
i
=>
{
a2
=
i
.
groupType
;
a1
=
i
.
root
;
a1
.
map
(
j
=>
{
j
.
group
=
a2
;
});
aa
.
push
(
i
.
root
);
});
aa
.
map
(
p
=>
{
p
.
map
(
o
=>
{
a3
.
push
(
o
);
});
});
// 判定传参是否符合规则
if
(
!
(
a3
instanceof
Array
))
{
return
'请传入正确格式的数组'
;
}
if
(
!
name
)
{
return
'请传入对象属性'
;
}
// 先获取一下这个数组中有多少个"name"
let
nameArr
=
[];
a3
.
map
(
i
=>
{
if
(
nameArr
.
indexOf
(
i
.
group
)
===
-
1
)
{
nameArr
.
push
(
i
.
group
);
}
});
// 新建一个包含多个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
);
});
}
return
tempObj
;
};
useEffect
(()
=>
{
let
checkedListArr
=
[...
saveCheckValue
];
let
data
=
checkDataRole
;
let
DataValue
=
[];
// 拿到当前页数据
checkDataRole
.
forEach
(
item
=>
{
if
(
roleValue
[
'角色'
]
&&
roleValue
[
'角色'
].
indexOf
(
item
)
!=
-
1
)
{
DataValue
.
push
(
item
);
}
});
// del
if
(
DataValue
.
length
>
list
.
length
)
{
DataValue
.
forEach
(
item
=>
{
if
(
list
.
indexOf
(
item
)
==
-
1
)
{
data
.
splice
(
data
.
findIndex
(
ele
=>
ele
===
item
),
1
);
let
hhh
=
selected
;
hhh
.
delete
(
item
);
setSelected
(
hhh
);
}
});
}
else
{
// add
list
.
forEach
(
item
=>
{
if
(
data
.
indexOf
(
item
)
==
-
1
)
{
data
.
push
(
item
);
}
});
let
cs
=
selected
;
data
.
map
(
i
=>
{
cs
.
set
(
i
,
{
type
:
0
,
});
});
setSelected
(
cs
);
}
checkedListArr
[
0
]
=
data
;
setCheckDataRole
(
data
);
setSaveCheckValue
(
checkedListArr
);
setCheckedList
(
checkedListArr
);
},
[
list
]);
useEffect
(()
=>
{
let
checkedListArr
=
[...
saveCheckValue
];
let
data
=
checkDataPm
;
let
DataValue
=
[];
// 拿到当前页数据
checkDataPm
.
forEach
(
item
=>
{
if
(
roleValue
[
'部门'
]
&&
roleValue
[
'部门'
].
indexOf
(
item
)
!=
-
1
)
{
DataValue
.
push
(
item
);
}
});
// del
if
(
DataValue
.
length
>
listPm
.
length
)
{
DataValue
.
forEach
(
item
=>
{
if
(
listPm
.
indexOf
(
item
)
==
-
1
)
{
data
.
splice
(
data
.
findIndex
(
ele
=>
ele
===
item
),
1
);
let
hhh
=
selected
;
hhh
.
delete
(
item
);
setSelected
(
hhh
);
}
});
}
else
{
// add
listPm
.
forEach
(
item
=>
{
if
(
data
.
indexOf
(
item
)
==
-
1
)
{
data
.
push
(
item
);
}
});
let
cs
=
selected
;
data
.
map
(
i
=>
{
cs
.
set
(
i
,
{
type
:
1
,
});
});
setSelected
(
cs
);
}
checkedListArr
[
1
]
=
data
;
setCheckDataPm
(
data
);
setSaveCheckValue
(
checkedListArr
);
setCheckedList
(
checkedListArr
);
},
[
listPm
]);
useEffect
(()
=>
{
const
checkedListArr
=
[...
saveCheckValue
];
let
data
=
checkDataSite
;
let
DataValue
=
[];
// 拿到当前页数据
checkDataSite
.
forEach
(
item
=>
{
if
(
roleValue
[
'站点'
]
&&
roleValue
[
'站点'
].
indexOf
(
item
)
!=
-
1
)
{
DataValue
.
push
(
item
);
}
});
// del
if
(
DataValue
.
length
>
listSite
.
length
)
{
DataValue
.
forEach
(
item
=>
{
if
(
listSite
.
indexOf
(
item
)
==
-
1
)
{
data
.
splice
(
data
.
findIndex
(
ele
=>
ele
===
item
),
1
);
let
hhh
=
selected
;
hhh
.
delete
(
item
);
setSelected
(
hhh
);
}
});
}
else
{
// add
listSite
.
forEach
(
item
=>
{
if
(
data
.
indexOf
(
item
)
==
-
1
)
{
data
.
push
(
item
);
}
});
let
cs
=
selected
;
data
.
map
(
i
=>
{
cs
.
set
(
i
,
{
type
:
2
,
});
});
setSelected
(
cs
);
}
checkedListArr
[
2
]
=
data
;
setCheckDataSite
(
data
);
setSaveCheckValue
(
checkedListArr
);
setCheckedList
(
checkedListArr
);
},
[
listSite
]);
const
handleParChange
=
key
=>
{
console
.
log
(
key
);
setKeyValue
(
key
);
// setSearchWord('');
setCurrentPage
(
1
);
setKeepTabKey
(
key
);
if
(
key
==
0
)
{
getRoles
(
'角色'
,
searchWord
,
pageSize
,
1
);
}
if
(
key
==
1
)
{
getRoles
(
'部门'
,
searchWord
,
pageSize
,
1
);
}
if
(
key
==
2
)
{
getRoles
(
'站点'
,
searchWord
,
pageSize
,
1
);
}
};
const
onChangeListNew
=
list
=>
{
setList
(
list
);
};
const
onChangeListNew1
=
list
=>
{
setListPm
(
list
);
};
const
onChangeListNew2
=
list
=>
{
setListSite
(
list
);
};
const
changeColor
=
e
=>
{
if
(
e
===
0
)
{
return
'cyan'
;
}
else
if
(
e
===
1
)
{
return
'orange'
;
}
else
{
return
'purple'
;
}
};
// 删除已选中列表
const
delSelected
=
value
=>
{
let
aa
=
selected
.
get
(
value
).
type
;
let
list
=
[];
let
checkedListArr
=
saveCheckValue
;
checkedListArr
[
aa
].
map
(
i
=>
{
if
(
i
!=
value
)
{
list
.
push
(
i
);
}
});
checkedListArr
[
aa
]
=
list
;
setSaveCheckValue
(
checkedListArr
);
setCheckedList
(
checkedListArr
);
if
(
aa
===
0
)
{
setCheckDataRole
(
list
);
}
else
if
(
aa
===
1
)
{
setCheckDataPm
(
list
);
}
else
if
(
aa
===
2
)
{
setCheckDataSite
(
list
);
}
let
hhh
=
selected
;
hhh
.
delete
(
value
);
setSelected
(
hhh
);
};
return
(
<
div
className=
{
styles
.
modalContainer
}
>
<
Modal
title=
"权限选择"
bodyStyle=
{
{
width
:
'100%'
,
height
:
'550px'
,
overflowY
:
'scorll'
}
}
width=
"1000px"
style=
{
{
top
:
'10px'
}
}
destroyOnClose
centered
cancelText=
"取消"
okText=
"确认"
{
...
props
}
onOk=
{
()
=>
onSubmit
()
}
forceRender
getContainer=
{
false
}
afterClose=
{
()
=>
{
setKeyValue
(
'0'
);
setSearchWord
(
''
);
}
}
>
<
div
className=
{
styles
.
pageContent
}
>
{
/* 可选列表 */
}
<
div
className=
{
styles
.
optionalList
}
>
<
div
className=
{
styles
.
header
}
/>
<
Search
className=
{
styles
.
searchInput
}
allowClear
placeholder=
"搜索"
onSearch=
{
submitSearchUser
}
onChange=
{
e
=>
handleSearch
(
e
)
}
value=
{
searchWord
}
/>
<
div
className=
{
styles
.
tabContent
}
>
{
visible
&&
(
<
Tabs
type=
"card"
activeKey=
{
keyValue
}
onChange=
{
handleParChange
}
>
{
/* {chooseGroupName &&
chooseGroupName.map((item, index) => {
<TabPane tab={item} key={index}>
{console.log(item)}
<div className={styles.checkContent}>
{emptyValue == 0 ? (
<div className={styles.check}>
<CheckboxGroup
options={roleValue[item]}
value={checkedList[index]}
onChange={onChangeListNew}
/>
</div>
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" />
)}
</div>
</TabPane>;
})} */
}
{
chooseGroupName
.
indexOf
(
'角色'
)
!==
-
1
?
(
<
TabPane
tab=
"角色"
key=
"0"
>
<
div
className=
{
styles
.
checkContent
}
>
{
emptyValue
==
0
?
(
<
div
className=
{
styles
.
check
}
>
<
CheckboxGroup
options=
{
roleValue
[
'角色'
]
}
value=
{
checkedList
[
0
]
}
onChange=
{
onChangeListNew
}
/>
</
div
>
)
:
(
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
description=
"暂无数据"
/>
)
}
</
div
>
</
TabPane
>
)
:
(
<></>
)
}
{
chooseGroupName
.
indexOf
(
'部门'
)
!==
-
1
?
(
<
TabPane
tab=
"部门"
key=
"1"
>
<
div
className=
{
styles
.
checkContent
}
>
{
emptyValue
==
0
?
(
<
div
className=
{
styles
.
check
}
>
<
CheckboxGroup
options=
{
roleValue
[
'部门'
]
}
value=
{
checkedList
[
1
]
}
onChange=
{
onChangeListNew1
}
/>
</
div
>
)
:
(
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
description=
"暂无数据"
/>
)
}
</
div
>
</
TabPane
>
)
:
(
<></>
)
}
{
chooseGroupName
.
indexOf
(
'站点'
)
!==
-
1
?
(
<
TabPane
tab=
"站点"
key=
"2"
>
<
div
className=
{
styles
.
checkContent
}
>
{
emptyValue
==
0
?
(
<
div
className=
{
styles
.
check
}
>
<
CheckboxGroup
options=
{
roleValue
[
'站点'
]
}
value=
{
checkedList
[
2
]
}
onChange=
{
onChangeListNew2
}
/>
</
div
>
)
:
(
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
description=
"暂无数据"
/>
)
}
</
div
>
</
TabPane
>
)
:
(
<></>
)
}
</
Tabs
>
)
}
</
div
>
{
/* 分页 */
}
<
div
className=
{
styles
.
footer
}
>
<
Pagination
size=
"small"
total=
{
total
}
showSizeChanger
defaultPageSize=
{
pageSize
}
defaultCurrent=
{
1
}
pageSizeOptions=
{
[
10
,
20
,
45
,
100
]
}
current=
{
currentPage
}
onChange=
{
paginationChange
}
style=
{
{
marginBottom
:
'10px'
}
}
/>
</
div
>
</
div
>
{
/* 已选列表 */
}
<
div
className=
{
styles
.
selectedList
}
>
<
div
className=
{
styles
.
header
}
>
<
div
className=
{
styles
.
title
}
>
已选列表
</
div
>
<
div
className=
{
styles
.
tagHead
}
>
{
chooseGroupName
.
indexOf
(
'角色'
)
!==
-
1
?
(
<
div
className=
{
styles
.
tagContent
}
>
<
div
className=
{
styles
.
tagRol
}
/>
<
div
>
角色
</
div
>
</
div
>
)
:
(
<></>
)
}
{
chooseGroupName
.
indexOf
(
'部门'
)
!==
-
1
?
(
<
div
className=
{
styles
.
tagContent
}
>
<
div
className=
{
styles
.
tagOrg
}
/>
<
div
>
部门
</
div
>
</
div
>
)
:
(
<></>
)
}
{
chooseGroupName
.
indexOf
(
'站点'
)
!==
-
1
?
(
<
div
className=
{
styles
.
tagContent
}
>
<
div
className=
{
styles
.
tagSite
}
/>
<
div
>
站点
</
div
>
</
div
>
)
:
(
<></>
)
}
</
div
>
</
div
>
<
div
className=
{
styles
.
selectBox
}
>
{
[...
selected
].
length
>
0
?
(
<
div
className=
{
styles
.
selectContent
}
>
{
[...
selected
].
map
(
item
=>
(
<
div
className=
{
styles
.
selectValue
}
key=
{
item
[
0
]
}
>
<
Tag
closable
color=
{
changeColor
(
item
[
1
].
type
)
}
onClose=
{
()
=>
delSelected
(
item
[
0
])
}
>
{
item
[
0
]
}
</
Tag
>
</
div
>
))
}
</
div
>
)
:
(
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
description=
{
`请选择${chooseGroupName.toString()}`
}
/>
)
}
</
div
>
</
div
>
</
div
>
</
Modal
>
</
div
>
);
};
export
default
RMSComponents
;
src/components/RolePmSite/index.less
0 → 100644
View file @
08310f08
.modalContainer {
.ant-modal-body {
padding: 0;
}
.ant-modal-header {
padding: 28px 16px;
}
.pageContent {
display: flex;
height: 100%;
.optionalList {
position: relative;
width: 60%;
border-right: 1px solid #e7e7e7;
.title {
position: absolute;
left: 17px;
top: 10px;
font-weight: 700;
font-size: 14px;
z-index: 1;
color: #00070d;
}
.tabContent {
height: 550px;
.ant-tabs-content-holder {
height: 480px;
}
}
.searchInput {
position: absolute;
width: 200px;
z-index: 1;
top: 3px;
right: 40px;
.anticon svg {
margin-top: 0px;
}
.ant-input,
.ant-input-affix-wrapper {
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
}
.ant-input-group-addon {
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
}
.ant-input-search-button {
width: 40px;
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
}
}
.checkContent {
display: flex;
flex-wrap: wrap;
margin-left: 32px;
.check {
.ant-checkbox-wrapper {
width: 180px;
margin-bottom: 10px;
margin-left: 6px;
}
.ant-checkbox-wrapper span {
max-width: 160px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
.footer {
padding-left: 25px;
.ant-pagination {
border: none;
}
}
.ant-tabs-nav {
background-color: #f2f1f1;
}
.ant-tabs-tab {
background-color: #f2f1f1;
color: #666666;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.ant-tabs-tab-active {
background-color: #fff;
color: #1685ff;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
}
.selectedList {
position: relative;
width: 40%;
.header {
height: 40px;
width: 100%;
background-color: #f2f1f1;
.title {
position: absolute;
left: 17px;
top: 10px;
font-weight: 700;
font-size: 14px;
z-index: 1;
color: #00070d;
}
.tagHead {
display: flex;
position: absolute;
top: 10px;
left: 88px;
.tagContent {
display: flex;
align-items: center;
margin-right: 11px;
}
.tagRol,
.tagOrg,
.tagSite {
width: 10px;
height: 3px;
margin-right: 5px;
}
.tagRol {
background-color: #87e8de;
}
.tagOrg {
background-color: #ffd591;
}
.tagSite {
background-color: #a785dd;
}
}
}
.selectBox {
height: 490px;
padding: 10px;
overflow-y: scroll;
.selectContent {
display: flex;
flex-wrap: wrap;
flex-direction: row;
.selectValue {
margin-bottom: 15px;
}
}
}
}
}
}
src/pages/bsmanager/patrolMaintenance/maintenance/AddModal.jsx
View file @
08310f08
...
...
@@ -31,6 +31,7 @@ import {
CM_XWBPlan_DataList
,
}
from
'@/services/maintenance/api'
;
import
{
CM_Event_LoadDepartmentAndRoles
}
from
'@/services/standingBook/api'
;
import
RMSComponents
from
'@/components/RolePmSite/index'
;
import
ChangeAdd
from
'./ChangeAdd'
;
...
...
@@ -56,6 +57,9 @@ const AddModal = props => {
const
[
characterValue
,
setCharacterValue
]
=
useState
(
''
);
// 打开弹框之前数据
const
[
ff
,
setFf
]
=
useState
([]);
const
[
chee
,
setChee
]
=
useState
(
''
);
const
[
isVisibleRoles
,
setIsVisibleRoles
]
=
useState
(
false
);
const
[
groupName
,
setGroupName
]
=
useState
(
'角色'
);
const
[
chooseGroupName
,
setChooseGroupName
]
=
useState
([
'角色'
]);
const
[
form
]
=
Form
.
useForm
();
const
{
Item
}
=
Form
;
...
...
@@ -181,7 +185,7 @@ const AddModal = props => {
console
.
log
(
inputValue
[
fileds
]);
console
.
log
(
inputValue
[
fileds
].
split
(
','
));
setPickItem
(
fileds
);
setIsVisible
(
true
);
setIsVisible
Roles
(
true
);
};
const
getRole
=
()
=>
{
CM_Event_LoadDepartmentAndRoles
().
then
(
res
=>
{
...
...
@@ -197,7 +201,7 @@ const AddModal = props => {
};
const
getFeedbackTable
=
()
=>
{
CM_XWBPlan_feedbackTable
().
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
if
(
res
.
code
===
0
)
{
let
arr
=
[];
res
.
data
.
map
((
item
,
index
)
=>
{
arr
.
push
(
item
.
accountName
);
...
...
@@ -278,6 +282,7 @@ const AddModal = props => {
};
const
onOK
=
prop
=>
{
console
.
log
(
prop
.
isType
);
setIsVisibleRoles
(
false
);
setIsVisible
(
false
);
console
.
log
(
props
);
let
inputText
=
{
...
inputValue
};
...
...
@@ -547,6 +552,16 @@ const AddModal = props => {
pickItem=
{
pickItem
}
characterValue=
{
characterValue
}
/>
<
RMSComponents
visible=
{
isVisibleRoles
}
onCancel=
{
()
=>
setIsVisibleRoles
(
false
)
}
callBackSubmit=
{
onOK
}
newCheckedList=
{
checkedList1
}
// 单选框中的值
filed11=
{
filed1
}
// 全部待选数据
pickItem=
{
pickItem
}
groupName=
{
groupName
}
// 打开组件展示的分组名,用来首次获取数据
chooseGroupName=
{
chooseGroupName
}
// 可选分组名
/>
</
Drawer
>
);
};
...
...
src/pages/bsmanager/patrolMaintenance/maintenance/ChangeAdd.jsx
View file @
08310f08
/* eslint-disable no-lonely-if */
/* eslint-disable eqeqeq */
import
React
,
{
useState
,
useEffect
,
PureComponent
}
from
'react'
;
import
{
Modal
,
Divider
,
Checkbox
,
Space
,
Button
}
from
'antd'
;
import
{
Modal
,
Divider
,
Checkbox
,
Space
,
Button
,
Empty
}
from
'antd'
;
import
styles
from
'./maintenance.less'
;
const
CheckboxGroup
=
Checkbox
.
Group
;
...
...
@@ -29,23 +29,10 @@ const ChangeAdd = props => {
list
.
map
((
item
,
index
)
=>
{
arr
.
push
(
item
);
});
console
.
log
(
list
);
console
.
log
(
arr
);
setCheckedList
(
arr
);
setIndeterminate
(
!!
list
.
length
&&
list
.
length
<
filed
.
length
);
setCheckAll
(
list
.
length
===
filed
.
length
);
};
const
onChangeList1
=
list
=>
{
let
arr
=
[];
list
.
map
((
item
,
index
)
=>
{
arr
.
push
(
item
);
});
console
.
log
(
list
);
console
.
log
(
arr
);
setCheckedList
(
arr
);
setIndeterminate
(
!!
list
.
length
&&
list
.
length
<
ff
.
length
);
setCheckAll
(
list
.
length
===
ff
.
length
);
};
const
onSubmit
=
()
=>
{
isType
===
'rule'
...
...
@@ -66,12 +53,9 @@ const ChangeAdd = props => {
setIndeterminate
(
false
);
setCheckAll
(
e
.
target
.
checked
);
};
const
onCheckAllChange1
=
e
=>
{
setCheckedList
(
e
.
target
.
checked
?
ff
:
[]);
setIndeterminate
(
false
);
setCheckAll
(
e
.
target
.
checked
);
};
useEffect
(()
=>
{
console
.
log
(
filed
);
selectAll
();
},
[
checkedList
]);
...
...
@@ -90,7 +74,6 @@ const ChangeAdd = props => {
if
(
isType
!=
''
&&
isType
===
'add'
)
{
// 反馈名称
let
checkArr
=
[];
console
.
log
(
newCheckedList
);
newCheckedList
.
map
(
checkItem
=>
{
if
(
filed
.
includes
(
checkItem
))
{
checkArr
.
push
(
checkItem
);
...
...
@@ -101,136 +84,32 @@ const ChangeAdd = props => {
setCheckAll
(
checkArr
.
length
===
filed
.
length
&&
filed
.
length
!=
0
);
let
newArr
=
characterValue
.
length
?
characterValue
.
split
(
','
)
:
[];
setSelectData
(
newArr
);
}
else
if
(
isType
===
'app'
)
{
// 执行角色
let
checkArr
=
[];
console
.
log
(
newCheckedList
);
newCheckedList
.
map
(
checkItem
=>
{
if
(
ff
.
includes
(
checkItem
))
{
checkArr
.
push
(
checkItem
);
}
});
setCheckedList
(
checkArr
);
setIndeterminate
(
!!
checkArr
.
length
&&
checkArr
.
length
<
ff
.
length
);
setCheckAll
(
checkArr
.
length
===
ff
.
length
&&
ff
.
length
!=
0
);
let
newArr
=
characterValue
.
length
?
characterValue
.
split
(
','
)
:
[];
setSelectData
(
newArr
);
}
}
else
{
if
(
isType
!=
''
&&
isType
===
'add'
)
{
// 反馈名称
let
checkArr
=
[];
console
.
log
(
filed
);
console
.
log
(
newCheckedList
);
newCheckedList
.
map
(
checkItem
=>
{
if
(
filed
.
includes
(
checkItem
))
{
checkArr
.
push
(
checkItem
);
}
});
console
.
log
(
checkArr
);
setCheckedList
(
checkArr
);
setIndeterminate
(
!!
checkArr
.
length
&&
checkArr
.
length
<
filed
.
length
);
setCheckAll
(
checkArr
.
length
===
filed
.
length
&&
filed
.
length
!=
0
);
let
newArr
=
characterValue
.
length
?
characterValue
.
split
(
','
)
:
[];
setSelectData
(
newArr
);
}
else
if
(
isType
===
'app'
)
{
// 执行角色
let
checkArr
=
[];
console
.
log
(
newCheckedList
);
newCheckedList
.
map
(
checkItem
=>
{
if
(
ff
.
includes
(
checkItem
))
{
checkArr
.
push
(
checkItem
);
}
});
setCheckedList
(
checkArr
);
setIndeterminate
(
!!
checkArr
.
length
&&
checkArr
.
length
<
ff
.
length
);
setCheckAll
(
checkArr
.
length
===
ff
.
length
&&
ff
.
length
!=
0
);
let
newArr
=
characterValue
.
length
?
characterValue
.
split
(
','
)
:
[];
setSelectData
(
newArr
);
}
}
},
[
visible
]);
if
(
isType
!=
'app'
)
{
return
(
<
div
className=
{
styles
.
ChangeAddContainer
}
>
<
Modal
title=
"反馈名称"
bodyStyle=
{
{
width
:
'100%'
,
minHeight
:
'100px'
}
}
style=
{
{
top
:
'10px'
}
}
width=
"400px"
destroyOnClose
centered
cancelText=
"取消"
okText=
"确认"
{
...
props
}
onOk=
{
()
=>
onSubmit
()
}
forceRender
getContainer=
{
false
}
>
{
visible
&&
(
<
div
className=
{
styles
.
listCard
}
>
<
div
className=
{
styles
.
cardItem
}
>
{
JSON
.
stringify
(
filed
)
==
'{}'
?
(
<>
<
div
className=
{
styles
.
cardContent
}
>
<
span
style=
{
{
color
:
'red'
,
fontSize
:
'1rem'
,
marginLeft
:
'25px'
,
}
}
>
暂无数据请先配置台账管理台账名称为反馈
</
span
>
</
div
>
</>
)
:
(
<>
<
div
className=
{
styles
.
cardContent
}
>
<
div
className=
{
styles
.
cardItemData
}
>
<
Divider
orientation=
"left"
style=
{
{
margin
:
'0 0 5px 0'
,
color
:
'#15428b'
,
borderTopColor
:
'#99bbe8'
,
}
}
>
全选
<
Checkbox
style=
{
{
marginLeft
:
'10px'
}
}
indeterminate=
{
indeterminate
}
onChange=
{
onCheckAllChange
}
checkvalue=
{
filed
}
checked=
{
checkAll
}
>
{
' '
}
</
Checkbox
>
</
Divider
>
<
CheckboxGroup
options=
{
filed
}
value=
{
checkedList
}
onChange=
{
e
=>
onChangeList
(
e
)
}
/>
</
div
>
</
div
>
</>
)
}
</
div
>
</
div
>
)
}
</
Modal
>
</
div
>
);
}
if
(
isType
===
'app'
)
{
return
(
return
(
<
div
className=
{
styles
.
ChangeAddContainer
}
>
<
Modal
title=
"
角色
"
title=
"
反馈名称
"
bodyStyle=
{
{
width
:
'100%'
,
minHeight
:
'100px'
}
}
style=
{
{
top
:
'10px'
}
}
width=
"4
5
0px"
width=
"4
0
0px"
destroyOnClose
centered
cancelText=
"取消"
...
...
@@ -243,40 +122,53 @@ const ChangeAdd = props => {
{
visible
&&
(
<
div
className=
{
styles
.
listCard
}
>
<
div
className=
{
styles
.
cardItem
}
>
<
div
className=
{
styles
.
cardContent
}
>
<
div
className=
{
styles
.
cardItemData
}
>
<
Divider
orientation=
"left"
style=
{
{
margin
:
'0 0 5px 0'
,
color
:
'#15428b'
,
borderTopColor
:
'#99bbe8'
,
}
}
>
全选
<
Checkbox
style=
{
{
marginLeft
:
'10px'
}
}
indeterminate=
{
indeterminate
}
onChange=
{
onCheckAllChange1
}
checkvalue=
{
ff
}
checked=
{
checkAll
}
>
{
' '
}
</
Checkbox
>
</
Divider
>
<
CheckboxGroup
options=
{
ff
}
value=
{
checkedList
}
onChange=
{
e
=>
onChangeList1
(
e
)
}
/>
{
filed
.
length
==
0
?
(
<>
<
div
className=
{
styles
.
cardContent
}
>
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
description=
"暂无数据请先在台账管理中配置台账类型为反馈"
/>
</
div
>
</>
)
:
(
<
div
>
<
div
className=
{
styles
.
cardContent
}
>
<
div
className=
{
styles
.
cardItemData
}
>
<
Divider
orientation=
"left"
style=
{
{
margin
:
'0 0 5px 0'
,
color
:
'#15428b'
,
borderTopColor
:
'#99bbe8'
,
}
}
>
全选
<
Checkbox
style=
{
{
marginLeft
:
'10px'
}
}
indeterminate=
{
indeterminate
}
onChange=
{
onCheckAllChange
}
checkvalue=
{
filed
}
checked=
{
checkAll
}
>
{
' '
}
</
Checkbox
>
</
Divider
>
<
CheckboxGroup
options=
{
filed
}
value=
{
checkedList
}
onChange=
{
e
=>
onChangeList
(
e
)
}
/>
</
div
>
</
div
>
</
div
>
</
div
>
)
}
</
div
>
</
div
>
)
}
</
Modal
>
);
}
</
div
>
);
};
export
default
ChangeAdd
;
src/pages/bsmanager/patrolMaintenance/patrolFeedback/AddModal.jsx
View file @
08310f08
...
...
@@ -17,6 +17,7 @@ import {
CM_Feedback_QueryPatrolFeedback
,
}
from
'@/services/PatrolFeedback/api'
;
import
{
CM_Event_LoadDepartmentAndRoles
}
from
'@/services/standingBook/api'
;
import
RMSComponents
from
'@/components/RolePmSite/index'
;
import
ChangeRoles
from
'./ChangeRoles'
;
import
ChangeFields
from
'./ChangeFields'
;
...
...
@@ -36,6 +37,8 @@ const AddModal = props => {
const
[
isVisibleRoles
,
setIsVisibleRoles
]
=
useState
(
false
);
const
[
nu
,
setNu
]
=
useState
([]);
const
[
nu1
,
setNu1
]
=
useState
([]);
const
[
groupName
,
setGroupName
]
=
useState
(
'角色'
);
const
[
chooseGroupName
,
setChooseGroupName
]
=
useState
([
'角色'
,
'部门'
,
'站点'
]);
const
[
form
]
=
Form
.
useForm
();
const
{
Item
}
=
Form
;
...
...
@@ -430,13 +433,23 @@ const AddModal = props => {
pickItem=
{
pickItem
}
formObj=
{
formObj
}
/>
<
ChangeRoles
{
/*
<ChangeRoles
visible={isVisibleRoles}
onCancel={() => setIsVisibleRoles(false)}
callBackSubmit={onOK}
newCheckedList={checkedList1}
filed11={filed1}
pickItem={pickItem}
/> */
}
<
RMSComponents
visible=
{
isVisibleRoles
}
onCancel=
{
()
=>
setIsVisibleRoles
(
false
)
}
callBackSubmit=
{
onOK
}
newCheckedList=
{
checkedList1
}
// 单选框中的值
filed11=
{
filed1
}
// 全部待选数据
pickItem=
{
pickItem
}
groupName=
{
groupName
}
// 打开组件展示的分组名,用来首次获取数据
chooseGroupName=
{
chooseGroupName
}
// 可选分组名
/>
</
Drawer
>
);
...
...
src/pages/bsmanager/patrolMaintenance/patrolFeedback/ChangeFields.jsx
View file @
08310f08
...
...
@@ -13,7 +13,7 @@
/* eslint-disable eqeqeq */
/* eslint-disable no-plusplus */
import
React
,
{
useState
,
useEffect
,
useCallback
,
useRef
}
from
'react'
;
import
{
Form
,
Modal
,
Divider
,
Checkbox
,
Tabs
}
from
'antd'
;
import
{
Form
,
Modal
,
Divider
,
Checkbox
,
Tabs
,
Empty
}
from
'antd'
;
import
DragTable
from
'@/components/DragTable/DragTable'
;
import
styles
from
'../../workOrder/incident/incident.less'
;
const
CheckboxGroup
=
Checkbox
.
Group
;
...
...
@@ -304,7 +304,11 @@ const ChangeFields = props => {
{
JSON
.
stringify
(
filed
)
==
'{}'
?
(
<>
<
div
className=
{
styles
.
cardContent
}
>
<
span
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
description=
"表字段缺失请先配置表/字段"
/>
{
/* <span
style={{
color: 'red',
fontSize: '1rem',
...
...
@@ -312,7 +316,7 @@ const ChangeFields = props => {
}}
>
表字段缺失请先配置表/字段
</
span
>
</span>
*/
}
</
div
>
</>
)
:
(
...
...
src/pages/bsmanager/workOrder/incident/AddFlowsModal.jsx
View file @
08310f08
...
...
@@ -23,6 +23,7 @@ import {
}
from
'antd'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
ChangeAddFlows
from
'./ChangeAddFlows'
;
import
RMSComponents
from
'@/components/RolePmSite/index'
;
import
{
CM_Event_ReloadFlows
,
CM_Event_LoadDepartmentAndRoles
,
...
...
@@ -56,22 +57,19 @@ const AddFlowsModal = props => {
const
[
inputValue
,
setInputValue
]
=
useState
({
Roles
:
''
});
const
[
selectValue
,
setSelectValue
]
=
useState
(
''
);
const
[
characterValue
,
setCharacterValue
]
=
useState
(
''
);
const
[
Order
,
setOrder
]
=
useState
(
''
);
// 弹窗类型
const
[
strr
,
setStrr
]
=
useState
(
''
);
const
[
groupName
,
setGroupName
]
=
useState
(
'角色'
);
const
[
chooseGroupName
,
setChooseGroupName
]
=
useState
([
'角色'
,
'部门'
,
'站点'
]);
useEffect
(()
=>
{
console
.
log
(
formObj
);
getRole
();
console
.
log
(
obj
);
CM_Event_ReloadFlows
({
eventTypeId
:
obj
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
console
.
log
(
res
.
data
);
let
arr
=
formateArrDataA
(
res
.
data
,
'System'
);
let
newArr
=
[];
Object
.
keys
(
arr
).
map
((
item
,
index
)
=>
{
newArr
.
push
(
item
);
});
console
.
log
(
newArr
);
setStandingTable
(
newArr
);
}
});
...
...
@@ -81,12 +79,10 @@ const AddFlowsModal = props => {
form
.
resetFields
();
}
else
if
(
type
===
'edit'
)
{
setStrr
(
record
.
FlowRoles
);
console
.
log
(
record
);
setInputValue
({
Roles
:
record
.
FlowRoles
,
});
setSelectValue
(
record
.
FlowName
);
console
.
log
(
selectValue
);
}
},
[
visible
]);
const
formateArrDataA
=
(
initialArr
,
name
)
=>
{
...
...
@@ -320,46 +316,9 @@ const AddFlowsModal = props => {
setVisible1(true);
};
const onOKk = prop => {
// let { title } = prop;
// let selectData = prop.stt;
// let ff = prop.filed22;
// let aa = [];
// let bb = 0;
// title.map((item, index) => {
// console.log(ff[item]);
// aa = [];
// selectData.map((item1, index1) => {
// console.log(item1);
// if (ff[item].indexOf(item1) != -1) {
// aa.push(item1);
// }
// });
// console.log(aa);
// if (aa.length == 0) {
// bb = 1;
// }
// });
// console.log(aa);
// if (bb == 1) {
// notification.error({
// message: '
提示
',
// description: '
权限角色部门必须都选至少一项
',
// });
// } else {
// setVisible1(false);
// let inputText = { ...inputValue };
// inputText[prop.pickItem] = prop.str;
// console.log(prop.str);
// console.log(inputText);
// setStrr(prop.str);
// setCheckedList1(prop.checkedList);
// setInputValue(inputText);
// }
setVisible1(false);
let inputText = { ...inputValue };
inputText[prop.pickItem] = prop.str;
console.log(prop.str);
console.log(inputText);
setStrr(prop.str);
setCheckedList1(prop.stt);
setInputValue(inputText);
...
...
@@ -433,15 +392,23 @@ const AddFlowsModal = props => {
</Col>
</Row>
</Form>
<ChangeAddFlows
{/*
<ChangeAddFlows
visible={visible1}
onCancel={() => setVisible1(false)}
callBackSubmit={onOKk}
newCheckedList={checkedList1}
filed11={filed1}
pickItem={pickItem}
characterValue={characterValue}
formObj={formObj}
/> */}
<RMSComponents
visible={visible1}
onCancel={() => setVisible1(false)}
callBackSubmit={onOKk}
newCheckedList={checkedList1} // 单选框中的值
filed11={filed1} // 全部待选数据
pickItem={pickItem}
groupName={groupName} // 打开组件展示的分组名,用来首次获取数据
chooseGroupName={chooseGroupName} // 可选分组名
/>
</Drawer>
);
...
...
src/pages/bsmanager/workOrder/incident/AddModal.jsx
View file @
08310f08
...
...
@@ -48,6 +48,7 @@ import { PlusOutlined, DownOutlined, InfoCircleOutlined } from '@ant-design/icon
import
styles
from
'./incident.less'
;
import
ChangeAdd
from
'./changeAdd'
;
import
ChangeEdit
from
'./changeEdit'
;
import
RMSComponents
from
'@/components/RolePmSite/index'
;
const
{
Option
}
=
Select
;
const
AddModal
=
props
=>
{
...
...
@@ -474,6 +475,9 @@ const AddModal = props => {
const
[
editableValue
,
setEditableValue
]
=
useState
();
// 保存编辑字段外部字段
const
[
transitValue
,
setTransitValue
]
=
useState
();
// 保存转单字段外部字段
const
[
relatedEventValue
,
setRelatedEventValue
]
=
useState
();
// 保存关联字段外部字段
const
[
groupName
,
setGroupName
]
=
useState
(
'角色'
);
const
[
chooseGroupName
,
setChooseGroupName
]
=
useState
([
'角色'
,
'部门'
,
'站点'
]);
const
[
keepFiled
,
setKeepFiled
]
=
useState
([]);
const
{
Item
}
=
Form
;
const
onSubmit
=
()
=>
{
...
...
@@ -684,6 +688,7 @@ const AddModal = props => {
if
(
res
.
msg
===
'Ok'
)
{
setNu1
(
res
.
data
);
setFiled1
(
formateArrDataA1
(
res
.
data
,
'groupType'
));
setKeepFiled
(
groupArr
(
res
.
data
,
'groupType'
));
}
});
};
...
...
@@ -963,6 +968,26 @@ const AddModal = props => {
}
return
tempObj
;
};
const
groupArr
=
(
initialArr
,
name
)
=>
{
let
list
=
{};
console
.
log
(
initialArr
);
initialArr
.
data
.
map
(
i
=>
{
console
.
log
(
i
);
let
ar
=
[];
i
.
root
.
map
(
j
=>
{
let
ss
=
{};
ss
.
label
=
j
.
Name
;
ss
.
value
=
j
.
ID
;
ar
.
push
(
ss
);
console
.
log
(
ss
);
});
list
[
i
.
groupType
]
=
ar
;
});
console
.
log
(
list
);
return
list
;
};
const
formateArrDataA1
=
(
initialArr
,
name
)
=>
{
console
.
log
(
initialArr
);
let
aa
=
[];
...
...
@@ -1018,7 +1043,6 @@ const AddModal = props => {
}
}
}
console
.
log
(
tempObj
);
for
(
let
key
in
tempObj
)
{
let
arr
=
[];
tempObj
[
key
].
map
(
item
=>
{
...
...
@@ -1152,7 +1176,9 @@ const AddModal = props => {
};
const
pickFiled1
=
fileds
=>
{
console
.
log
(
nu1
);
let
pp
=
formateArrDataA1
(
nu1
,
'group'
);
setKeepFiled
(
groupArr
(
nu1
,
'group'
));
if
(
form
.
getFieldValue
(
fileds
))
{
setFiled1
(
pp
);
setCheckedList1
(
form
.
getFieldValue
(
fileds
).
split
(
','
));
...
...
@@ -1748,13 +1774,24 @@ const AddModal = props => {
</
Col
>
</
Row
>
</
Form
>
<
ChangeAdd
{
/*
<ChangeAdd
visible={isVisible}
onCancel={onCancel}
callBackSubmit={onOK}
newCheckedList={checkedList1}
filed11={filed1}
pickItem={pickItem}
/> */
}
<
RMSComponents
visible=
{
isVisible
}
onCancel=
{
onCancel
}
callBackSubmit=
{
onOK
}
newCheckedList=
{
checkedList1
}
// 单选框中的值
filed11=
{
filed1
}
// 全部待选数据
pickItem=
{
pickItem
}
groupName=
{
groupName
}
// 打开组件展示的分组名,用来首次获取数据
chooseGroupName=
{
chooseGroupName
}
// 可选分组名
keepFiled=
{
keepFiled
}
/>
<
ChangeEdit
visible=
{
isVisibleEdit
}
...
...
src/pages/bsmanager/workOrder/incident/changeEdit.jsx
View file @
08310f08
...
...
@@ -13,7 +13,7 @@
/* eslint-disable eqeqeq */
/* eslint-disable no-plusplus */
import
React
,
{
useState
,
useEffect
,
useCallback
,
useRef
}
from
'react'
;
import
{
Form
,
Modal
,
Divider
,
Checkbox
,
Tabs
}
from
'antd'
;
import
{
Form
,
Modal
,
Divider
,
Checkbox
,
Tabs
,
Empty
}
from
'antd'
;
import
DragTable
from
'@/components/DragTable/DragTable'
;
import
styles
from
'./incident.less'
;
const
CheckboxGroup
=
Checkbox
.
Group
;
...
...
@@ -302,15 +302,10 @@ const EditModal = props => {
{
JSON
.
stringify
(
filed
)
==
'{}'
?
(
<>
<
div
className=
{
styles
.
cardContent
}
>
<
span
style=
{
{
color
:
'red'
,
fontSize
:
'1rem'
,
marginLeft
:
'25px'
,
}
}
>
表字段缺失请先配置表/字段
</
span
>
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
description=
"表字段缺失请先配置表/字段"
/>
</
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