wtt
2025-09-22 2ed3ad168181ecf0a3cc05426791a960ad9dc9c8
添加查看工资页面
3个文件已修改
500 ■■■■■ 已修改文件
pages.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/gongxuOut/moneystatistics.vue 487 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/mine.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json
@@ -188,6 +188,13 @@
                "enablePullDownRefresh": true
            }
        },
        {
            "path": "pages/gongxuOut/moneystatistics",
            "style": {
                "navigationBarTitleText": "我的工资(汇报预估)",
                "enablePullDownRefresh": true
            }
        },
        {
            "path": "pages/shebeiguanli/form",
            "style": {
pages/gongxuOut/moneystatistics.vue
@@ -1,151 +1,190 @@
<template>
    <view class="content">
        <view class="form">
            <view class="form-item">
            <!-- <view class="form-item">
                <view class="title">月份:</view>
                <view class="right">
                    <picker :range="arrayHMonth" :value="hform.HMonth" @change="HMonthChange">
                        <input name="HMonth" disabled :value="hform.HMonth" placeholder="请选择月份" />
                    </picker>
                    <uni-combox :candidates="arrayHMonth" placeholder="请选择月份" v-model="hform.HMonth"
                    ></uni-combox>
                </view>
            </view>
            <view class="form-item">
            </view> -->
            <view class="form-item" v-show="false">
                <view class="title">操作员:</view>
                <view class="right">
                    <picker :range="arrayHEmp" :value="hform.HEmp" @change="HEmpChange">
                    <picker :range="arrayHEmpName" :value="hform.HEmp" disabled>
                        <input name="HEmp" disabled :value="hform.HEmp" placeholder="请选择"  style="pointer-events: none;"/>
                    </picker>
                </view>
            </view>
            <view class="buttons">
                <button class="btn-a" size="mini" type="default" @tap="clear">重置</button>
                <button class="btn-c" size="mini" type="default" @tap="search">查询</button>
                <!-- <button class="btn-a" size="mini" type="default" @tap="clear">重置</button> -->
                <!-- <button class="btn-c" size="mini" type="default" @tap="search">查询</button> -->
            </view>
        </view>
        
        <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
        <view class="tabs">
            <view :class="tabs == 0 ? 'on':''" @tap="tabs = 0">汇报合计</view>
            <view :class="tabs == 1 ? 'on':''" @tap="tabs = 1">明细信息</view>
            <view :class="tabs == 0 ? 'on':''" @tap="tabs = 0">汇报合计(操作员:{{hform.HEmp}})</view>
            <!-- <view :class="tabs == 1 ? 'on':''" @tap="tabs = 1">明细信息</view> -->
        </view>
        <view class="list" v-for="(item,index) in showList" :key="index">
            <uni-card :title="item.任务单" :extra="item.单据号" style="margin: 10px;" @tap="showDetail = showDetail==index?-1:index">
                <view class="card-detail">
                    <view class="detail" v-if="item.工序流转卡号">
                        <text>流转卡号:</text>{{item.工序流转卡号}}
        <view v-if="tabs == 0">
            <view class="list" v-for="(item,index) in moneyList" :key="index">
                <uni-card title="月份" :extra="item.month" style="margin: 10px;">
                    <view class="card-detail">
                        <view class="detail" >
                            <text>总单量:</text>{{item.HBillQty}}
                        </view>
                        <view class="detail" >
                            <text>总出站数量:</text>{{item.HOutQty}}
                        </view>
                        <view class="detail" >
                            <text>总计件出站数量:</text>{{item.HPieceBillQty}}
                        </view>
                        <view class="detail" >
                            <text>总预估计件金额:</text>{{item.HMoney}}
                        </view>
                        <view class="detail" >
                            <text>计时单量:</text>{{item.HTimingBillQty}}
                        </view>
                        <view class="detail" >
                            <text>总计时:</text>{{item.HTime}}
                        </view>
                    </view>
                    <view class="detail" v-if="item.产品名称">
                        <text>产品名称:</text>{{item.产品名称}}
                </uni-card>
            </view>
        </view>
        <!-- <view v-if="tabs == 1">
            <view class="list" v-for="(item,index) in showList" :key="index">
                <uni-card :title="item.任务单" :extra="item.单据号" style="margin: 10px;" @tap="showDetail = showDetail==index?-1:index">
                    <view class="card-detail">
                        <view class="detail" v-if="item.工序流转卡号">
                            <text>流转卡号:</text>{{item.工序流转卡号}}
                        </view>
                        <view class="detail" v-if="item.产品名称">
                            <text>产品名称:</text>{{item.产品名称}}
                        </view>
                        <view class="detail" v-if="item.产品代码">
                            <text>产品代码:</text>{{item.产品代码}}
                        </view>
                        <view class="detail" v-if="item.款号">
                            <text>款号:</text>{{item.款号}}
                        </view>
                        <view class="detail" v-if="item.当前工序">
                            <text>当前工序:</text>{{item.当前工序}}
                        </view>
                        <view class="detail" v-if="item.当前工序代码">
                            <text>工序代码:</text>{{item.当前工序代码}}
                        </view>
                        <view class="detail" v-if="item.日期">
                            <text>日期:</text>{{item.日期.substr(0,10)}}
                        </view>
                        <!-- <view class="detail" v-if="item.计件金额">
                            <text>计件金额:</text>{{item.计件金额}}
                        </view>
                        <view class="detail" v-if="item.计件单价">
                            <text>计件单价:</text>{{item.计件单价}}
                        </view> -->
                        <!-- <view class="detail" v-if="item.工时">
                            <text>工时:</text>{{item.工时}}
                        </view>
                        <view class="detail" v-if="item.是否计时">
                            <text>是否计时:</text>{{item.是否计时}}
                        </view>
                    </view>
                    <view class="detail" v-if="item.产品代码">
                        <text>产品代码:</text>{{item.产品代码}}
                    </view>
                    <view class="detail" v-if="item.款号">
                        <text>款号:</text>{{item.款号}}
                    </view>
                    <view class="detail" v-if="item.当前工序">
                        <text>当前工序:</text>{{item.当前工序}}
                    </view>
                    <view class="detail" v-if="item.当前工序代码">
                        <text>工序代码:</text>{{item.当前工序代码}}
                    </view>
                    <view class="detail" v-if="item.日期">
                        <text>日期:</text>{{item.日期.substr(0,10)}}
                    </view>
                </view>
                <view class="card-detail" v-if="showDetail == index">
                    <view class="detail" v-if="item.规格型号">
                        <text>规格型号:</text>{{item.规格型号}}
                    </view>
                    <view class="detail" v-if="item.流水号">
                        <text>流水号:</text>{{item.流水号}}
                    </view>
                    <view class="detail" v-if="item.出站数量">
                        <text>出站数量:</text>{{item.出站数量}}
                    </view>
                    <view class="detail" v-if="item.不良数量">
                        <text>不良数量:</text>{{item.不良数量}}
                    </view>
                    <view class="detail" v-if="item.报废数量">
                        <text>报废数量:</text>{{item.报废数量}}
                    </view>
                    <view class="detail" v-if="item.包装标识">
                        <text>包装标识:</text>{{item.包装标识}}
                    </view>
                    <view class="detail" v-if="item.包装标识代码">
                        <text>包装标识代码:</text>{{item.包装标识代码}}
                    </view>
                    <view class="detail" v-if="item.出站时间">
                        <text>出站时间:</text>{{item.出站时间.substr(0,19)}}
                    <view class="card-detail" v-if="showDetail == index">
                        <view class="detail" v-if="item.规格型号">
                            <text>规格型号:</text>{{item.规格型号}}
                        </view>
                        <view class="detail" v-if="item.流水号">
                            <text>流水号:</text>{{item.流水号}}
                        </view>
                        <view class="detail" v-if="item.出站数量">
                            <text>出站数量:</text>{{item.出站数量}}
                        </view>
                        <view class="detail" v-if="item.不良数量">
                            <text>不良数量:</text>{{item.不良数量}}
                        </view>
                        <view class="detail" v-if="item.报废数量">
                            <text>报废数量:</text>{{item.报废数量}}
                        </view>
                        <view class="detail" v-if="item.包装标识">
                            <text>包装标识:</text>{{item.包装标识}}
                        </view>
                        <view class="detail" v-if="item.包装标识代码">
                            <text>包装标识代码:</text>{{item.包装标识代码}}
                        </view>
                        <view class="detail" v-if="item.出站时间">
                            <text>出站时间:</text>{{item.出站时间.substr(0,19)}}
                        </view>
                        <view class="detail" v-if="item.操作员">
                            <text>操作员:</text>{{item.操作员}}
                        </view>
                        <view class="detail" v-if="item.操作员代码">
                            <text>操作员代码:</text>{{item.操作员代码}}
                        </view>
                        <view class="detail" v-if="item.生产资源">
                            <text>生产资源:</text>{{item.生产资源}}
                        </view>
                        <view class="detail" v-if="item.生产资源代码">
                            <text>生产资源代码:</text>{{item.生产资源代码}}
                        </view>
                        <view class="detail" v-if="item.生产班组">
                            <text>生产班组:</text>{{item.生产班组}}
                        </view>
                        <view class="detail" v-if="item.生产班组代码">
                            <text>生产班组代码:</text>{{item.生产班组代码}}
                        </view>
                        <view class="detail" v-if="item.LOT数量">
                            <text>LOT数量:</text>{{item.LOT数量}}
                        </view>
                        <view class="detail" v-if="item.制单人">
                            <text>制单人:</text>{{item.制单人}}
                        </view>
                        <view class="detail" v-if="item.制单日期">
                            <text>制单日期:</text>{{item.制单日期.substr(0,10)}}
                        </view>
                        <view class="detail" v-if="item.修改人">
                            <text>修改人:</text>{{item.修改人}}
                        </view>
                        <view class="detail" v-if="item.修改日期">
                            <text>修改日期:</text>{{item.修改日期.substr(0,10)}}
                        </view>
                        <view class="detail" v-if="item.审核人">
                            <text>审核人:</text>{{item.审核人}}
                        </view>
                        <view class="detail" v-if="item.审核日期">
                            <text>审核日期:</text>{{item.审核日期.substr(0,10)}}
                        </view>
                        <view class="detail" v-if="item.关闭人">
                            <text>关闭人:</text>{{item.关闭人}}
                        </view>
                        <view class="detail" v-if="item.关闭日期">
                            <text>关闭日期:</text>{{item.关闭日期.substr(0,10)}}
                        </view>
                        <view class="detail" v-if="item.备注">
                            <text>备注:</text>{{item.备注}}
                        </view>
                    </view>
                    
                    <view class="detail" v-if="item.操作员">
                        <text>操作员:</text>{{item.操作员}}
                    <view class="more" v-if="showDetail == index">
                        <view class="part" style="border-right: 1px solid #eee;">
                            <uni-icons type="top" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>收起
                        </view>
                    </view>
                    <view class="detail" v-if="item.操作员代码">
                        <text>操作员代码:</text>{{item.操作员代码}}
                    <view class="more" v-if="showDetail != index">
                        <view class="part" style="border-right: 1px solid #eee;">
                            <uni-icons type="bottom" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>更多信息
                        </view>
                    </view>
                    <view class="detail" v-if="item.生产资源">
                        <text>生产资源:</text>{{item.生产资源}}
                    </view>
                    <view class="detail" v-if="item.生产资源代码">
                        <text>生产资源代码:</text>{{item.生产资源代码}}
                    </view>
                    <view class="detail" v-if="item.生产班组">
                        <text>生产班组:</text>{{item.生产班组}}
                    </view>
                    <view class="detail" v-if="item.生产班组代码">
                        <text>生产班组代码:</text>{{item.生产班组代码}}
                    </view>
                    <view class="detail" v-if="item.LOT数量">
                        <text>LOT数量:</text>{{item.LOT数量}}
                    </view>
                    <view class="detail" v-if="item.制单人">
                        <text>制单人:</text>{{item.制单人}}
                    </view>
                    <view class="detail" v-if="item.制单日期">
                        <text>制单日期:</text>{{item.制单日期.substr(0,10)}}
                    </view>
                    <view class="detail" v-if="item.修改人">
                        <text>修改人:</text>{{item.修改人}}
                    </view>
                    <view class="detail" v-if="item.修改日期">
                        <text>修改日期:</text>{{item.修改日期.substr(0,10)}}
                    </view>
                    <view class="detail" v-if="item.审核人">
                        <text>审核人:</text>{{item.审核人}}
                    </view>
                    <view class="detail" v-if="item.审核日期">
                        <text>审核日期:</text>{{item.审核日期.substr(0,10)}}
                    </view>
                    <view class="detail" v-if="item.关闭人">
                        <text>关闭人:</text>{{item.关闭人}}
                    </view>
                    <view class="detail" v-if="item.关闭日期">
                        <text>关闭日期:</text>{{item.关闭日期.substr(0,10)}}
                    </view>
                    <view class="detail" v-if="item.备注">
                        <text>备注:</text>{{item.备注}}
                    </view>
                </view>
                <view class="more" v-if="showDetail == index && operations != index">
                    <view class="part" style="border-right: 1px solid #eee;">
                        <uni-icons type="top" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>收起
                    </view>
                </view>
                <view class="more" v-if="showDetail != index && operations != index">
                    <view class="part" style="border-right: 1px solid #eee;">
                        <uni-icons type="bottom" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>更多信息
                    </view>
                </view>
            </uni-card>
        </view>
                </uni-card>
            </view>
            <view class="over" v-if="listData.length == 0">暂无数据</view>
            <view class="over" v-if="listData.length != 0 && listData.length != showList.length">加载中...</view>
            <view class="over" v-if="listData.length != 0 && listData.length == showList.length">已到底</view>
        </view> -->
        
        <view class="over" v-if="listData.length == 0">暂无数据</view>
        <view class="over" v-if="listData.length != 0 && listData.length != showList.length">加载中...</view>
        <view class="over" v-if="listData.length != 0 && listData.length == showList.length">已到底</view>
    </view>
</template>
@@ -156,38 +195,44 @@
            return {
                userInfo:getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl')||'http://47.96.97.237/API',
                showmore:false,
                arrayHEmpName: [], //接收人
                HEmpNameList: [],
                arrayHMonth:[1,2,3,4,5,6,7,8,9,11,12],
                tabs:0,
                hform:{
                    HMonth:'',
                    HMonth:new Date().getMonth()+1,
                    HEmp:'',
                    HEmpID:0,
                },
                sWhere:'',
                moneyList:[],
                listData:[],
                showList:[],
                showDetail:-1,
                operations:-1,
                
                page:1,
            }
        },
        onLoad() {
            this.getList()
            this.getHEmpList()
            this.getDefValByUser()
            setTimeout(()=>{this.search();},200);
            // console.log(this.userInfo,uni.getStorageSync('HUserName'))
        },
        onReachBottom: function() {
            this.page++
            setTimeout(() => {
                this.showList = this.showList.concat(this.getPage(this.page,this.listData))
            }, 100)
            // this.page++
            // setTimeout(() => {
            //     this.showList = this.showList.concat(this.getPage(this.page,this.listData))
            // }, 100)
        },
        onPullDownRefresh: function() {
            this.clear()
            //this.clear()
            setTimeout(()=>{
                uni.stopPullDownRefresh();
            }, 1000);
            this.search();
        },
        methods: {
            getPage(page,list){
@@ -197,7 +242,7 @@
                return newList
            },
            getList(){
                this.sWhere += ` and 制单人 like N'%${this.userInfo.Czymc}'`
                //this.sWhere += ` and 制单人 like N'%${this.userInfo.Czymc}'`
                uni.showLoading({
                    title:'加载中...'
                })
@@ -213,6 +258,7 @@
                        if(res.data.count == 1){
                            this.listData = res.data.data
                            this.showList = this.getPage(this.page,this.listData)
                            this.moneyList=this.getSumMoney();
                            setTimeout(()=>{
                                 uni.hideLoading()
                            }, 1000)
@@ -243,48 +289,155 @@
                this.showList = []
                
                console.log(this.hform)
                this.sWhere +=" and HEmpID = " + this.hform.HEmpID
                this.sWhere +=" and YEAR(日期) = "+ new Date().getFullYear();
                this.getList()
            },
            //新增
            creat(){
                uni.navigateTo({
                    url:'/pages/gongxuOut/form'
                })
            //操作员等
            getHEmpList() {
                uni.request({
                    url: this.serverUrl + '/Web/GetEmployeeList_Json',
                    data: {
                        Employee: '',
                        HGroupID: 0
                    },
                    success: (res) => {
                        if (res.data.count == 1) {
                            this.HEmpNameList = res.data.data
                            for (var i = 0; i < res.data.data.length; i++) {
                                this.arrayHEmpName[i] = res.data.data[i].HName
                            }
                            this.$forceUpdate();
                        } else {
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                });
            },
            //重置
            clear(){
                this.listData = []
                this.page = 1
                this.showList = []
                this.showmore = false
                this.sWhere = ''
                this.showDetail = -1,
                this.operations = -1,
                this.hform = {
                    HStatus:'全部',
                    HBeginDate:'',
                    HEndDate:'',
                    HWorkBillNo:'',
                    HBillNo:'',
                    HProcExchBillNo:'',
                    HNumber:'',
                    HName:'',
                    checkHWasterQty:'',
                    ColName:'',
                    Comparator:'',
                    ColContent:'',
                }
                this.getList()
            //通过登录用户获取默认值
            getDefValByUser() {
                uni.request({
                    url: this.serverUrl + '/Cj_StationInBill/GetDefValByUser',
                    type: "GET",
                    async: false,
                    data: {
                        "Czybm": this.userInfo.Czybm,
                        "Czymc": this.userInfo.Czymc
                    },
                    success: (res) => {
                        // console.log(res.data)
                        if (res.data.count == 1) {
                            var data = res.data.data[0]
                            this.hform.HEmp = data.操作员名称
                            this.hform.HEmpID = data.HEmpID
                        } else {
                            uni.showToast({
                                title: '获取生产班组信息失败',
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title: '获取生产班组信息失败',
                            icon: 'none'
                        })
                    },
                });
            },
        }
            //计算工资
            getSumMoney(){
                // 初始化结果数组,12个月的数据
                    const monthlyData = Array(12).fill().map(() => ({
                        month: 0, // 月份,1-12
                        HBillQty: 0, // 总单量
                        HOutQty:0,//总出站数量
                        HPieceBillQty: 0, // 总出站数量
                        HTimingBillQty: 0, // 计时单量
                        HMoney: 0, // 总金额
                        HTime: 0 // 总计时
                    }));
                    const currentYear = new Date().getFullYear();
                    const currentMonth = new Date().getMonth() + 1; // JavaScript月份是0-11
                    // 初始化数组,从当前月开始往前倒数12个月
                    for (let i = 0; i < 12; i++) {
                        const monthIndex = (currentMonth - 1 - i + 12) % 12;
                        monthlyData[i].month = (monthIndex + 1); // 转换为1-12月份
                    }
                    this.listData.forEach(item => {
                        const itemDate = new Date(item.日期); // 假设有日期字段,根据实际数据调整
                        const itemYear = itemDate.getFullYear();
                        const itemMonth = itemDate.getMonth() + 1;
                        // 只处理今年的数据
                        if (itemYear === currentYear) {
                            // 计算这个数据应该属于数组中的哪个位置(从当月开始往前数)
                            const monthDiff = (currentMonth - itemMonth + 12) % 12;
                            const dataIndex = monthDiff;
                            // 更新统计数据
                            monthlyData[dataIndex].HBillQty++;
                            monthlyData[dataIndex].HOutQty+=item.出站数量 || 0;
                            if (item.是否计时 === "否") {
                                monthlyData[dataIndex].HPieceBillQty += item.出站数量 || 0;
                                monthlyData[dataIndex].HMoney += item.计件金额 || 0;
                            } else {
                                monthlyData[dataIndex].HTimingBillQty++;
                                monthlyData[dataIndex].HTime += item.工时 || 0;
                            }
                        }
                    });
                    // 格式化金额为两位小数
                    monthlyData.forEach(item => {
                        item.HMoney = parseFloat(item.HMoney.toFixed(2));
                    });
                    // **过滤掉总单量为0的月份**
                    const filteredData = monthlyData.filter(item => item.HBillQty > 0);
                    // **如果希望仍然返回12个月(即使某些月份为0),则去掉上面的 filter**
                    return filteredData;
            }
        }
    }
</script>
<style lang="scss" scoped>
    .tabs {
        width: 100%;
        display: flex;
        border-bottom: 1px solid #ddd;
        margin: 20rpx 0;
        view {
            width: 100%;
            font-size: 30rpx;
            color: #555;
            text-align: center;
            padding: 16rpx 0;
        }
        .on {
            color: #3a78ff;
            font-weight: bold;
            border-bottom: 3px solid #3a78ff;
        }
    }
    .form{
        width: 640rpx;
        margin: 20rpx auto;
@@ -378,7 +531,7 @@
            line-height: 120%;
            .detail{
                // width: 50%;
                font-size: 26rpx;
                font-size: 30rpx;
                margin-bottom: 12rpx;
                color: #555;
                margin-right: 20rpx;
pages/index/mine.vue
@@ -59,6 +59,12 @@
                  text:'修改密码',
                  url:'/pages/xiugaimima/index',
                  id:4
              },
              {
                  img:'../../static/icon05.png',
                  text:'我的工资(预估)',
                  url:'/pages/gongxuOut/moneystatistics',
                  id:4
              }
              ]
            }