!13 报工报表添加用户选择

Merge pull request !13 from guopeiyu/guopeiyu
main
guopeiyu 2 years ago committed by Gitee
commit cab3cba37c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -110,7 +110,6 @@
import {processTypes, groupTypes} from "@/api/system/dict/data"; import {processTypes, groupTypes} from "@/api/system/dict/data";
import { import {
getProductList,
createReport, createReport,
getOtherPersonalUser, getOtherPersonalUser,
getOtherOrgList, getOtherOrgList,
@ -202,7 +201,6 @@ export default {
submit(ref) { submit(ref) {
if(this.customFormData.reportDateString.length<11)this.customFormData.reportDateString+=' 00:00:00'; if(this.customFormData.reportDateString.length<11)this.customFormData.reportDateString+=' 00:00:00';
this.customFormData.reportType = '代报工'; this.customFormData.reportType = '代报工';
console.log(this.customFormData);
this.$refs[ref].validate().then(res => { this.$refs[ref].validate().then(res => {
var ok = 1; var ok = 1;
if(this.customFormData.produceReportDetails && this.customFormData.produceReportDetails.length > 0) { if(this.customFormData.produceReportDetails && this.customFormData.produceReportDetails.length > 0) {

@ -8,6 +8,8 @@
<text class="point">.</text> <text class="point">.</text>
<text class="title">报工报表</text> <text class="title">报工报表</text>
</view> </view>
<uni-data-select v-if="auth.hasPermi('mes:produce-report-detail:replace')" class="select" v-model="userId" :localdata="userList" placement="top" @change="handleChange()">
</uni-data-select>
<view class="top_desc"> <view class="top_desc">
<view> <view>
<view class="text">上月报工汇总</view> <view class="text">上月报工汇总</view>
@ -104,6 +106,8 @@ import useUserStore from "@/store/modules/user";
import Config from '@/pages/js/config' import Config from '@/pages/js/config'
import { ref } from 'vue'; import { ref } from 'vue';
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import auth from "@/plugins/auth";
import {getOtherPersonalUser} from "@/api/mes/organization";
const now = new Date(); const now = new Date();
const nowTime = { const nowTime = {
@ -116,7 +120,6 @@ const useStore = useUserStore()
const userId = ref(useStore.userId) const userId = ref(useStore.userId)
const isCanvas2d = ref(Config.ISCANVAS2D) const isCanvas2d = ref(Config.ISCANVAS2D)
let expendCount = 0;
let delayload = ref(false); let delayload = ref(false);
let historyData = ref({}); let historyData = ref({});
const reportTime = ref([]) const reportTime = ref([])
@ -128,98 +131,118 @@ const detailList = ref([]);
const historyBtn = ref([ const historyBtn = ref([
{ {
name: "总数", name: "总数",
state: 1, state: true,
type: "sumNumber" type: "sumNumber"
}, },
{ {
name: "合格数", name: "合格数",
state: 0, state: false,
type: "totalQualityNumber" type: "totalQualityNumber"
}, },
{ {
name: "废品数", name: "废品数",
state: 0, state: false,
type: "totalWasteNumber" type: "totalWasteNumber"
} }
]); ]);
const filterHistoryData = () => { const userList = ref([])
getReportTimeList()
let type = historyBtn.value.filter(x => x.state === 1)[0].type; const getUserList = ()=> {
switch (type) { getOtherPersonalUser().then(response => {
case "sumNumber": userList.value = response.data
historyData.value = dataOne.sumNumber; })
break; }
case "totalQualityNumber": const handleChange = ()=>{
historyData.value = dataOne.totalQualityNumber; getLastMonthSumList()
break; getThisMonthSumList()
case "totalWasteNumber": getReportTimeList()
historyData.value = dataOne.totalWasteNumber; getSumReportTimeList()
break; getDayReportTimeList()
}
} }
const changeHistoryBtn = (type) => { const changeHistoryBtn = (type) => {
for (let i = 0; i < historyBtn.value.length; i++) { historyBtn.value.forEach(btn => {
if (historyBtn.value[i].type === type) { btn.state = false;
historyBtn.value[i].state = 1; });
} else { for (let i = 0; i < historyBtn.value.length; i++) {
historyBtn.value[i].state = 0; historyBtn.value[i].state = historyBtn.value[i].type === type;
}
}
filterHistoryData();
} }
// 30 if(type === 'sumNumber') {
const getReportTimeList = ()=>{
getReportTime(userId.value).then(response => {
reportTime.value = response.data;
dataOne.sumNumber.categories = [] dataOne.sumNumber.categories = []
dataOne.sumNumber.series[0].data = [] dataOne.sumNumber.series[0].data = []
dataOne.totalQualityNumber.categories = [] reportTime.value.forEach(item => {
dataOne.totalQualityNumber.series[0].data = []
dataOne.totalWasteNumber.categories = []
dataOne.totalWasteNumber.series[0].data = []
reportTime.value.forEach(item=>{
dataOne.sumNumber.categories.push(`${new Date(item.reportDay).getMonth() + 1}${new Date(item.reportDay).getDate()}`) dataOne.sumNumber.categories.push(`${new Date(item.reportDay).getMonth() + 1}${new Date(item.reportDay).getDate()}`)
dataOne.sumNumber.series[0].data.push(item.sumNumber) dataOne.sumNumber.series[0].data.push(item.sumNumber)
})
historyData.value = dataOne.sumNumber
} else if (type === 'totalQualityNumber') {
dataOne.totalQualityNumber.categories = []
dataOne.totalQualityNumber.series[0].data = []
reportTime.value.forEach(item => {
dataOne.totalQualityNumber.categories.push(`${new Date(item.reportDay).getMonth() + 1}${new Date(item.reportDay).getDate()}`) dataOne.totalQualityNumber.categories.push(`${new Date(item.reportDay).getMonth() + 1}${new Date(item.reportDay).getDate()}`)
dataOne.totalQualityNumber.series[0].data.push(item.totalQualityNumber) dataOne.totalQualityNumber.series[0].data.push(item.totalQualityNumber)
})
historyData.value = dataOne.totalQualityNumber
} else {
dataOne.totalWasteNumber.categories = []
dataOne.totalWasteNumber.series[0].data = []
reportTime.value.forEach(item => {
dataOne.totalWasteNumber.categories.push(`${new Date(item.reportDay).getMonth() + 1}${new Date(item.reportDay).getDate()}`) dataOne.totalWasteNumber.categories.push(`${new Date(item.reportDay).getMonth() + 1}${new Date(item.reportDay).getDate()}`)
dataOne.totalWasteNumber.series[0].data.push(item.totalWasteNumber) dataOne.totalWasteNumber.series[0].data.push(item.totalWasteNumber)
}) })
historyData.value = dataOne.totalWasteNumber
}
}
// 30
const defaultBtnIndex = ref(0)
const getReportTimeList = async () => {
defaultBtnIndex.value = 0;
historyBtn.value.forEach((btn, index) => {
btn.state = (index === defaultBtnIndex.value);
});
historyData.value= {}
reportTime.value = []
dataOne.sumNumber.categories = [];
dataOne.sumNumber.series[0].data = [];
const response = await getReportTime(userId.value);
reportTime.value = response.data;
reportTime.value.forEach(item => {
const month = new Date(item.reportDay).getMonth() + 1;
const day = new Date(item.reportDay).getDate();
dataOne.sumNumber.categories.push(`${month}${day}`);
dataOne.sumNumber.series[0].data.push(item.sumNumber);
}); });
historyData.value = dataOne.sumNumber;
} }
// //
const getLastMonthSumList = ()=>{ const getLastMonthSumList = async () => {
getLastMonthSum(userId.value).then(response => { const response = await getLastMonthSum(userId.value);
lastMonthSum.value = response.data; lastMonthSum.value = response.data;
});
} }
// //
const getThisMonthSumList = ()=>{ const getThisMonthSumList = async () => {
getThisMonthSum(userId.value).then(response => { const response = await getThisMonthSum(userId.value);
thisMonthSum.value = response.data; thisMonthSum.value = response.data;
});
} }
// //
const getSumReportTimeList = ()=>{ const getSumReportTimeList = async () => {
getSumReportTime(userId.value).then(response => { const response = await getSumReportTime(userId.value);
sumReportTime.value = response.data; sumReportTime.value = response.data;
});
} }
// 30 // 30
const getDayReportTimeList = ()=>{ const getDayReportTimeList = async () => {
getDayReportTime(userId.value).then(response => { const response = await getDayReportTime(userId.value);
detailList.value = response.data; detailList.value = response.data;
});
} }
onLoad(() => { onLoad(() => {
filterHistoryData() getUserList()
getReportTimeList() getReportTimeList()
getLastMonthSumList() getLastMonthSumList()
getThisMonthSumList() getThisMonthSumList()
@ -230,171 +253,183 @@ onLoad(() => {
<style scoped lang="scss"> <style scoped lang="scss">
.body { .body {
height: 100%; height: 100%;
background-color: #f1f1f1; background-color: #f1f1f1;
margin: 0; margin: 0;
padding-bottom: 20rpx; padding-bottom: 20rpx;
.text_green { .text_green {
color: #4ECDB6; color: #4ECDB6;
} }
.main { .main {
width: 100%; width: 100%;
padding: 0 10rpx; padding: 0 10rpx;
box-sizing: border-box; box-sizing: border-box;
margin-top: 20rpx; margin-top: 20rpx;
.detail_list { .detail_list {
height: 700rpx; height: 700rpx;
overflow: auto; overflow: auto;
color: #9E9E9E; color: #9E9E9E;
.detail_item { .detail_item {
display: flex; display: flex;
margin: 20rpx 0; margin: 20rpx 0;
align-items: center; align-items: center;
.right_content { .right_content {
width: 75%; width: 75%;
text-align: center; text-align: center;
} }
.hour { .hour {
color: #000; color: #000;
} }
} }
} }
.right_btn { .right_btn {
float: right; float: right;
display: flex; display: flex;
color: #ccc; color: #ccc;
font-size: 22rpx; font-size: 22rpx;
view { view {
line-height: 50rpx; line-height: 50rpx;
height: 50rpx; height: 50rpx;
margin: 0 20rpx; margin: 0 20rpx;
} }
.active_btn { .active_btn {
padding: 0 20rpx; padding: 0 20rpx;
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 40rpx; border-radius: 40rpx;
} }
} }
.end_block { .end_block {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
border-radius: 12rpx; border-radius: 12rpx;
position: relative; position: relative;
padding: 20rpx; padding: 20rpx;
.flex_wrap { .flex_wrap {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
} }
.row_block { .row_block {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
border-radius: 12rpx; border-radius: 12rpx;
position: relative; position: relative;
padding: 20rpx; padding: 20rpx;
&::after { &::after {
content: ""; content: "";
height: 0; height: 0;
width: 92%; width: 92%;
position: absolute; position: absolute;
transform: translateX(-50%); transform: translateX(-50%);
left: 50%; left: 50%;
bottom: 0; bottom: 0;
border-top: 1px dashed #ccc; border-top: 1px dashed #ccc;
} }
} }
.the_title { .the_title {
display: flex; display: flex;
align-items: center; align-items: center;
.left_title { .left_title {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.title_icon { .title_icon {
background-color: #7E7E7E; background-color: #7E7E7E;
height: 40rpx; height: 40rpx;
width: 10rpx; width: 10rpx;
border-radius: 10rpx; border-radius: 10rpx;
margin-right: 20rpx; margin-right: 20rpx;
font-size: 16px; font-size: 16px;
font-weight: 600; font-weight: 600;
} }
} }
.extend_rank { .extend_rank {
width: 100%; width: 100%;
background-color: #F5F5F5; background-color: #F5F5F5;
box-sizing: border-box; box-sizing: border-box;
padding: 10rpx; padding: 10rpx;
.rank_item { .rank_item {
width: 100%; width: 100%;
margin: 20rpx 0; margin: 20rpx 0;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
font-size: 26rpx; font-size: 26rpx;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
image { image {
width: 10%; width: 10%;
} }
text { text {
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
display: block; display: block;
} }
.name { .name {
margin: 0 10rpx; margin: 0 10rpx;
color: #7D7D7D; color: #7D7D7D;
width: 20%; width: 20%;
} }
.desc { .desc {
width: 50%; width: 50%;
color: #ccc; color: #ccc;
} }
.money { .money {
width: 20%; width: 20%;
text-align: right; text-align: right;
} }
} }
} }
} }
.top_head { .top_head {
height: 495rpx; position: relative;
width: 100%; height: 495rpx;
padding: 110rpx 10rpx 0 10rpx; width: 100%;
background: url('@/static/images/icon/background.png') no-repeat center 0; padding: 110rpx 10rpx 0 10rpx;
box-sizing: border-box; background: url('@/static/images/icon/background.png') no-repeat center 0;
box-sizing: border-box;
.top_desc {
width: 100%; .select {
border-radius: 20rpx; position: absolute;
background-color: #fff; width: 240rpx;
margin-top: 20rpx; top: 155rpx;
padding: 20rpx; right: 30rpx;
box-sizing: border-box; :deep(.uni-select__input-text) {
color: #ffffff;
font-weight: bold;
}
}
.top_desc {
width: 100%;
border-radius: 20rpx;
background-color: #fff;
margin-top: 20rpx;
padding: 20rpx;
box-sizing: border-box;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
@ -404,64 +439,66 @@ onLoad(() => {
color: #1783f2; color: #1783f2;
margin-bottom: 10px margin-bottom: 10px
} }
.text-gray { .text-gray {
font-size: 28rpx; font-size: 28rpx;
color: #ccc; color: #ccc;
margin-right: 10rpx; margin-right: 10rpx;
} }
.remaining { .remaining {
font-size: 46rpx; font-size: 46rpx;
} }
.flex_1 { .flex_1 {
flex: 1; flex: 1;
} }
.head_block { .head_block {
margin-top: 20rpx; margin-top: 20rpx;
.income { .income {
color: #E34B5E; color: #E34B5E;
} }
} }
} }
.text_des { .text_des {
height: 100rpx; height: 100rpx;
color: #fff; color: #fff;
font-weight: 900; font-weight: 900;
position: relative; position: relative;
margin-left: 60rpx; margin-left: 60rpx;
margin-bottom: 40rpx;
text {
display: inline-block; text {
height: 100%; display: inline-block;
} height: 100%;
}
.month_num {
font-size: 90rpx; .month_num {
} font-size: 90rpx;
}
.month_text {
font-size: 56rpx; .month_text {
} font-size: 56rpx;
}
.month_year {
font-size: 22rpx; .month_year {
position: absolute; font-size: 22rpx;
left: 60rpx; position: absolute;
top: 20rpx; left: 60rpx;
} top: 20rpx;
}
.point {
font-size: 40rpx; .point {
} font-size: 40rpx;
}
.title {
font-size: 40rpx; .title {
} font-size: 40rpx;
} }
} }
}
} }
</style> </style>

Loading…
Cancel
Save