educode_sales 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/educode_sales/sale_trends_controller.rb +13 -13
- data/app/controllers/educode_sales/upload_files_controller.rb +29 -29
- data/app/views/educode_sales/businesses/file.html.erb +2 -2
- data/app/views/educode_sales/sale_trends/trends.html.erb +36 -12
- data/app/views/educode_sales/sales/index.html.erb +7 -7
- data/app/views/educode_sales/upload_files/index.json.jbuilder +1 -1
- data/lib/educode_sales/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87e480da43efa545f556407cb3aced122684a09ebba821cc1d5ba1b33013758c
|
4
|
+
data.tar.gz: f8a1d0d849c2f45fac61856394ebd61fa19c6993349393cf30c73061071e200b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b9b85218c9ab2ba92752aaac23ed8329bd130c48f27c00488d4e8a484cdb8791b29b9be8bb9ccafa6828ba9bc4500c4365718d5c080cfd789960c5125c2da33
|
7
|
+
data.tar.gz: 8ae91d1a4d9337886c87067b69728cd93831e8d7a85bf524c6acef57915561726a574d6a3c5a1c2eb4cead28ea6aea1450dd94949920d0113856b7390f418445
|
@@ -33,7 +33,7 @@ module EducodeSales
|
|
33
33
|
x_business_ids << d.id
|
34
34
|
end
|
35
35
|
end
|
36
|
-
colors = ['#FF0000', '#FF7F00', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF', '#8B00FF', 'rgba(255, 99, 132, 1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)']
|
36
|
+
colors = ['#44D7B6','#4CACFF','#F7B500','#FF0000', '#FF7F00', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF', '#8B00FF', 'rgba(255, 99, 132, 1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)']
|
37
37
|
@follow_count_range = params[:follow_count_range] || "day"
|
38
38
|
@goal_count_range = params[:goal_count_range] || "day"
|
39
39
|
# 商机跟进数图表
|
@@ -82,8 +82,8 @@ module EducodeSales
|
|
82
82
|
Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ? ", "#{d}-01", "#{d}-31").sum(:amount).round(2)
|
83
83
|
end
|
84
84
|
},
|
85
|
-
backgroundColor: colors[sale_names.index(name)
|
86
|
-
borderColor: colors[sale_names.index(name)
|
85
|
+
backgroundColor: colors[sale_names.index(name)],
|
86
|
+
borderColor: colors[sale_names.index(name)],
|
87
87
|
borderWidth: 1
|
88
88
|
}
|
89
89
|
end
|
@@ -108,8 +108,8 @@ module EducodeSales
|
|
108
108
|
else
|
109
109
|
Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ? ", "#{d}-01", "#{d}-31").sum(:amount).round(2)
|
110
110
|
end },
|
111
|
-
backgroundColor: colors[sale_names.index(name)
|
112
|
-
borderColor: colors[sale_names.index(name)
|
111
|
+
backgroundColor: colors[sale_names.index(name)],
|
112
|
+
borderColor: colors[sale_names.index(name)],
|
113
113
|
borderWidth: 1
|
114
114
|
}
|
115
115
|
end
|
@@ -132,8 +132,8 @@ module EducodeSales
|
|
132
132
|
else
|
133
133
|
Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ? ", "#{d}-01-01", "#{d}-12-31").sum(:amount).round(2)
|
134
134
|
end },
|
135
|
-
backgroundColor: colors[sale_names.index(name)
|
136
|
-
borderColor: colors[sale_names.index(name)
|
135
|
+
backgroundColor: colors[sale_names.index(name)],
|
136
|
+
borderColor: colors[sale_names.index(name)],
|
137
137
|
borderWidth: 1
|
138
138
|
}
|
139
139
|
end
|
@@ -172,8 +172,8 @@ module EducodeSales
|
|
172
172
|
data: dates.map{ |d| @follow_up = FollowUp.where(staff_id: name[1], created_at: d.beginning_of_day..d.end_of_day).where.not(business: x_business_ids).count },
|
173
173
|
backgroundColor: "#fff",
|
174
174
|
pointBorderColor: "#fff",
|
175
|
-
borderColor: colors[names.index(name)%
|
176
|
-
pointBackgroundColor: colors[names.index(name)%
|
175
|
+
borderColor: colors[names.index(name)%15],
|
176
|
+
pointBackgroundColor: colors[names.index(name)%15],
|
177
177
|
borderWidth: 1
|
178
178
|
}
|
179
179
|
end
|
@@ -189,8 +189,8 @@ module EducodeSales
|
|
189
189
|
data: dates.map { |d| @follow_up = FollowUp.where( staff_id: name[1]).where("created_at >= ? AND created_at <= ?", "#{d}-01", "#{d}-31").where.not(business: x_business_ids).count },
|
190
190
|
backgroundColor: "#fff",
|
191
191
|
pointBorderColor: "#fff",
|
192
|
-
borderColor: colors[names.index(name)%
|
193
|
-
pointBackgroundColor: colors[names.index(name)%
|
192
|
+
borderColor: colors[names.index(name)%15],
|
193
|
+
pointBackgroundColor: colors[names.index(name)%15],
|
194
194
|
borderWidth: 1
|
195
195
|
}
|
196
196
|
end
|
@@ -206,8 +206,8 @@ module EducodeSales
|
|
206
206
|
data: dates.map { |d| @follow_up = FollowUp.where( staff_id: name[1]).where("created_at >= ? AND created_at <= ?", "#{d}-01-01", "#{d}-12-31").where.not(business: x_business_ids).count },
|
207
207
|
backgroundColor: "#fff",
|
208
208
|
pointBorderColor: "#fff",
|
209
|
-
borderColor: colors[names.index(name)%
|
210
|
-
pointBackgroundColor: colors[names.index(name)%
|
209
|
+
borderColor: colors[names.index(name)%15],
|
210
|
+
pointBackgroundColor: colors[names.index(name)%15],
|
211
211
|
borderWidth: 1
|
212
212
|
}
|
213
213
|
end
|
@@ -20,46 +20,46 @@ module EducodeSales
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def create
|
23
|
-
folder =
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
23
|
+
folder = File.join(Rails.root, "public", "images", 'educode_sales')
|
24
|
+
upload_file = params["file"]
|
25
|
+
raise "未上传文件" unless upload_file
|
26
|
+
save_path = File.join(folder)
|
27
|
+
ext = file_ext(upload_file.original_filename)
|
28
|
+
local_path, digest = file_save_to_local(save_path, upload_file.tempfile, ext)
|
29
|
+
content_type = upload_file.content_type.presence || 'application/octet-stream'
|
30
|
+
disk_filename = local_path[save_path.size + 1, local_path.size]
|
31
|
+
@attachment = Attachment.where(disk_filename: disk_filename,
|
32
|
+
author_id: @current_admin.user_id).first
|
33
|
+
if @attachment.blank?
|
34
|
+
@attachment = Attachment.new
|
35
|
+
@attachment.filename = upload_file.original_filename
|
36
|
+
@attachment.description = "business"
|
37
|
+
@attachment.disk_filename = local_path[save_path.size + 1, local_path.size]
|
38
|
+
@attachment.filesize = upload_file.tempfile.size
|
39
|
+
@attachment.content_type = content_type
|
40
|
+
@attachment.digest = digest
|
41
|
+
@attachment.author_id = @current_admin.user_id
|
42
|
+
@attachment.container_id = params[:business_id]
|
43
|
+
@attachment.save!
|
44
|
+
else
|
45
|
+
logger.info "文件已存在,id = #{@attachment.id}, filename = #{@attachment.filename}"
|
46
|
+
end
|
47
|
+
render_success
|
48
48
|
end
|
49
49
|
|
50
50
|
def destroy
|
51
|
-
folder =
|
51
|
+
folder = File.join(Rails.root, "public", "images", 'educode_sales')
|
52
52
|
file = Attachment.find(params[:id])
|
53
53
|
file.destroy
|
54
|
-
File.delete(folder
|
54
|
+
File.delete(folder + "/" +file.disk_filename) if FileTest::exist?(folder + "/" +file.disk_filename)
|
55
55
|
render_success
|
56
56
|
end
|
57
57
|
|
58
58
|
def download
|
59
|
-
folder =
|
59
|
+
folder = File.join(Rails.root, "public", "images", 'educode_sales')
|
60
60
|
file = Attachment.find_by_id(params[:id])
|
61
61
|
raise "未找到文件" unless file
|
62
|
-
send_file(folder
|
62
|
+
send_file(folder + "/" +file.disk_filename, filename: file.title, stream: true, type: file.content_type.presence || 'application/octet-stream')
|
63
63
|
end
|
64
64
|
|
65
65
|
def edu_setting name
|
@@ -122,11 +122,11 @@
|
|
122
122
|
if (obj.event === 'preview') {
|
123
123
|
if (data.content_type.split("/")[0] === "image"){
|
124
124
|
layer.photos({
|
125
|
-
photos: { "data": [{"src": '/
|
125
|
+
photos: { "data": [{"src": '/images/educode_sales/' + name}] }
|
126
126
|
,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机
|
127
127
|
});
|
128
128
|
}else if (data.content_type.split("/")[1] === "pdf"){
|
129
|
-
var pdf = '/business_file/' + name;
|
129
|
+
var pdf = '/images/business_file/' + name;
|
130
130
|
console.log(pdf);
|
131
131
|
var openWH = miniPage.getOpenWidthHeight();
|
132
132
|
layer.open({
|
@@ -203,6 +203,8 @@
|
|
203
203
|
</div>
|
204
204
|
</div>
|
205
205
|
</div>
|
206
|
+
<br>
|
207
|
+
<br>
|
206
208
|
<div class="layui-tab layui-tab-card " id="销售额分析" lay-filter="test1">
|
207
209
|
<ul class="layui-tab-title">
|
208
210
|
<li class="layui-this">销售额分析</li>
|
@@ -327,7 +329,7 @@
|
|
327
329
|
laydate.render({
|
328
330
|
elem: '#date',
|
329
331
|
min: -15
|
330
|
-
,max:
|
332
|
+
,max: 0,
|
331
333
|
range: true
|
332
334
|
});
|
333
335
|
laydate.render({
|
@@ -348,14 +350,14 @@
|
|
348
350
|
type: 'year',
|
349
351
|
elem: '#date_year',
|
350
352
|
min: -3660
|
351
|
-
,max:
|
353
|
+
,max: 0,
|
352
354
|
range: true
|
353
355
|
});
|
354
356
|
laydate.render({
|
355
357
|
type: 'year',
|
356
358
|
elem: '#goal_date_year',
|
357
359
|
min: -3660
|
358
|
-
,max:
|
360
|
+
,max: 0,
|
359
361
|
range: true
|
360
362
|
});
|
361
363
|
laydate.render({
|
@@ -424,19 +426,41 @@
|
|
424
426
|
}
|
425
427
|
});
|
426
428
|
|
429
|
+
|
430
|
+
var opt = {
|
431
|
+
events: false,
|
432
|
+
tooltips: {
|
433
|
+
enabled: false
|
434
|
+
},
|
435
|
+
hover: {
|
436
|
+
animationDuration: 0
|
437
|
+
},
|
438
|
+
animation: {
|
439
|
+
duration: 1,
|
440
|
+
onComplete: function () {
|
441
|
+
var chartInstance = this.chart,
|
442
|
+
ctx = chartInstance.ctx;
|
443
|
+
ctx.font = Chart.helpers.fontString(Chart.defaults.global.defaultFontSize, Chart.defaults.global.defaultFontStyle, Chart.defaults.global.defaultFontFamily);
|
444
|
+
ctx.textAlign = 'center';
|
445
|
+
ctx.textBaseline = 'bottom';
|
446
|
+
|
447
|
+
this.data.datasets.forEach(function (dataset, i) {
|
448
|
+
var meta = chartInstance.controller.getDatasetMeta(i);
|
449
|
+
meta.data.forEach(function (bar, index) {
|
450
|
+
var data = dataset.data[index];
|
451
|
+
ctx.fillText(data, bar._model.x, bar._model.y - 5);
|
452
|
+
});
|
453
|
+
});
|
454
|
+
}
|
455
|
+
}
|
456
|
+
};
|
457
|
+
|
458
|
+
|
427
459
|
var ctx = document.getElementById('myChart2');
|
428
460
|
var myChart2 = new Chart(ctx, {
|
429
461
|
type: 'bar',
|
430
462
|
data: <%=raw @goal_count_data.to_json %>,
|
431
|
-
options:
|
432
|
-
scales: {
|
433
|
-
yAxes: [{
|
434
|
-
ticks: {
|
435
|
-
beginAtZero:true
|
436
|
-
}
|
437
|
-
}]
|
438
|
-
}
|
439
|
-
}
|
463
|
+
options: opt
|
440
464
|
});
|
441
465
|
})
|
442
466
|
</script>
|
@@ -66,42 +66,42 @@
|
|
66
66
|
templet: "#business_a",
|
67
67
|
totalRow:true,
|
68
68
|
sort:true,
|
69
|
-
width:
|
69
|
+
width: 100
|
70
70
|
},
|
71
71
|
{
|
72
72
|
field: 'business_b',
|
73
73
|
title: 'B类商机',
|
74
74
|
templet: "#business_b",
|
75
75
|
totalRow:true,sort:true,
|
76
|
-
width:
|
76
|
+
width: 100
|
77
77
|
},
|
78
78
|
{
|
79
79
|
field: 'business_c',
|
80
80
|
title: 'C类商机',
|
81
81
|
templet: "#business_c",
|
82
82
|
totalRow:true,sort:true,
|
83
|
-
width:
|
83
|
+
width: 100
|
84
84
|
},
|
85
85
|
{
|
86
86
|
field: 'business_d',
|
87
87
|
title: 'D类商机',
|
88
88
|
templet: "#business_d",
|
89
89
|
totalRow:true,sort:true,
|
90
|
-
width:
|
90
|
+
width: 100
|
91
91
|
},
|
92
92
|
{
|
93
93
|
field: 'business_e',
|
94
94
|
title: 'E类商机',
|
95
95
|
templet: "#business_e",
|
96
96
|
totalRow:true,sort:true,
|
97
|
-
width:
|
97
|
+
width: 100
|
98
98
|
},
|
99
99
|
{
|
100
100
|
field: 'business_o',
|
101
101
|
title: 'O类商机',
|
102
102
|
templet: "#business_o",
|
103
103
|
totalRow:true,sort:true,
|
104
|
-
width:
|
104
|
+
width: 100
|
105
105
|
},
|
106
106
|
{
|
107
107
|
field: 'goal',
|
@@ -110,7 +110,7 @@
|
|
110
110
|
width: 120
|
111
111
|
}, {
|
112
112
|
field: 'return_money',
|
113
|
-
title: '
|
113
|
+
title: '回款金额',
|
114
114
|
totalRow:true,sort:true,
|
115
115
|
width: 120
|
116
116
|
}
|
@@ -4,7 +4,7 @@ json.data do
|
|
4
4
|
json.name d.filename
|
5
5
|
json.size d.filesize < 1000000 ? (d.filesize.to_f / 1000).round(2).to_s + 'KB' : (d.filesize.to_f / 1000000).round(2).to_s + 'MB'
|
6
6
|
json.created_on d.created_on.to_s
|
7
|
-
json.upload_person
|
7
|
+
json.upload_person d.author.real_name
|
8
8
|
json.disk_filename d.disk_filename
|
9
9
|
json.content_type d.content_type
|
10
10
|
end
|