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
8838ce8c
Commit
8838ce8c
authored
Dec 19, 2022
by
wuhao
🎯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asder
parent
290f4fdc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
21 deletions
+97
-21
index.jsx
src/components/InitForm/index.jsx
+0
-1
columns.js
src/pages/spare/supplier/columns.js
+2
-4
index.jsx
src/pages/spare/supplier/index.jsx
+48
-15
extraColumns.js
src/utils/extraColumns.js
+47
-1
No files found.
src/components/InitForm/index.jsx
View file @
8838ce8c
...
@@ -103,7 +103,6 @@ function InitForm(props) {
...
@@ -103,7 +103,6 @@ function InitForm(props) {
},
},
val
,
val
,
}
=
props
;
}
=
props
;
console
.
log
(
props
);
let
proformRef
=
useRef
();
let
proformRef
=
useRef
();
proformRef
=
formRef
??
proformRef
;
proformRef
=
formRef
??
proformRef
;
...
...
src/pages/spare/supplier/columns.js
View file @
8838ce8c
function
getcolumns
(
setdrawer
)
{
function
getcolumns
(
setdrawer
)
{
return
{
return
{
columns
:
[
columns
:
[
...
@@ -52,11 +50,11 @@ function getcolumns(setdrawer) {
...
@@ -52,11 +50,11 @@ function getcolumns(setdrawer) {
options
:
[
options
:
[
{
{
label
:
'启用'
,
label
:
'启用'
,
value
:
'1'
,
value
:
1
,
},
},
{
{
label
:
'停用'
,
label
:
'停用'
,
value
:
'2'
,
value
:
2
,
},
},
],
],
formItemProps
:
{
formItemProps
:
{
...
...
src/pages/spare/supplier/index.jsx
View file @
8838ce8c
...
@@ -4,8 +4,9 @@ import DrawerPro from '@/components/DrawerPro';
...
@@ -4,8 +4,9 @@ import DrawerPro from '@/components/DrawerPro';
import
AutoTable
from
'@/components/AutoTable'
;
import
AutoTable
from
'@/components/AutoTable'
;
import
PremButton
from
'@/components/PremButton'
;
import
PremButton
from
'@/components/PremButton'
;
import
getcolumns
from
'./columns'
;
import
getcolumns
from
'./columns'
;
import
{
useRequest
}
from
'ahooks'
;
import
{
use
AsyncEffect
,
use
Request
}
from
'ahooks'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
extraColumns
from
'@/utils/extraColumns'
;
function
Supplier
(
props
)
{
function
Supplier
(
props
)
{
const
actionRef
=
useRef
(),
const
actionRef
=
useRef
(),
...
@@ -13,10 +14,19 @@ function Supplier(props) {
...
@@ -13,10 +14,19 @@ function Supplier(props) {
const
[
drawer
,
setdrawer
]
=
useState
({
const
[
drawer
,
setdrawer
]
=
useState
({
open
:
false
,
open
:
false
,
});
});
const
[
columns
,
setcolumns
]
=
useState
([
{
title
:
'asd'
,
key
:
'ads'
,
},
]);
const
pathconfig
=
useMemo
(()
=>
{
const
pathconfig
=
useMemo
(()
=>
{
let
pathconf
=
getcolumns
(
setdrawer
)?.
pathconfig
??
{};
let
pathconf
=
getcolumns
(
setdrawer
)?.
pathconfig
??
{};
return
pathconf
;
return
pathconf
;
},
[]);
},
[]);
const
{
run
,
loading
}
=
useRequest
(
doFetch
,
{
const
{
run
,
loading
}
=
useRequest
(
doFetch
,
{
manual
:
true
,
manual
:
true
,
onSuccess
:
(
res
,
params
)
=>
{
onSuccess
:
(
res
,
params
)
=>
{
...
@@ -95,9 +105,16 @@ function Supplier(props) {
...
@@ -95,9 +105,16 @@ function Supplier(props) {
);
);
};
};
const
columns
=
useMemo
(()
=>
{
useAsyncEffect
(
async
()
=>
{
let
extracolumns
=
await
extraColumns
({
url
:
'/base/paFormField/queryList'
,
params
:
{
formId
:
4
},
});
let
defcolumn
=
getcolumns
(
setdrawer
)?.
columns
;
let
defcolumn
=
getcolumns
(
setdrawer
)?.
columns
;
return
defcolumn
.
concat
({
setcolumns
([
...
defcolumn
,
...
extracolumns
,
{
title
:
'操作'
,
title
:
'操作'
,
valueType
:
'option'
,
valueType
:
'option'
,
width
:
150
,
width
:
150
,
...
@@ -106,8 +123,10 @@ function Supplier(props) {
...
@@ -106,8 +123,10 @@ function Supplier(props) {
pathconfig
?.
enableedit
&&
edit
(
text
,
row
,
_
,
action
),
pathconfig
?.
enableedit
&&
edit
(
text
,
row
,
_
,
action
),
pathconfig
?.
enabledelete
&&
remove
(
text
,
row
,
_
,
action
),
pathconfig
?.
enabledelete
&&
remove
(
text
,
row
,
_
,
action
),
],
],
});
},
]);
},
[]);
},
[]);
console
.
log
(
columns
);
return
(
return
(
<
div
style=
{
{
position
:
'relative'
}
}
>
<
div
style=
{
{
position
:
'relative'
}
}
>
...
@@ -117,7 +136,7 @@ function Supplier(props) {
...
@@ -117,7 +136,7 @@ function Supplier(props) {
actionRef=
{
actionRef
}
actionRef=
{
actionRef
}
path=
{
pathconfig
?.
list
||
'/ngic-auth/sysUser/query/page'
}
path=
{
pathconfig
?.
list
||
'/ngic-auth/sysUser/query/page'
}
pageextra=
{
pathconfig
?.
enableadd
?
'add'
:
null
}
pageextra=
{
pathconfig
?.
enableadd
?
'add'
:
null
}
resizeable=
{
tru
e
}
resizeable=
{
fals
e
}
addconfig=
{
{
addconfig=
{
{
// access: 'sysDepartment_save',
// access: 'sysDepartment_save',
btn
:
{
btn
:
{
...
@@ -137,6 +156,7 @@ function Supplier(props) {
...
@@ -137,6 +156,7 @@ function Supplier(props) {
<
DrawerPro
<
DrawerPro
fields=
{
columns
}
fields=
{
columns
}
extendField=
"supplierCharList"
params=
{
{
id
:
drawer
?.
item
?.
id
}
}
params=
{
{
id
:
drawer
?.
item
?.
id
}
}
formRef=
{
formRef
}
formRef=
{
formRef
}
placement=
"right"
placement=
"right"
...
@@ -151,10 +171,23 @@ function Supplier(props) {
...
@@ -151,10 +171,23 @@ function Supplier(props) {
}
}
}
}
{
...
drawer
}
{
...
drawer
}
onFinish=
{
(
vals
)
=>
{
onFinish=
{
(
vals
)
=>
{
const
newVals
=
JSON
.
parse
(
JSON
.
stringify
(
vals
));
const
supplierCharReqList
=
[];
for
(
let
i
in
newVals
)
{
if
(
!
isNaN
(
i
))
{
supplierCharReqList
.
push
({
fieldId
:
i
,
fieldRealValue
:
newVals
[
i
],
});
delete
newVals
[
i
];
}
}
newVals
.
supplierCharReqList
=
supplierCharReqList
;
if
(
drawer
?.
val
==
'add'
)
{
if
(
drawer
?.
val
==
'add'
)
{
run
({
url
:
pathconfig
?.
add
||
'/add'
,
params
:
{
...
v
als
}
});
run
({
url
:
pathconfig
?.
add
||
'/add'
,
params
:
{
...
newV
als
}
});
}
else
if
(
drawer
?.
val
==
'edit'
)
{
}
else
if
(
drawer
?.
val
==
'edit'
)
{
run
({
url
:
pathconfig
?.
edit
||
'/edit'
,
params
:
{
...
v
als
,
id
:
drawer
?.
item
?.
id
}
});
run
({
url
:
pathconfig
?.
edit
||
'/edit'
,
params
:
{
...
newV
als
,
id
:
drawer
?.
item
?.
id
}
});
}
}
}
}
}
}
/>
/>
...
...
src/utils/extraColumns.js
View file @
8838ce8c
import
{
doFetch
}
from
'./doFetch'
;
import
{
doFetch
}
from
'./doFetch'
;
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'
,
fieldProps
:
{
mode
:
'multiple'
,
},
options
,
};
default
:
break
;
}
};
async
function
extraColumns
({
url
,
params
})
{
async
function
extraColumns
({
url
,
params
})
{
let
res
=
doFetch
({
url
,
params
});
let
res
=
await
doFetch
({
url
,
params
});
if
(
res
?.
data
?.
dataList
)
{
let
column
=
[
{
title
:
'扩展字段'
,
valueType
:
'split'
,
},
res
?.
data
?.
dataList
?.
map
?.((
el
)
=>
{
return
{
...
selectValueType
(
el
.
fieldChar
,
el
.
valueList
),
title
:
el
.
fieldName
,
dataIndex
:
el
.
id
,
key
:
el
.
id
,
};
}),
];
return
column
.
flat
();
}
}
}
export
default
extraColumns
;
export
default
extraColumns
;
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