From 10348cc0c583611482fdb78be09545483d170281 Mon Sep 17 00:00:00 2001
From: DESKTOP-6GG29MI\dell <2847338803@qq.com>
Date: Tue, 05 Aug 2025 07:54:02 +0000
Subject: [PATCH] 日报总览页日报合计功能添加
---
eladmin-web-master/src/views/task/other/other.vue | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/eladmin-web-master/src/views/task/other/other.vue b/eladmin-web-master/src/views/task/other/other.vue
index b5e5595..f75b44e 100644
--- a/eladmin-web-master/src/views/task/other/other.vue
+++ b/eladmin-web-master/src/views/task/other/other.vue
@@ -23,8 +23,9 @@
clearable
placeholder="员工"
:show-all-levels="false"
- style="width: 200px;"
+ :collapse-tags="true"
@change="changeUserList"
+ class="cascader-item"
/>
<el-select v-model="query.projectId" filterable clearable placeholder="所属项目" :loading="loadingProject" style="width: 185px; margin-top: 6px;" class="filter-item" @change="queryProjectChange" @clear="clearQueryTasks">
<el-option
@@ -47,7 +48,7 @@
<rrOperation :crud="crud" />
</div>
<!--表格渲染-->
- <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
+ <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" :summary-method="getSummaries" show-summary @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column :show-overflow-tooltip="true" prop="fillDate" label="填写日期" fixed="left" min-width="100px">
<template slot-scope="scope">
@@ -213,6 +214,31 @@
clearQueryTasks() {
this.loadingTask = false
},
+ // 表格工时汇总
+ getSummaries(param) {
+ const { columns, data } = param;
+ const sums = [];
+ sums[0] = '合计';
+ columns.forEach((column, index) => {
+ if(column.property === 'consumedHours') {
+ const values = data.map(item => Number(item[column.property]));
+ if (!values.every(value => isNaN(value))) {
+ sums[index] = values.reduce((prev, curr) => {
+ const value = Number(curr);
+ if (!isNaN(value)) {
+ return prev + curr;
+ } else {
+ return prev;
+ }
+ }, 0);
+ sums[index] += ' 小时';
+ } else {
+ sums[index] = '';
+ }
+ }
+ });
+ return sums;
+ }
}
}
</script>
@@ -221,4 +247,27 @@
adventTable tr:first-child {
display: none;
}
+ .cascader-item >>> .el-input__inner {
+ height: 29.5px !important;
+ line-height: 29.5px !important;
+ }
+ .cascader-item >>> .el-cascader__search-input {
+ height: 20px !important;
+ margin: 2px 0px 0px 15px !important;
+ }
+ .cascader-item >>> .el-tag {
+ margin-top: 4.5px;
+ }
+ .cascader-item >>> .el-input__suffix {
+ height: 29.5px !important;
+ }
+ .cascader-item >>> .el-input--small {
+ height: 29.5px !important;
+ }
+ .cascader-item >>> .el-cascader__tags {
+ height: 29.5px !important;
+ }
+ .cascader-item >>> .el-input--small {
+ height: 29.5px !important;
+ }
</style>
--
Gitblit v1.9.3