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
d9cb097a
Commit
d9cb097a
authored
Dec 24, 2021
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
流程受理权限界面交互修改
parent
798c46fb
Pipeline
#41227
skipped with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
564 additions
and
369 deletions
+564
-369
AddFlowsModal.jsx
...ages/platformCenter/bsmanager/workOrder/AddFlowsModal.jsx
+50
-42
ChangeAddFlows.jsx
...ges/platformCenter/bsmanager/workOrder/ChangeAddFlows.jsx
+514
-321
changeAdd.jsx
src/pages/platformCenter/bsmanager/workOrder/changeAdd.jsx
+0
-6
No files found.
src/pages/platformCenter/bsmanager/workOrder/AddFlowsModal.jsx
View file @
d9cb097a
...
...
@@ -262,7 +262,7 @@ const AddFlowsModal = props => {
duration: 3,
description: '
编辑失败
',
});
setLoading(false);
//
setLoading(false);
});
}
};
...
...
@@ -304,11 +304,11 @@ const AddFlowsModal = props => {
}
}
});
if (a.length > 0) {
pp.外部字段 = a;
console.log(pp);
arr.push('
外部字段
');
}
//
if (a.length > 0) {
//
pp.外部字段 = a;
//
console.log(pp);
//
arr.push('
外部字段
');
//
}
console.log(a);
console.log(pp);
setFiled1(pp);
...
...
@@ -319,41 +319,49 @@ 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);
}
// 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);
};
return (
<Drawer
...
...
@@ -433,7 +441,7 @@ const AddFlowsModal = props => {
onCancel={() => setVisible1(false)}
callBackSubmit={onOKk}
newCheckedList={checkedList1}
filed1={filed1}
filed1
1
={filed1}
pickItem={pickItem}
characterValue={characterValue}
formObj={formObj}
...
...
src/pages/platformCenter/bsmanager/workOrder/ChangeAddFlows.jsx
View file @
d9cb097a
...
...
@@ -2,21 +2,10 @@
/* eslint-disable array-callback-return */
/* eslint-disable no-unused-expressions */
/* eslint-disable no-shadow */
import
React
,
{
useState
,
useEffect
,
useCallback
,
useRef
}
from
'react'
;
import
{
Form
,
Modal
,
Space
,
Divider
,
Radio
,
Checkbox
,
Button
,
Tabs
,
Pagination
,
Input
,
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Modal
,
Checkbox
,
Tabs
,
Input
,
Button
,
Pagination
}
from
'antd'
;
import
{
CM_Event_LoadDepartmentAndRoles
}
from
'@/services/standingBook/api'
;
import
DragTable
from
'@/components/DragTable/DragTable'
;
import
styles
from
'./incident.less'
;
const
CheckboxGroup
=
Checkbox
.
Group
;
const
{
TabPane
}
=
Tabs
;
...
...
@@ -25,309 +14,485 @@ const ChangeAddFlows = props => {
callBackSubmit
=
()
=>
{},
pickItem
,
visible
,
filed1
,
characterValue
,
filed11
,
newCheckedList
,
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
value
,
setValue
]
=
useState
(
''
);
const
[
checkValue
,
setCheckValue
]
=
useState
([]);
const
[
form
]
=
Form
.
useForm
();
const
[
title
,
setTitle
]
=
useState
([]);
const
{
Item
}
=
Form
;
const
[
checkedList
,
setCheckedList
]
=
useState
([]);
// 选中的复选框内容
const
[
indeterminate
,
setIndeterminate
]
=
useState
([]);
const
[
checkAll
,
setCheckAll
]
=
useState
([]);
const
[
selectData
,
setSelectData
]
=
useState
([]);
const
[
arrValue
,
setArrValue
]
=
useState
([]);
const
[
data
,
setData
]
=
useState
([]);
const
[
checkedList
,
setCheckedList
]
=
useState
([]);
// 选中复选框内容
const
[
flagg
,
setFlagg
]
=
useState
(
0
);
const
[
type
,
setType
]
=
useState
();
// 是否全选
const
[
searchWord
,
setSearchWord
]
=
useState
(
''
);
// 关键字
const
{
Search
}
=
Input
;
const
[
total
,
setTotal
]
=
useState
();
const
[
pageSize
,
setPageSize
]
=
useState
(
10
);
const
[
pageSize
,
setPageSize
]
=
useState
(
42
);
const
[
currentPage
,
setCurrentPage
]
=
useState
(
1
);
let
objArr
=
[];
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
[
isCheck
,
setIsCheck
]
=
useState
(
0
);
// 是否点击了角色复选框下的
const
[
isCheck1
,
setIsCheck1
]
=
useState
(
0
);
// 是否点击了部门复选框下的
const
[
isCheck2
,
setIsCheck2
]
=
useState
(
0
);
// 是否点击了站点复选框下的
const
[
keepOption1
,
setKeepOption1
]
=
useState
([]);
// 保存了获取的部门列表数据
const
[
keepOption2
,
setKeepOption2
]
=
useState
([]);
// 保存了获取的站点列表数据
const
[
keepTabKey
,
setKeepTabKey
]
=
useState
(
0
);
const
[
searchFlag
,
setSearchFlag
]
=
useState
(
0
);
const
[
keepSearchList
,
setkeepSearchList
]
=
useState
([]);
// 保存搜索后出现的选中列表
const
[
list
,
setList
]
=
useState
([]);
const
[
listPm
,
setListPm
]
=
useState
([]);
const
[
listSite
,
setListSite
]
=
useState
([]);
const
[
keyValue
,
setKeyValue
]
=
useState
(
'0'
);
const
onChangeList1
=
(
list
,
index
,
title
)
=>
{
const
checkedListArr
=
[...
checkedList
];
checkedListArr
[
index
]
=
list
;
// 将第一次打开回显数据先存成数组
let
oldArr
=
[];
let
addArr
=
[];
let
newArr
=
[];
if
(
flagg
==
0
)
{
arrValue
.
map
((
item
,
index
)
=>
{
oldArr
=
oldArr
.
concat
(
item
);
});
console
.
log
(
oldArr
);
// 将第一次打开回显数据存入已选择数组里
oldArr
.
map
(
item
=>
{
newArr
.
push
(
item
);
});
console
.
log
(
newArr
);
// 获取本次新增数据后的数组
let
objArr
=
[];
checkedListArr
.
map
(
item
=>
{
objArr
=
objArr
.
concat
(
item
);
});
console
.
log
(
objArr
);
// 本次增加数据后数组
console
.
log
(
arrValue
);
// 上次数组
// 获取新增数据
objArr
.
map
((
item1
,
index1
)
=>
{
if
(
arrValue
.
indexOf
(
item1
)
==
-
1
)
{
addArr
.
push
(
item1
);
}
});
}
else
{
arrValue
.
map
((
item
,
index
)
=>
{
oldArr
=
oldArr
.
concat
(
item
);
});
console
.
log
(
oldArr
);
// 将第一次打开回显数据存入已选择数组里
oldArr
.
map
(
item
=>
{
newArr
.
push
(
item
);
});
console
.
log
(
newArr
);
// 获取本次新增数据后的数组
let
objArr
=
[];
checkedListArr
.
map
(
item
=>
{
objArr
=
objArr
.
concat
(
item
);
});
console
.
log
(
objArr
);
// 本次增加数据后数组
console
.
log
(
oldArr
);
// 上次数组
// 获取新增数据
objArr
.
map
((
item1
,
index1
)
=>
{
if
(
oldArr
.
indexOf
(
item1
)
==
-
1
)
{
addArr
.
push
(
item1
);
const
onSubmit
=
()
=>
{
// 没有勾选部门下的选项
if
(
saveCheckValue
[
1
]
==
undefined
)
{
let
data
=
[];
newCheckedList
.
map
(
checkItem
=>
{
if
(
keepOption1
.
includes
(
checkItem
))
{
data
.
push
(
checkItem
);
}
});
console
.
log
(
data
);
saveCheckValue
[
1
]
=
data
;
}
// 将每次新增数据从尾部写入已选择数组里
console
.
log
(
addArr
);
if
(
addArr
.
length
!=
0
)
{
addArr
.
map
(
item
=>
{
newArr
.
push
(
item
);
console
.
log
(
saveCheckValue
);
// 没有勾选站点下的选项
if
(
saveCheckValue
[
2
]
==
undefined
)
{
let
data
=
[];
newCheckedList
.
map
(
checkItem
=>
{
if
(
keepOption2
.
includes
(
checkItem
))
{
data
.
push
(
checkItem
);
}
});
console
.
log
(
data
);
saveCheckValue
[
2
]
=
data
;
}
console
.
log
(
newArr
);
// 保存此次所有数据顺序
setArrValue
(
newArr
);
setCheckedList
(
checkedListArr
);
console
.
log
(
checkedListArr
);
// setSelectData(checkedListArr);
const
indeterminateArr
=
[...
indeterminate
];
const
checkAllArr
=
[...
checkAll
];
indeterminateArr
[
index
]
=
!!
list
.
length
&&
list
.
length
<
filed1
[
title
].
length
;
checkAllArr
[
index
]
=
list
.
length
===
filed1
[
title
].
length
;
setIndeterminate
(
indeterminateArr
);
setCheckAll
(
checkAllArr
);
setFlagg
(
0
);
};
const
onSubmit
=
()
=>
{
console
.
log
(
selectData
);
let
aRR
=
[];
selectData
.
map
(
item
=>
{
console
.
log
(
typeof
item
);
if
(
typeof
item
==
'string'
)
{
aRR
=
selectData
;
}
else
{
console
.
log
(
112212
);
console
.
log
(
item
.
name
);
aRR
.
push
(
item
.
name
);
console
.
log
(
63467246
);
console
.
log
(
aRR
);
}
console
.
log
(
newCheckedList
);
console
.
log
(
saveCheckValue
);
let
data
=
[];
saveCheckValue
.
map
((
item
,
index
)
=>
{
data
=
data
.
concat
(
item
);
});
console
.
log
(
aRR
);
callBackSubmit
({
checkedList
,
str
:
aRR
.
join
(
','
),
saveCheckValue
,
str
:
data
.
join
(
','
),
pickItem
,
stt
:
aRR
,
stt
:
data
,
title
,
filed22
:
filed1
,
});
setIsCheck
(
0
);
setIsCheck1
(
0
);
setIsCheck2
(
0
);
setKeyValue
(
'0'
);
setSearchWord
(
''
);
};
const
onCheckAllChange
=
e
=>
{
setData
(
1
);
const
indeterminateArr
=
[...
indeterminate
];
const
checkAllArr
=
[...
checkAll
];
const
checkedListArr
=
[...
checkedList
];
checkAllArr
[
e
.
target
.
index
]
=
e
.
target
.
checked
;
indeterminateArr
[
e
.
target
.
index
]
=
false
;
e
.
target
.
checked
?
(
checkedListArr
[
e
.
target
.
index
]
=
e
.
target
.
checkvalue
)
:
(
checkedListArr
[
e
.
target
.
index
]
=
[]);
setCheckedList
(
checkedListArr
);
setType
(
e
.
target
.
checked
);
setIndeterminate
(
indeterminateArr
);
setCheckAll
(
checkAllArr
);
};
useEffect
(()
=>
{
if
(
flagg
==
0
)
{
selectAll
();
setKeepOption1
(
filed11
[
'部门'
]);
setKeepOption2
(
filed11
[
'站点'
]);
getRoles
(
'角色'
,
''
,
pageSize
,
1
);
setRoleValue
(
filed1
);
setFlagg
(
1
);
let
arr
=
Object
.
keys
(
filed1
);
setTitle
(
arr
);
let
checkArr
=
[];
console
.
log
(
newCheckedList
);
// 已选中数组
let
listdata
=
[];
newCheckedList
.
map
(
checkItem
=>
{
if
(
filed11
[
'角色'
].
includes
(
checkItem
))
{
listdata
.
push
(
checkItem
);
}
});
setCheckDataRole
(
listdata
);
checkArr
[
0
]
=
listdata
;
console
.
log
(
listdata
);
// 按对象数组格式
setSaveCheckValue
(
checkArr
);
setCheckedList
(
checkArr
);
let
pmdata
=
[];
newCheckedList
.
map
(
checkItem
=>
{
if
(
filed11
[
'部门'
].
includes
(
checkItem
))
{
pmdata
.
push
(
checkItem
);
}
});
console
.
log
(
pmdata
);
setCheckDataPm
(
pmdata
);
let
sitedata
=
[];
newCheckedList
.
map
(
checkItem
=>
{
if
(
filed11
[
'站点'
].
includes
(
checkItem
))
{
sitedata
.
push
(
checkItem
);
}
});
console
.
log
(
sitedata
);
setCheckDataSite
(
sitedata
);
},
[
visible
]);
const
submitSearchUser
=
()
=>
{
if
(
searchWord
!=
''
)
{
setSearchFlag
(
1
);
}
if
(
keepTabKey
==
0
)
{
sreachRoles
(
'角色'
,
searchWord
,
pageSize
,
1
);
}
if
(
data
==
1
)
{
s
electAll
(
);
if
(
keepTabKey
==
1
)
{
s
reachRoles
(
'部门'
,
searchWord
,
pageSize
,
1
);
}
setData
(
0
);
},
[
checkedList
]);
if
(
keepTabKey
==
2
)
{
sreachRoles
(
'站点'
,
searchWord
,
pageSize
,
1
);
}
};
const
selectAll
=
()
=>
{
console
.
log
(
data
);
console
.
log
(
checkedList
);
objArr
=
[];
let
lastArr
=
[];
checkedList
.
map
(
item
=>
{
objArr
=
objArr
.
concat
(
item
);
});
console
.
log
(
arrValue
);
console
.
log
(
objArr
);
if
(
data
==
1
)
{
let
newArr
=
[];
arrValue
.
map
(
item
=>
{
if
(
item
.
name
==
undefined
)
{
newArr
=
arrValue
;
}
else
{
newArr
=
arrValue
.
map
(
item
=>
item
.
name
);
// 获取搜索框的值
const
handleSearch
=
e
=>
{
if
(
e
.
target
.
value
==
''
)
{
setSearchFlag
(
0
);
}
setSearchWord
(
e
.
target
.
value
);
};
// 监听分页
const
paginationChange
=
(
page
,
pageSizes
)
=>
{
if
(
searchWord
)
{
if
(
keepTabKey
==
0
)
{
getRoles
(
'角色'
,
searchWord
,
pageSizes
,
page
);
}
if
(
keepTabKey
==
1
)
{
getRoles
(
'部门'
,
searchWord
,
pageSizes
,
page
);
}
if
(
keepTabKey
==
2
)
{
getRoles
(
'站点'
,
searchWord
,
pageSizes
,
page
);
}
}
else
{
if
(
keepTabKey
==
0
)
{
getRoles
(
'角色'
,
''
,
pageSizes
,
page
);
}
if
(
keepTabKey
==
1
)
{
getRoles
(
'部门'
,
''
,
pageSizes
,
page
);
}
if
(
keepTabKey
==
2
)
{
getRoles
(
'站点'
,
''
,
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'
)
{
setRoleValue
(
formateArrDataA1
(
res
.
data
,
'groupType'
));
setFiled1
(
formateArrDataA1
(
res
.
data
,
'groupType'
));
let
data
=
[];
if
(
type
==
'角色'
)
{
checkDataRole
.
forEach
(
item
=>
{
if
(
formateArrDataA1
(
res
.
data
,
'groupType'
)[
type
].
indexOf
(
item
)
!=
-
1
)
{
data
.
push
(
item
);
}
});
}
});
console
.
log
(
newArr
);
if
(
type
==
false
)
{
newArr
.
map
(
item
=>
{
if
(
objArr
.
indexOf
(
item
)
!=
-
1
)
{
lastArr
.
push
(
item
);
if
(
type
==
'部门'
)
{
checkDataPm
.
forEach
(
item
=>
{
if
(
formateArrDataA1
(
res
.
data
,
'groupType'
)[
type
].
indexOf
(
item
)
!=
-
1
)
{
data
.
push
(
item
);
}
});
// setListPm(data);
}
if
(
type
==
'站点'
)
{
checkDataSite
.
forEach
(
item
=>
{
if
(
formateArrDataA1
(
res
.
data
,
'groupType'
)[
type
].
indexOf
(
item
)
!=
-
1
)
{
data
.
push
(
item
);
}
});
}
setkeepSearchList
(
data
);
setCurrentPage
(
1
);
setTotal
(
res
.
data
.
count
);
}
});
};
// 重置
const
onReset
=
()
=>
{
setSearchFlag
(
0
);
// setListPm([]);
if
(
keepTabKey
==
0
)
{
getRoles
(
'角色'
,
''
,
pageSize
,
1
);
}
if
(
keepTabKey
==
1
)
{
getRoles
(
'部门'
,
''
,
pageSize
,
1
);
}
if
(
keepTabKey
==
2
)
{
getRoles
(
'站点'
,
''
,
pageSize
,
1
);
}
setCurrentPage
(
1
);
setSearchWord
(
''
);
};
const
getRoles
=
(
type
,
keywords
,
pageSizes
,
pageIndex
)
=>
{
CM_Event_LoadDepartmentAndRoles
({
type
,
keywords
,
pageSize
:
pageSizes
,
pageIndex
,
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
setTotal
(
res
.
data
.
count
);
setRoleValue
(
formateArrDataA1
(
res
.
data
,
'groupType'
));
setFiled1
(
formateArrDataA1
(
res
.
data
,
'groupType'
));
}
});
};
useEffect
(()
=>
{
let
arr
=
Object
.
keys
(
filed1
);
setTitle
(
arr
);
let
checkArr
=
[];
console
.
log
(
saveCheckValue
);
console
.
log
(
newCheckedList
);
// 已选中数组
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
);
}
});
let
newArr1
=
lastArr
.
map
(
item
=>
({
name
:
item
}));
if
(
newArr1
.
length
===
1
&&
newArr1
[
0
].
name
===
''
)
{
newArr1
=
[];
}
console
.
log
(
newArr1
);
setSelectData
(
newArr1
);
setArrValue
(
lastArr
);
}
else
{
let
addArr
=
[];
objArr
.
map
(
item
=>
{
if
(
newArr
.
indexOf
(
item
)
==
-
1
)
{
addArr
.
push
(
item
);
// setCheckDataRole(checkArr[0]);
console
.
log
(
arr
);
console
.
log
(
checkArr
);
// 按对象数组格式
setCheckedList
(
checkArr
);
}
else
if
(
item
==
'部门'
)
{
checkArr
[
1
]
=
[];
checkDataPm
.
map
(
checkItem
=>
{
if
(
filed1
[
'部门'
].
includes
(
checkItem
))
{
checkArr
[
1
].
push
(
checkItem
);
}
});
console
.
log
(
addArr
);
addArr
.
map
(
item
=>
{
newArr
.
push
(
item
);
// setCheckDataPm(checkArr[1]);
console
.
log
(
checkArr
);
// 按对象数组格式
setCheckedList
(
checkArr
);
}
else
if
(
item
==
'站点'
)
{
checkArr
[
2
]
=
[];
console
.
log
(
checkDataSite
);
checkDataSite
.
map
(
checkItem
=>
{
if
(
filed1
[
'站点'
].
includes
(
checkItem
))
{
checkArr
[
2
].
push
(
checkItem
);
}
});
console
.
log
(
newArr
);
let
newArr1
=
newArr
.
map
(
item
=>
({
name
:
item
}));
if
(
newArr1
.
length
===
1
&&
newArr1
[
0
].
name
===
''
)
{
newArr1
=
[];
}
console
.
log
(
newArr1
);
setSelectData
(
newArr1
);
setArrValue
(
newArr
);
// setCheckDataSite(checkArr[2]);
console
.
log
(
checkArr
);
// 按对象数组格式
setCheckedList
(
checkArr
);
}
}
else
{
arrValue
.
map
(
item
=>
{
if
(
objArr
.
indexOf
(
item
)
!=
-
1
)
{
lastArr
.
push
(
item
);
}
});
},
[
filed1
]);
const
formateArrDataA1
=
(
initialArr
,
name
)
=>
{
console
.
log
(
initialArr
);
let
aa
=
[];
let
a1
=
[];
let
a2
;
let
a3
=
[];
initialArr
.
data
.
map
(
i
=>
{
a2
=
i
.
groupType
;
a1
=
i
.
root
;
a1
.
map
(
j
=>
{
j
.
group
=
a2
;
});
let
newArr1
=
lastArr
.
map
(
item
=>
({
name
:
item
}));
if
(
newArr1
.
length
===
1
&&
newArr1
[
0
].
name
===
''
)
{
newArr1
=
[];
aa
.
push
(
i
.
root
);
});
aa
.
map
(
p
=>
{
p
.
map
(
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
]);
}
}
console
.
log
(
lastArr
);
console
.
log
(
newArr1
);
setSelectData
(
newArr1
);
setArrValue
(
lastArr
);
}
console
.
log
(
tempObj
);
for
(
let
key
in
tempObj
)
{
let
arr
=
[];
tempObj
[
key
].
map
(
item
=>
{
tempObj
[
key
]
=
arr
;
arr
.
push
(
item
.
Name
);
});
}
return
tempObj
;
};
useEffect
(()
=>
{
if
(
visible
)
{
setFlagg
(
1
);
console
.
log
(
filed1
);
let
arr
=
Object
.
keys
(
filed1
);
console
.
log
(
arr
,
'arr'
);
setTitle
(
arr
);
let
checkArr
=
[];
let
indeterminateArr
=
[];
let
checkAllArr
=
[];
console
.
log
(
newCheckedList
);
arr
.
map
((
item
,
index
)
=>
{
checkArr
[
index
]
=
[];
newCheckedList
.
map
(
checkItem
=>
{
if
(
filed1
[
item
].
includes
(
checkItem
))
{
checkArr
[
index
].
push
(
checkItem
);
}
});
indeterminateArr
.
push
(
!!
checkArr
[
index
].
length
&&
checkArr
[
index
].
length
<
filed1
[
item
].
length
,
);
checkAllArr
.
push
(
checkArr
[
index
].
length
===
filed1
[
item
].
length
);
let
checkedListArr
=
[...
saveCheckValue
];
setIsCheck
(
1
);
let
data
=
checkDataRole
;
let
DataValue
=
[];
checkDataRole
.
forEach
(
item
=>
{
if
(
roleValue
[
'角色'
].
indexOf
(
item
)
!=
-
1
)
{
DataValue
.
push
(
item
);
}
});
console
.
log
(
DataValue
);
// del
if
(
DataValue
.
length
>
list
.
length
)
{
DataValue
.
forEach
(
item
=>
{
if
(
list
.
indexOf
(
item
)
==
-
1
)
{
data
.
splice
(
data
.
findIndex
(
ele
=>
ele
===
item
),
1
);
}
});
}
else
{
// add
list
.
forEach
(
item
=>
{
if
(
data
.
indexOf
(
item
)
==
-
1
)
{
data
.
push
(
item
);
}
});
setCheckedList
(
checkArr
);
setIndeterminate
(
indeterminateArr
);
setCheckAll
(
checkAllArr
);
console
.
log
(
characterValue
);
let
newArr
=
characterValue
.
length
?
characterValue
.
split
(
','
)
:
[];
console
.
log
(
newArr
);
let
newArr1
=
newCheckedList
.
map
(
item
=>
({
name
:
item
}));
if
(
newArr1
.
length
===
1
&&
newArr1
[
0
].
name
===
''
)
{
newArr1
=
[];
}
checkedListArr
[
0
]
=
data
;
setCheckDataRole
(
data
);
setSaveCheckValue
(
checkedListArr
);
setCheckedList
(
checkedListArr
);
},
[
list
]);
useEffect
(()
=>
{
let
checkedListArr
=
[...
saveCheckValue
];
setIsCheck
(
1
);
setIsCheck1
(
1
);
let
data
=
checkDataPm
;
let
DataValue
=
[];
checkDataPm
.
forEach
(
item
=>
{
if
(
roleValue
[
'部门'
].
indexOf
(
item
)
!=
-
1
)
{
DataValue
.
push
(
item
);
}
console
.
log
(
newArr1
);
setSelectData
(
newArr1
);
setArrValue
(
newArr1
);
});
console
.
log
(
DataValue
);
// del
if
(
DataValue
.
length
>
listPm
.
length
)
{
DataValue
.
forEach
(
item
=>
{
if
(
listPm
.
indexOf
(
item
)
==
-
1
)
{
data
.
splice
(
data
.
findIndex
(
ele
=>
ele
===
item
),
1
);
}
});
}
else
{
setSelectData
([]);
setArrValue
([]);
// add
listPm
.
forEach
(
item
=>
{
if
(
data
.
indexOf
(
item
)
==
-
1
)
{
data
.
push
(
item
);
}
});
}
},
[
visible
]);
const
dragCallBack
=
arr
=>
{
console
.
log
(
arr
);
checkedListArr
[
1
]
=
data
;
setCheckDataPm
(
data
);
setSaveCheckValue
(
checkedListArr
);
setCheckedList
(
checkedListArr
);
},
[
listPm
]);
if
(
arr
)
{
console
.
log
(
111
);
setSelectData
(
arr
);
let
newArr
=
arr
.
map
(
item
=>
item
.
name
);
console
.
log
(
newArr
);
setArrValue
(
newArr
);
useEffect
(()
=>
{
setIsCheck
(
1
);
const
checkedListArr
=
[...
saveCheckValue
];
setIsCheck
(
1
);
let
data
=
checkDataSite
;
let
DataValue
=
[];
checkDataSite
.
forEach
(
item
=>
{
if
(
roleValue
[
'站点'
].
indexOf
(
item
)
!=
-
1
)
{
DataValue
.
push
(
item
);
}
});
console
.
log
(
DataValue
);
// del
if
(
DataValue
.
length
>
listSite
.
length
)
{
DataValue
.
forEach
(
item
=>
{
if
(
listSite
.
indexOf
(
item
)
==
-
1
)
{
data
.
splice
(
data
.
findIndex
(
ele
=>
ele
===
item
),
1
);
}
});
}
else
{
// add
listSite
.
forEach
(
item
=>
{
if
(
data
.
indexOf
(
item
)
==
-
1
)
{
data
.
push
(
item
);
}
});
}
checkedListArr
[
2
]
=
data
;
setCheckDataSite
(
data
);
setSaveCheckValue
(
checkedListArr
);
setCheckedList
(
checkedListArr
);
},
[
listSite
]);
const
handleParChange
=
key
=>
{
setKeyValue
(
key
);
setSearchWord
(
''
);
setSearchFlag
(
0
);
setCurrentPage
(
1
);
setKeepTabKey
(
key
);
let
value
;
if
(
key
==
0
)
{
value
=
'角色'
;
getRoles
(
'角色'
,
''
,
pageSize
,
1
);
}
if
(
key
==
1
)
{
value
=
'部门'
;
getRoles
(
'部门'
,
''
,
pageSize
,
1
);
}
if
(
key
==
2
)
{
value
=
'站点'
;
getRoles
(
'站点'
,
''
,
pageSize
,
1
);
}
};
const
submitSearchUser
=
()
=>
{};
// 获取搜索框的值
const
handleSearch
=
e
=>
{
setSearchWord
(
e
.
target
.
value
);
const
onChangeListNew
=
list
=>
{
setList
(
list
);
};
// 监听分页
const
paginationChange
=
(
page
,
pageSizes
)
=>
{
// 分页时清空复选框
setCurrentPage
(
page
);
setPageSize
(
pageSizes
);
// let username = form.getFieldValue('username');
// getData(username, page, pageSizes);
const
onChangeListNew1
=
list
=>
{
setListPm
(
list
);
};
const
onChangeListNew2
=
list
=>
{
setListSite
(
list
);
};
const
columns
=
[
{
title
:
'已选列表'
,
dataIndex
:
'name'
,
width
:
150
,
key
:
'name'
,
},
];
return
(
<
Modal
...
...
@@ -344,7 +509,7 @@ const ChangeAddFlows = props => {
forceRender
getContainer=
{
false
}
>
{
/*
<Search
<
Search
style=
{
{
width
:
260
,
marginRight
:
'20px'
,
...
...
@@ -356,70 +521,98 @@ const ChangeAddFlows = props => {
enterButton
value=
{
searchWord
}
/>
<Button
type="primary"
htmlType="submit"
// onClick={() => {
// setCurrentPage(1);
// getData('', 1, pageSize);
// form.setFieldsValue({ username: '' });
// }}
>
<
Button
type=
"primary"
htmlType=
"submit"
onClick=
{
onReset
}
>
重置
</Button>
*/
}
</
Button
>
{
visible
&&
(
<
div
className=
{
styles
.
listCard1
}
>
<
div
className=
{
styles
.
cardItem1
}
>
<
div
className=
{
styles
.
cardContent1
}
>
<
Tabs
defaultActiveKey=
"0"
className=
{
styles
.
tab
}
>
{
title
.
map
((
item
,
index
)
=>
(
<
TabPane
tab=
{
item
}
key=
{
index
}
>
<
div
className=
{
styles
.
cardItemData1
}
key=
{
index
}
>
<
Divider
orientation=
"left"
style=
{
{
margin
:
'0 0 10px 0'
,
color
:
'#15428b'
,
borderTopColor
:
'#99bbe8'
,
}
}
>
<
Checkbox
indeterminate=
{
indeterminate
[
index
]
}
onChange=
{
onCheckAllChange
}
index=
{
index
}
checkvalue=
{
filed1
[
item
]
}
checked=
{
checkAll
[
index
]
}
style=
{
{
marginRight
:
'7px'
}
}
/>
{
item
}
</
Divider
>
<
CheckboxGroup
options=
{
filed1
[
item
]
}
value=
{
checkedList
[
index
]
}
onChange=
{
e
=>
onChangeList1
(
e
,
index
,
item
)
}
/>
</
div
>
</
TabPane
>
))
}
<
Tabs
activeKey=
{
keyValue
}
className=
{
styles
.
tab
}
onChange=
{
handleParChange
}
>
<
TabPane
tab=
"角色"
key=
"0"
>
<
div
className=
{
styles
.
cardItemData1
}
>
<
CheckboxGroup
options=
{
roleValue
[
'角色'
]
}
value=
{
checkedList
[
0
]
}
onChange=
{
onChangeListNew
}
/>
</
div
>
</
TabPane
>
<
TabPane
tab=
"部门"
key=
"1"
>
<
div
className=
{
styles
.
cardItemData1
}
>
<
CheckboxGroup
options=
{
roleValue
[
'部门'
]
}
value=
{
checkedList
[
1
]
}
onChange=
{
onChangeListNew1
}
/>
</
div
>
</
TabPane
>
<
TabPane
tab=
"站点"
key=
"2"
>
<
div
className=
{
styles
.
cardItemData1
}
>
<
CheckboxGroup
options=
{
roleValue
[
'站点'
]
}
value=
{
checkedList
[
2
]
}
onChange=
{
onChangeListNew2
}
/>
</
div
>
</
TabPane
>
</
Tabs
>
</
div
>
</
div
>
<
div
className=
{
styles
.
cardItem11
}
>
<
DragTable
bordered
style=
{
{
marginBottom
:
'10px'
}
}
rowKey=
{
record
=>
record
.
name
}
columns=
{
columns
}
dataSource=
{
selectData
}
pagination=
{
false
}
size=
"small"
dragCallBack=
{
dragCallBack
}
ItemTypes=
"stadingOrder"
/>
<
div
className=
{
styles
.
cardContent1
}
>
<
Tabs
// defaultActiveKey="0"
className=
{
styles
.
tab
}
activeKey=
{
keyValue
}
onChange=
{
handleParChange
}
>
<
TabPane
tab=
"角色"
key=
"0"
>
{
checkDataRole
.
map
((
item
,
index
)
=>
(
<
div
key=
{
index
}
style=
{
{
marginBottom
:
'5px'
,
}
}
>
{
item
}
</
div
>
))
}
</
TabPane
>
<
TabPane
tab=
"部门"
key=
"1"
>
{
checkDataPm
.
map
((
item
,
index
)
=>
(
<
div
key=
{
index
}
style=
{
{
marginBottom
:
'5px'
,
}
}
>
{
item
}
</
div
>
))
}
</
TabPane
>
<
TabPane
tab=
"站点"
key=
"2"
>
{
checkDataSite
.
map
((
item
,
index
)
=>
(
<
div
key=
{
index
}
style=
{
{
marginBottom
:
'5px'
,
}
}
>
{
item
}
</
div
>
))
}
</
TabPane
>
</
Tabs
>
</
div
>
</
div
>
</
div
>
)
}
{
/*
<Pagination
<
Pagination
total=
{
total
}
showTotal=
{
item
=>
`共 ${item} 条`
}
defaultPageSize=
{
pageSize
}
...
...
@@ -429,7 +622,7 @@ const ChangeAddFlows = props => {
style=
{
{
marginBottom
:
'10px'
}
}
size=
"small"
showQuickJumper
/>
*/
}
/>
</
Modal
>
);
};
...
...
src/pages/platformCenter/bsmanager/workOrder/changeAdd.jsx
View file @
d9cb097a
...
...
@@ -107,7 +107,6 @@ const ChangeAdd = props => {
setIsCheck
(
0
);
setIsCheck1
(
0
);
setIsCheck2
(
0
);
// setList([]);
setKeyValue
(
'0'
);
setSearchWord
(
''
);
};
...
...
@@ -116,7 +115,6 @@ const ChangeAdd = props => {
setKeepOption1
(
filed11
[
'部门'
]);
setKeepOption2
(
filed11
[
'站点'
]);
getRoles
(
'角色'
,
''
,
pageSize
,
1
);
console
.
log
(
filed1
);
setRoleValue
(
filed1
);
setFlagg
(
1
);
let
arr
=
Object
.
keys
(
filed1
);
...
...
@@ -295,7 +293,6 @@ const ChangeAdd = props => {
arr
.
forEach
(
item
=>
{
if
(
item
==
'角色'
)
{
checkArr
[
0
]
=
[];
console
.
log
(
filed1
);
checkDataRole
.
map
(
checkItem
=>
{
if
(
filed1
[
'角色'
].
includes
(
checkItem
))
{
checkArr
[
0
].
push
(
checkItem
);
...
...
@@ -394,7 +391,6 @@ const ChangeAdd = props => {
setIsCheck
(
1
);
let
data
=
checkDataRole
;
let
DataValue
=
[];
console
.
log
(
roleValue
);
checkDataRole
.
forEach
(
item
=>
{
if
(
roleValue
[
'角色'
].
indexOf
(
item
)
!=
-
1
)
{
DataValue
.
push
(
item
);
...
...
@@ -428,7 +424,6 @@ const ChangeAdd = props => {
setIsCheck1
(
1
);
let
data
=
checkDataPm
;
let
DataValue
=
[];
console
.
log
(
roleValue
);
checkDataPm
.
forEach
(
item
=>
{
if
(
roleValue
[
'部门'
].
indexOf
(
item
)
!=
-
1
)
{
DataValue
.
push
(
item
);
...
...
@@ -462,7 +457,6 @@ const ChangeAdd = props => {
setIsCheck
(
1
);
let
data
=
checkDataSite
;
let
DataValue
=
[];
console
.
log
(
roleValue
);
checkDataSite
.
forEach
(
item
=>
{
if
(
roleValue
[
'站点'
].
indexOf
(
item
)
!=
-
1
)
{
DataValue
.
push
(
item
);
...
...
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