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
8e2d9467
Commit
8e2d9467
authored
Sep 27, 2022
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改新增分组清空套餐数据的问题
parent
4d334927
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
+17
-12
FormPackage.jsx
src/pages/ServiceGoods/components/FormPackage.jsx
+15
-10
FormSettlementOthers.jsx
src/pages/ServiceGoods/components/FormSettlementOthers.jsx
+2
-2
No files found.
src/pages/ServiceGoods/components/FormPackage.jsx
View file @
8e2d9467
...
@@ -21,7 +21,7 @@ const FormCai = forwardRef((props, ref) => {
...
@@ -21,7 +21,7 @@ const FormCai = forwardRef((props, ref) => {
const
{
gitem
,
groupName
,
groupkey
,
packageIndex
}
=
props
;
const
{
gitem
,
groupName
,
groupkey
,
packageIndex
}
=
props
;
const
onDel
=
(
callback
,
name
,
key
)
=>
{
const
onDel
=
(
callback
,
name
,
key
)
=>
{
callback
(
name
);
//
callback(name);
props
.
onDelCai
(
packageIndex
,
groupkey
,
key
);
props
.
onDelCai
(
packageIndex
,
groupkey
,
key
);
};
};
...
@@ -155,7 +155,7 @@ const FormPackage = forwardRef((props, ref) => {
...
@@ -155,7 +155,7 @@ const FormPackage = forwardRef((props, ref) => {
const
[
list
,
setList
]
=
useState
([]);
const
[
list
,
setList
]
=
useState
([]);
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
{
validateFields
}
=
form
;
const
{
validateFields
,
getFieldsValue
}
=
form
;
const
onCheck
=
async
()
=>
{
const
onCheck
=
async
()
=>
{
console
.
log
(
'
form :>>
'
,
form
);
console
.
log
(
'
form :>>
'
,
form
);
...
@@ -181,15 +181,16 @@ const FormPackage = forwardRef((props, ref) => {
...
@@ -181,15 +181,16 @@ const FormPackage = forwardRef((props, ref) => {
const
str
=
groupName
&&
groupName
.
trim
();
const
str
=
groupName
&&
groupName
.
trim
();
if
(
str
)
{
if
(
str
)
{
const
arr
=
[...
list
];
const
arr
=
[...
list
];
arr
[
groupIndex
].
children
.
push
({
const
fieldsValue
=
getFieldsValue
();
const
obj
=
{
groupName
:
str
,
groupName
:
str
,
uuid
:
UUID
.
createUUID
(),
uuid
:
UUID
.
createUUID
(),
dishes
:
[
getCaiJson
(
str
)],
dishes
:
[
getCaiJson
(
str
)],
});
};
arr
[
groupIndex
].
children
.
push
(
obj
);
fieldsValue
.
lists
[
groupIndex
].
children
.
push
(
obj
);
setList
(
arr
);
setList
(
arr
);
form
.
setFieldsValue
({
form
.
setFieldsValue
(
fieldsValue
);
lists
:
arr
,
});
setVisibleGroup
(
!
1
);
setVisibleGroup
(
!
1
);
}
}
};
};
...
@@ -217,14 +218,18 @@ const FormPackage = forwardRef((props, ref) => {
...
@@ -217,14 +218,18 @@ const FormPackage = forwardRef((props, ref) => {
// 删除菜品
// 删除菜品
const
onDelCai
=
(
i
,
j
,
k
)
=>
{
const
onDelCai
=
(
i
,
j
,
k
)
=>
{
const
arr
=
[...
list
];
const
arr
=
[...
list
];
const
arrList
=
props
.
form
.
getFieldsValue
();
const
arrList
=
getFieldsValue
();
const
len
=
arr
[
i
].
children
[
j
].
dishes
.
length
;
const
len
=
arr
[
i
].
children
[
j
].
dishes
.
length
;
if
(
len
===
1
)
{
if
(
len
===
1
)
{
arr
[
i
].
children
.
splice
(
j
,
1
);
arr
[
i
].
children
=
[];
arrList
.
lists
[
i
].
children
=
[];
}
else
{
}
else
{
arr
[
i
].
children
[
j
].
dishes
.
splice
(
k
,
1
);
arr
[
i
].
children
[
j
].
dishes
.
splice
(
k
,
1
);
console
.
log
(
'
arrList :>>
'
,
[...
arrList
.
lists
]);
arrList
.
lists
[
i
].
children
[
j
].
dishes
.
splice
(
k
,
1
);
}
}
setList
(
arr
);
setList
(
arr
);
form
.
setFieldsValue
(
arrList
);
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -254,7 +259,7 @@ const FormPackage = forwardRef((props, ref) => {
...
@@ -254,7 +259,7 @@ const FormPackage = forwardRef((props, ref) => {
}
else
{
}
else
{
setList
([]);
setList
([]);
form
.
setFieldsValue
({
form
.
setFieldsValue
({
list
:
[],
list
s
:
[],
});
});
}
}
},
[
props
.
initData
]);
},
[
props
.
initData
]);
...
...
src/pages/ServiceGoods/components/FormSettlementOthers.jsx
View file @
8e2d9467
...
@@ -139,13 +139,13 @@ const FormSettlementOthers = forwardRef((props, ref) => {
...
@@ -139,13 +139,13 @@ const FormSettlementOthers = forwardRef((props, ref) => {
<
InputNumber
min=
{
0
}
style=
{
{
width
:
200
}
}
placeholder=
"请输入每日最低接待量"
/>
<
InputNumber
min=
{
0
}
style=
{
{
width
:
200
}
}
placeholder=
"请输入每日最低接待量"
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Title
title=
"结算信息"
/>
<
Title
title=
"结算信息"
/>
<
Form
.
Item
{
/*
<Form.Item
name="packageContent"
name="packageContent"
label="套餐内容"
label="套餐内容"
rules={[{ required: true, message: '请输入套餐内容, 1000字以内!!' }]}
rules={[{ required: true, message: '请输入套餐内容, 1000字以内!!' }]}
>
>
<Input.TextArea showCount maxLength={1000} placeholder="请输入套餐内容, 1000字以内!!" />
<Input.TextArea showCount maxLength={1000} placeholder="请输入套餐内容, 1000字以内!!" />
</
Form
.
Item
>
</Form.Item>
*/
}
<
Form
.
Item
<
Form
.
Item
name=
"settlementMethod"
name=
"settlementMethod"
label=
"结算方式"
label=
"结算方式"
...
...
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