Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wms
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
wms
Commits
5722a4a5
Commit
5722a4a5
authored
Jul 11, 2022
by
wuhao
🎯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kiu
parent
a5dffbe5
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
921 additions
and
366 deletions
+921
-366
proxy.js
config/proxy.js
+1
-1
index.jsx
src/components/AutoTable/index.jsx
+13
-14
mcard.jsx
src/components/AutoTable/mcard.jsx
+24
-18
mtable.jsx
src/components/AutoTable/mtable.jsx
+2
-1
detail.jsx
src/components/Details/detail.jsx
+205
-0
index.jsx
src/components/DrawInitForm/index.jsx
+19
-3
index.jsx
src/components/EditTable/index.jsx
+81
-8
index.jsx
src/components/InitForm/index.jsx
+4
-0
Index.jsx
src/pages/craft/Materiel/Index.jsx
+1
-1
fields.js
src/pages/insertstore/Instore/fields.js
+233
-115
index.jsx
src/pages/insertstore/Instore/index.jsx
+338
-205
No files found.
config/proxy.js
View file @
5722a4a5
...
...
@@ -11,7 +11,7 @@ export default {
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
"/wms/"
:
{
// 要代理的地址
target
:
"http://192.168.40.
215
:18040/"
,
//39:18040 23/wms/ //60 翔 //18
target
:
"http://192.168.40.
114
:18040/"
,
//39:18040 23/wms/ //60 翔 //18
changeOrigin
:
true
,
pathRewrite
:
{
"^/wms"
:
""
,
...
...
src/components/AutoTable/index.jsx
View file @
5722a4a5
...
...
@@ -84,7 +84,6 @@ export default (props) => {
return
<
div
style=
{
{
height
:
32
,
width
:
64
}
}
></
div
>
}
else
{
let
strarr
=
props
.
pageextra
?
props
.
pageextra
.
split
(
","
)
:
[
"add"
];
console
.
log
(
strarr
);
return
strarr
.
map
((
it
,
i
)
=>
{
return
<
div
style=
{
{
marginRight
:
i
==
strarr
.
length
-
1
?
0
:
6
}
}
>
{
actionbtn
[
it
]
}
...
...
@@ -95,22 +94,22 @@ export default (props) => {
// screens.xs ? (
// <div
// style={{ display: "flex", flexDirection: "column", height: "100%" }}
// >
// {props.children && (
// <div style={{ marginBottom: 12 }}>{props.children}</div>
// )}
// <div>
// <Mcard {...props} pageextra={renderextra()}/>
// </div>
// </div>
// ) :
return
(
<
div
className=
"diycard"
>
{
screens
.
xs
?
(
<
div
style=
{
{
display
:
"flex"
,
flexDirection
:
"column"
,
height
:
"100%"
}
}
>
{
props
.
children
&&
(
<
div
style=
{
{
marginBottom
:
12
}
}
>
{
props
.
children
}
</
div
>
)
}
<
div
>
<
Mcard
{
...
props
}
/>
</
div
>
</
div
>
)
:
props
.
withCard
===
false
?
(
{
props
.
withCard
===
false
?
(
<
div
style=
{
{
display
:
"flex"
,
width
:
"100%"
}
}
>
{
(
props
.
childposition
==
"left"
||
!
props
.
childposition
)
&&
props
.
children
}
...
...
src/components/AutoTable/mcard.jsx
View file @
5722a4a5
...
...
@@ -124,7 +124,7 @@ class Mcard extends PureComponent {
if
(
this
.
props
.
path
!=
np
.
path
||
JSON
.
stringify
(
this
.
props
.
extraparams
)
!=
JSON
.
stringify
(
np
.
extraparams
)
||
JSON
.
stringify
(
np
.
extraparams
)
||
JSON
.
stringify
(
this
.
props
.
dataSource
)
!=
JSON
.
stringify
(
np
.
dataSource
)
)
{
this
.
lv
.
scrollTo
(
0
);
...
...
@@ -192,16 +192,16 @@ class Mcard extends PureComponent {
render
()
{
let
{
scrolltop
,
dataSource
,
isLoading
,
refreshing
,
hasMore
,
isEmpty
,
visible
,
fields
,
searchlist
,
}
=
this
.
state
,
scrolltop
,
dataSource
,
isLoading
,
refreshing
,
hasMore
,
isEmpty
,
visible
,
fields
,
searchlist
,
}
=
this
.
state
,
{
columns
,
cardtitle
,
...
...
@@ -214,6 +214,7 @@ class Mcard extends PureComponent {
tabList
,
}
=
this
.
props
;
return
(
<
div
style=
{
{
height
:
"100%"
}
}
>
<
div
className=
"fixedsearch"
>
...
...
@@ -229,10 +230,15 @@ class Mcard extends PureComponent {
<
SearchOutlined
style=
{
{
color
:
"#fff"
}
}
/>
</
div
>
)
}
{
pageextra
&&
pageextra
.
map
((
it
)
=>
{
return
<
div
>
{
it
}
</
div
>;
})
}
{
pageextra
?
Array
.
isArray
(
pageextra
)
?
pageextra
.
map
((
it
)
=>
{
return
<
div
>
{
it
}
</
div
>;
})
:
pageextra
:
null
}
</
div
>
<
Drawer
...
...
@@ -247,7 +253,7 @@ class Mcard extends PureComponent {
>
<
InitForm
fields=
{
fields
}
onChange=
{
()
=>
{}
}
onChange=
{
()
=>
{
}
}
reset=
{
true
}
submitData=
{
(
values
)
=>
{
this
.
onRefresh
(
this
.
props
,
values
);
...
...
@@ -327,8 +333,8 @@ class Mcard extends PureComponent {
columns
.
filter
((
it
)
=>
it
.
valueType
==
"option"
).
length
==
0
?
null
:
columns
.
filter
((
it
)
=>
it
.
valueType
==
"option"
)[
0
]
?.
render
(
null
,
rowData
,
null
,
{
type
:
"text"
})
.
filter
((
it
)
=>
it
.
valueType
==
"option"
)[
0
]
?.
render
(
null
,
rowData
,
null
,
{
type
:
"text"
})
}
>
<
Row
>
...
...
src/components/AutoTable/mtable.jsx
View file @
5722a4a5
...
...
@@ -29,7 +29,8 @@ class Mtable extends PureComponent {
JSON
.
stringify
(
nextprops
.
extraparams
)
||
JSON
.
stringify
(
this
.
props
.
path
)
!=
JSON
.
stringify
(
nextprops
.
path
)
||
JSON
.
stringify
(
this
.
props
.
refreshDep
)
!=
JSON
.
stringify
(
nextprops
.
refreshDep
)
JSON
.
stringify
(
nextprops
.
refreshDep
)
||
this
.
props
.
columns
!=
nextprops
.
columns
)
{
if
(
nextprops
.
actionRef
)
{
nextprops
.
actionRef
?.
current
?.
reload
();
...
...
src/components/Details/detail.jsx
0 → 100644
View file @
5722a4a5
import
React
,
{
useState
,
useEffect
,
memo
}
from
"react"
;
import
{
Table
,
Divider
,
Card
,
Descriptions
,
Typography
,
Spin
,
Row
,
Col
,
Tooltip
,
Rate
,
Image
,
}
from
"antd"
;
import
{
doFetch
,
postFetch
}
from
"@/utils/doFetch"
;
import
AutoTable
from
"@/components/Tableform"
;
import
styles
from
"./index.less"
;
const
Details
=
(
props
)
=>
{
/**
* dataSource: 整个页面的数据,Object
* totalPath: 整个详情页的接口,String
* totalParams: 整个详情页接口的参数
* totalCard: 整个页面的模块,Array
* col: 列数
*
* totalCard中的每一项变量:cardTitle每一个模块的标题;itemData每一个模块的数据信息(Array)
* itemData中的每一项变量:key所对应的字段;title每一项label标题;type每一项的类型(file,img,textarea,table,不填默认就是普通的展示类型);col每一项的占比;columns表格类型所用;path当类型为表格时,若该表格是单独查询出来的可以填入path;urlName 当传入文件为url为字符串时
*
*/
const
{
totalPath
=
""
,
dataSource
,
totalCard
,
totalParams
,
col
,
bottomNode
,
topNode
,
}
=
props
;
const
[
pageData
,
cp
]
=
useState
({});
useEffect
(()
=>
{
if
(
dataSource
)
{
cp
(
dataSource
);
}
else
if
(
!
dataSource
&&
!
Array
.
isArray
(
totalPath
))
{
doFetch
({
url
:
totalPath
,
params
:
totalParams
?
{
...
totalParams
}
:
{},
}).
then
((
res
)
=>
{
if
(
res
.
code
==
"0000"
)
{
if
(
!
res
.
data
)
{
return
;
}
cp
(
res
?.
data
?.
data
);
}
});
}
},
[]);
const
getCol
=
(
itemcol
)
=>
{
if
(
itemcol
)
{
return
itemcol
;
}
else
{
return
col
?
col
:
{
xs
:
24
,
sm
:
24
,
md
:
12
,
lg
:
8
,
xl
:
8
,
xxl
:
6
};
}
};
//获取每一项
const
getItem
=
(
itemData
)
=>
{
const
{
type
,
key
,
title
,
columns
,
path
,
urlName
,
col
,
rowKey
,
expandable
,
}
=
itemData
,
value
=
pageData
[
key
];
if
(
!
type
||
type
==
"input"
)
{
return
value
==
0
||
value
?
(
<
Tooltip
title=
{
`${title}:${value}`
}
>
<
pre
className=
{
col
?
""
:
styles
.
one
}
>
{
value
}
</
pre
>
</
Tooltip
>
)
:
(
<
div
>
-
</
div
>
);
}
else
if
(
type
==
"file"
)
{
return
(
<
div
style=
{
{
display
:
"flex"
,
flexFlow
:
"row wrap"
,
width
:
"100%"
}
}
>
{
value
&&
typeof
value
==
"string"
?
(
<
a
href=
{
value
}
download=
{
value
}
style=
{
{
margin
:
"0 10px 0 0"
,
display
:
"block"
}
}
>
{
urlName
?
urlName
:
"下载"
}
</
a
>
)
:
value
&&
Array
.
isArray
(
value
)
&&
value
?.
length
?
(
value
?.
map
((
el
)
=>
{
return
(
<
a
key=
{
el
.
url
}
href=
{
el
.
url
}
download=
{
el
.
name
}
style=
{
{
margin
:
"0 10px 0 0"
,
display
:
"block"
}
}
>
{
el
.
name
}
</
a
>
);
})
)
:
(
"-"
)
}
</
div
>
);
}
else
if
(
type
==
"img"
)
{
return
(
<
div
style=
{
{
display
:
"flex"
,
flexFlow
:
"row wrap"
}
}
>
{
value
&&
value
?.
length
?
value
?.
map
((
el
)
=>
{
return
(
<
Image
style=
{
{
margin
:
"0 10px 0 0"
}
}
src=
{
el
?.
url
}
width=
{
30
}
height=
{
30
}
key=
{
el
?.
uid
}
></
Image
>
);
})
:
"-"
}
</
div
>
);
}
else
if
(
type
==
"table"
)
{
return
(
<
AutoTable
columns=
{
columns
||
[]
}
path=
{
path
?
path
:
null
}
bordered=
{
false
}
dataSource=
{
path
?
null
:
value
}
rowKey=
{
rowKey
??
"id"
}
expandable=
{
expandable
??
null
}
></
AutoTable
>
);
}
else
if
(
type
==
"rate"
)
{
return
(
<
Rate
bordered=
{
false
}
className=
{
"simple"
}
style=
{
{
width
:
"100%"
}
}
disabled=
{
itemData
.
disabled
}
allowHalf=
{
itemData
.
allowHalf
?
itemData
.
allowHalf
:
false
}
value=
{
value
||
0
}
/>
);
}
};
return
(
<
div
className=
{
`${styles.bodyBox} detailCards`
}
>
<
Spin
spinning=
{
false
}
>
{
topNode
&&
<
div
>
{
topNode
}
</
div
>
}
{
totalCard
?.
map
((
item
,
i
)
=>
{
return
(
<
Card
key=
{
i
}
title=
{
item
.
cardTitle
}
bordered=
{
false
}
style=
{
{
marginBottom
:
16
}
}
bodyStyle=
{
{
padding
:
"16px 10px"
}
}
>
<
Row
gutter=
{
[
12
,
12
]
}
>
{
item
?.
itemData
?.
map
((
it
,
j
)
=>
{
return
(
<
Col
key=
{
j
}
{
...
getCol
(
it
.
col
)}
>
<
div
style=
{
{
width
:
"100%"
,
display
:
"flex"
}
}
>
<
div
style=
{
{
flexShrink
:
0
,
display
:
`${it.title ? "block" : "none"}`
,
textAlign
:
"right"
,
width
:
126
,
}
}
>
{
it
.
title
}
:
</
div
>
{
getItem
(
it
)
}
</
div
>
</
Col
>
);
})
}
</
Row
>
</
Card
>
);
})
}
{
bottomNode
&&
<
div
>
{
bottomNode
}
</
div
>
}
</
Spin
>
</
div
>
);
};
export
default
memo
(
Details
);
src/components/DrawInitForm/index.jsx
View file @
5722a4a5
import
InitForm
from
"../InitForm"
;
import
{
Drawer
}
from
"antd"
;
import
React
,
{
useState
,
memo
}
from
"react"
;
import
Details
from
"../Details/detail"
;
// title="Basic Drawer"
// placement="right"
// closable={false}
...
...
@@ -10,20 +10,36 @@ import React, { useState, memo } from "react";
// getContainer={false}
// style={{ position: 'absolute' }}
// drawer props + initform props + detial props
function
DrawInitForm
(
props
)
{
let
newProps
=
{
...
props
};
delete
newProps
.
children
;
const
detailprops
=
{
totalPath
:
props
.
totalPath
,
dataSource
:
props
.
detaildataSource
,
totalCard
:
props
.
totalCard
,
totalParams
:
props
.
totalParams
,
col
:
props
.
col
,
bottomNode
:
props
.
bottomNode
,
topNode
:
props
.
topNode
,
}
return
(
<
Drawer
maskClosable=
{
false
}
placement=
"right"
closable=
{
true
}
getContainer=
{
false
}
style=
{
{
position
:
"absolute"
,
transform
:
"translateX(0)"
}
}
style=
{
{
position
:
"absolute"
,
transform
:
"translateX(0)"
}
}
width=
{
props
.
val
==
"detail"
?
1000
:
props
.
width
}
destroyOnClose=
{
true
}
{
...
props
}
>
{
props
.
children
}
<
InitForm
{
...
newProps
}
></
InitForm
>
{
props
.
val
==
"detail"
?
<
Details
{
...
detailprops
}
></
Details
>
:
<
InitForm
{
...
newProps
}
></
InitForm
>
}
</
Drawer
>
);
}
...
...
src/components/EditTable/index.jsx
View file @
5722a4a5
import
React
,
{
useEffect
}
from
"react"
;
import
React
,
{
useEffect
,
useRef
}
from
"react"
;
import
{
EditableProTable
}
from
"@ant-design/pro-table"
;
import
ProField
from
"@ant-design/pro-field"
;
import
ProCard
from
"@ant-design/pro-card"
;
...
...
@@ -11,7 +11,9 @@ const EditTable = ({
rowKey
,
recordCreatorProps
,
maxLength
,
linkconfig
})
=>
{
const
editorFormRef
=
useRef
()
return
(
<
EditableProTable
columns=
{
columns
}
...
...
@@ -22,20 +24,91 @@ const EditTable = ({
recordCreatorProps
==
"false"
?
false
:
{
newRecordType
:
"dataSource"
,
record
:
()
=>
({
[
rowKey
]:
Date
.
now
(),
}),
}
newRecordType
:
"dataSource"
,
record
:
()
=>
({
[
rowKey
]:
Date
.
now
(),
}),
}
}
editableFormRef=
{
editorFormRef
}
editable=
{
{
type
:
"multiple"
,
editableKeys
:
value
?
value
.
map
((
item
)
=>
item
[
rowKey
])
:
[],
actionRender
:
(
row
,
config
,
defaultDoms
)
=>
{
return
[
defaultDoms
.
delete
];
},
onValuesChange
:
(
record
,
recordList
)
=>
{
onChange
(
recordList
);
onValuesChange
:
async
(
record
,
recordList
)
=>
{
let
{
urlchangeval
}
=
linkconfig
??
{};
let
newvalue
=
[...
recordList
];
if
(
urlchangeval
&&
record
)
{
//根据url 改变 数据值
let
{
params
,
database
,
effectresult
}
=
urlchangeval
??
{},
curvaluerow
=
value
&&
value
.
length
>
0
?
value
.
filter
(
it
=>
it
[
rowKey
]
==
record
[
rowKey
])[
0
]
:
{}
//获取除本行之外已修改的value值
newvalue
=
newvalue
.
map
((
it
,
i
)
=>
{
if
(
!
record
)
return
it
;
if
(
it
[
rowKey
]
==
record
[
rowKey
])
{
let
freshvals
=
{}
Object
.
keys
(
effectresult
).
map
(
its
=>
{
freshvals
[
its
]
=
value
[
i
][
its
]
})
it
=
{
...
record
,
...
freshvals
}
}
else
{
it
=
value
&&
value
.
length
>
0
?
value
.
filter
(
its
=>
its
[
rowKey
]
==
it
[
rowKey
])[
0
]
:
{}
}
return
it
});
//参数获取
let
parames
=
{};
let
ifs
=
false
;
Object
.
keys
(
params
).
map
(
it
=>
{
if
(
params
[
it
]
==
"linked"
)
{
parames
[
it
]
=
record
[
it
]
if
(
record
[
it
]
==
curvaluerow
[
it
])
{
ifs
=
true
;
}
}
else
{
parames
[
it
]
=
params
[
it
]
}
})
if
(
ifs
)
{
//值未变化
}
else
{
let
res
=
await
database
(
parames
);
console
.
log
(
newvalue
);
newvalue
=
newvalue
.
map
((
it
,
i
)
=>
{
if
(
it
[
rowKey
]
==
record
[
rowKey
])
{
Object
.
keys
(
effectresult
).
map
(
items
=>
{
it
[
items
]
=
res
?.
data
?.
data
[
effectresult
[
items
]];
})
}
editorFormRef
.
current
?.
setRowData
?.(
i
,
it
)
return
it
})
};
}
onChange
(
newvalue
);
},
}
}
maxLength=
{
maxLength
??
1000
}
...
...
src/components/InitForm/index.jsx
View file @
5722a4a5
...
...
@@ -557,6 +557,9 @@ let InitForm = ({
// formartSubmit(values);
}
}
onValuesChange=
{
(
changedValues
,
values
)
=>
{
console
.
log
(
'===================================='
)
console
.
log
(
changedValues
)
console
.
log
(
'===================================='
)
let
newvalue
=
{};
let
linkkey
=
Object
.
keys
(
changedValues
)[
0
];
//联动逻辑
...
...
@@ -1187,6 +1190,7 @@ let InitForm = ({
recordCreatorProps=
{
item
.
recordCreatorProps
}
value=
{
item
.
value
}
maxLength=
{
item
.
maxLength
}
linkconfig=
{
item
.
linkconfig
}
></
EditTable
>
</
Form
.
Item
>
</
Col
>
...
...
src/pages/craft/Materiel/Index.jsx
View file @
5722a4a5
...
...
@@ -273,7 +273,7 @@ const Materiel = (props) => {
dataIndex
:
"option_dataindex"
,
key
:
"option_dataindex"
,
valueType
:
"option"
,
width
:
275
,
width
:
160
,
render
:
(
text
,
row
,
_
,
action
)
=>
extraAction
(
text
,
row
,
_
,
action
),
},
];
...
...
src/pages/insertstore/Instore/fields.js
View file @
5722a4a5
This diff is collapsed.
Click to expand it.
src/pages/insertstore/Instore/index.jsx
View file @
5722a4a5
This diff is collapsed.
Click to expand it.
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