Commit 70bff294 authored by 罗林杰's avatar 罗林杰

Merge remote-tracking branch 'origin/master'

parents 12579f69 293351d8
import request from '@/utils/request' import request from '@/utils/request'
// 查询员工年假列表 // 查询员工余额列表
export function listAnnualleave(query) { export function listBalance(query) {
return request({ return request({
url: '/system/annualleave/list', url: '/system/balance/list',
method: 'get', method: 'get',
params: query params: query
}) })
} }
// 查询员工年假详细 // 查询员工余额详细
export function getAnnualleave(id) { export function getBalance(id) {
return request({ return request({
url: '/system/annualleave/' + id, url: '/system/balance/' + id,
method: 'get' method: 'get'
}) })
} }
// 新增员工年假 // 新增员工余额
export function addAnnualleave(data) { export function addBalance(data) {
return request({ return request({
url: '/system/annualleave', url: '/system/balance',
method: 'post', method: 'post',
data: data data: data
}) })
} }
// 修改员工年假 // 修改员工余额
export function updateAnnualleave(data) { export function updateBalance(data) {
return request({ return request({
url: '/system/annualleave', url: '/system/balance',
method: 'put', method: 'put',
data: data data: data
}) })
} }
// 删除员工年假 // 删除员工余额
export function delAnnualleave(id) { export function delBalance(id) {
return request({ return request({
url: '/system/annualleave/' + id, url: '/system/balance/' + id,
method: 'delete' method: 'delete'
}) })
} }
...@@ -202,10 +202,11 @@ ...@@ -202,10 +202,11 @@
</el-table> </el-table>
<div style="padding-right: 35%"> <div style="padding-right: 35%">
<pagination <pagination
v-show="total > 0" :page-sizes="pageSizes"
:total="total" v-show="item.total > 0"
v-model:page="queryParams.pageNum" :total="item.total"
v-model:limit="queryParams.pageSize" v-model:page="paginationState[item.projectId].pageNum"
v-model:limit="paginationState[item.projectId].pageSize"
@pagination="getList" @pagination="getList"
/> />
</div> </div>
...@@ -263,8 +264,6 @@ const printDis = (row) => { ...@@ -263,8 +264,6 @@ const printDis = (row) => {
const data = reactive({ const data = reactive({
form:{}, form:{},
queryParams:{ queryParams:{
pageNum: 1,
pageSize: 10,
projectName: undefined, projectName: undefined,
reimbursementType:undefined, reimbursementType:undefined,
projectNumber: undefined, projectNumber: undefined,
...@@ -276,7 +275,9 @@ const data = reactive({ ...@@ -276,7 +275,9 @@ const data = reactive({
}); });
const { queryParams, form} = toRefs(data); const { queryParams, form} = toRefs(data);
// 分页参数
const paginationState = ref({});
const pageSizes = ref([3, 6, 9, 12, 15]);
//获取列表第一个顶部信息 //获取列表第一个顶部信息
const getTopApproveInfo = ()=>{ const getTopApproveInfo = ()=>{
let item2 = costManageList.value[0] let item2 = costManageList.value[0]
...@@ -289,8 +290,12 @@ const getTopApproveInfo = ()=>{ ...@@ -289,8 +290,12 @@ const getTopApproveInfo = ()=>{
/** 查询报销列表 */ /** 查询报销列表 */
function getList() { function getList() {
loading.value = true; loading.value = true;
const params = {
...queryParams.value,
projectPageParams: JSON.stringify(paginationState.value)
}
//获取日常报销列表 //获取日常报销列表
listCostManage(queryParams.value).then((res) => { listCostManage(params).then((res) => {
costManageList.value = res.rows costManageList.value = res.rows
for(let item of costManageList.value){ for(let item of costManageList.value){
if(!item.tableItemList){ if(!item.tableItemList){
...@@ -316,6 +321,42 @@ function getList() { ...@@ -316,6 +321,42 @@ function getList() {
}) })
} }
/** 初始化报销列表 */
function onMountGetList() {
loading.value = true;
//获取日常报销列表
listCostManage(queryParams.value).then((res) => {
costManageList.value = res.rows
// 初始化分页状态
costManageList.value.forEach((item) => {
paginationState.value[item.projectId] = {
pageNum: 1,
pageSize: 3,
};
});
for(let item of costManageList.value){
if(!item.tableItemList){
item.tableItemList = []
}
}
for(let key in res.rows){
// console.log(data)
res.rows[key].tableItemList.sort((a, b) => {
if(a.status === 1 && b.status !== 1){
return -1;
}
if(b.status === 1 && a.status !== 1){
return 1;
}
return new Date(b.registrationTime) - new Date(a.registrationTime)
})
}
total.value = res.total
loading.value = false
getTopApproveInfo()
})
}
//获取所有审批流程 //获取所有审批流程
const getAllshenpiList = ()=>{ const getAllshenpiList = ()=>{
getAllapproveList(16).then(res => { getAllapproveList(16).then(res => {
...@@ -468,7 +509,7 @@ const handleLeave = () => { ...@@ -468,7 +509,7 @@ const handleLeave = () => {
} }
onMounted(() => { onMounted(() => {
getList(); onMountGetList();
getAllshenpiList(); getAllshenpiList();
getProjectList(); getProjectList();
getUserSelectList(); getUserSelectList();
......
...@@ -285,10 +285,17 @@ const submitProject = async () => { ...@@ -285,10 +285,17 @@ const submitProject = async () => {
/** 查询工时记录列表 */ /** 查询工时记录列表 */
function getList(employId) { function getList(employId) {
loading.value = true; loading.value = true;
// 从本地存储获取缓存数据
const cachedData = localStorage.getItem(`timesheet_${employId}`);
if (cachedData) {
personalTimesheetList.value = JSON.parse(cachedData);
}
getPersonalTimesheet(employId).then(response => { getPersonalTimesheet(employId).then(response => {
console.log(response) console.log(response);
if (Array.isArray(response)) { // 检查是否为数组 if (Array.isArray(response)) {
personalTimesheetList.value = response.map(project => ({ const newData = response.map(project => ({
...project, ...project,
addWorkList: project.addWorkList.map(day => ({ addWorkList: project.addWorkList.map(day => ({
...day, ...day,
...@@ -298,16 +305,25 @@ function getList(employId) { ...@@ -298,16 +305,25 @@ function getList(employId) {
approvalState: parseInt(project.approvalState), approvalState: parseInt(project.approvalState),
departmentLeaderName: project.departmentLeaderName || '', departmentLeaderName: project.departmentLeaderName || '',
})); }));
// 对比数据是否相同
const isSame = JSON.stringify(newData) === cachedData;
if (!isSame) {
personalTimesheetList.value = newData;
// 将新数据存入本地存储
localStorage.setItem(`timesheet_${employId}`, JSON.stringify(newData));
}
} else { } else {
console.error("Invalid response format:", response); console.error("Invalid response format:", response);
} }
loading.value = false; loading.value = false;
}) })
.catch(error => { .catch(error => {
// console.error("API error:", error); console.error("API error:", error);
loading.value = false; loading.value = false;
}); });
} }
const A =(data)=>{ const A =(data)=>{
getPersonalTimesheet(data).then(response => { getPersonalTimesheet(data).then(response => {
if (response.code === 200) { if (response.code === 200) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment