Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
merchant-manage-ui
Commits
78d2d448
Commit
78d2d448
authored
Mar 31, 2023
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 添加字符串去空功能
parent
f7ab93b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
43 deletions
+69
-43
index.jsx
src/pages/GoodsManage/SearchForm/index.jsx
+40
-38
GroupInfo.jsx
src/pages/GoodsManage/Takeaway/components/GroupInfo.jsx
+8
-5
utils.js
src/utils/utils.js
+21
-0
No files found.
src/pages/GoodsManage/SearchForm/index.jsx
View file @
78d2d448
...
@@ -164,7 +164,7 @@ class goodsManage extends Component {
...
@@ -164,7 +164,7 @@ class goodsManage extends Component {
className=
{
styles
.
searchForm
}
className=
{
styles
.
searchForm
}
>
>
<
FormItem
label=
"SKU编码"
name=
"skuId"
>
<
FormItem
label=
"SKU编码"
name=
"skuId"
>
<
InputNumber
placeholder=
"请输入SKU编码"
style=
{
selectW
}
/>
<
InputNumber
placeholder=
"请输入SKU编码"
max=
{
99999999999999999
}
style=
{
selectW
}
/>
</
FormItem
>
</
FormItem
>
<
FormItem
label=
"商品名称"
name=
"skuName"
>
<
FormItem
label=
"商品名称"
name=
"skuName"
>
<
Input
placeholder=
"请输入商品名称"
allowClear
style=
{
selectW
}
/>
<
Input
placeholder=
"请输入商品名称"
allowClear
style=
{
selectW
}
/>
...
@@ -193,48 +193,48 @@ class goodsManage extends Component {
...
@@ -193,48 +193,48 @@ class goodsManage extends Component {
/>
/>
</
FormItem
>
</
FormItem
>
{
this
.
state
.
productType
!==
5
&&
(
{
this
.
state
.
productType
!==
5
&&
(
<
FormItem
label=
"审核状态"
name=
"state"
>
<>
<
Select
<
FormItem
label=
"审核状态"
name=
"state"
>
style=
{
selectW
}
<
Select
placeholder=
"请选择审核状态"
style=
{
selectW
}
allowClear
placeholder=
"请选择审核状态"
filterOption=
{
filterOption
}
allowClear
>
filterOption=
{
filterOption
}
{
stateList
?.
map
(
item
=>
(
>
<
Option
key=
{
item
.
value
}
value=
{
item
.
value
}
>
{
stateList
?.
map
(
item
=>
(
{
item
.
label
}
<
Option
key=
{
item
.
value
}
value=
{
item
.
value
}
>
</
Option
>
{
item
.
label
}
))
}
</
Option
>
</
Select
>
))
}
</
FormItem
>
</
Select
>
)
}
</
FormItem
>
<
FormItem
label=
"供货价区间"
>
<
FormItem
label=
"供货价区间"
>
<
FormItem
name=
"supplyPriceMin"
className=
{
styles
.
iptNumRight
}
noStyle
>
<
FormItem
name=
"supplyPriceMin"
className=
{
styles
.
iptNumRight
}
noStyle
>
<
InputNumber
placeholder=
"请输入"
min=
{
0
}
max=
{
999999999
}
style=
{
iptNumWidth
}
/>
<
InputNumber
placeholder=
"请输入"
min=
{
0
}
max=
{
999999999
}
style=
{
iptNumWidth
}
/>
</
FormItem
>
</
FormItem
>
<
span
>
<
span
>
<
SwapRightOutlined
/>
<
SwapRightOutlined
/>
</
span
>
</
span
>
<
FormItem
name=
"supplyPriceMax"
className=
{
styles
.
iptNumRight
}
noStyle
>
<
FormItem
name=
"supplyPriceMax"
className=
{
styles
.
iptNumRight
}
noStyle
>
<
InputNumber
<
InputNumber
style=
{
iptNumWidth
}
style=
{
iptNumWidth
}
min=
{
0
}
min=
{
0
}
max=
{
999999999
}
max=
{
999999999
}
placeholder=
"请输入"
placeholder=
"请输入"
onChange=
{
this
.
valueMin
}
onChange=
{
this
.
valueMin
}
/>
/>
</
FormItem
>
</
FormItem
>
</
FormItem
>
</
FormItem
>
{
this
.
state
.
productType
!==
5
&&
(
<
FormItem
name=
"thirdSkuNo"
label=
"第三方SKU编码"
>
<
FormItem
name=
"thirdSkuNo"
label=
"第三方SKU编码"
>
<
Input
placeholder=
"请输入第三方SKU编码"
allowClear
style=
{
selectW
}
/
>
<
Input
placeholder=
"请输入第三方SKU编码"
allowClear
style=
{
selectW
}
/
>
<
/
FormItem
>
</
FormItem
>
</>
)
}
)
}
<
FormItem
className=
{
styles
.
queryBtn
}
>
<
FormItem
className=
{
styles
.
queryBtn
}
>
<
Button
onClick=
{
()
=>
this
.
handleSearch
()
}
type=
"primary"
className=
{
styles
.
button
}
>
<
Button
onClick=
{
()
=>
this
.
handleSearch
()
}
type=
"primary"
className=
{
styles
.
button
}
>
查询
查询
</
Button
>
</
Button
>
<
Button
onClick=
{
()
=>
this
.
onReset
()
}
type=
"primary"
className=
{
styles
.
button
}
>
<
Button
onClick=
{
()
=>
this
.
onReset
()
}
className=
{
styles
.
button
}
>
重置
重置
</
Button
>
</
Button
>
{
this
.
state
.
productType
!==
5
&&
(
{
this
.
state
.
productType
!==
5
&&
(
...
@@ -242,6 +242,8 @@ class goodsManage extends Component {
...
@@ -242,6 +242,8 @@ class goodsManage extends Component {
<
Button
<
Button
loading=
{
this
.
state
.
loading
}
loading=
{
this
.
state
.
loading
}
onClick=
{
()
=>
this
.
onExportGoodsInfo
()
}
onClick=
{
()
=>
this
.
onExportGoodsInfo
()
}
type=
"primary"
ghost
className=
{
styles
.
button
}
className=
{
styles
.
button
}
>
>
导出
导出
...
...
src/pages/GoodsManage/Takeaway/components/GroupInfo.jsx
View file @
78d2d448
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
{
Form
,
Modal
,
Input
,
Switch
,
Alert
,
message
}
from
'
antd
'
;
import
{
Form
,
Modal
,
Input
,
Switch
,
Alert
,
message
}
from
'
antd
'
;
import
{
apiCreateStorage
,
apiEditStorage
,
apiStorageInfo
}
from
'
../../service
'
;
import
{
apiCreateStorage
,
apiEditStorage
,
apiStorageInfo
}
from
'
../../service
'
;
import
{
stringOrObjectTrim
}
from
'
@/utils/utils
'
;
const
GroupInfo
=
options
=>
{
const
GroupInfo
=
options
=>
{
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
...
@@ -15,15 +16,17 @@ const GroupInfo = options => {
...
@@ -15,15 +16,17 @@ const GroupInfo = options => {
const
handleConfirm
=
async
()
=>
{
const
handleConfirm
=
async
()
=>
{
const
{
name
,
necessary
}
=
await
form
.
validateFields
();
const
{
name
,
necessary
}
=
await
form
.
validateFields
();
const
api
=
options
.
id
?
apiEditStorage
:
apiCreateStorage
;
const
api
=
options
.
id
?
apiEditStorage
:
apiCreateStorage
;
await
api
({
const
res
=
await
api
({
name
,
name
:
stringOrObjectTrim
(
name
)
,
necessary
:
necessary
?
1
:
0
,
necessary
:
necessary
?
1
:
0
,
shopId
:
options
.
shopId
,
shopId
:
options
.
shopId
,
id
:
options
.
id
,
id
:
options
.
id
,
});
});
message
.
success
(
'
添加成功!
'
);
if
(
res
.
code
===
'
0000
'
&&
res
.
businessCode
===
'
0000
'
)
{
handleCancel
();
message
.
success
(
'
保存成功!
'
);
options
.
search
();
handleCancel
();
options
.
search
();
}
};
};
const
getInfo
=
async
id
=>
{
const
getInfo
=
async
id
=>
{
...
...
src/utils/utils.js
View file @
78d2d448
...
@@ -126,4 +126,25 @@ export const getClientInfo = () => {
...
@@ -126,4 +126,25 @@ export const getClientInfo = () => {
};
};
};
};
// 字符串或json去空格
export
const
stringOrObjectTrim
=
params
=>
{
if
(
isClass
(
params
)
===
'
String
'
)
{
return
params
.
trim
();
}
if
(
isClass
(
params
)
===
'
Object
'
)
{
Object
.
keys
(
params
).
forEach
(
key
=>
{
if
(
isClass
(
params
[
key
])
===
'
String
'
)
{
params
[
key
]
=
params
[
key
].
trim
();
}
else
if
(
isClass
(
params
[
key
])
===
'
Object
'
)
{
stringOrObjectTrim
(
params
[
key
]);
}
else
if
(
isClass
(
params
[
key
])
===
'
Array
'
)
{
params
[
key
].
forEach
((
item
,
i
)
=>
{
params
[
key
][
i
]
=
stringOrObjectTrim
(
item
);
});
}
});
}
return
params
;
};
export
const
getObjectType
=
v
=>
Object
.
prototype
.
toString
.
call
(
v
).
replace
(
/
\[
object |]/g
,
''
);
export
const
getObjectType
=
v
=>
Object
.
prototype
.
toString
.
call
(
v
).
replace
(
/
\[
object |]/g
,
''
);
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