information-analyze4.vue
13 KB
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
<template>
<div class="container resource close-left-menu contaNEW">
<div class="pop-banner clearfix">
<div class="operate-btns">
<a href="javascript:;" class="fbtn fb-download" @click='download'>导出</a>
</div>
<h3 class="current-module">销售出库数据分析</h3>
</div>
<nav class="o_nav_4 clearfix">
<li><a class="pandect-sort" href="javascript:;" v-link="{path:'/informationAnalyze'}"></a></li>
<li><a class="region-sort" href="javascript:;" v-link="{path:'/informationAnalyze2'}"></a></li>
<li><a class="hospital-sort" href="javascript:;" v-link="{path:'/informationAnalyze3'}"></a></li>
<li><a class="firm-sort" href="javascript:;" ></a></li>
<li><a class="category-sort active" href="javascript:;"></a></li>
<li><a class="salesman-sort" href="javascript:;"></a></li>
</nav>
<div class="pd-form mt-20 fast-search-form">
<div class="group-row">
<div class="form-group fl" style='width: 540px;'>
<label for="cn3" class="label w60">时间范围</label>
<div class="control control-filtering control-filtering-green fl ml-10" style='width:460px;'>
<a class="option" :class="{'all active':search.search_EQ_date==1}" href="javascript:;" @click='search.search_EQ_date=1'>近一周</a>
<a class="option" :class="{'all active':search.search_EQ_date==2}" href="javascript:;" style='margin: 4px 14px;'@click='search.search_EQ_date=2'>近一月</a>
<a class="option" :class="{'all active':search.search_EQ_date==3}" href="javascript:;" style='margin: 4px 14px;'@click='search.search_EQ_date=3'>近三月</a>
<a class="option" :class="{'all active':search.search_EQ_date==4}" href="javascript:;" style='margin: 4px 14px;'@click='search.search_EQ_date=4'>近六月</a>
<a class="option" :class="{'all active':search.search_EQ_date==5}" href="javascript:;" style='margin: 4px 14px;'@click='search.search_EQ_date=5'>近一年</a>
<a class="option" :class="{'all active':search.search_EQ_date==6}" href="javascript:;" style='margin: 4px 14px;'@click='search.search_EQ_date=6'>其他</a>
</div>
</div>
<div class="form-group" style="width: 414px;" v-if='search.search_EQ_date==6'>
<label for="cn3" class="label label-xf"></label>
<div class="control control-date" style="width: 414px;height:34px;overflow: inherit;">
<div style="width: 46%;float: left">
<datepicker :target.sync='search.search_Start_date' :readonly="readonlyFlag" title="时间范围" placeholder="时间范围"
styleobj="width:100% !important;border-radius:8px 0px 0px 8px !important;"></datepicker>
</div>
<span class="text-and">—</span>
<div style="width: 46%;float: left">
<datepicker :target.sync='search.search_End_date' :readonly="readonlyFlag" title="时间范围" placeholder="时间范围"
styleobj="width:100% !important;border-radius:0px 8px 8px 0px !important;"></datepicker>
</div>
</div>
</div>
</div>
<div class="group-row">
<div class="form-group fl" style='width: 800px;'>
<label for="cn3" class="label w60">分析维度</label>
<div class="control control-filtering control-filtering-green fl ml-10" style='width:440px;'>
<a class="option" href="javascript:;" @click='search.search_EQ_FLAG="amount"' :class="{'all active':search.search_EQ_FLAG=='amount'}">金额</a>
<a class="option" href="javascript:;" @click='search.search_EQ_FLAG="frequency"' style='margin: 4px 14px;' :class="{'all active':search.search_EQ_FLAG=='frequency'}">订货次数</a>
</div>
</div>
</div>
<div class="group-row t-right">
<button class="fast-analy-form-btn btn-d btn-d-lg btn-d-activate btn-d-circle" @click='getData'>分 析</button>
</div>
</div>
<div class="fpart">
<table class=" itable itable-thead-13px itable-td-long-text">
<thead>
<tr>
<th class="w60">名次</th>
<th class="w140">商品名称</th>
<th class="w80">规格</th>
<th class="w70">单位</th>
<th class="w140">生产厂商</th>
<th class="w130">注册证号/批准文号</th>
<th class="w80">单价</th>
<th class="w80" v-if='search.search_EQ_FLAG=="amount"'>总金额</th>
<th class="w80" v-if='search.search_EQ_FLAG=="frequency"'>订货次数</th>
<th class="w120">操作</th>
</tr>
</thead>
<tbody >
<tr v-if='list.length==0 || list==null'>
<td colspan="10">
暂无符合条件的记录
</td>
</tr>
<tr class="txt_v" v-for="item in list">
<td>{{$index+1}}</td>
<td class="t-left pr10">{{item.goodsName}}</td>
<td>{{item.goodsSpec}}</td>
<td>{{item.goodsUnit}}</td>
<td class="t-left pr10">{{item.manufacturer}}</td>
<td class="t-left pr10">{{item.registKey}}</td>
<td class="t-right pr10">{{item.price| numDigit 2 | numFmt}}元</td>
<td class="t-right pr10" v-if='search.search_EQ_FLAG=="amount"'>{{item.amount| numDigit 2 | numFmt}}元</td>
<td class="t-right pr10" v-if='search.search_EQ_FLAG=="frequency"'>{{item.frequency}}</td>
<td><a class="btn button-green mar-none" href="javascript:;" @click="chart(item.goodsGuid,true)">历史趋势</a></td>
</tr>
</tbody>
</table>
<pagination
@page-change="getData"
:page-no.sync="search.page"
:total-pages.sync="search.totalPages">
</pagination>
</div>
<div class="fpart" v-if='chartFlag' id="tendency">
<div class="fheader">
<h4 class="fh-tendency">趋势分析</h4>
<!-- <div class="stretch ml-20">
<div class="stretch-pull">
</div>
</div> -->
</div>
<div class="epi-form">
<div class="group-row">
<div class="form-group form-radio">
<label class="label">趋势分类</label>
<div class="control radio-control w700">
<input type="radio" id="radio03" v-model="search.search_EQ_cycle" value="1">
<label class="radio" for="radio03">总额趋势</label>
<input type="radio" id="radio01" v-model="search.search_EQ_cycle" value="2">
<label class="radio" for="radio01">增长率趋势(同比)</label>
<input type="radio" id="radio02" v-model="search.search_EQ_cycle" value="3">
<label class="radio" for="radio02">增长率趋势(环比)</label>
</div>
</div>
</div>
<div class="group-row">
<div class="form-group form-radio">
<label class="label">趋势周期</label>
<div class="control radio-control">
<input type="radio" id="radio1" v-model="search.search_EQ_classify" value="1">
<label class="radio" for="radio1">天</label>
<input type="radio" id="radio2" v-model="search.search_EQ_classify" value="2">
<label class="radio" for="radio2">周</label>
<input type="radio" id="radio3" v-model="search.search_EQ_classify" value="3">
<label class="radio" for="radio3">月</label>
<input type="radio" id="radio4" v-model="search.search_EQ_classify" value="4">
<label class="radio" for="radio4">年</label>
</div>
</div>
</div>
</div>
</div>
<div style='width:100%;height:600px;' v-if='chartFlag'>
<div id='echart1' style='width:100%;height:600px;'></div>
</div>
</div>
</template>
<script>
var echarts_api=require('../../options/echarts_api.js')
module.exports={
data:function(){
return {
search:{
pageSize: 10,
pageNo: 1,
totalPages: 0,
total:0,
search_EQ_date:1,
search_Start_date:'',
search_End_date:'',
search_EQ_FLAG:'amount',
search_EQ_cycle:1,
search_EQ_classify:1,
search_EQ_goodsguid:''
},
list:{},
chartFlag:false,
row:[],
rowVlaue:[],
rowName:'',
stateFlag:true
}
},methods:{
// 初始化查询数据
getData:function(){
var self=this;
if(self.search.search_EQ_date==6){
if(!self.search.search_Start_date || !self.search.search_End_date){
layer.msg('请输入正确的日期格式,如1992-03-02');
return;
}
}
Ajax.get('/supplierSupplierReport/getVarietiesView',self.search)
.then(function(response){
var res = response.data.data;
self.list=res.list;
self.search.total=res.total;
self.search.totalPages=res.totalPages;
});
// this.echarts();
},
// 导出魔板
download:function(){
var self=this;
Ajax.get('/supplierSupplierReport/exportVarietiesView',self.search)
.then(function(response){
var res = response.data;
window.open(res);
})
},
down: function () {
var divheight = document.getElementById("echart1").offsetHeight;
var bodyheight = document.body.clientHeight;
var downheight = bodyheight - divheight;
$('html,body').animate({scrollTop: downheight + 750}, 800)
},
// 历史趋势图标查询
chart:function(guid,falg){
var self=this;
// $('.tendency')
// console.log('')
self.chartFlag=true;
self.row=[];
self.rowVlaue=[];
if(falg){
self.search.search_EQ_goodsguid=guid;
}
if(self.stateFlag){
self.stateFlag=false;
Ajax.get('/supplierSupplierReport/getVarietiesViewHistory',self.search)
.then(function(response){
var res = response.data.data;
var test= /\d+(\.\d{2})/;;
// 金额和订货数判断
var Y,W,YW;
for(var a=0;a<res.length;a++){
if(self.search.search_EQ_classify==2){
for(var i=0;i<res.length;i++){
Y=res[i].row.substr(0 , 4 );
W=res[i].row.substr(4 , 2 );
YW=Y+'年'+W+'周';
self.row.push( YW );
}
}else{
self.row.push(res[a].row);
}
if(self.search.search_EQ_FLAG=="amount" && self.search.search_EQ_cycle==1){
self.rowVlaue.push( test.exec(res[a].value)[0] );
}else{
self.rowVlaue.push( res[a].value );
}
}
self.echarts();
self.down();
})
}
},
// echarts 图表
echarts:function(){
var self=this;
var rowName;
if(self.search.search_EQ_cycle==2 || self.search.search_EQ_cycle==3){
rowName='%';
}else if(self.search.search_EQ_FLAG=="amount"){
rowName='元';
}else if(self.search.search_EQ_FLAG=='frequency'){
rowName='次数';
}
self.rowName=rowName;
this.chart1=echarts_api.init('echart1',{
title: {
text: ''
},
tooltip : {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: '3%',
right: '5%',
bottom: '3%',
containLabel: true
},
xAxis : [
{
type : 'category',
boundaryGap : true,
data : self.row,
}
],
yAxis : [
{
type : 'value',
boundaryGap : false,
// data :['0','200','400','600','800','1000']
}
],
series : [
{
name:self.rowName,
type:'line',
stack: '总量',
areaStyle: {opacity:0},
itemStyle:{
normal:{
borderWidth:5,
borderType:'solid',
shadowColor:'#49A7E5',
shadowBlur:10
}
},
showAllSymbol:true,
color:["#49A7E5"] ,
data:self.rowVlaue,
symbolSize:5,
},
]
},'echart1')
self.stateFlag=true;
}
},route:{
activate:function(){
this.getData();
}
},
watch:{
'search.search_EQ_FLAG':function(){
this.getData();
},
'search.search_EQ_classify':function(){
this.chart();
},
'search.search_EQ_cycle':function(){
this.chart();
},
'search.search_EQ_date':function(){
this.getData();
}
}
}
</script>