balance-query.vue
10.9 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
<template>
<div class="container resource close-left-menu contaNEW">
<div class="pop-banner clearfix">
<div class="operate-btns">
<a href="javascript:;" class="fbtn fb-setting" v-link="{path:'/balanceQuery2'}">查看列表</a>
</div>
<h3 class="current-module">结存金额可视化</h3>
</div>
<div class="pd-form fast-search-form">
<div class="group-row">
<div class="form-group fl" style='width: 480px;'>
<label for="cn3" class="label w60 fl">时间范围</label>
<div class="control control-filtering control-filtering-green fl ml-10" style='width:400px;'>
<a class="option" href="javascript:;" @click='search.time=2' :class="{'all active':search.time==2}">近一月</a>
<a class="option" href="javascript:;" style='margin: 4px 14px;' @click='search.time=3' :class="{'all active':search.time==3}">近三月</a>
<a class="option" href="javascript:;" style='margin: 4px 14px;' @click='search.time=4' :class="{'all active':search.time==4}">近六月</a>
<a class="option" href="javascript:;" style='margin: 4px 14px;' @click='search.time=5' :class="{'all active':search.time==5}">近一年</a>
<a class="option" href="javascript:;" style='margin: 4px 14px;' @click='search.time=6' :class="{'all active':search.time==6}">其他</a>
</div>
</div>
<div class="form-group" style="width: 462px;" v-if='search.time==6'>
<!-- <label for="cn3" class="label label-xf"></label> -->
<div class="control control-date" style="width: 462px;height:34px;overflow: inherit;">
<div style="width: 46%;float: left">
<datepicker :target.sync='search.begindate' :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.enddate' :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 form-radio">
<label class="label w60 fl" style='color: #373737;'>趋势周期</label>
<div class="control radio-control" style='width:300px;' style='color: #373737;'>
<input type="radio" id="radio03" v-model="search.classify" value='1'>
<label class="radio" for="radio03">天</label>
<input type="radio" id="radio01" v-model="search.classify" value='2'>
<label class="radio" for="radio01">周</label>
<input type="radio" id="radio04" v-model="search.classify" value='3'>
<label class="radio" for="radio04">月</label>
</div>
</div>
</div>
<div class="group-row">
<div class="form-group form-label">
<label for="cn3" class="label w60 fl">商品大类</label>
<div class="control">
<select id="cn3" class="inp4" v-model='categuid'>
<option value="">请选择</option>
<option v-for='item in cateList' :value="item.guid">{{item.catename}}</option>
</select>
</div>
</div>
<div class="form-group form-label">
<div class="control">
<input type="text" placeholder="商品分类过滤" id="cnn1" v-model='catename'>
</div>
</div>
</div>
<div class="group-row">
<div class="form-group fl" style='width: 960px;'>
<label for="cn3" class="label w60 fl">过滤分类</label>
<div class="control control-filtering control-filtering-green fl ml-10" style='width:890px;'>
<a class="option checked" href="javascript:;" v-if='cateDetail.length==0'>暂无符合的数据</a>
<a class="option" href="javascript:;" v-for='item in cateDetail' @click='item.state=!item.state' :class="{'all active':item.state==true}">{{item.catename}}</a>
<a class="option checkbox" href="javascript:;" @click='checkedFlag'>选中</a>
</div>
</div>
</div>
<div class="group-row">
<div class="form-group fl" style='width: 960px;'>
<label for="cn3" class="label w60 fl">已选结果</label>
<div class="control control-filtering control-filtering-green control-checked fl ml-10" style='width:890px;'>
<a class="option checked" href="javascript:;" v-if='checkedList.length==0'>暂无符合的数据</a>
<a class="all active" href="javascript:;" v-for='item in checkedList' track-by="$index" @click='checkedList.splice($index,1)'>{{item.catename}}</a>
</div>
</div>
</div>
<div class="group-row t-right">
<button class="fast-search-form-btn btn-d btn-d-lg btn-d-activate btn-d-circle" @click='getGoodS(true)'>查 询</button>
</div>
</div>
<div style='width:100%;height:400px;'>
<div id='echart1' style='width:100%;height:400px;'></div>
</div>
</div>
</template>
<script>
var echarts_api = require('../../options/echarts_api.js');
module.exports = {
data: function() {
return {
cateList:[],
catename:'',
categuid:'',
cateDetail:[],
checkedList:[],
search: {
begindate: '',
enddate: '',
time: 2,
list:[],
classify:1
},
row: [],
rentalName: [],
dateList: [],
map: {},
hos: [],
hosList: [],
hosListS: [],
rowArr: [],
valueArr: [],
seriesList: [],
colorList: ['#f0b3b0', '#7ea677', '#f6e0c4', '#7293b4', '#ffc63b', '#f2ccc4', '#c6df15', '#e3cf08', '#fad895', '#b37ec0'],
stateFlag: true,
sumData: '',
rentalData: [],
seriesName:'金额 (万元) ',
count:0,
countName:'',
countUnit:'',
goodsList:[],
rowVlaue:[]
}
},
methods: {
// 查询子级商品大类
getDataList:function(){
var self = this;
Ajax.post('/billType/getmedgoodscate',{guid:self.categuid,catename:self.catename})
.then(function(response) {
var data=response.data.data;
if(response.data.errorCode==0){
for(var a=0;a<data.length;a++){
data[a].state=false;
}
self.$set('cateDetail',data);
}
});
},
// 查询第一级 商品大类
getData: function() {
var self = this;
Ajax.post('/billType/getmedgoodscate')
.then(function(response) {
var data=response.data.data;
if(response.data.errorCode==0){
self.$set('cateList',data);
}
});
},
checkedFlag:function(){
var self = this;
for(var a=0;a<self.cateDetail.length;a++){
if(self.cateDetail[a].state){
self.checkedList.push(self.cateDetail[a]);
}
}
var hash=[];
self.$set('checkedList', self.checkedList.reduce(function(item, next) {
hash[next.guid] ? '' : hash[next.guid] = true && item.push(next);
return item
}, []))
},
// 金额
getGoodS: function(params) {
var self = this;
self.row=[];
self.search.list=self.checkedList;
Ajax.post('/billType/getmfmedstockbalances', self.search)
.then(function(response) {
var data = response.data.data;
if(response.data.errorCode==0){
var Y,W,YW;
for(var a=0;a<data.length;a++){
if(self.search.classify==2){
data[a].name=data[a].name.toString();
Y=data[a].name.substr(0 , 4 );
W=data[a].name.substr(4 , 2 );
YW=Y+'年'+W+'周';
self.row.push( YW );
}else{
self.row.push(data[a].name);
self.rowVlaue.push({value:data[a].value*1});
}
}
self.rowVlaue=data;
}else{
layer.msg(response.data.message);
}
setTimeout(function() {
self.echarts();
}.bind(this), 1000)
});
},
echarts:function(){
var self=this;
self.countName='金额(元)';
this.chart1=echarts_api.init('echart1',{
title: {
text: ''
},
tooltip : {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data:['']
},
toolbox: {
feature: {
saveAsImage: {
}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '12%',
containLabel: true
},
xAxis : [
{
type : 'category',
boundaryGap : true,
data : self.row,
}
],
yAxis : [
{
type : 'value',
boundaryGap : false,
// data :['0','200','400','600','800','1000']
}
],
dataZoom: [{
type: 'inside',
startValue: self.rowVlaue.length-12,
endValue: self.rowVlaue.length
}, {
startValue: self.rowVlaue.length-12,
endValue: self.rowVlaue.length,
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '60%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
}
}],
series : [
{
name:self.countName,
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')
},
},
route: {
activate: function() {
this.getData();
// 科室查询
this.getDataList();
this.getGoodS(true);
}
},
watch: {
'catename':function(){
this.getDataList();
},
'categuid':function(){
this.getDataList();
this.getGoodS(true);
},
'search.time':function(){
var self = this;
if(self.search.time!=6){
this.getGoodS(true);
}
},
'search.classify':function(){
this.getGoodS(true);
},
'checkedList':{
handler(curVal,oldVal){
var self = this;
self.getGoodS(true);
},
deep:true
},
}
}
</script>