Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
psa-web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
高滢
psa-web
Commits
400adca2
Commit
400adca2
authored
Apr 22, 2025
by
‘老张’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
员工年假和填报工时优化
parent
8d8af891
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
482 additions
and
19 deletions
+482
-19
balance.js
src/api/system/balance.js
+44
-0
index.vue
src/views/system/balance/index.vue
+403
-0
index.vue
src/views/timesheet/timesheet/index.vue
+35
-19
No files found.
src/api/system/
annualleav
e.js
→
src/api/system/
balanc
e.js
View file @
400adca2
import
request
from
'@/utils/request'
// 查询员工
年假
列表
export
function
list
Annualleav
e
(
query
)
{
// 查询员工
余额
列表
export
function
list
Balanc
e
(
query
)
{
return
request
({
url
:
'/system/
annualleav
e/list'
,
url
:
'/system/
balanc
e/list'
,
method
:
'get'
,
params
:
query
})
}
// 查询员工
年假
详细
export
function
get
Annualleav
e
(
id
)
{
// 查询员工
余额
详细
export
function
get
Balanc
e
(
id
)
{
return
request
({
url
:
'/system/
annualleav
e/'
+
id
,
url
:
'/system/
balanc
e/'
+
id
,
method
:
'get'
})
}
// 新增员工
年假
export
function
add
Annualleav
e
(
data
)
{
// 新增员工
余额
export
function
add
Balanc
e
(
data
)
{
return
request
({
url
:
'/system/
annualleav
e'
,
url
:
'/system/
balanc
e'
,
method
:
'post'
,
data
:
data
})
}
// 修改员工
年假
export
function
update
Annualleav
e
(
data
)
{
// 修改员工
余额
export
function
update
Balanc
e
(
data
)
{
return
request
({
url
:
'/system/
annualleav
e'
,
url
:
'/system/
balanc
e'
,
method
:
'put'
,
data
:
data
})
}
// 删除员工
年假
export
function
del
Annualleav
e
(
id
)
{
// 删除员工
余额
export
function
del
Balanc
e
(
id
)
{
return
request
({
url
:
'/system/
annualleav
e/'
+
id
,
url
:
'/system/
balanc
e/'
+
id
,
method
:
'delete'
})
}
src/views/system/
annualleav
e/index.vue
→
src/views/system/
balanc
e/index.vue
View file @
400adca2
This diff is collapsed.
Click to expand it.
src/views/timesheet/timesheet/index.vue
View file @
400adca2
...
...
@@ -284,30 +284,46 @@ const submitProject = async () => {
/** 查询工时记录列表 */
function
getList
(
employId
)
{
loading
.
value
=
true
;
getPersonalTimesheet
(
employId
).
then
(
response
=>
{
console
.
log
(
response
)
if
(
Array
.
isArray
(
response
))
{
// 检查是否为数组
personalTimesheetList
.
value
=
response
.
map
(
project
=>
({
...
project
,
addWorkList
:
project
.
addWorkList
.
map
(
day
=>
({
...
day
,
hours
:
Number
(
day
.
hours
)
||
0
,
})),
totalHours
:
project
.
totalHours
||
0
,
approvalState
:
parseInt
(
project
.
approvalState
),
departmentLeaderName
:
project
.
departmentLeaderName
||
''
,
}));
loading
.
value
=
true
;
// 从本地存储获取缓存数据
const
cachedData
=
localStorage
.
getItem
(
`timesheet_
${
employId
}
`
);
if
(
cachedData
)
{
personalTimesheetList
.
value
=
JSON
.
parse
(
cachedData
);
}
getPersonalTimesheet
(
employId
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
Array
.
isArray
(
response
))
{
const
newData
=
response
.
map
(
project
=>
({
...
project
,
addWorkList
:
project
.
addWorkList
.
map
(
day
=>
({
...
day
,
hours
:
Number
(
day
.
hours
)
||
0
,
})),
totalHours
:
project
.
totalHours
||
0
,
approvalState
:
parseInt
(
project
.
approvalState
),
departmentLeaderName
:
project
.
departmentLeaderName
||
''
,
}));
// 对比数据是否相同
const
isSame
=
JSON
.
stringify
(
newData
)
===
cachedData
;
if
(
!
isSame
)
{
personalTimesheetList
.
value
=
newData
;
// 将新数据存入本地存储
localStorage
.
setItem
(
`timesheet_
${
employId
}
`
,
JSON
.
stringify
(
newData
));
}
}
else
{
console
.
error
(
"Invalid response format:"
,
response
);
console
.
error
(
"Invalid response format:"
,
response
);
}
loading
.
value
=
false
;
})
.
catch
(
error
=>
{
//
console.error("API error:", error);
})
.
catch
(
error
=>
{
console
.
error
(
"API error:"
,
error
);
loading
.
value
=
false
;
});
});
}
const
A
=
(
data
)
=>
{
getPersonalTimesheet
(
data
).
then
(
response
=>
{
if
(
response
.
code
===
200
)
{
...
...
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