Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ems3.3
Project
Project
Details
Activity
Releases
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
wuhao
ems3.3
Commits
908e661a
Commit
908e661a
authored
Dec 01, 2022
by
TZW
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
12011420
parent
8e4441b6
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
617 additions
and
311 deletions
+617
-311
index.jsx
src/components/ExtendField/index.jsx
+35
-10
index.jsx
src/pages/device/account/index.jsx
+259
-174
columns.js
src/pages/setting/users/columns.js
+197
-125
index.jsx
src/pages/setting/users/index.jsx
+47
-2
fieldsDetail.js
src/utils/fieldsDetail.js
+79
-0
No files found.
src/components/ExtendField/index.jsx
View file @
908e661a
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Author: Li Hanlin
* @Date: 2022-11-29 14:03:07
* @Date: 2022-11-29 14:03:07
* @Last Modified by: Li Hanlin
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-1
1-29 16:28:29
* @Last Modified time: 2022-1
2-01 11:06:20
*/
*/
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
...
@@ -10,8 +10,9 @@ import { useRequest } from 'ahooks';
...
@@ -10,8 +10,9 @@ import { useRequest } from 'ahooks';
import
{
useState
,
useEffect
}
from
'react'
;
import
{
useState
,
useEffect
}
from
'react'
;
import
InitForm
from
'../InitForm'
;
import
InitForm
from
'../InitForm'
;
export
default
({
formId
})
=>
{
const
App
=
({
setDrawer
,
onFinish
,
drawer
,
actionRef
,
columns
,
urlParams
,
formId
})
=>
{
const
[
columns
,
setcolumns
]
=
useState
([]);
const
[
value
,
setValue
]
=
useState
(
''
);
const
[
fieldscolumns
,
setfieldscolumns
]
=
useState
(
columns
);
const
selectValueType
=
(
type
,
options
)
=>
{
const
selectValueType
=
(
type
,
options
)
=>
{
switch
(
type
)
{
switch
(
type
)
{
case
1
:
case
1
:
...
@@ -43,29 +44,53 @@ export default ({ formId }) => {
...
@@ -43,29 +44,53 @@ export default ({ formId }) => {
let
res
=
await
doFetch
({
let
res
=
await
doFetch
({
url
:
'/base/paFormField/queryList'
,
url
:
'/base/paFormField/queryList'
,
params
:
{
params
:
{
formId
,
formId
:
formId
,
},
},
});
});
if
(
res
?.
data
?.
dataList
)
{
if
(
res
?.
data
?.
dataList
)
{
let
column
=
[];
let
column
=
[
{
title
:
'扩展字段'
,
valueType
:
'split'
,
},
];
res
?.
data
?.
dataList
?.
forEach
((
el
)
=>
{
res
?.
data
?.
dataList
?.
forEach
((
el
)
=>
{
column
.
push
({
column
.
push
({
...
selectValueType
(
el
.
fieldChar
,
el
.
value
Type
),
...
selectValueType
(
el
.
fieldChar
,
el
.
value
List
),
title
:
el
.
fieldName
,
title
:
el
.
fieldName
,
dataIndex
:
'title'
,
dataIndex
:
el
.
fieldName
,
key
:
el
.
id
,
key
:
el
.
id
,
});
});
});
});
console
.
log
(
'11111'
,
column
);
setfieldscolumns
(
fieldscolumns
.
concat
(
column
));
setcolumns
(
column
);
}
}
};
};
fn
();
fn
();
},
[]);
},
[]);
const
selectextendField
=
(
type
)
=>
{
switch
(
Number
(
type
))
{
case
1
:
return
'userCharList'
;
case
2
:
return
'equipmentCharList'
;
case
3
:
return
'equipmentSupplierCharList'
;
default
:
break
;
}
};
return
(
return
(
<>
<>
<
InitForm
fields=
{
columns
}
/>
<
InitForm
extendField=
{
selectextendField
(
formId
)
}
detailpath=
{
urlParams
.
detail
}
params=
{
{
id
:
drawer
?.
item
?.
id
}
}
fields=
{
fieldscolumns
}
onFinish=
{
onFinish
}
/>
</>
</>
);
);
};
};
export
default
App
;
src/pages/device/account/index.jsx
View file @
908e661a
This diff is collapsed.
Click to expand it.
src/pages/setting/users/columns.js
View file @
908e661a
This diff is collapsed.
Click to expand it.
src/pages/setting/users/index.jsx
View file @
908e661a
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-1
1-30 16:42:10
* @Last Modified time: 2022-1
2-01 11:13:59
*/
*/
import
*
as
React
from
'react'
;
import
*
as
React
from
'react'
;
...
@@ -14,6 +14,7 @@ import InitForm from '@/components/InitForm';
...
@@ -14,6 +14,7 @@ import InitForm from '@/components/InitForm';
import
getcolumns
from
'./columns'
;
import
getcolumns
from
'./columns'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
{
message
,
AutoComplete
}
from
'antd'
;
import
{
message
,
AutoComplete
}
from
'antd'
;
import
ExtendField
from
'@/components/ExtendField'
;
function
User
(
props
)
{
function
User
(
props
)
{
const
actionRef
=
useRef
(),
const
actionRef
=
useRef
(),
...
@@ -298,7 +299,51 @@ function User(props) {
...
@@ -298,7 +299,51 @@ function User(props) {
}
}
}
}
{
...
drawer
}
{
...
drawer
}
>
>
{
drawer
?.
type
==
'add'
?
<
Adduser
/>
:
null
}
{
drawer
?.
type
==
'add'
?
(
<
ExtendField
setDrawer=
{
setDrawer
}
drawer=
{
drawer
}
actionRef=
{
actionRef
}
columns=
{
columns
}
formId=
{
'1'
}
urlParams=
{
urlParams
}
onFinish=
{
async
(
vals
)
=>
{
let
userCharReqList
=
[];
for
(
let
i
in
vals
)
{
if
(
!
isNaN
(
Number
(
i
)))
{
userCharReqList
.
push
({
fieldId
:
i
,
fieldRealValue
:
vals
[
i
],
});
delete
vals
[
i
];
}
}
let
params
=
{
...
vals
,
id
:
drawer
?.
title
==
'编辑'
?
drawer
?.
item
?.
id
:
''
,
userCharReqList
,
};
delete
params
.
shopId
;
console
.
log
(
params
,
'!!!!'
);
let
res
=
await
doFetch
({
url
:
urlParams
.
save
,
params
,
});
if
(
res
.
code
===
'0000'
)
{
if
(
drawer
?.
title
==
'编辑'
)
{
message
.
success
(
'编辑成功!'
);
}
else
{
message
.
success
(
'新增成功!'
);
}
setDrawer
((
s
)
=>
({
...
s
,
visible
:
false
,
}));
actionRef
.
current
.
reload
();
}
}
}
/>
)
:
null
}
</
DrawerPro
>
</
DrawerPro
>
</
div
>
</
div
>
);
);
...
...
src/utils/fieldsDetail.js
0 → 100644
View file @
908e661a
import
{
doFetch
}
from
'./doFetch'
;
export
default
async
(
fieldscolumns
,
setdrawer
,
row
,
formId
,
detailpath
)
=>
{
let
newfieldscolumns
=
[];
const
selectValueType
=
(
type
,
options
)
=>
{
switch
(
type
)
{
case
1
:
return
{
valueType
:
'input'
,
};
case
2
:
return
{
valueType
:
'select'
,
options
,
};
case
3
:
return
{
valueType
:
'radio'
,
options
,
};
case
4
:
return
{
valueType
:
'select'
,
options
,
};
default
:
break
;
}
};
const
selectextendField
=
(
type
)
=>
{
switch
(
Number
(
type
))
{
case
1
:
return
'userCharList'
;
case
2
:
return
'equipmentCharList'
;
case
3
:
return
'equipmentSupplierCharList'
;
default
:
break
;
}
};
let
res
=
await
doFetch
({
url
:
'/base/paFormField/queryList'
,
params
:
{
formId
,
},
});
if
(
res
?.
data
?.
dataList
)
{
let
column
=
[
{
title
:
'扩展字段'
,
valueType
:
'split'
,
},
];
res
?.
data
?.
dataList
?.
forEach
((
el
)
=>
{
column
.
push
({
...
selectValueType
(
el
.
fieldChar
,
el
.
valueList
),
title
:
el
.
fieldName
,
dataIndex
:
el
.
id
,
key
:
el
.
id
,
});
});
newfieldscolumns
=
fieldscolumns
.
concat
(
column
);
console
.
log
(
'fieldscolumns'
,
newfieldscolumns
);
}
setdrawer
((
s
)
=>
({
...
s
,
visible
:
true
,
item
:
row
,
title
:
'详情'
,
fields
:
newfieldscolumns
,
extendField
:
selectextendField
(
formId
),
detailpath
,
params
:
{
id
:
row
.
id
},
val
:
'detail'
,
title
:
row
.
fullName
+
'的详细信息'
,
}));
};
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