ke_junjie
2025-06-04 84620534eb627e95811b971a4b552b6a177829bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<template>
    <div class="home-page-compontent-d" v-loading="loading">
        <div class="compontent-header">
            <span class="pannel-title">今日出库计划</span>
            <el-link type="primary" @click="onMore">更多</el-link>
        </div>
        
        <div class="actual-plan-comparison">
            <div class="comparison-block">
                <div class="title">计划出库数量</div>
                <div class="value">{{totals.planStr}}</div>
            </div>
            <div class="comparison-block">
                <div class="title">实际出库数量</div>
                <div class="value">{{totals.infactStr}}</div>
            </div>
            <div class="comparison-block">
                <div class="title">实际出库数量</div>
                <div class="value">{{totals.rate}}</div>
            </div>
        </div>
        
        <el-table :data="list" stripe>
            <el-table-column prop="MainTaskNo" label="任务号" min-width="150" />
            <el-table-column prop="SerialNumber" label="序列号" min-width="120" />
            <el-table-column prop="OrderNo" label="订货号" min-width="120" />
            <el-table-column prop="OutTaskDetailStateName" label="当前状态" width="100" />
        </el-table>
        
        <div class="pagination-row"><el-pagination :pager-count="5" layout="total,prev, pager, next, jumper" :total="total" @current-change="onPageList" /></div>
    </div>
</template>
 
<script>
export default {
    name:'homePageCompontentD',
    data(){
        return {
            loading:false,
            totals:{
                plan:0,
                planStr:'0',
                infact:0,
                infactStr:'0',
                rate:'0%'
            },
            list:[],
            total:100,
            queried:{...this.$config.pagination,...{pageSize:5}}
        }
    },
    mounted() {
        this.init()
    },
    methods:{
        init(){
            this.loading = true;
            this.getTotals((f)=>{
                if (f) {
                    this.newList(false,()=>{
                        this.loading = false;
                    })
                } else {
                    this.loading = false;
                }
            })
        },
        getTotals(callback){
            this.$api.post('HomePageOutTask',{},{block:'home'}).then((d)=>{
                this.totals.plan = d.PlanOutCount || 0;
                this.totals.planStr = this.totals.plan.toLocaleString()
                this.totals.infact = d.PlanOutCompleteCount || 0;
                this.totals.infactStr = this.totals.infact.toLocaleString()
                this.totals.rate = this.totals.plan?(Number((this.totals.infact/this.totals.plan*100).toFixed(2))+'%'):'0%'
                callback && callback(true)
            }).catch((err)=>{
                callback && callback(false)
            })
        },
        /* 翻页功能 */
        onPageList(page){
            this.queried.page = page;
            this.getList();
        },
        /* 表格刷新至首页 */
        newList(needLoading=true,callback){
            this.queried = {...this.$config.pagination,...{pageSize:5}}
            this.getList(callback,needLoading)
        },
        /* 更新数据表 */
        getList(callback,needLoading=true){
            if (needLoading) {
                this.loading=true;
            }
            this.$api.post('HomePageOutTaskToDay',this.queried,{block:'home'}).then((d)=>{
                this.total = d.total || 0;
                this.list = d.list || []
                if (needLoading) {
                    this.loading=false;
                }
                callback && callback(true)
            }).catch((err)=>{
                if (needLoading) {
                    this.loading=false;
                }
                callback && callback(false)
            })
        },
        onMore(){
            this.$router.push('/sub-tasks-output-plan')
        }
    }
}
</script>
 
<style scoped lang="scss">
.home-page-compontent-d{
    padding: 24px;
    .compontent-header{
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .actual-plan-comparison{
        display: flex;
        padding: 28px 0;
        .comparison-block{
            width: 100px;
            flex: 1;
            .title{
                color: rgba(0, 0, 0, 0.43);
                padding-left: 20px;
            }
            .value{
                color: rgba(0, 0, 0, 0.65);
                font-size: 24px;
                padding-left: 50px;
                padding-top: 12px;
            }
        }
    }
}
</style>
<style lang="scss">
.home-page-compontent-d{
    .el-table__header {
        th {
            background-color: #fafafa !important;
        }
    }
}
</style>