This commit is contained in:
xyc 2025-08-25 13:46:36 +08:00
parent bea8eea449
commit 3c71424ed7
4 changed files with 132 additions and 107 deletions

View File

@ -6,25 +6,21 @@
<!-- 头像 --> <!-- 头像 -->
<view class="management-title-left" @click="showUserDetail"> <view class="management-title-left" @click="showUserDetail">
<view class="management-title-left-icon"> <view class="management-title-left-icon">
<image :key="customerInfo.avatar" v-if="null!=customerInfo && null!=customerInfo.avatar" <image v-if="customerInfo && customerInfo.avatar" :src="imageUrl+customerInfo.avatar"
:src="imageUrl+customerInfo.avatar" mode="scaleToFill"></image> mode="aspectFill"></image>
<image v-else src="../../static/icons/avatar.png" mode="scaleToFill"></image> <image v-else src="../../static/icons/avatar.png" mode="aspectFill"></image>
</view> </view>
<view class="management-title-left-text">
<view class="management-title-left-text">
<!-- 名称 --> <!-- 名称 -->
<view class="text-top"> <view class="text-top">{{loginTitle}}工作台</view>
{{loginTitle}}工作台
</view>
<!-- 姓名--> <!-- 姓名-->
<view class="text-bottom" :key="customerInfo.nickname" <view class="text-bottom" v-if="customerInfo && customerInfo.nickname">
v-if="null!=customerInfo && customerInfo.nickname">
{{ customerInfo.nickname }} {{ customerInfo.nickname }}
</view> </view>
<view v-if="null!=customerInfo && customerInfo.roleNames && showRoleNames" class="text-bottom"> <view v-if="customerInfo && customerInfo.roleNames && showRoleNames" class="text-bottom">
{{customerInfo.roleNames}} {{customerInfo.roleNames}}
</view> </view>
</view> </view>
@ -32,10 +28,9 @@
<!-- 消息 --> <!-- 消息 -->
<view class="management-title-right" @click='gotoMsg'> <view class="management-title-right" @click='gotoMsg'>
<view class="management-title-right-icon"> <view class="management-title-right-icon">
<image src="/static/imgs/xiaoxi.png" mode="scaleToFill"></image> <image src="/static/imgs/xiaoxi.png" mode="aspectFit"></image>
<view class="msg-num">{{noReadNum}}</view> <view class="msg-num" v-if="noReadNum > 0">{{noReadNum}}</view>
</view> </view>
<view class="management-title-right-text">消息</view> <view class="management-title-right-text">消息</view>
</view> </view>
@ -53,8 +48,8 @@
export default { export default {
props: { props: {
loginTitle: { loginTitle: {
type: String, // type: String,
default: '默认标题' // default: '默认标题'
}, },
noReadNum: { noReadNum: {
type: Number, type: Number,
@ -88,10 +83,8 @@
setUserInfo(res.data.user) setUserInfo(res.data.user)
}) })
} }
const staffInfo = getUserInfo(); this.customerInfo = getUserInfo() || {};
this.customerInfo = staffInfo || {}; console.log('用户信息加载成功', this.customerInfo);
console
.log('用户信息加载成功', getUserInfo());
} catch (e) { } catch (e) {
console.error('加载用户信息失败:', e); console.error('加载用户信息失败:', e);
this.customerInfo = { this.customerInfo = {
@ -122,95 +115,101 @@
align-items: center; align-items: center;
color: white; color: white;
background: linear-gradient(180deg, #054DF3 0%, #55A3FF 100%); background: linear-gradient(180deg, #054DF3 0%, #55A3FF 100%);
}
.management-title-class { .management-title-class {
padding: 0 32rpx; padding: 0 32rpx;
height: 100%; height: 100%;
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
}
.management-title-left { .management-title-left {
display: flex; display: flex;
align-items: center; align-items: center;
}
.management-title-left-icon { .management-title-left-icon {
width: 90rpx; width: 90rpx;
height: 90rpx; height: 90rpx;
border-radius: 50%; border-radius: 50%;
background-color: white; background-color: white;
margin-right: 20rpx; margin-right: 20rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
overflow: hidden;
/* 保证圆形头像内不溢出 */
}
image { .management-title-left-icon image {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 50%; border-radius: 50%;
} object-fit: cover;
} /* H5 有效,小程序用 mode=aspectFill */
}
.management-title-left-text { .management-title-left-text {
padding-top: 20rpx; padding-top: 20rpx;
}
.text-top { .text-top {
font-weight: 400; font-weight: 400;
font-size: 36rpx; font-size: 36rpx;
color: #FFFFFF; color: #FFFFFF;
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.text-bottom { .text-bottom {
font-weight: 400; font-weight: 400;
font-size: 16px; font-size: 16px;
color: #FFFFFF; color: #FFFFFF;
} }
}
}
.management-title-right { .management-title-right {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
}
.management-title-right-icon { .management-title-right-icon {
width: 50rpx; width: 50rpx;
height: 50rpx; height: 50rpx;
margin-bottom: 10rpx; margin-bottom: 10rpx;
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
}
image { .management-title-right-icon image {
width: 100%; width: 100%;
height: 100%; height: 100%;
} object-fit: contain;
/* 保持比例 */
}
.msg-num { .msg-num {
position: absolute; position: absolute;
right: -15rpx; right: -15rpx;
color: white; top: -15rpx;
background: #d74a43; color: white;
width: 35rpx; background: #d74a43;
height: 35rpx; width: 35rpx;
line-height: 35rpx; height: 35rpx;
text-align: center; line-height: 35rpx;
font-weight: 800; text-align: center;
font-size: 11px; font-weight: 800;
border-radius: 50%; font-size: 11px;
top: -15rpx; border-radius: 50%;
} }
}
.management-title-right-text { .management-title-right-text {
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 24rpx;
color: #FFFFFF; color: #FFFFFF;
}
}
}
} }
</style> </style>

View File

@ -262,22 +262,16 @@
uni.redirectTo({ uni.redirectTo({
url: '/pages/staff/staff' url: '/pages/staff/staff'
}) })
return
} }
if (this.shopinfo == 3 || this.shopinfo == 4) { if (this.shopinfo == 3 || this.shopinfo == 4) {
uni.showLoading({
title: '加载中'
});
uni.setStorageSync('roleSelect', 'businessManager') uni.setStorageSync('roleSelect', 'businessManager')
uni.redirectTo({ uni.redirectTo({
url: '/pages/businessManager/businessManager' url: '/pages/businessManager/businessManager'
}) })
return
} }
if (this.shopinfo == 1) { if (this.shopinfo == 1) {
uni.showLoading({
title: '加载中'
});
request({ request({
url: '/rescue/getJcgfInfo', url: '/rescue/getJcgfInfo',
method: 'get', method: 'get',

View File

@ -25,7 +25,7 @@
<text style="color: red;">*</text> <text style="color: red;">*</text>
汇报内容 汇报内容
</view> </view>
<u--textarea v-model="report.reportContent" placeholder="请输入内容"></u--textarea> <textarea maxlength="-1" auto-height v-model="report.reportContent" placeholder="请输入内容"></textarea>
<view class="x_"></view> <view class="x_"></view>
<view class="d_b" @click="handleUpload"> <view class="d_b" @click="handleUpload">
<view class="">附件</view> <view class="">附件</view>

View File

@ -32,6 +32,17 @@
</uni-datetime-picker> </uni-datetime-picker>
</view> </view>
<view class="user_box">
<view class="user_left">
<view class="user_name">总计</view>
</view>
<view class="user_right">
<view class="user_kar" v-for="(item,index) in allCounts" :key="index">
<view class="">{{ item.projectName }}</view>
<view class="num_">{{ item.total }}</view>
</view>
</view>
</view>
<!-- 循环 --> <!-- 循环 -->
<view class="user_box" v-for="(items,index) in List" :key="index"> <view class="user_box" v-for="(items,index) in List" :key="index">
<view class="user_left" @click="goDetail(items)"> <view class="user_left" @click="goDetail(items)">
@ -84,6 +95,7 @@
mode: 'range', mode: 'range',
titles: "员工统计", titles: "员工统计",
List: [], List: [],
allCounts: [],
selectList: [], selectList: [],
useSelectList: [], useSelectList: [],
status: "loading", status: "loading",
@ -132,6 +144,7 @@
}).then((res) => { }).then((res) => {
this.$nextTick(() => { this.$nextTick(() => {
this.List = res.data; this.List = res.data;
this.allCounts = this.summarizeByProjectName(res.data);
}); });
}); });
}, // 1 01 }, // 1 01
@ -172,6 +185,25 @@
pad(num) { pad(num) {
return num.toString().padStart(2, "0"); 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() { getInspectionProject() {
request({ request({