新增员工查看自己的产值
This commit is contained in:
parent
9d16d707b4
commit
e9a38b4680
@ -560,6 +560,13 @@
|
||||
"navigationBarTitleText": "",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/statistics/myOutputValue/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的产值",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
@ -38,6 +38,17 @@
|
||||
<uni-icons type="right" color="#999999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="on-input" @click="goOutputValue()">
|
||||
<view class="dix">
|
||||
<view class="d-icon">
|
||||
<image src="../../static/detection/zhaq.png" mode=""></image>
|
||||
</view>
|
||||
<view class="aa">我的产值</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<uni-icons type="right" color="#999999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="on-input" @click="goRoyalty()">
|
||||
<view class="dix">
|
||||
<view class="d-icon">
|
||||
@ -224,24 +235,30 @@
|
||||
url: '/pages/modifyPassword/modifyPassword' // 修改密码页面路径
|
||||
});
|
||||
},
|
||||
generateUniCode(code) {
|
||||
this.$nextTick(() => {
|
||||
// 获取uQRCode实例
|
||||
const qr = new UQRCode();
|
||||
// 设置二维码内容
|
||||
qr.data = this.shareUrl + code;
|
||||
// 设置二维码大小,必须与canvas设置的宽高一致
|
||||
qr.size = 200;
|
||||
// 调用制作二维码方法
|
||||
qr.make();
|
||||
// 获取canvas上下文
|
||||
const canvasContext = uni.createCanvasContext('qrcode', this); // 如果是组件,this必须传入
|
||||
// 设置uQRCode实例的canvas上下文
|
||||
qr.canvasContext = canvasContext;
|
||||
// 调用绘制方法将二维码图案绘制到canvas上
|
||||
qr.drawCanvas();
|
||||
})
|
||||
},
|
||||
goOutputValue() {
|
||||
// 跳转到个人产值页面
|
||||
uni.navigateTo({
|
||||
url: '/pages/statistics/myOutputValue/index'
|
||||
});
|
||||
},
|
||||
generateUniCode(code) {
|
||||
this.$nextTick(() => {
|
||||
// 获取uQRCode实例
|
||||
const qr = new UQRCode();
|
||||
// 设置二维码内容
|
||||
qr.data = this.shareUrl + code;
|
||||
// 设置二维码大小,必须与canvas设置的宽高一致
|
||||
qr.size = 200;
|
||||
// 调用制作二维码方法
|
||||
qr.make();
|
||||
// 获取canvas上下文
|
||||
const canvasContext = uni.createCanvasContext('qrcode', this); // 如果是组件,this必须传入
|
||||
// 设置uQRCode实例的canvas上下文
|
||||
qr.canvasContext = canvasContext;
|
||||
// 调用绘制方法将二维码图案绘制到canvas上
|
||||
qr.drawCanvas();
|
||||
})
|
||||
},
|
||||
dialogConfirm() {
|
||||
this.tui()
|
||||
this.$refs.alertDialog.close()
|
||||
|
BIN
pages/statistics/myOutputValue/assets/banner.png
Normal file
BIN
pages/statistics/myOutputValue/assets/banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 273 KiB |
BIN
pages/statistics/myOutputValue/assets/icon_tap.png
Normal file
BIN
pages/statistics/myOutputValue/assets/icon_tap.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 501 B |
BIN
pages/statistics/myOutputValue/assets/name.png
Normal file
BIN
pages/statistics/myOutputValue/assets/name.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
466
pages/statistics/myOutputValue/index.vue
Normal file
466
pages/statistics/myOutputValue/index.vue
Normal file
@ -0,0 +1,466 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<view class="top_">
|
||||
<view class="icon_" @click="goBack()">
|
||||
<u-icon name="arrow-left" color="#fff" size="24"></u-icon>
|
||||
</view>
|
||||
<view class="top_img">
|
||||
<image src="../staffStatistics/assets/name.png" mode=""></image>
|
||||
<view class="top_i_text">我的产值统计</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-subsection :list="tabList" :current="tabIndex" @change="changeTab"></u-subsection>
|
||||
<view class="cont_box">
|
||||
<view class="cont_top">
|
||||
<view class="ds_">
|
||||
<view class="tap_text" :class="{'acv':tapIndex == index}" v-for="(item,index) in tapList"
|
||||
:key="index" @click="tapIcon(index)">
|
||||
<view class="">{{item.label || "无"}}</view>
|
||||
<view class="tap_img" v-show="tapIndex == index">
|
||||
<image src="../staffStatistics/assets/icon_tap.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-datetime-picker v-model="queryParams.datetimeRange" type="daterange" rangeSeparator="至"
|
||||
@change="getMyStatistics" class="">
|
||||
<view class="cont_time">
|
||||
<view class="cont_size">{{queryParams.datetimeRange[0]}}</view>
|
||||
<view class="bule_size">~</view>
|
||||
<view class="cont_size">{{queryParams.datetimeRange[1]}}</view>
|
||||
<view class=""> <u-icon name="arrow-down-fill" color="#0357FF" size="12"></u-icon></view>
|
||||
</view>
|
||||
</uni-datetime-picker>
|
||||
|
||||
</view>
|
||||
<view v-if="tabIndex == 0">
|
||||
<view class="user_box">
|
||||
<view class="user_left">
|
||||
<view class="user_img">
|
||||
<image :src="userInfo.avatar ? baseImageUrl + userInfo.avatar : '/static/imgs/yh.png'"
|
||||
mode=""></image>
|
||||
</view>
|
||||
<view class="user_name">{{ userInfo.nickname || '未设置昵称' }}</view>
|
||||
<view class="user_ramk">服务{{ myStatistics.totalCount }}次</view>
|
||||
</view>
|
||||
<view class="user_right">
|
||||
<view class="user_kar_1" v-for="(item,index) in myStatistics.children" :key="index">
|
||||
<view class="user_kar_1_c">
|
||||
<view class="">{{ item.projectName }}</view>
|
||||
<view class="num_">{{ item.count }}</view>
|
||||
</view>
|
||||
<view class="user_kar_1_c">
|
||||
<view class="">产值</view>
|
||||
<view class="num_">{{ item.outputValue }}</view>
|
||||
</view>
|
||||
<view class="user_kar_1_c">
|
||||
<view class="">占比</view>
|
||||
<view class="num_1">{{ item.percentage }}%</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="tabIndex == 1">
|
||||
<view class="user_box">
|
||||
<view class="user_left">
|
||||
<view class="user_img">
|
||||
<image :src="userInfo.avatar ? baseImageUrl + userInfo.avatar : '/static/imgs/yh.png'"
|
||||
mode=""></image>
|
||||
</view>
|
||||
<view class="user_name">{{ userInfo.nickname || '未设置昵称' }}</view>
|
||||
<view class="user_ramk">总产值{{ myOutputStatistics.totalPassOutputValue }}</view>
|
||||
</view>
|
||||
<view class="user_right">
|
||||
<view class="user_kar">
|
||||
<view class="">初检公示产值</view>
|
||||
<view class="num_1">{{ myOutputStatistics.initialInspectionOutputValue }}</view>
|
||||
</view>
|
||||
<view class="user_kar">
|
||||
<view class="">复检公示产值</view>
|
||||
<view class="num_1">{{ myOutputStatistics.recheckInspectionOutputValue }}</view>
|
||||
</view>
|
||||
<view class="user_kar">
|
||||
<view class="">初检合格产值</view>
|
||||
<view class="num_1">{{ myOutputStatistics.initialInspectionPassOutputValue }}</view>
|
||||
</view>
|
||||
<view class="user_kar">
|
||||
<view class="">复检合格产值</view>
|
||||
<view class="num_1">{{ myOutputStatistics.recheckInspectionPassOutputValue }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-calendar :show="show" minDate="2023-05-05" maxDate="2026-01-01" :mode="mode" @confirm="confirm"></u-calendar>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
import config from "@/config";
|
||||
import {
|
||||
getDateRange
|
||||
} from "@/utils/utils";
|
||||
import {
|
||||
getUserInfo
|
||||
} from "@/utils/auth";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tapList: [{
|
||||
label: "本日",
|
||||
value: "day",
|
||||
},
|
||||
{
|
||||
label: "本月",
|
||||
value: "month",
|
||||
},
|
||||
],
|
||||
tabList: ['工作量统计', '产值统计'],
|
||||
tapIndex: 1,
|
||||
tabIndex: 0,
|
||||
show: false,
|
||||
mode: 'range',
|
||||
titles: "我的产值",
|
||||
myStatistics: {
|
||||
totalCount: 0,
|
||||
children: []
|
||||
},
|
||||
myOutputStatistics: {
|
||||
totalPassOutputValue: 0,
|
||||
initialInspectionOutputValue: 0,
|
||||
recheckInspectionOutputValue: 0,
|
||||
initialInspectionPassOutputValue: 0,
|
||||
recheckInspectionPassOutputValue: 0
|
||||
},
|
||||
baseImageUrl: config.baseImageUrl,
|
||||
userInfo: {},
|
||||
queryParams: {
|
||||
datetimeRange: [],
|
||||
userId: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
const now = new Date();
|
||||
this.setCurrentMonthRange();
|
||||
this.userInfo = getUserInfo();
|
||||
this.queryParams.userId = uni.getStorageSync('userId');
|
||||
this.getMyStatistics();
|
||||
},
|
||||
methods: {
|
||||
confirm(e) {
|
||||
console.log(e);
|
||||
},
|
||||
tapIcon(index) {
|
||||
this.tapIndex = index
|
||||
this.slectRange(index)
|
||||
},
|
||||
changeTab(index) {
|
||||
this.tabIndex = index
|
||||
this.getMyStatistics()
|
||||
},
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
// 获取个人统计数据
|
||||
getMyStatistics() {
|
||||
if (this.tabIndex == 0) {
|
||||
this.getMyWorkCount();
|
||||
} else {
|
||||
this.getMyOutputStatistics();
|
||||
}
|
||||
},
|
||||
// 获取个人工作量统计
|
||||
getMyWorkCount() {
|
||||
request({
|
||||
url: "/partnerOwn/partner/getStaffCount",
|
||||
method: "post",
|
||||
data: this.queryParams,
|
||||
}).then((res) => {
|
||||
this.$nextTick(() => {
|
||||
// 找到当前用户的数据
|
||||
const myData = res.data.find(item => item.userId === this.queryParams.userId);
|
||||
this.myStatistics = myData || {
|
||||
totalCount: 0,
|
||||
children: []
|
||||
};
|
||||
});
|
||||
});
|
||||
},
|
||||
// 获取个人产值统计
|
||||
getMyOutputStatistics() {
|
||||
request({
|
||||
url: '/inspection/statistics/queryOutputMoneyStatisticsRanking',
|
||||
method: 'POST',
|
||||
data: this.queryParams,
|
||||
}).then((res) => {
|
||||
this.$nextTick(() => {
|
||||
// 找到当前用户的数据
|
||||
const myData = res.data.find(item => item.userId === this.queryParams.userId);
|
||||
this.myOutputStatistics = myData || {
|
||||
totalPassOutputValue: 0,
|
||||
initialInspectionOutputValue: 0,
|
||||
recheckInspectionOutputValue: 0,
|
||||
initialInspectionPassOutputValue: 0,
|
||||
recheckInspectionPassOutputValue: 0
|
||||
};
|
||||
});
|
||||
});
|
||||
},
|
||||
// Date → "YYYY-MM-DD"
|
||||
formatDate(d) {
|
||||
// 添加类型检查,确保 d 是 Date 对象
|
||||
if (!(d instanceof Date)) {
|
||||
console.error("formatDate() 期望接收 Date 对象,但收到:", d);
|
||||
d = new Date(d); // 尝试转换为 Date 对象
|
||||
if (isNaN(d.getTime())) {
|
||||
// 检查是否有效日期
|
||||
d = new Date(); // 如果转换失败,使用当前日期
|
||||
}
|
||||
}
|
||||
return `${d.getFullYear()}-${this.pad(d.getMonth() + 1)}-${this.pad(
|
||||
d.getDate()
|
||||
)}`;
|
||||
},
|
||||
|
||||
// 设置本月起止日期:月初到今天
|
||||
setCurrentMonthRange() {
|
||||
// 直接使用 Date 对象
|
||||
const now = new Date();
|
||||
|
||||
// 创建月初的 Date 对象
|
||||
const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||
|
||||
this.queryParams.datetimeRange = [
|
||||
this.formatDate(startOfMonth), // 月初
|
||||
this.formatDate(now), // 今天
|
||||
];
|
||||
},
|
||||
|
||||
// 辅助函数:补零
|
||||
pad(num) {
|
||||
return num.toString().padStart(2, "0");
|
||||
},
|
||||
slectRange(index) {
|
||||
this.selected = index;
|
||||
console.log(index, this.selected);
|
||||
const {
|
||||
value
|
||||
} = this.tapList[index];
|
||||
console.log(value);
|
||||
this.queryParams.datetimeRange = getDateRange(value);
|
||||
this.getMyStatistics();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
.top_ {
|
||||
width: 100%;
|
||||
height: 340rpx;
|
||||
position: relative;
|
||||
background: #dea5ff;
|
||||
background: url(./assets/banner.png);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.icon_ {
|
||||
position: absolute;
|
||||
left: 30rpx;
|
||||
top: 100rpx;
|
||||
}
|
||||
|
||||
.top_img {
|
||||
position: absolute;
|
||||
top: 100rpx;
|
||||
left: 52rpx;
|
||||
width: 474rpx;
|
||||
height: 148rpx;
|
||||
z-index: 999;
|
||||
|
||||
image {
|
||||
width: 474rpx;
|
||||
height: 148rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.top_i_text {
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #0357FF;
|
||||
}
|
||||
|
||||
.cont_box {
|
||||
background: #F8F9FA;
|
||||
box-shadow: 0rpx 6rpx 16rpx 0rpx rgba(12, 74, 157, 0.25);
|
||||
border-radius: 20rpx 20rpx 0rpx 0rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.cont_top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.ds_ {
|
||||
display: flex;
|
||||
align-items: center
|
||||
}
|
||||
|
||||
.tap_text {
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #707677;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.cont_time {
|
||||
width: 422rpx;
|
||||
height: 60rpx;
|
||||
background: #F1F4F7;
|
||||
border-radius: 36rpx;
|
||||
border: 2rpx solid #0357FF;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0px 30rpx;
|
||||
}
|
||||
|
||||
.cont_size {
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #686C7A;
|
||||
}
|
||||
|
||||
.bule_size {
|
||||
color: #0357FF;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin: 0px 10rpx;
|
||||
}
|
||||
|
||||
.tap_img {
|
||||
height: 3px;
|
||||
text-align: center;
|
||||
margin: 0 auto;
|
||||
|
||||
image {
|
||||
width: 34rpx;
|
||||
height: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.acv {
|
||||
font-weight: bold;
|
||||
color: #292D2E !important;
|
||||
}
|
||||
|
||||
.user_box {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
background: #FFFFFF;
|
||||
border-radius: 8rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 15rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.user_right {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
.user_left {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.user_img {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 50%;
|
||||
border: 4rpx solid #FFDD89;
|
||||
margin: 0px auto;
|
||||
text-align: center;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.user_name {
|
||||
font-weight: 600;
|
||||
font-size: 28rpx;
|
||||
color: #2F353B;
|
||||
margin: 5px auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.user_ramk {
|
||||
width: 150rpx;
|
||||
height: 34rpx;
|
||||
background: #E3EAF8;
|
||||
border-radius: 50px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #0357FF;
|
||||
margin: 0px auto;
|
||||
}
|
||||
|
||||
.user_kar {
|
||||
width: 230rpx;
|
||||
height: 80rpx;
|
||||
background: #F9F9FC;
|
||||
border-radius: 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
box-sizing: border-box;
|
||||
padding: 30rpx;
|
||||
font-weight: 400;
|
||||
font-size: 26rpx;
|
||||
color: #6D7377;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.user_kar_1 {
|
||||
width: 230rpx;
|
||||
background: #F9F9FC;
|
||||
border-radius: 8rpx;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
box-sizing: border-box;
|
||||
padding: 30rpx;
|
||||
font-weight: 400;
|
||||
font-size: 26rpx;
|
||||
color: #6D7377;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.user_kar_1_c {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.num_ {
|
||||
font-weight: 600;
|
||||
font-size: 28rpx;
|
||||
color: #2F353B;
|
||||
}
|
||||
|
||||
.num_1 {
|
||||
color: #0357FF;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user