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
153
154
155
156
<template>
    <div class="home-page-compontent-e" v-loading="loading">
        <div class="compontent-header">
            <span class="pannel-title">故障信息</span>
            <el-link type="primary" @click="onMore">更多</el-link>
        </div>
        
        <div class="list-frame">
            
            <div class="list-item" v-for="(item,index) in list" :key="'warnings-'+index">
                <div class="image-view">
                    <div class="image-box">
                        <div class="empty-image">
                            <span class="iconfont" :class="[item.DeviceType===1?'icon-machine1':'icon-agv']"></span>
                        </div>
                    </div>
                </div>
                <div class="content-view">
                    <div class="row1 auto-wrap">{{item.DeviceName}}</div>
                    <div class="row2 auto-wrap">{{item.WarningContent}} |  {{item.WarningTime}}</div>
                </div>
                <div class="link-view">
                    <el-link type="primary" @click.stop="onOpenDetail(item)">详情</el-link>
                </div>
            </div>
            
        </div>
        
        <div class="pagination-row"><el-pagination :pager-count="5" layout="total,prev, pager, next, jumper" :total="total"  @current-change="onPageList" /></div>
    
        <detail-modal v-model:visible="detailModalVisible" :row="detailRow" />
    </div>
</template>
 
<script>
import DetailModal from './ModelEDetailModal.vue'
export default {
    name:'homePageCompontentE',
    components:{DetailModal},
    data(){
        return {
            loading:false,
            list:[],
            total:100,
            queried:{...this.$config.pagination,...{pageSize:5}},
            detailModalVisible:false,
            detailRow:{}
        }
    },
    mounted() {
        this.init()
    },
    methods:{
        init(){
            this.newList()
        },
        /* 翻页功能 */
        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('HomePageGetWarning',this.queried,{block:'home'}).then((d)=>{
                this.total = d.total || 0;
                this.list = (d.list || []).map((currentItem)=>{
                    currentItem.WarningTime = this.$utils.project.parseTimeStr(currentItem.WarningTime)
                    return currentItem
                });
                if (needLoading) {
                    this.loading=false;
                }
                callback && callback(true)
            }).catch((err)=>{
                if (needLoading) {
                    this.loading=false;
                }
                callback && callback(false)
            })
        },
        onOpenDetail(obj){
            this.detailRow = obj;
            this.detailModalVisible = true
        },
        onMore(){
            this.$router.push('/sub-statistics-eqp-errs')
        }
    }
}
</script>
 
<style scoped lang="scss">
.home-page-compontent-e{
    padding: 24px;
    .compontent-header{
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
    }
    .list-item{
        display: flex;
        border-bottom: 1px solid #e9e9e9;
        padding: 12px 0;
        .image-view,.link-view{
            flex-shrink: 0;
        }
        .image-view{
            width: 63px;
            display: flex;
            align-items: center;
            .image-box{
                width: 45px;
                height: 40px;
                border-radius: 4px;
                background-color: #f2f2f2;
                overflow: hidden;
                padding: 1px;
            }
            .empty-image{
                width: 100%;
                height: 100%;
                display: flex;
                align-items: center;
                justify-content: center;
                color: #666666;
                font-size: 24px;
            }
        }
        .link-view{
            display: flex;
            align-items: center;
            padding-left: 12px;
        }
        .content-view{
            font-family: Arial Normal;
            flex: 1;
            line-height: 21px;
            .row1{
                color: #272727;
            }
            .row2{
                color: #8d8d8d;
            }
        }
    }
}
</style>