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
6957119a
Commit
6957119a
authored
Jun 14, 2023
by
张子雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 代码优化
parent
1a6bb192
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
87 additions
and
29 deletions
+87
-29
newEmployeeModal.jsx
src/pages/EmployeeManagement/components/newEmployeeModal.jsx
+2
-2
index.jsx
src/pages/EmployeeManagement/index.jsx
+28
-9
service.js
src/pages/EmployeeManagement/service.js
+4
-0
index.jsx
src/pages/StoreManagement/editRepastModal/index.jsx
+9
-3
index.jsx
src/pages/StoreManagement/index.jsx
+39
-15
service.js
src/pages/StoreManagement/service.js
+5
-0
No files found.
src/pages/EmployeeManagement/components/newEmployeeModal.jsx
View file @
6957119a
...
...
@@ -71,9 +71,9 @@ const NewEmployeeModal = props => {
<
Modal
visible=
{
visible
}
title=
"添加新员工"
onCancel=
{
handleCancel
}
onCancel=
{
()
=>
handleCancel
(
false
)
}
footer=
{
[
<
Button
key=
"cancel"
onClick=
{
handleCancel
}
>
<
Button
key=
"cancel"
onClick=
{
()
=>
handleCancel
(
false
)
}
>
取消
</
Button
>,
<
Button
key=
"save"
type=
"primary"
onClick=
{
handleSave
}
>
...
...
src/pages/EmployeeManagement/index.jsx
View file @
6957119a
...
...
@@ -49,9 +49,10 @@ const StoreManagement = () => {
const
[
firstEnterprise
,
setFirstEnterprise
]
=
useState
();
const
[
departmentList
,
setDepartmentList
]
=
useState
([]);
const
[
generateLog
,
setGenerateLog
]
=
useState
([]);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
page
,
setPage
]
=
useState
({
page
:
1
,
s
ize
:
10
,
current
:
1
,
pageS
ize
:
10
,
});
const
[
total
,
setTotal
]
=
useState
(
0
);
const
[
searchForm
,
setSearchForm
]
=
useState
({});
...
...
@@ -62,12 +63,20 @@ const StoreManagement = () => {
const
[
repastId
,
setRepastId
]
=
useState
(
null
);
const
shopList
=
async
params
=>
{
setLoading
(
true
);
const
res
=
await
apiStaffList
(
params
);
if
(
res
.
businessCode
===
'
0000
'
&&
res
.
data
?.
records
)
{
const
list
=
res
.
data
.
records
;
if
(
res
?.
businessCode
===
'
0000
'
)
{
const
list
=
res
.
data
?
.
records
;
setTotal
(
res
.
data
.
total
);
setStaffList
(
list
);
setLoading
(
false
);
return
;
}
setTimeout
(()
=>
{
setLoading
(
false
);
setStaffList
([]);
setTotal
(
0
);
},
5000
);
};
const
rowSelection
=
{
selectedRowKeys
,
...
...
@@ -180,8 +189,8 @@ const StoreManagement = () => {
const
onFinish
=
values
=>
{
setSearchForm
(
values
);
const
pageInfo
=
{
page
:
1
,
s
ize
:
10
,
current
:
1
,
pageS
ize
:
10
,
};
setPage
(
pageInfo
);
shopList
({
...
pageInfo
,
data
:
values
});
...
...
@@ -193,10 +202,10 @@ const StoreManagement = () => {
shopList
({
...
page
,
data
:
{
enterpriseId
:
firstEnterprise
}
});
};
// 分页
const
onChange
=
(
pageNo
,
s
ize
)
=>
{
const
onChange
=
(
current
,
pageS
ize
)
=>
{
const
pageInfo
=
{
page
:
pageNo
,
s
ize
,
current
,
pageS
ize
,
};
setPage
(
pageInfo
);
shopList
({
data
:
searchForm
,
...
pageInfo
});
...
...
@@ -221,7 +230,16 @@ const StoreManagement = () => {
}
};
const
enterpriseOnChange
=
val
=>
{
setFirstEnterprise
(
val
);
getDepartmentList
(
val
);
const
pageInfo
=
{
current
:
1
,
pageSize
:
10
,
};
const
values
=
formRef
.
current
.
getFieldsValue
();
setPage
(
pageInfo
);
setSearchForm
(
values
);
shopList
({
...
pageInfo
,
data
:
values
});
};
const
res
=
{
delEmployee
,
...
...
@@ -364,6 +382,7 @@ const StoreManagement = () => {
bordered
rowSelection=
{
rowSelection
}
pagination=
{
pagination
}
loading=
{
loading
}
/>
</
Card
>
<
NewEmployeeModal
...
...
src/pages/EmployeeManagement/service.js
View file @
6957119a
...
...
@@ -8,6 +8,10 @@ const { goodsApi, apiPrefix, roleApi } = config;
// [企业员工]-列表查询
// http://yapi.quantgroups.com/project/389/interface/api/65359
export
const
apiStaffList
=
async
params
=>
{
params
.
page
=
params
.
current
;
params
.
size
=
params
.
pageSize
;
delete
params
.
current
;
delete
params
.
pageSize
;
const
data
=
await
request
.
post
(
`
${
apiPrefix
}
/enterprise/staff/pageList`
,
{
prefix
:
roleApi
,
data
:
params
,
...
...
src/pages/StoreManagement/editRepastModal/index.jsx
View file @
6957119a
import
React
,
{
useState
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
Modal
,
Radio
,
Form
,
Space
,
message
,
Checkbox
}
from
'
antd
'
;
import
styles
from
'
../index.less
'
;
import
{
apiShopUpdate
,
busineesTypeCheck
}
from
'
../service.js
'
;
const
EditRepastModal
=
props
=>
{
const
[
form
]
=
Form
.
useForm
();
const
{
editVisible
,
repastType
,
id
,
enterpriseId
,
isStore
}
=
props
;
const
{
editVisible
,
repastType
,
id
,
enterpriseId
,
isStore
,
selectMealType
}
=
props
;
const
handleCancel
=
status
=>
{
form
.
resetFields
();
props
.
onCancel
(
status
,
'
edit
'
);
};
useEffect
(()
=>
{
if
(
selectMealType
.
length
)
{
const
mealTypeList
=
selectMealType
.
filter
(
item
=>
item
!==
4
);
const
store
=
selectMealType
.
includes
(
4
)
?
[
4
]
:
[];
form
.
setFieldsValue
({
mealTypeList
,
store
});
}
},
[
selectMealType
]);
const
onOk
=
()
=>
{
form
.
validateFields
().
then
(
async
values
=>
{
console
.
log
(
values
);
...
...
src/pages/StoreManagement/index.jsx
View file @
6957119a
...
...
@@ -18,8 +18,8 @@ import {
const
{
confirm
}
=
Modal
;
const
StoreManagement
=
()
=>
{
const
[
page
,
setPage
]
=
useState
({
page
:
1
,
s
ize
:
10
,
current
:
1
,
pageS
ize
:
10
,
});
const
[
total
,
setTotal
]
=
useState
(
0
);
const
[
searchForm
,
setSearchForm
]
=
useState
({});
...
...
@@ -34,12 +34,22 @@ const StoreManagement = () => {
const
[
dataList
,
setDataList
]
=
useState
([]);
const
[
name
,
setName
]
=
useState
(
''
);
const
[
isStore
,
setIsStore
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
selectMealType
,
setSelectMealType
]
=
useState
([]);
const
shopList
=
async
params
=>
{
setLoading
(
true
);
const
res
=
await
setShopList
(
params
);
if
(
res
.
businessCode
===
'
0000
'
)
{
if
(
res
?.
businessCode
===
'
0000
'
)
{
setLoading
(
false
);
setDataList
(
res
.
data
?.
records
);
setTotal
(
res
.
data
?.
total
);
return
;
}
setTimeout
(()
=>
{
setLoading
(
false
);
setDataList
([]);
setTotal
(
0
);
},
5000
);
};
// 企业查询
...
...
@@ -67,8 +77,8 @@ const StoreManagement = () => {
const
closeModal
=
(
status
,
val
)
=>
{
if
(
status
)
{
const
pageInfo
=
{
page
:
1
,
s
ize
:
10
,
current
:
1
,
pageS
ize
:
10
,
};
setPage
(
pageInfo
);
shopList
({
data
:
searchForm
,
...
pageInfo
});
...
...
@@ -77,12 +87,13 @@ const StoreManagement = () => {
setIsStore
(
false
);
setEditVisible
(
false
);
setRepastType
([]);
setSelectMealType
([]);
return
;
}
setName
(
false
);
setAddVisible
(
false
);
};
const
s
etMealTypeList
=
async
id
=>
{
const
g
etMealTypeList
=
async
id
=>
{
const
res
=
await
mealTypeList
({
id
});
if
(
res
.
businessCode
===
'
0000
'
)
{
const
resData
=
res
.
data
;
...
...
@@ -100,9 +111,10 @@ const StoreManagement = () => {
}
};
// 修改餐饮类型
const
editRepastType
=
({
id
})
=>
{
const
editRepastType
=
({
id
,
mealType
})
=>
{
setSelectMealType
(
mealType
);
setRepastId
(
id
);
s
etMealTypeList
(
id
);
g
etMealTypeList
(
id
);
};
// 删除
const
editShop
=
async
id
=>
{
...
...
@@ -126,6 +138,15 @@ const StoreManagement = () => {
});
};
const
onChange
=
(
value
,
option
)
=>
{
setFirstEnterprise
(
value
);
const
values
=
formRef
.
current
.
getFieldsValue
();
const
pageInfo
=
{
current
:
1
,
pageSize
:
10
,
};
setPage
(
pageInfo
);
setSearchForm
(
values
);
shopList
({
...
pageInfo
,
data
:
values
});
setEnterprise
(
option
);
};
// 添加商户
...
...
@@ -140,8 +161,8 @@ const StoreManagement = () => {
const
onFinish
=
async
values
=>
{
setSearchForm
(
values
);
const
pageInfo
=
{
page
:
1
,
s
ize
:
10
,
current
:
1
,
pageS
ize
:
10
,
};
setPage
(
pageInfo
);
shopList
({
data
:
values
,
...
pageInfo
});
...
...
@@ -150,18 +171,18 @@ const StoreManagement = () => {
const
onReset
=
()
=>
{
formRef
.
current
.
resetFields
();
const
pageInfo
=
{
page
:
1
,
s
ize
:
10
,
current
:
1
,
pageS
ize
:
10
,
};
setPage
(
pageInfo
);
setSearchForm
({
enterpriseId
:
firstEnterprise
});
shopList
({
data
:
{
enterpriseId
:
firstEnterprise
},
...
pageInfo
});
};
// 分页
const
handleTableChange
=
(
pageNo
,
s
ize
)
=>
{
const
handleTableChange
=
(
current
,
pageS
ize
)
=>
{
const
pageInfo
=
{
page
:
pageNo
,
s
ize
,
current
,
pageS
ize
,
};
setPage
(
pageInfo
);
shopList
({
data
:
searchForm
,
...
pageInfo
});
...
...
@@ -249,6 +270,7 @@ const StoreManagement = () => {
rowKey=
{
r
=>
r
.
id
}
bordered
pagination=
{
pagination
}
loading=
{
loading
}
/>
</
Card
>
<
EditRepastModal
...
...
@@ -258,7 +280,9 @@ const StoreManagement = () => {
onCancel=
{
closeModal
}
enterpriseId=
{
searchForm
.
enterpriseId
}
isStore=
{
isStore
}
selectMealType=
{
selectMealType
}
/>
<
AddModal
addVisible=
{
addVisible
}
enterpriseId=
{
searchForm
.
enterpriseId
}
...
...
src/pages/StoreManagement/service.js
View file @
6957119a
...
...
@@ -2,12 +2,17 @@ import request from '@/utils/request';
import
config
from
'
../../../config/env.config
'
;
import
{
stringify
}
from
'
qs
'
;
import
_
from
'
lodash
'
;
import
{
de
}
from
'
date-fns/locale
'
;
const
{
goodsApi
,
apiPrefix
,
roleApi
}
=
config
;
console
.
log
(
apiPrefix
,
'
apiPrefix
'
);
// [企业店铺]-列表查询
// http://yapi.quantgroups.com/project/389/interface/api/65284
export
const
setShopList
=
async
params
=>
{
params
.
page
=
params
.
current
;
params
.
size
=
params
.
pageSize
;
delete
params
.
current
;
delete
params
.
pageSize
;
const
data
=
await
request
.
post
(
`
${
apiPrefix
}
/enterprise/shop/list`
,
{
prefix
:
roleApi
,
data
:
params
,
...
...
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