From 3c71424ed74f10e9f1a818f69eb5dcfb5729edcd Mon Sep 17 00:00:00 2001 From: xyc <3422692813@qq.com> Date: Mon, 25 Aug 2025 13:46:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/staffHeader/staffHeader.vue | 195 ++++++++++----------- pages/Login/login.vue | 10 +- pages/manage/workReport/reportDetals.vue | 2 +- pages/statistics/staffStatistics/index.vue | 32 ++++ 4 files changed, 132 insertions(+), 107 deletions(-) diff --git a/components/staffHeader/staffHeader.vue b/components/staffHeader/staffHeader.vue index 0fde8b8..4ae1b18 100644 --- a/components/staffHeader/staffHeader.vue +++ b/components/staffHeader/staffHeader.vue @@ -6,25 +6,21 @@ - - - + + - + - - {{loginTitle}}工作台 - + {{loginTitle}}工作台 - + {{ customerInfo.nickname }} - + {{customerInfo.roleNames}} @@ -32,10 +28,9 @@ - - - {{noReadNum}} + + {{noReadNum}} 消息 @@ -53,8 +48,8 @@ export default { props: { loginTitle: { - type: String, // 指定类型为字符串 - default: '默认标题' // 设置默认值 + type: String, + default: '默认标题' }, noReadNum: { type: Number, @@ -88,10 +83,8 @@ setUserInfo(res.data.user) }) } - const staffInfo = getUserInfo(); - this.customerInfo = staffInfo || {}; - console - .log('用户信息加载成功', getUserInfo()); + this.customerInfo = getUserInfo() || {}; + console.log('用户信息加载成功', this.customerInfo); } catch (e) { console.error('加载用户信息失败:', e); this.customerInfo = { @@ -122,95 +115,101 @@ align-items: center; color: white; background: linear-gradient(180deg, #054DF3 0%, #55A3FF 100%); + } - .management-title-class { - padding: 0 32rpx; - height: 100%; - width: 100%; - display: flex; - align-items: center; - justify-content: space-between; + .management-title-class { + padding: 0 32rpx; + height: 100%; + width: 100%; + display: flex; + align-items: center; + justify-content: space-between; + } - .management-title-left { - display: flex; - align-items: center; + .management-title-left { + display: flex; + align-items: center; + } - .management-title-left-icon { - width: 90rpx; - height: 90rpx; - border-radius: 50%; - background-color: white; - margin-right: 20rpx; - display: flex; - align-items: center; - justify-content: center; + .management-title-left-icon { + width: 90rpx; + height: 90rpx; + border-radius: 50%; + background-color: white; + margin-right: 20rpx; + display: flex; + align-items: center; + justify-content: center; + overflow: hidden; + /* 保证圆形头像内不溢出 */ + } - image { - width: 100%; - height: 100%; - border-radius: 50%; - } - } + .management-title-left-icon image { + width: 100%; + height: 100%; + border-radius: 50%; + object-fit: cover; + /* H5 有效,小程序用 mode=aspectFill */ + } - .management-title-left-text { - padding-top: 20rpx; + .management-title-left-text { + padding-top: 20rpx; + } - .text-top { - font-weight: 400; - font-size: 36rpx; - color: #FFFFFF; - margin-bottom: 10rpx; - } + .text-top { + font-weight: 400; + font-size: 36rpx; + color: #FFFFFF; + margin-bottom: 10rpx; + } - .text-bottom { - font-weight: 400; - font-size: 16px; - color: #FFFFFF; - } - } - } + .text-bottom { + font-weight: 400; + font-size: 16px; + color: #FFFFFF; + } - .management-title-right { - display: flex; - flex-direction: column; - align-items: center; + .management-title-right { + display: flex; + flex-direction: column; + align-items: center; + } - .management-title-right-icon { - width: 50rpx; - height: 50rpx; - margin-bottom: 10rpx; - position: relative; - display: flex; - align-items: center; - justify-content: center; + .management-title-right-icon { + width: 50rpx; + height: 50rpx; + margin-bottom: 10rpx; + position: relative; + display: flex; + align-items: center; + justify-content: center; + } - image { - width: 100%; - height: 100%; - } + .management-title-right-icon image { + width: 100%; + height: 100%; + object-fit: contain; + /* 保持比例 */ + } - .msg-num { - position: absolute; - right: -15rpx; - color: white; - background: #d74a43; - width: 35rpx; - height: 35rpx; - line-height: 35rpx; - text-align: center; - font-weight: 800; - font-size: 11px; - border-radius: 50%; - top: -15rpx; - } - } + .msg-num { + position: absolute; + right: -15rpx; + top: -15rpx; + color: white; + background: #d74a43; + width: 35rpx; + height: 35rpx; + line-height: 35rpx; + text-align: center; + font-weight: 800; + font-size: 11px; + border-radius: 50%; + } - .management-title-right-text { - font-weight: 400; - font-size: 24rpx; - color: #FFFFFF; - } - } - } + .management-title-right-text { + font-weight: 400; + font-size: 24rpx; + color: #FFFFFF; } \ No newline at end of file diff --git a/pages/Login/login.vue b/pages/Login/login.vue index 85c4c9e..4eb10af 100644 --- a/pages/Login/login.vue +++ b/pages/Login/login.vue @@ -262,22 +262,16 @@ uni.redirectTo({ url: '/pages/staff/staff' }) - + return } if (this.shopinfo == 3 || this.shopinfo == 4) { - uni.showLoading({ - title: '加载中' - }); uni.setStorageSync('roleSelect', 'businessManager') uni.redirectTo({ url: '/pages/businessManager/businessManager' }) - + return } if (this.shopinfo == 1) { - uni.showLoading({ - title: '加载中' - }); request({ url: '/rescue/getJcgfInfo', method: 'get', diff --git a/pages/manage/workReport/reportDetals.vue b/pages/manage/workReport/reportDetals.vue index 325bf5c..816b7a2 100644 --- a/pages/manage/workReport/reportDetals.vue +++ b/pages/manage/workReport/reportDetals.vue @@ -25,7 +25,7 @@ * 汇报内容 - + 附件 diff --git a/pages/statistics/staffStatistics/index.vue b/pages/statistics/staffStatistics/index.vue index fa95a30..5705a7b 100644 --- a/pages/statistics/staffStatistics/index.vue +++ b/pages/statistics/staffStatistics/index.vue @@ -32,6 +32,17 @@ + + + 总计 + + + + {{ item.projectName }} + {{ item.total }} + + + @@ -84,6 +95,7 @@ mode: 'range', titles: "员工统计", List: [], + allCounts: [], selectList: [], useSelectList: [], status: "loading", @@ -132,6 +144,7 @@ }).then((res) => { this.$nextTick(() => { this.List = res.data; + this.allCounts = this.summarizeByProjectName(res.data); }); }); }, // 补零:1 → 01 @@ -172,6 +185,25 @@ pad(num) { return num.toString().padStart(2, "0"); }, + summarizeByProjectName(data) { + const result = {}; + + data.forEach(user => { + user.children.forEach(item => { + const name = item.projectName || '未知项目'; + const count = item.count || 0; + result[name] = (result[name] || 0) + count; + }); + }); + + // 转成数组并按总数降序排序 + return Object.entries(result) + .map(([projectName, total]) => ({ + projectName, + total + })) + .sort((a, b) => b.total - a.total); + }, // 获取工作内容列表 getInspectionProject() { request({