hailu
2024-11-11 bb657c2cb6a539e3b55384437df955527163ca7b
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<template>
    <div id="newPushDetail">
        <header>
            <img src="../../assets/images/homeLogin.png" alt="" srcset="">
        </header>
        <Col v-if="show" class="demo-spin-col" span="24">
        <Spin fix>
            <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
            <div>Loading</div>
        </Spin>
        </Col>
        <main v-else>
            <div class="item" v-for="item in this.arr1">
                <div class="left">{{ item.Name ? item.Name.replace('事件', '').replace('系统', '') + ':' : '--' }}</div>
                <div class="right"> {{ item.Value ? item.Value : '--' }}</div>
            </div>
 
            <div class="item">
                <div class="left">公司名称:</div>
                <div class="right"> {{ content.CompanyName ? content.CompanyName : '--' }}</div>
 
            </div>
            <div class="item">
                <div class="left">事件类别:</div>
                <div class="right"> {{ content.EventType ? content.EventType : '--' }}</div>
            </div>
            <div class="item">
                <div class="left">风险等级:</div>
                <div class="right"> {{ getWarnLevel(content.WarnLevel) }} </div>
            </div>
            <div v-if="this.arr2.length > 0">
                <div v-for="(item, index) in this.arr2" style="display: flex;padding:0 10px 0 0" :key="index">
                    <span style="display: inline-block;white-space: nowrap;font-size: 18px;font-weight: 500;"
                        v-html="item.Name"></span>
                    <span style="display: inline-block;font-size: 18px;font-weight: 500;">:</span>
                    <span style="display: inline-block;line-height: 27px;"
                        v-show="item.Value === '' || item.Value === null">--</span>
                    <span style="display: inline-block;word-break: break-all;line-height: 27px;"
                        v-if="item.Value !== '' && item.Value != null"
                        v-html="item.Name.indexOf('元') > -1 || item.Name.indexOf('(元)') > -1 ? CustomMethods.numTo$((item.Value+'').replace(/\n/g, '<br>')) : (item.Value+'').replace(/\n/g, '<br>')"></span>
                </div>
            </div>
        </main>
    </div>
</template>
 
<script>
import axios from '@/libs/api.request'
export default {
    name: 'newPushDetail',
    data() {
        return {
            id: 0,
            content: {
                CompanyName: '',
                EventType: '',
                WarnLevelName: '',
                Content: '',
            },
            arr1: [],
            arr2: [],
            show: false,
 
        }
    },
    created() {
 
    },
    mounted() {
 
        // setTimeout(() => {
 
        // return false
        // }, 1000);
        // 
    },
    methods: {
        getWarnLevel(item){
            if(item == 3){
                return  "红色"
            }else if(item == 2){
                return  "黄色"
            }else {
                return  "绿色"
            }
 
        },
        // EventKg/GetDynamicById(int Id)
 
        GetDynamicById() {
            this.show = true
            let data = {
                Id: this.id
                // Id: 28616
            }
            axios.request({
                url: '/EventKg/GetDynamicById',
                method: 'post',
                data: data
            }).then(res => {
                if (res.data.Check) {
                    this.content = res.data.Data
                    this.content.Content = JSON.parse(this.content.Content)
                    this.arr1 = this.content.Content.slice(0, 2)
                    this.arr2 = this.content.Content.slice(3)
                    if(this.content.EventType == '深度信息-经营信息-新闻舆情'){
                        for(let i = 0; i < this.arr2.length; i++){
                            if(this.arr2[i].Name ==='分类'){
                                if(this.arr2[i].Value == -1){
                                    this.arr2[i].Value = '消极'
                                }else if(this.arr2[i].Value == 0){ 
                                    this.arr2[i].Value = '中性'
                                } else if(this.arr2[i].Value == 1){ 
                                    this.arr2[i].Value = '积极'
                                }
                               
                            }
                        }
                    }
                    console.log(this.content, this.arr1, this.arr2);
                    this.show = false
                } else {
                    this.content = {}
                    this.arr1 = []
                    this.arr2 = []
                    this.show = false
                }
            }, res => {
                this.content = {}
                this.arr1 = []
                this.arr2 = []
                this.show = false
            })
        }
    },
    watch: {
        $route: {
            handler() {
                if (this.$router.currentRoute.name === 'newPushDetail') {
                    this.id = this.$route.query.Id
                    this.GetDynamicById()
                    return
                }
            },
            immediate: true,
        },
    },
    beforeRouteLeave(to, from, next) {
        // console.log(to, from);
        // if(to.name=='login'){
        //     next()
        // }
    }
 
}
</script>
 
<style lang="less" >
body {
    overflow: auto;
}
 
#newPushDetail {
    overflow: visible !important;
}
 
#newPushDetail header {
    width: 100vw;
    height: 80px;
    background-color: #123DD6;
 
    img {
        height: 60px;
        margin-top: 10px;
        position: relative;
        left: ~'calc(50% - 132px)';
    }
}
 
main {
    width: 100vw;
    padding: 20px 10px;
 
    .item {
        display: flex;
 
        .left {
            min-width: 90px;
            // width: 120px;
        }
        
 
        .right {
            line-height: 27px;
            display: inline-block;
            word-break: break-all;
        }
    }
}
 
#newPushDetail img {
    max-width: 300px !important;
}
 
 
#newPushDetail .demo-spin-col .circular {
    width: 25px;
    height: 25px;
}
 
#newPushDetail .demo-spin-icon-load {
    animation: ani-demo-spin 1s linear infinite;
}
 
@keyframes ani-demo-spin {
    from {
        transform: rotate(0deg);
    }
 
    50% {
        transform: rotate(180deg);
    }
 
    to {
        transform: rotate(360deg);
    }
}
 
#newPushDetail .demo-spin-col {
    height: 100vh;
    position: relative;
    border: 1px solid #eee;
}
</style>