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
2d3be144
Commit
2d3be144
authored
Apr 07, 2023
by
张子雨
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/constructionOne' into feature/20230327_public_takeaway
* feat/constructionOne: feat: 增加校验规则
parents
1c772b85
c692257b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
30 deletions
+48
-30
storeModal.jsx
src/pages/chainStoreManage/components/storeModal.jsx
+17
-12
index.jsx
src/pages/chainStoreManage/index.jsx
+16
-3
utils.js
src/utils/utils.js
+15
-15
No files found.
src/pages/chainStoreManage/components/storeModal.jsx
View file @
2d3be144
...
@@ -232,6 +232,18 @@ const StoreModal = props => {
...
@@ -232,6 +232,18 @@ const StoreModal = props => {
const
normFile
=
fileList
=>
fileList
;
const
normFile
=
fileList
=>
fileList
;
const
timerWrapper
=
async
(
time
,
timeString
,
callback
)
=>
{
if
(
timeString
&&
timeString
.
length
)
{
const
begin
=
moment
(
timeString
[
0
]).
format
(
'
HH:mm
'
);
const
end
=
moment
(
timeString
[
1
]).
format
(
'
HH:mm
'
);
if
(
begin
===
end
)
{
callback
(
new
Error
(
'
选择开始时间结束时间不能一样
'
));
}
}
else
{
callback
();
}
};
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
visible
)
{
if
(
visible
)
{
resetFields
();
resetFields
();
...
@@ -254,7 +266,6 @@ const StoreModal = props => {
...
@@ -254,7 +266,6 @@ const StoreModal = props => {
if
(
info
.
townId
)
{
if
(
info
.
townId
)
{
info
.
addr
.
push
(
info
.
townId
);
info
.
addr
.
push
(
info
.
townId
);
}
}
console
.
log
(
info
);
setTimes
(
harr
);
setTimes
(
harr
);
setFormData
(
info
);
setFormData
(
info
);
getLazyAddr
(
info
);
getLazyAddr
(
info
);
...
@@ -331,18 +342,12 @@ const StoreModal = props => {
...
@@ -331,18 +342,12 @@ const StoreModal = props => {
<
div
>
<
div
>
<
FormItem
name=
{
item
.
name
}
>
<
FormItem
name=
{
item
.
name
}
>
{
getFieldDecorator
(
item
.
name
,
{
{
getFieldDecorator
(
item
.
name
,
{
rules
:
[{
required
:
true
,
message
:
'
请选择营业时间!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请选择营业时间!
'
},
{
validator
:
timerWrapper
,
message
:
'
选择开始时间结束时间不能一样
'
},
],
initialValue
:
formData
[
item
.
name
],
initialValue
:
formData
[
item
.
name
],
})(
})(<
TimePicker
.
RangePicker
format=
"HH:mm"
disabled=
{
disabled
}
/>)
}
<
TimePicker
.
RangePicker
format=
"HH:mm"
showTime=
{
{
hideDisabledOptions
:
true
,
defaultValue
:
[
moment
(
'
00:00
'
,
'
HH:mm
'
),
moment
(
'
23:59
'
,
'
HH:mm
'
)],
}
}
disabled=
{
disabled
}
/>,
)
}
</
FormItem
>
</
FormItem
>
</
div
>
</
div
>
{
!
disabled
&&
{
!
disabled
&&
...
...
src/pages/chainStoreManage/index.jsx
View file @
2d3be144
...
@@ -37,7 +37,6 @@ export default () => {
...
@@ -37,7 +37,6 @@ export default () => {
// 获取业务模式
// 获取业务模式
const
getBusiness
=
async
()
=>
{
const
getBusiness
=
async
()
=>
{
const
res
=
await
apiproductBusiness
();
const
res
=
await
apiproductBusiness
();
console
.
log
(
res
);
if
(
res
)
{
if
(
res
)
{
setProductBusiness
(
res
.
productBusiness
||
[]);
setProductBusiness
(
res
.
productBusiness
||
[]);
setExistTakewayShop
(
res
.
existTakewayShop
);
setExistTakewayShop
(
res
.
existTakewayShop
);
...
@@ -127,6 +126,9 @@ export default () => {
...
@@ -127,6 +126,9 @@ export default () => {
if
(
val
.
businessStatus
)
{
if
(
val
.
businessStatus
)
{
params
.
businessStatus
=
val
.
businessStatus
;
params
.
businessStatus
=
val
.
businessStatus
;
}
}
if
(
val
.
productBusiness
)
{
params
.
productBusiness
=
val
.
productBusiness
;
}
getList
(
params
);
getList
(
params
);
};
};
...
@@ -220,8 +222,8 @@ export default () => {
...
@@ -220,8 +222,8 @@ export default () => {
dataIndex
:
'
productBusiness
'
,
dataIndex
:
'
productBusiness
'
,
width
:
120
,
width
:
120
,
align
:
'
center
'
,
align
:
'
center
'
,
render
:
v
=>
render
:
(
v
,
value
)
=>
v
&&
(
v
alue
?.
productBusiness
?.
length
&&
(
<
div
>
<
div
>
{
v
.
map
(
it
=>
(
{
v
.
map
(
it
=>
(
<
span
>
{
businessList
.
find
(
item
=>
+
it
===
+
item
.
value
).
label
}
</
span
>
<
span
>
{
businessList
.
find
(
item
=>
+
it
===
+
item
.
value
).
label
}
</
span
>
...
@@ -314,6 +316,17 @@ export default () => {
...
@@ -314,6 +316,17 @@ export default () => {
</
Select
>
</
Select
>
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
<
Col
span=
{
8
}
>
<
Form
.
Item
label=
"业务模式"
name=
"productBusiness"
>
<
Select
>
{
businessList
.
map
(
item
=>
(
<
Option
label=
{
item
.
label
}
value=
{
item
.
value
}
key=
{
item
.
value
}
>
{
item
.
label
}
</
Option
>
))
}
</
Select
>
</
Form
.
Item
>
</
Col
>
</
Row
>
</
Row
>
<
div
className=
{
style
.
search
}
>
<
div
className=
{
style
.
search
}
>
<
Button
type=
"primary"
htmlType=
"submit"
size=
"middle"
>
<
Button
type=
"primary"
htmlType=
"submit"
size=
"middle"
>
...
...
src/utils/utils.js
View file @
2d3be144
...
@@ -154,20 +154,20 @@ export const getObjectType = v => Object.prototype.toString.call(v).replace(/\[o
...
@@ -154,20 +154,20 @@ export const getObjectType = v => Object.prototype.toString.call(v).replace(/\[o
export
const
getErrorMessage
=
err
=>
{
export
const
getErrorMessage
=
err
=>
{
const
message
=
'
请检查表单数据!
'
;
const
message
=
'
请检查表单数据!
'
;
// eslint-disable-next-line wrap-iife
// eslint-disable-next-line wrap-iife
//
(function getMsg(v) {
(
function
getMsg
(
v
)
{
//
if (Array.isArray(v)) {
if
(
Array
.
isArray
(
v
))
{
//
getMsg(v[0]);
getMsg
(
v
[
0
]);
//
} else {
}
else
{
//
const keys = Object.keys(v);
const
keys
=
Object
.
keys
(
v
);
//
if (Array.isArray(v[keys[0]])) {
if
(
Array
.
isArray
(
v
[
keys
[
0
]]))
{
//
getMsg(v[keys[0]][0]);
getMsg
(
v
[
keys
[
0
]][
0
]);
//
} else if (v[keys[0]].errors && v[keys[0]].errors.length) {
}
else
if
(
v
[
keys
[
0
]].
errors
&&
v
[
keys
[
0
]].
errors
.
length
)
{
//
// eslint-disable-next-line no-const-assign
// eslint-disable-next-line no-const-assign
//
message = v[keys[0]].errors[0].message;
message
=
v
[
keys
[
0
]].
errors
[
0
].
message
;
//
} else {
}
else
{
//
getMsg(v);
getMsg
(
v
);
//
}
}
//
}
}
//
})(err);
})(
err
);
return
message
;
return
message
;
};
};
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