Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
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
zhaochengxiang
szse
Commits
c17aca7b
Commit
c17aca7b
authored
May 16, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产要素选用户 选部门
parent
d113ca65
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
120 additions
and
45 deletions
+120
-45
user.js
src/model/user.js
+7
-0
user.js
src/service/user.js
+9
-0
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+104
-45
No files found.
src/model/user.js
View file @
c17aca7b
...
...
@@ -20,4 +20,10 @@ export function* userGroups() {
}
export
function
*
getGroupUsers
(
payload
)
{
return
yield
call
(
service
.
getGroupUsers
,
payload
);
}
export
function
*
getMcclUsers
()
{
return
yield
call
(
service
.
getMcclUsers
);
}
export
function
*
getMcclDepartments
()
{
return
yield
call
(
service
.
getMcclDepartments
);
}
\ No newline at end of file
src/service/user.js
View file @
c17aca7b
...
...
@@ -29,4 +29,12 @@ export function userGroups() {
export
function
getGroupUsers
(
payload
)
{
return
GetJSON
(
`/authservice/userGroups/
${
payload
.
id
}
/users`
)
}
export
function
getMcclUsers
()
{
return
PostJSON
(
"/auth/peopleCenter/listMcclUser"
)
}
export
function
getMcclDepartments
()
{
return
PostJSON
(
"/auth/peopleCenter/getOrganMcclList"
)
}
\ No newline at end of file
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
c17aca7b
...
...
@@ -2,6 +2,7 @@ import React, { useEffect, useState, useContext, useMemo, useRef } from 'react';
import
{
Form
,
Spin
,
Input
,
Descriptions
,
Space
,
Button
,
Tooltip
,
Select
,
Cascader
,
Radio
,
Divider
,
Typography
,
Modal
,
Row
,
Col
,
Pagination
,
Dropdown
,
Menu
,
message
}
from
'antd'
;
import
{
DownOutlined
,
UpOutlined
,
QuestionCircleOutlined
}
from
'@ant-design/icons'
;
import
LocalStorage
from
'local-storage'
;
import
{
useDebounceEffect
}
from
'ahooks'
;
import
MetadataInfo
from
'./MetadataInfo'
;
import
{
dispatch
}
from
'../../../../model'
;
...
...
@@ -280,7 +281,7 @@ const AssetAction = (props) => {
const
getUsers
=
()
=>
{
setLoadingUsers
(
true
);
dispatch
({
type
:
'
pds.getOwn
ers'
,
type
:
'
user.getMcclUs
ers'
,
callback
:
(
data
)
=>
{
setLoadingUsers
(
false
);
setUsers
(
data
);
...
...
@@ -309,7 +310,7 @@ const AssetAction = (props) => {
const
getDepartments
=
()
=>
{
setLoadingDepartments
(
true
);
dispatch
({
type
:
'
pds.get
Departments'
,
type
:
'
user.getMccl
Departments'
,
callback
:
(
data
)
=>
{
setLoadingDepartments
(
false
);
setDepartments
(
data
);
...
...
@@ -680,23 +681,6 @@ const AssetAction = (props) => {
)
}
// if (element.name==='数据关键用户' || element.name?.toLowerCase()==='业务数据owner' || element.name?.toLowerCase()==='it责任人') {
// return <SelectUser
// type='edit'
// loading={loadingUsers}
// users={users}
// disabled={element.manualMaintain==='否'}
// />
// }
// if (element.name==='业务责任部门' || element.name?.toLowerCase()==='it责任部门') {
// return <SelectFilter
// loading={loadingDepartments}
// data={departments}
// disabled={element.manualMaintain==='否'}
// />
// }
if (element.name === '主题域分组') {
return (
<Select
...
...
@@ -749,13 +733,23 @@ const AssetAction = (props) => {
}
if (element.selectMode==='单选') {
const tmp = (element.optional??'').split(',')
if ((tmp??[]).indexOf('部门列表')!==-1) {
return <DepartmentItem loading={loadingDepartments} departments={departments} />
}
if ((tmp??[]).indexOf('用户列表')!==-1) {
return <UserItem loading={loadingUsers} users={users} />
}
return (
<Select
allowClear
disabled={element.manualMaintain==='否'}
>
{
element.optional?.split(',')
.map((value, index) => {
tmp?
.map((value, index) => {
return <Select.Option key={index} value={value}>
{value}
</Select.Option>
...
...
@@ -779,15 +773,6 @@ const AssetAction = (props) => {
return <IndexCode value={item.value||''} terms={terms} />;
}
// if (item.name==='数据关键用户' || item.name?.toLowerCase()==='业务数据owner' || item.name?.toLowerCase()==='it责任人' || item.name==='创建人' || item.name==='更新人') {
// return <SelectUser
// type='detail'
// users={users}
// terms={terms}
// value={item.value||''}
// />
// }
return <span className='text-color'>{highlightSearchContentByTerms(item.value||'', terms)}</span>;
}
...
...
@@ -850,20 +835,6 @@ const AssetAction = (props) => {
} else if (changedValues.hasOwnProperty('主题域')) {
setCurrentBussinessDomain(changedValues['主题域']);
form.setFieldsValue({'业务对象': ''});
} else if (changedValues.hasOwnProperty('业务数据Owner')) {
if (changedValues['业务数据Owner']) {
const index = (users||[]).findIndex(item => item.pernr === changedValues['业务数据Owner']);
if (index !== -1) {
form.setFieldsValue({'业务责任部门': users[index].orgtx});
}
}
} else if (changedValues.hasOwnProperty('IT责任人')) {
if (changedValues['IT责任人']) {
const index = (users||[]).findIndex(item => item.pernr === changedValues['IT责任人']);
if (index !== -1) {
form.setFieldsValue({'IT责任部门': users[index].orgtx});
}
}
}
}
...
...
@@ -1216,4 +1187,92 @@ const CascaderItem = ({ value = null, data, onChange, ...restProps }) => {
{...restProps}
/>
)
}
\ No newline at end of file
}
const DepartmentItem = ({ loading, departments, value, onChange }) => {
const [searchValue, setSearchValue] = React.useState()
const [options, setOptions] = React.useState()
useDebounceEffect(() => {
setOptions(
(departments??[])
.filter(item => !searchValue || (item.organizationname??'').toLowerCase().indexOf(searchValue.toLowerCase())!==-1)
.map(item => ({
label: item.organizationname,
value: item.organizationname,
}))
)
}, [searchValue, departments], { wait: 300 })
return (
<Select loading={loading} showSearch allowClear
placeholder='请选择部门'
value={(options??[]).length>0?value:undefined}
searchValue={searchValue}
onSearch={(val) => {
setSearchValue(val)
}}
onClear={() => {
setSearchValue()
}}
filterOption={false}
options={options}
onChange={(val) => {
onChange?.(val)
}}
/>
)
}
const UserItem = ({ loading, users, value, onChange, readonly=false, terms = [] }) => {
const [searchValue, setSearchValue] = React.useState()
const [options, setOptions] = React.useState()
const userInfo = React.useMemo(() => {
if (value) {
const index = (users??[]).findIndex(item => item.username === value)
if (index !== -1) {
const currentUser = users[index]
return `
$
{
currentUser
.
username
}(
$
{
currentUser
.
chinesename
})
`
}
}
return value
}, [value, users])
useDebounceEffect(() => {
setOptions(
(users??[])
.filter(item => !searchValue || (item.username??'').toLowerCase().indexOf(searchValue.toLowerCase())!==-1 || (item.chinesename??'').toLowerCase().indexOf(searchValue.toLowerCase())!==-1)
.map(item => ({
label: `
$
{
item
.
username
}(
$
{
item
.
chinesename
})
`,
value: item.username,
}))
)
}, [searchValue, users], { wait: 300 })
return (
<React.Fragment>
{
readonly ? <Typography.Text>
{highlightSearchContentByTerms(userInfo, terms)}
</Typography.Text> : <Select loading={loading} showSearch allowClear
placeholder='请选择用户'
value={(options??[]).length>0?value:undefined}
searchValue={searchValue}
onSearch={(val) => {
setSearchValue(val)
}}
onClear={() => {
setSearchValue()
}}
filterOption={false}
options={options}
onChange={(val) => {
onChange?.(val)
}}
/>
}
</React.Fragment>
)
}
\ No newline at end of file
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