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
77adc3e3
Commit
77adc3e3
authored
Dec 30, 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
22ee879c
fdf2eab8
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
936 additions
and
206 deletions
+936
-206
authRoutes.js
config/authRoutes.js
+6
-0
proxy.js
config/proxy.js
+1
-1
mtable.jsx
src/components/AutoTable/mtable.jsx
+11
-7
index.jsx
src/components/DrawerPro/index.jsx
+9
-2
index.jsx
src/components/InitForm/index.jsx
+2
-1
columns.js
src/pages/spare/edgestore/columns.js
+43
-41
index.jsx
src/pages/spare/edgestore/index.jsx
+144
-154
columns.js
src/pages/spare/outstore/columns.js
+42
-0
columns.js
src/pages/spare/requisition/columns.js
+450
-0
index.jsx
src/pages/spare/requisition/index.jsx
+228
-0
No files found.
config/authRoutes.js
View file @
77adc3e3
...
@@ -200,6 +200,12 @@ export default [
...
@@ -200,6 +200,12 @@ export default [
"path"
:
"/spare/setting"
,
"path"
:
"/spare/setting"
,
"icon"
:
""
,
"icon"
:
""
,
"component"
:
"./spare/setting"
"component"
:
"./spare/setting"
},
{
"name"
:
"备件领用"
,
"path"
:
"/spare/requisition"
,
"icon"
:
""
,
"component"
:
"./spare/requisition"
}
}
]
]
}
}
...
...
config/proxy.js
View file @
77adc3e3
...
@@ -13,7 +13,7 @@ export default {
...
@@ -13,7 +13,7 @@ export default {
dev
:
{
dev
:
{
[
defaultSetting
.
proxypath
]:
{
[
defaultSetting
.
proxypath
]:
{
// 要代理的地址
// 要代理的地址
target
:
'http://192.168.40.64:2800
1
'
,
//jf哥
target
:
'http://192.168.40.64:2800
0
'
,
//jf哥
// target: 'http://192.168.40.203:8000', //dj哥
// target: 'http://192.168.40.203:8000', //dj哥
changeOrigin
:
true
,
changeOrigin
:
true
,
},
},
...
...
src/components/AutoTable/mtable.jsx
View file @
77adc3e3
...
@@ -403,13 +403,17 @@ const Mtable = (props) => {
...
@@ -403,13 +403,17 @@ const Mtable = (props) => {
}
}
:
{}
:
{}
}
}
pagination=
{
{
pagination=
{
showTotal
:
(
total
,
range
)
=>
<
span
>
共
{
total
}
条
</
span
>,
pagination
showQuickJumper
:
true
,
?
{
showSizeChanger
:
true
,
showTotal
:
(
total
,
range
)
=>
<
span
>
共
{
total
}
条
</
span
>,
pageSizeOptions
:
[
5
,
10
,
15
,
30
,
50
,
100
,
200
],
showQuickJumper
:
true
,
defaultPageSize
:
pageSize
||
15
,
showSizeChanger
:
true
,
}
}
pageSizeOptions
:
[
5
,
10
,
15
,
30
,
50
,
100
,
200
],
defaultPageSize
:
pageSize
||
15
,
}
:
false
}
search=
{
{
search=
{
{
filterType
:
'light'
,
//轻量模式
filterType
:
'light'
,
//轻量模式
}
}
}
}
...
...
src/components/DrawerPro/index.jsx
View file @
77adc3e3
...
@@ -26,12 +26,19 @@ function DrawerPro(props) {
...
@@ -26,12 +26,19 @@ function DrawerPro(props) {
destroyOnClose=
{
true
}
destroyOnClose=
{
true
}
{
...
props
}
{
...
props
}
>
>
{
props
.
val
==
'only'
&&
props
.
children
}
{
props
.
val
==
'only'
?
(
{
props
.
val
==
'only'
?
null
:
props
.
val
==
'detail'
?
(
props
.
children
)
:
props
.
val
==
'detail'
?
(
<
DetailPro
{
...
detailprops
}
/>
<
DetailPro
{
...
detailprops
}
/>
)
:
props
.
val
==
'detailaddon'
?
(
<
div
>
<
DetailPro
{
...
detailprops
}
/>
{
props
?.
children
}
</
div
>
)
:
(
)
:
(
<
InitForm
{
...
newProps
}
/>
<
InitForm
{
...
newProps
}
/>
)
}
)
}
{
pushSettingFlag
?
(
{
pushSettingFlag
?
(
<
a
<
a
id=
"pushSettingBtn"
id=
"pushSettingBtn"
...
...
src/components/InitForm/index.jsx
View file @
77adc3e3
...
@@ -102,13 +102,14 @@ function InitForm(props) {
...
@@ -102,13 +102,14 @@ function InitForm(props) {
//console.log(changedValues, allValues);
//console.log(changedValues, allValues);
},
},
val
,
val
,
style
=
{},
}
=
props
;
}
=
props
;
let
proformRef
=
useRef
();
let
proformRef
=
useRef
();
proformRef
=
formRef
??
proformRef
;
proformRef
=
formRef
??
proformRef
;
return
(
return
(
<
ProForm
<
ProForm
style=
{
{
overflow
:
'hidden'
}
}
style=
{
{
overflow
:
'hidden'
,
...
style
}
}
formRef=
{
proformRef
}
formRef=
{
proformRef
}
onFinish=
{
onFinish
}
onFinish=
{
onFinish
}
formKey=
{
formKey
??
parseInt
(
Math
.
random
()
*
1000000
)
}
formKey=
{
formKey
??
parseInt
(
Math
.
random
()
*
1000000
)
}
...
...
src/pages/spare/edgestore/columns.js
View file @
77adc3e3
function
getcolumns
(
setdrawer
)
{
function
getcolumns
(
setdrawer
)
{
return
{
return
{
"pathconfig"
:
{
"enableadd"
:
false
,
"enableedit"
:
false
,
"enabledelete"
:
false
,
"enabledetail"
:
false
,
"add"
:
""
,
"edit"
:
""
,
"list"
:
"/repair/umRepairOrder/queryRepairOrderList"
,
"delete"
:
""
,
"detail"
:
""
},
"columns"
:
[
"columns"
:
[
{
{
"title"
:
"
维修单号
"
,
"title"
:
"
线边库名称
"
,
"dataIndex"
:
"
repairOrderNo
"
,
"dataIndex"
:
"
stockName
"
,
"key"
:
"
repairOrderNo
"
"key"
:
"
stockName
"
},
},
{
{
"title"
:
"
设备编
号"
,
"title"
:
"
备件料
号"
,
"dataIndex"
:
"
equipmen
tNo"
,
"dataIndex"
:
"
sparePar
tNo"
,
"key"
:
"
equipmen
tNo"
"key"
:
"
sparePar
tNo"
},
},
{
{
"title"
:
"
设备
名称"
,
"title"
:
"
备件
名称"
,
"dataIndex"
:
"
equipmen
tName"
,
"dataIndex"
:
"
sparePar
tName"
,
"key"
:
"
equipmen
tName"
"key"
:
"
sparePar
tName"
},
},
{
{
"title"
:
"
故障描述
"
,
"title"
:
"
供应商编号
"
,
"dataIndex"
:
"
faultDescription
"
,
"dataIndex"
:
"
supplierNo
"
,
"key"
:
"
faultDescription
"
"key"
:
"
supplierNo
"
},
},
{
{
"title"
:
"
报修人员
"
,
"title"
:
"
供应商名称
"
,
"dataIndex"
:
"
repairUs
erName"
,
"dataIndex"
:
"
suppli
erName"
,
"key"
:
"
repairUs
erName"
"key"
:
"
suppli
erName"
},
},
{
{
"title"
:
"
报修时间
"
,
"title"
:
"
持有数量
"
,
"dataIndex"
:
"
repairTime
"
,
"dataIndex"
:
"
actualStock
"
,
"key"
:
"
repairTimeList
"
,
"key"
:
"
actualStock
"
,
"
valueType"
:
"dateTimeRange"
"
hideInSearch"
:
true
},
},
{
{
"title"
:
"报修单号"
,
"title"
:
"可用数量"
,
"dataIndex"
:
"repairNo"
,
"dataIndex"
:
"usedStock"
,
"key"
:
"repairNo"
"key"
:
"usedStock"
,
"hideInSearch"
:
true
},
},
{
{
"title"
:
"工单状态"
,
"title"
:
"库存单位"
,
"dataIndex"
:
"statusName"
,
"dataIndex"
:
"unit"
,
"key"
:
"statusName"
"key"
:
"unit"
,
"hideInSearch"
:
true
}
}
]
],
"pathconfig"
:
{
"enableadd"
:
false
,
"enableedit"
:
false
,
"enabledelete"
:
false
,
"enabledetail"
:
false
,
"add"
:
""
,
"edit"
:
""
,
"list"
:
"/sparepart/lineStock/queryList"
,
"delete"
:
""
,
"detail"
:
""
}
};
};
}
}
export
default
getcolumns
;
export
default
getcolumns
;
\ No newline at end of file
\ No newline at end of file
src/pages/spare/edgestore/index.jsx
View file @
77adc3e3
import
*
as
React
from
'react'
;
import
*
as
React
from
'react'
;
import
{
useState
,
useMemo
,
useRef
}
from
'react'
;
import
{
useState
,
useMemo
,
useRef
}
from
'react'
;
import
DrawerPro
from
'@/components/DrawerPro'
;
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
{
useRequest
}
from
'ahooks'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
function
Edgestore
(
props
)
{
function
Edgestore
(
props
)
{
const
actionRef
=
useRef
(),
const
actionRef
=
useRef
(),
formRef
=
useRef
();
formRef
=
useRef
();
const
[
drawer
,
setdrawer
]
=
useState
({
const
[
drawer
,
setdrawer
]
=
useState
({
open
:
false
,
open
:
false
,
});
});
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
)
=>
{
if
(
res
?.
code
==
'0000'
)
{
if
(
res
?.
code
==
'0000'
)
{
actionRef
?.
current
?.
reload
();
actionRef
?.
current
?.
reload
();
setdrawer
((
s
)
=>
({
setdrawer
((
s
)
=>
({
...
s
,
...
s
,
open
:
false
,
open
:
false
,
}));
}));
}
}
},
},
});
});
const
detail
=
(
text
,
row
,
_
,
action
)
=>
{
const
detail
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
return
(
<
PremButton
<
PremButton
btn=
{
{
btn=
{
{
size
:
'small'
,
size
:
'small'
,
type
:
'link'
,
type
:
'link'
,
onClick
:
()
=>
{
onClick
:
()
=>
{
setdrawer
((
s
)
=>
({
setdrawer
((
s
)
=>
({
...
s
,
...
s
,
open
:
true
,
open
:
true
,
item
:
row
,
item
:
row
,
title
:
'详情'
,
title
:
'详情'
,
val
:
'detail'
,
val
:
'detail'
,
title
:
'详细信息'
,
title
:
'详细信息'
,
}));
}));
},
},
}
}
}
}
>
>
详情
详情
</
PremButton
>
</
PremButton
>
);
);
};
};
const
edit
=
(
text
,
row
,
_
,
action
)
=>
{
const
edit
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
return
(
<
PremButton
<
PremButton
btn=
{
{
btn=
{
{
size
:
'small'
,
size
:
'small'
,
onClick
:
()
=>
{
setdrawer
((
s
)
=>
({
...
s
,
open
:
true
,
item
:
row
,
title
:
'编辑'
,
val
:
'edit'
,
}));
},
}
}
>
编辑
</
PremButton
>
);
};
const
remove
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
<
PremButton
pop=
{
{
title
:
'是否删除?'
,
okText
:
'确认'
,
cancelText
:
'取消'
,
onConfirm
:
()
=>
{
run
({
url
:
pathconfig
?.
delete
||
'/delete'
,
params
:
{
id
:
row
?.
id
}
});
},
}
}
btn=
{
{
size
:
'small'
,
type
:
'danger'
,
}
}
>
删除
</
PremButton
>
);
};
const
columns
=
useMemo
(()
=>
{
let
defcolumn
=
getcolumns
(
setdrawer
)?.
columns
;
return
defcolumn
;
},
[]);
return
(
<
div
style=
{
{
position
:
'relative'
}
}
>
<
AutoTable
pagetitle=
" 线边库存"
columns=
{
columns
}
actionRef=
{
actionRef
}
path=
{
pathconfig
?.
list
||
'/ngic-auth/sysUser/query/page'
}
pageextra=
{
pathconfig
?.
enableadd
?
'add'
:
null
}
resizeable=
{
false
}
addconfig=
{
{
// access: 'sysDepartment_save',
btn
:
{
disabled
:
false
,
onClick
:
()
=>
{
onClick
:
()
=>
{
setdrawer
((
s
)
=>
({
setdrawer
((
s
)
=>
({
...
s
,
...
s
,
open
:
true
,
open
:
true
,
item
:
row
,
item
:
null
,
title
:
'
编辑
'
,
title
:
'
新增
'
,
val
:
'
edit
'
,
val
:
'
add
'
,
}));
}));
},
},
}
}
},
>
}
}
编辑
/>
</
PremButton
>
);
};
const
remove
=
(
text
,
row
,
_
,
action
)
=>
{
<
DrawerPro
return
(
fields=
{
columns
}
<
PremButton
params=
{
{
id
:
drawer
?.
item
?.
id
}
}
pop=
{
{
formRef=
{
formRef
}
title
:
'是否删除?'
,
placement=
"right"
okText
:
'确认'
,
detailpath=
{
pathconfig
?.
detail
||
null
}
cancelText
:
'取消'
,
detailData=
{
drawer
?.
item
}
onConfirm
:
()
=>
{
defaultFormValue=
{
drawer
?.
item
}
run
({
url
:
pathconfig
?.
delete
||
'/delete'
,
params
:
{
id
:
row
?.
id
}
});
onClose=
{
()
=>
{
},
setdrawer
((
s
)
=>
({
}
}
...
s
,
btn=
{
{
open
:
false
,
size
:
'small'
,
}));
type
:
'danger'
,
}
}
}
}
{
...
drawer
}
>
onFinish=
{
(
vals
)
=>
{
删除
if
(
drawer
?.
val
==
'add'
)
{
</
PremButton
>
run
({
url
:
pathconfig
?.
add
||
'/add'
,
params
:
{
...
vals
}
});
);
}
else
if
(
drawer
?.
val
==
'edit'
)
{
};
run
({
url
:
pathconfig
?.
edit
||
'/edit'
,
params
:
{
...
vals
,
id
:
drawer
?.
item
?.
id
}
});
}
const
columns
=
useMemo
(()
=>
{
}
}
let
defcolumn
=
getcolumns
(
setdrawer
)?.
columns
;
/>
return
defcolumn
.
concat
({
</
div
>
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
),
],
});
},
[]);
return
(
<
div
style=
{
{
position
:
'relative'
}
}
>
<
AutoTable
pagetitle=
" 线边库存"
columns=
{
columns
}
actionRef=
{
actionRef
}
path=
{
pathconfig
?.
list
||
'/ngic-auth/sysUser/query/page'
}
pageextra=
{
pathconfig
?.
enableadd
?
'add'
:
null
}
resizeable=
{
true
}
addconfig=
{
{
// access: 'sysDepartment_save',
btn
:
{
disabled
:
false
,
onClick
:
()
=>
{
setdrawer
((
s
)
=>
({
...
s
,
open
:
true
,
item
:
null
,
title
:
'新增'
,
val
:
'add'
,
}));
},
},
}
}
/>
<
DrawerPro
fields=
{
columns
}
params=
{
{
id
:
drawer
?.
item
?.
id
}
}
formRef=
{
formRef
}
placement=
"right"
detailpath=
{
pathconfig
?.
detail
||
null
}
detailData=
{
drawer
?.
item
}
defaultFormValue=
{
drawer
?.
item
}
onClose=
{
()
=>
{
setdrawer
((
s
)
=>
({
...
s
,
open
:
false
,
}));
}
}
{
...
drawer
}
onFinish=
{
(
vals
)
=>
{
if
(
drawer
?.
val
==
'add'
)
{
run
({
url
:
pathconfig
?.
add
||
'/add'
,
params
:
{
...
vals
}
});
}
else
if
(
drawer
?.
val
==
'edit'
)
{
run
({
url
:
pathconfig
?.
edit
||
'/edit'
,
params
:
{
...
vals
,
id
:
drawer
?.
item
?.
id
}
});
}
}
}
/>
</
div
>
);
}
export
default
Edgestore
;
export
default
Edgestore
;
\ No newline at end of file
src/pages/spare/outstore/columns.js
View file @
77adc3e3
import
AutoTable
from
'@/components/AutoTable/mtable'
;
import
AutoTable
from
'@/components/AutoTable/mtable'
;
function
ExtraTable
({
dataSource
})
{
return
(
<
div
style
=
{{
padding
:
'4px 4px 4px 36px'
}}
>
<
AutoTable
dataSource
=
{
dataSource
}
pagination
=
{
false
}
resizeable
=
{
false
}
columns
=
{[
{
title
:
'供应商编号'
,
dataIndex
:
'supplierNo'
,
key
:
'supplierNo'
,
width
:
200
},
{
title
:
'供应商名称'
,
dataIndex
:
'supplierName'
,
key
:
'supplierName'
,
width
:
200
},
{
title
:
'库存数量'
,
dataIndex
:
'actualStock'
,
key
:
'actualStock'
,
hideInSearch
:
true
,
width
:
200
,
},
{
title
:
'下架数量'
,
dataIndex
:
'operateNum'
,
key
:
'operateNum'
,
hideInSearch
:
true
},
]}
/
>
<
/div
>
);
}
function
getcolumns
(
setdrawer
)
{
function
getcolumns
(
setdrawer
)
{
const
columns
=
[
const
columns
=
[
{
{
...
@@ -7,12 +31,14 @@ function getcolumns(setdrawer) {
...
@@ -7,12 +31,14 @@ function getcolumns(setdrawer) {
dataIndex
:
'sparePartNo'
,
dataIndex
:
'sparePartNo'
,
key
:
'sparePartNo'
,
key
:
'sparePartNo'
,
editable
:
false
,
editable
:
false
,
width
:
235
,
},
},
{
{
title
:
'备件名称'
,
title
:
'备件名称'
,
dataIndex
:
'sparePartName'
,
dataIndex
:
'sparePartName'
,
key
:
'sparePartName'
,
key
:
'sparePartName'
,
editable
:
false
,
editable
:
false
,
width
:
200
,
},
},
{
{
title
:
'可用库存'
,
title
:
'可用库存'
,
...
@@ -20,6 +46,7 @@ function getcolumns(setdrawer) {
...
@@ -20,6 +46,7 @@ function getcolumns(setdrawer) {
key
:
'usedStock'
,
key
:
'usedStock'
,
editable
:
false
,
editable
:
false
,
hideInSearch
:
true
,
hideInSearch
:
true
,
width
:
200
,
},
},
{
{
title
:
'出库数量'
,
title
:
'出库数量'
,
...
@@ -30,6 +57,7 @@ function getcolumns(setdrawer) {
...
@@ -30,6 +57,7 @@ function getcolumns(setdrawer) {
fieldProps
:
{
fieldProps
:
{
precision
:
3
,
precision
:
3
,
},
},
width
:
200
,
},
},
{
{
title
:
'库存单位'
,
title
:
'库存单位'
,
...
@@ -167,6 +195,7 @@ function getcolumns(setdrawer) {
...
@@ -167,6 +195,7 @@ function getcolumns(setdrawer) {
path
:
'/sparepart/spareStock/queryByOperate'
,
path
:
'/sparepart/spareStock/queryByOperate'
,
hideInSearch
:
true
,
hideInSearch
:
true
,
hideInTable
:
true
,
hideInTable
:
true
,
rowName
:
'sparePartName'
,
render
:
(
text
,
row
)
=>
{
render
:
(
text
,
row
)
=>
{
return
(
return
(
<
AutoTable
<
AutoTable
...
@@ -175,6 +204,12 @@ function getcolumns(setdrawer) {
...
@@ -175,6 +204,12 @@ function getcolumns(setdrawer) {
hideInSearch
:
true
,
hideInSearch
:
true
,
}))}
}))}
dataSource
=
{
row
?.
taskSpareList
}
dataSource
=
{
row
?.
taskSpareList
}
resizeable
=
{
false
}
expandable
=
{{
expandedRowRender
:
(
record
)
=>
(
<
ExtraTable
dataSource
=
{
record
?.
taskSpareSupplierList
??
[]}
/
>
),
}}
/
>
/
>
);
);
},
},
...
@@ -330,6 +365,7 @@ function getcolumns(setdrawer) {
...
@@ -330,6 +365,7 @@ function getcolumns(setdrawer) {
path
:
'/sparepart/spareStock/queryByOperate'
,
path
:
'/sparepart/spareStock/queryByOperate'
,
hideInSearch
:
true
,
hideInSearch
:
true
,
hideInTable
:
true
,
hideInTable
:
true
,
rowName
:
'sparePartName'
,
render
:
(
text
,
row
)
=>
{
render
:
(
text
,
row
)
=>
{
return
(
return
(
<
AutoTable
<
AutoTable
...
@@ -337,7 +373,13 @@ function getcolumns(setdrawer) {
...
@@ -337,7 +373,13 @@ function getcolumns(setdrawer) {
...
it
,
...
it
,
hideInSearch
:
true
,
hideInSearch
:
true
,
}))}
}))}
resizeable
=
{
false
}
dataSource
=
{
row
?.
taskSpareList
}
dataSource
=
{
row
?.
taskSpareList
}
expandable
=
{{
expandedRowRender
:
(
record
)
=>
(
<
ExtraTable
dataSource
=
{
record
?.
taskSpareSupplierList
??
[]}
/
>
),
}}
/
>
/
>
);
);
},
},
...
...
src/pages/spare/requisition/columns.js
0 → 100644
View file @
77adc3e3
This diff is collapsed.
Click to expand it.
src/pages/spare/requisition/index.jsx
0 → 100644
View file @
77adc3e3
import
*
as
React
from
'react'
;
import
{
useState
,
useMemo
,
useRef
}
from
'react'
;
import
DrawerPro
from
'@/components/DrawerPro'
;
import
AutoTable
from
'@/components/AutoTable'
;
import
PremButton
from
'@/components/PremButton'
;
import
getcolumns
from
'./columns'
;
import
{
useRequest
}
from
'ahooks'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
InitForm
from
'@/components/InitForm'
;
import
{
message
,
Divider
}
from
'antd'
;
function
Requisition
(
props
)
{
const
actionRef
=
useRef
(),
formRef
=
useRef
();
const
[
drawer
,
setdrawer
]
=
useState
({
open
:
false
,
}),
[
activeTabKey
,
setactiveTabKey
]
=
useState
(
'1'
);
const
{
run
,
loading
}
=
useRequest
(
doFetch
,
{
manual
:
true
,
onSuccess
:
(
res
,
params
)
=>
{
if
(
res
?.
code
==
'0000'
)
{
message
.
success
(
'操作成功'
);
actionRef
?.
current
?.
reload
();
setdrawer
((
s
)
=>
({
...
s
,
open
:
false
,
}));
}
},
});
const
detail
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
<
PremButton
btn=
{
{
size
:
'small'
,
type
:
'link'
,
onClick
:
()
=>
{
setdrawer
((
s
)
=>
({
...
s
,
open
:
true
,
item
:
row
,
title
:
'详情'
,
val
:
'detail'
,
title
:
'详细信息'
,
}));
},
}
}
>
详情
</
PremButton
>
);
};
const
edit
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
<
PremButton
btn=
{
{
size
:
'small'
,
disabled
:
row
.
status
==
2
,
onClick
:
()
=>
{
setdrawer
((
s
)
=>
({
...
s
,
open
:
true
,
item
:
row
,
title
:
'审批'
,
val
:
'detailaddon'
,
addon
:
(
<>
<
InitForm
style=
{
{
background
:
'#f0f0f0'
,
padding
:
12
,
borderTop
:
'#1890ff solid 1px'
}
}
fields=
{
[
{
title
:
'审批结果'
,
dataIndex
:
'approvalResult'
,
key
:
'approvalResult'
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}]
},
valueType
:
'radio'
,
options
:
[
{
label
:
'通过'
,
value
:
'1'
},
{
label
:
'不通过'
,
value
:
'2'
},
],
},
{
title
:
'审批备注'
,
dataIndex
:
'approvalRemark'
,
key
:
'approvalRemark'
,
valueType
:
'textarea'
,
colProps
:
{
span
:
24
},
},
]
}
onFinish=
{
(
vals
)
=>
{
run
({
url
:
'/sparepart/spareApplyTask/approval'
,
params
:
{
...
vals
,
id
:
row
?.
id
},
});
}
}
/>
</>
),
}));
},
}
}
>
审批
</
PremButton
>
);
};
const
remove
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
<
PremButton
pop=
{
{
title
:
'是否删除?'
,
okText
:
'确认'
,
cancelText
:
'取消'
,
onConfirm
:
()
=>
{
run
({
url
:
pathconfig
?.
delete
||
'/delete'
,
params
:
{
id
:
row
?.
id
}
});
},
}
}
btn=
{
{
size
:
'small'
,
type
:
'danger'
,
}
}
>
删除
</
PremButton
>
);
};
const
columns
=
useMemo
(()
=>
{
let
defcolumn
=
getcolumns
(
drawer
?.
type
).
filter
((
it
)
=>
it
.
key
==
activeTabKey
)[
0
]?.
columns
;
let
defpath
=
getcolumns
(
drawer
?.
type
).
filter
((
it
)
=>
it
.
key
==
activeTabKey
)[
0
]?.
pathconfig
??
{};
return
defcolumn
.
concat
({
title
:
'操作'
,
valueType
:
'option'
,
width
:
150
,
render
:
(
text
,
row
,
_
,
action
)
=>
[
defpath
?.
enabledetail
&&
detail
(
text
,
row
,
_
,
action
),
defpath
?.
enableedit
&&
edit
(
text
,
row
,
_
,
action
),
defpath
?.
enabledelete
&&
remove
(
text
,
row
,
_
,
action
),
],
});
},
[
activeTabKey
,
drawer
?.
type
]);
const
pathconfig
=
useMemo
(()
=>
{
let
defpath
=
getcolumns
(
setdrawer
).
filter
((
it
)
=>
it
.
key
==
activeTabKey
)[
0
]?.
pathconfig
??
{};
return
defpath
;
},
[
activeTabKey
]);
return
(
<
div
style=
{
{
position
:
'relative'
}
}
>
<
AutoTable
pagetitle=
"备件领用"
columns=
{
columns
}
path=
{
pathconfig
?.
list
||
'/ngic-auth/sysUser/query/page'
}
actionRef=
{
actionRef
}
pageextra=
{
pathconfig
?.
enableadd
?
'add'
:
null
}
resizeable=
{
false
}
addconfig=
{
{
// access: 'sysDepartment_save',
btn
:
{
disabled
:
false
,
onClick
:
async
()
=>
{
let
res
=
await
doFetch
({
url
:
'/base/pmBaseBusinessData/querySpareStockType'
,
params
:
{},
});
let
type
=
res
?.
data
?.
data
?.
type
;
setdrawer
((
s
)
=>
({
...
s
,
open
:
true
,
item
:
null
,
title
:
'新增'
,
val
:
'add'
,
type
,
}));
},
},
}
}
tabList=
{
getcolumns
()
}
activeTabKey=
{
activeTabKey
}
onTabChange=
{
(
key
)
=>
{
setactiveTabKey
(
key
);
}
}
/>
<
DrawerPro
fields=
{
columns
}
detailpath=
{
pathconfig
?.
detail
||
null
}
defaultFormValue=
{
drawer
?.
item
}
params=
{
{
id
:
drawer
?.
item
?.
id
}
}
formRef=
{
formRef
}
placement=
"right"
onClose=
{
()
=>
{
setdrawer
((
s
)
=>
({
...
s
,
open
:
false
,
}));
}
}
{
...
drawer
}
onFinish=
{
(
vals
)
=>
{
const
detailsList
=
vals
?.
detailsList
?.
map
?.((
it
,
i
)
=>
{
return
{
spareStockId
:
it
?.
id
,
operateNum
:
it
?.
operateNum
,
};
});
if
(
drawer
?.
val
==
'add'
)
{
run
({
url
:
pathconfig
?.
add
||
'/add'
,
params
:
{
...
vals
,
detailsList
}
});
}
else
if
(
drawer
?.
val
==
'edit'
)
{
run
({
url
:
pathconfig
?.
edit
||
'/edit'
,
params
:
{
...
vals
,
id
:
drawer
?.
item
?.
id
,
detailsList
},
});
}
}
}
>
{
drawer
?.
addon
}
</
DrawerPro
>
</
div
>
);
}
export
default
Requisition
;
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