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
83abff4e
Commit
83abff4e
authored
Dec 19, 2022
by
TZW
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://47.100.234.193:9527/wuhao/ems3.3
parents
1d84b278
8838ce8c
Changes
4
Hide 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 @
83abff4e
...
...
@@ -103,7 +103,6 @@ function InitForm(props) {
},
val
,
}
=
props
;
console
.
log
(
props
);
let
proformRef
=
useRef
();
proformRef
=
formRef
??
proformRef
;
...
...
src/pages/spare/supplier/columns.js
View file @
83abff4e
function
getcolumns
(
setdrawer
)
{
return
{
columns
:
[
...
...
@@ -52,11 +50,11 @@ function getcolumns(setdrawer) {
options
:
[
{
label
:
'启用'
,
value
:
'1'
,
value
:
1
,
},
{
label
:
'停用'
,
value
:
'2'
,
value
:
2
,
},
],
formItemProps
:
{
...
...
src/pages/spare/supplier/index.jsx
View file @
83abff4e
...
...
@@ -4,8 +4,9 @@ import DrawerPro from '@/components/DrawerPro';
import
AutoTable
from
'@/components/AutoTable'
;
import
PremButton
from
'@/components/PremButton'
;
import
getcolumns
from
'./columns'
;
import
{
useRequest
}
from
'ahooks'
;
import
{
use
AsyncEffect
,
use
Request
}
from
'ahooks'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
extraColumns
from
'@/utils/extraColumns'
;
function
Supplier
(
props
)
{
const
actionRef
=
useRef
(),
...
...
@@ -13,10 +14,19 @@ function Supplier(props) {
const
[
drawer
,
setdrawer
]
=
useState
({
open
:
false
,
});
const
[
columns
,
setcolumns
]
=
useState
([
{
title
:
'asd'
,
key
:
'ads'
,
},
]);
const
pathconfig
=
useMemo
(()
=>
{
let
pathconf
=
getcolumns
(
setdrawer
)?.
pathconfig
??
{};
return
pathconf
;
},
[]);
const
{
run
,
loading
}
=
useRequest
(
doFetch
,
{
manual
:
true
,
onSuccess
:
(
res
,
params
)
=>
{
...
...
@@ -95,19 +105,28 @@ function Supplier(props) {
);
};
const
columns
=
useMemo
(()
=>
{
let
defcolumn
=
getcolumns
(
setdrawer
)?.
columns
;
return
defcolumn
.
concat
({
title
:
'操作'
,
valueType
:
'option'
,
width
:
150
,
render
:
(
text
,
row
,
_
,
action
)
=>
[
pathconfig
?.
enabledetail
&&
detail
(
text
,
row
,
_
,
action
),
pathconfig
?.
enableedit
&&
edit
(
text
,
row
,
_
,
action
),
pathconfig
?.
enabledelete
&&
remove
(
text
,
row
,
_
,
action
),
],
useAsyncEffect
(
async
()
=>
{
let
extracolumns
=
await
extraColumns
({
url
:
'/base/paFormField/queryList'
,
params
:
{
formId
:
4
},
});
let
defcolumn
=
getcolumns
(
setdrawer
)?.
columns
;
setcolumns
([
...
defcolumn
,
...
extracolumns
,
{
title
:
'操作'
,
valueType
:
'option'
,
width
:
150
,
render
:
(
text
,
row
,
_
,
action
)
=>
[
pathconfig
?.
enabledetail
&&
detail
(
text
,
row
,
_
,
action
),
pathconfig
?.
enableedit
&&
edit
(
text
,
row
,
_
,
action
),
pathconfig
?.
enabledelete
&&
remove
(
text
,
row
,
_
,
action
),
],
},
]);
},
[]);
console
.
log
(
columns
);
return
(
<
div
style=
{
{
position
:
'relative'
}
}
>
...
...
@@ -117,7 +136,7 @@ function Supplier(props) {
actionRef=
{
actionRef
}
path=
{
pathconfig
?.
list
||
'/ngic-auth/sysUser/query/page'
}
pageextra=
{
pathconfig
?.
enableadd
?
'add'
:
null
}
resizeable=
{
tru
e
}
resizeable=
{
fals
e
}
addconfig=
{
{
// access: 'sysDepartment_save',
btn
:
{
...
...
@@ -137,6 +156,7 @@ function Supplier(props) {
<
DrawerPro
fields=
{
columns
}
extendField=
"supplierCharList"
params=
{
{
id
:
drawer
?.
item
?.
id
}
}
formRef=
{
formRef
}
placement=
"right"
...
...
@@ -151,10 +171,23 @@ function Supplier(props) {
}
}
{
...
drawer
}
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'
)
{
run
({
url
:
pathconfig
?.
add
||
'/add'
,
params
:
{
...
v
als
}
});
run
({
url
:
pathconfig
?.
add
||
'/add'
,
params
:
{
...
newV
als
}
});
}
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 @
83abff4e
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
})
{
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
;
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