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
315b92db
Commit
315b92db
authored
Jun 27, 2023
by
张子雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 代码优化
parent
31bbc3be
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
47 deletions
+43
-47
app.js
src/app.js
+1
-1
blacklistModal.jsx
src/pages/EmployeeManagement/components/blacklistModal.jsx
+13
-15
departmentModal.jsx
src/pages/EmployeeManagement/components/departmentModal.jsx
+8
-9
newEmployeeModal.jsx
src/pages/EmployeeManagement/components/newEmployeeModal.jsx
+14
-15
viewDepartmentModal.jsx
...ges/EmployeeManagement/components/viewDepartmentModal.jsx
+1
-1
index.jsx
src/pages/EmployeeManagement/index.jsx
+5
-5
validator.js
src/utils/validator.js
+1
-1
No files found.
src/app.js
View file @
315b92db
...
...
@@ -2,7 +2,7 @@
import
*
as
Sentry
from
'
@sentry/react
'
;
import
localStorage
from
'
@/utils/localStorage
'
;
if
(
process
.
env
.
SENTRY_ENV
!==
'
test
'
&&
process
.
env
.
NODE_ENV
===
'
production
'
)
{
if
(
process
.
env
.
SENTRY_ENV
!==
'
prod
'
&&
process
.
env
.
NODE_ENV
===
'
production
'
)
{
try
{
Sentry
.
init
({
dsn
:
'
https://b3f60c62e1234e26a5b851b9f26fba07@sentry.q-gp.com/34
'
,
...
...
src/pages/EmployeeManagement/components/blacklistModal.jsx
View file @
315b92db
...
...
@@ -8,21 +8,19 @@ const { Item } = Form;
const
BlacklistModal
=
({
visible
,
onClose
,
list
,
enterpriseId
,
selectedRows
})
=>
{
const
[
form
]
=
Form
.
useForm
();
const
handleSave
=
()
=>
{
form
.
validateFields
().
then
(
values
=>
{
const
params
=
{
enterpriseId
,
ids
:
list
,
isBlack
:
1
,
balanceBackFlag
:
1
,
};
apiStaffBlack
(
params
).
then
(
res
=>
{
if
(
res
.
businessCode
===
'
0000
'
)
{
message
.
success
(
'
设置成功
'
);
onClose
(
true
,
'
blacklist
'
);
}
});
});
const
handleSave
=
async
()
=>
{
const
values
=
await
form
.
validateFields
();
const
params
=
{
enterpriseId
,
ids
:
list
,
isBlack
:
1
,
balanceBackFlag
:
1
,
};
const
res
=
apiStaffBlack
(
params
);
if
(
res
?.
businessCode
===
'
0000
'
)
{
message
.
success
(
'
设置成功
'
);
onClose
(
true
,
'
blacklist
'
);
}
};
return
(
...
...
src/pages/EmployeeManagement/components/departmentModal.jsx
View file @
315b92db
...
...
@@ -46,20 +46,19 @@ const DepartmentModal = ({ visible, onClose, enterpriseList }) => {
file
:
values
.
file
,
};
const
res
=
await
apiDepartmentExcel
(
params
);
if
(
res
.
businessCode
===
'
0000
'
)
{
if
(
res
?
.
businessCode
===
'
0000
'
)
{
message
.
success
(
'
保存成功
'
);
handleCancel
(
true
);
}
};
const
handleSave
=
()
=>
{
form
.
validateFields
().
then
(
values
=>
{
if
(
importMode
)
{
getDepartmentExcel
(
values
);
return
;
}
getDepartmentSave
(
values
);
});
const
handleSave
=
async
()
=>
{
const
values
=
await
form
.
validateFields
();
if
(
importMode
)
{
getDepartmentExcel
(
values
);
return
;
}
getDepartmentSave
(
values
);
};
return
(
...
...
src/pages/EmployeeManagement/components/newEmployeeModal.jsx
View file @
315b92db
...
...
@@ -21,22 +21,21 @@ const NewEmployeeModal = props => {
setImportMode
(
false
);
onClose
(
val
,
'
newEmployee
'
);
};
const
handleSave
=
()
=>
{
form
.
validateFields
().
then
(
async
values
=>
{
if
(
importMode
)
{
const
res
=
await
apiStaffExcel
(
values
);
if
(
res
.
businessCode
===
'
0000
'
)
{
message
.
success
(
'
上传成功
'
);
handleCancel
(
true
);
}
return
;
}
const
res
=
await
apiStaffSave
(
values
);
if
(
res
.
businessCode
===
'
0000
'
)
{
message
.
success
(
'
保存成功
'
);
const
handleSave
=
async
()
=>
{
const
values
=
await
form
.
validateFields
();
if
(
importMode
)
{
const
res
=
await
apiStaffExcel
(
values
);
if
(
res
?.
businessCode
===
'
0000
'
)
{
message
.
success
(
'
上传成功
'
);
handleCancel
(
true
);
}
});
return
;
}
const
res
=
await
apiStaffSave
(
values
);
if
(
res
?.
businessCode
===
'
0000
'
)
{
message
.
success
(
'
保存成功
'
);
handleCancel
(
true
);
}
};
const
validatePhone
=
(
_
,
value
)
=>
{
...
...
@@ -51,7 +50,7 @@ const NewEmployeeModal = props => {
// 部门查询
const
getDepartmentList
=
async
id
=>
{
const
res
=
await
apiDepartmentList
({
data
:
{
enterpriseId
:
id
},
page
:
1
,
size
:
10000
});
if
(
res
.
businessCode
===
'
0000
'
&&
res
.
data
?.
records
?.
length
)
{
if
(
res
?
.
businessCode
===
'
0000
'
&&
res
.
data
?.
records
?.
length
)
{
const
list
=
res
.
data
.
records
;
const
optionData
=
list
.
map
(
item
=>
({
value
:
item
.
id
,
...
...
src/pages/EmployeeManagement/components/viewDepartmentModal.jsx
View file @
315b92db
...
...
@@ -53,7 +53,7 @@ const ViewDepartmentModal = ({ visible, onClose, enterpriseList }) => {
name
:
values
.
name
,
};
const
res
=
await
apiDepartmentUpdate
(
params
);
if
(
res
.
businessCode
===
'
0000
'
)
{
if
(
res
?
.
businessCode
===
'
0000
'
)
{
message
.
success
(
'
修改成功
'
);
setNameVisible
(
false
);
getDepartmentList
({
data
:
{
enterpriseId
},
...
pageInfo
});
...
...
src/pages/EmployeeManagement/index.jsx
View file @
315b92db
...
...
@@ -94,7 +94,7 @@ const StoreManagement = () => {
// 部门查询
const
getDepartmentList
=
async
id
=>
{
const
res
=
await
apiDepartmentList
({
data
:
{
enterpriseId
:
id
},
page
:
1
,
size
:
10000
});
if
(
res
.
businessCode
===
'
0000
'
&&
res
.
data
?.
records
?.
length
)
{
if
(
res
?
.
businessCode
===
'
0000
'
&&
res
.
data
?.
records
?.
length
)
{
const
list
=
res
.
data
.
records
;
const
optionData
=
list
.
map
(
item
=>
({
value
:
item
.
id
,
...
...
@@ -140,7 +140,7 @@ const StoreManagement = () => {
// 企业查询
const
getEnterpriseList
=
async
()
=>
{
const
res
=
await
apiEnterpriseList
();
if
(
res
.
businessCode
===
'
0000
'
&&
res
.
data
?.
records
?.
length
)
{
if
(
res
?
.
businessCode
===
'
0000
'
&&
res
.
data
?.
records
?.
length
)
{
const
list
=
res
.
data
.
records
;
const
firstOption
=
list
[
0
].
id
;
const
optionData
=
list
.
map
(
item
=>
({
...
...
@@ -169,7 +169,7 @@ const StoreManagement = () => {
// 删除
const
deleteEmployee
=
async
id
=>
{
const
res
=
await
apiStaffDelete
({
id
,
enterpriseId
:
searchForm
.
enterpriseId
,
state
:
0
});
if
(
res
.
businessCode
===
'
0000
'
)
{
if
(
res
?
.
businessCode
===
'
0000
'
)
{
message
.
success
(
'
删除成功!
'
);
shopList
({
...
page
,
data
:
searchForm
});
}
...
...
@@ -219,7 +219,7 @@ const StoreManagement = () => {
const
goDetails
=
async
({
staffNo
})
=>
{
setRechargeDetailsVisible
(
true
);
const
res
=
await
apiGenerateLogList
({
staffNo
,
enterpriseId
:
searchForm
.
enterpriseId
});
if
(
res
.
businessCode
===
'
0000
'
)
{
if
(
res
?
.
businessCode
===
'
0000
'
)
{
const
list
=
res
.
data
;
setGenerateLog
(
list
);
}
...
...
@@ -230,7 +230,7 @@ const StoreManagement = () => {
isLimit
:
checked
?
1
:
0
,
enterpriseId
:
searchForm
.
enterpriseId
,
});
if
(
res
.
businessCode
===
'
0000
'
)
{
if
(
res
?
.
businessCode
===
'
0000
'
)
{
message
.
success
(
'
设置成功
'
);
shopList
({
...
page
,
data
:
searchForm
});
}
...
...
src/utils/validator.js
View file @
315b92db
...
...
@@ -456,7 +456,7 @@ export const getDefaultRule = data => {
// 输入空格校验
export
const
validateSpaces
=
(
rule
,
value
,
callback
)
=>
{
// 输入不能包括空格
if
(
value
&&
value
.
includes
(
'
'
))
{
if
(
value
?
.
includes
(
'
'
))
{
// eslint-disable-next-line prefer-promise-reject-errors
return
Promise
.
reject
(
'
输入不能为空格
'
);
}
...
...
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