统计数据

This commit is contained in:
磷叶 2025-01-14 11:03:37 +08:00
parent eb113f4b7d
commit 78e658d816
4 changed files with 116 additions and 13 deletions

10
src/api/yh/dashboard.js Normal file
View File

@ -0,0 +1,10 @@
import request from '@/utils/request.js'
// 获取员工产量统计
export function dashboardUserProd(params) {
return request({
url: "/yh/dashboard/userProd",
method: 'get',
params
})
}

View File

@ -51,7 +51,7 @@
<div class="search-area">
<div class="search-wrapper">
<el-input
v-model="queryParams.priceName"
v-model="queryParams.name"
placeholder="搜索工序名称"
clearable
prefix-icon="el-icon-search"
@ -183,7 +183,7 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
priceName: null,
name: null,
category: null,
size: null,
surface: null,
@ -345,7 +345,8 @@ export default {
display: block;
position: relative;
.condition-box {
height: 100%;
position: relative;
height: calc(100vh - 32px);
overflow: auto;
padding: 1em;
.condition-title {

View File

@ -2,6 +2,44 @@
<div :class="listConfig.containerClass">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- 报表日期 -->
<el-form-item label="部门" prop="deptId">
<dept-tree-select v-model="queryParams.deptId" placeholder="请选择部门" class="small-tree-select" @change="handleQuery"/>
</el-form-item>
<el-form-item label="报表状态" prop="reportStatus">
<el-select
v-model="queryParams.reportStatus"
placeholder="请选择报表状态"
clearable
@change="handleQuery"
>
<el-option v-for="item in dict.type.report_status" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="员工名称" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入员工名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工序名称" prop="priceName">
<el-input
v-model="queryParams.priceName"
placeholder="请输入工序名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工序代码" prop="priceCode">
<el-input
v-model="queryParams.priceCode"
placeholder="请输入工序代码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="报表日期" prop="reportDateRange">
<el-date-picker
v-model="queryParams.reportDateRange"
@ -14,14 +52,6 @@
@change="handleQuery"
/>
</el-form-item>
<el-form-item label="员工名称" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入员工名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -65,6 +95,18 @@
<right-toolbar :show-refresh="listConfig.showRefresh" :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"/>
</el-row>
<!-- TODO 统计数据 -->
<el-row class="statistics-row">
<div class="statistics-item">
<span class="statistics-label">总产量</span>
<span class="statistics-value">{{ statistics.totalNum || 0 }}</span>
</div>
<div class="statistics-item">
<span class="statistics-label">总工资</span>
<span class="statistics-value">{{ statistics.totalPrice || 0 }} </span>
</div>
</el-row>
<el-table v-loading="loading" :data="reportUserProdList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="onSortChange">
<el-table-column type="selection" width="55" align="center" />
<template v-for="column of showColumns">
@ -162,6 +204,8 @@ import {
} from "@/api/yh/reportUserProd";
import {$listConfig, $showColumns, $showSearch} from '@/utils/mixins';
import FormCol from "@/components/FormCol/index.vue";
import DeptTreeSelect from '@/components/Business/Dept/DeptTreeSelect.vue';
import {dashboardUserProd} from '@/api/yh/dashboard.js';
//
const defaultSort = {
@ -173,7 +217,7 @@ export default {
name: "ReportUserProd",
mixins: [$showColumns, $listConfig, $showSearch],
dicts: ['report_status'],
components: {FormCol},
components: {FormCol, DeptTreeSelect},
props: {
query: {
type: Object,
@ -247,7 +291,9 @@ export default {
num: [
{ required: true, message: "产量不能为空", trigger: "blur" }
]
}
},
//
statistics: {},
};
},
created() {
@ -259,8 +305,14 @@ export default {
this.initSearchColumns();
this.initColumns();
this.getList();
this.getStatistics();
},
methods: {
getStatistics() {
dashboardUserProd(this.queryParams).then(res => {
this.statistics = res.data;
})
},
/** 当排序按钮被点击时触发 **/
onSortChange(column) {
if (column.order == null) {
@ -300,6 +352,7 @@ export default {
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
this.getStatistics();
},
/** 重置按钮操作 */
resetQuery() {
@ -367,3 +420,37 @@ export default {
}
};
</script>
<style scoped>
.box-card {
margin: 10px;
}
.card-content {
text-align: center;
padding: 20px 0;
}
.statistics-row {
background: #f5f7fa;
padding: 15px;
margin: 10px 0;
border-radius: 4px;
display: flex;
justify-content: flex-start;
align-items: center;
}
.statistics-item {
margin-right: 40px;
display: flex;
align-items: center;
}
.statistics-label {
font-size: 14px;
color: #606266;
margin-right: 8px;
}
.statistics-value {
font-size: 20px;
font-weight: bold;
color: #409EFF;
}
</style>

View File

@ -127,5 +127,10 @@ module.exports = {
})
config.optimization.runtimeChunk('single')
})
config.plugin('html').tap(args => {
args[0].version = new Date().getTime()
return args
})
}
}