educode_sales 0.6.3 → 0.6.7
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/assets/images/educode_sales/money_plans.png +0 -0
- data/app/controllers/educode_sales/activities_controller.rb +0 -2
- data/app/controllers/educode_sales/businesses_controller.rb +103 -47
- data/app/controllers/educode_sales/money_plans_controller.rb +65 -0
- data/app/controllers/educode_sales/roles_controller.rb +4 -1
- data/app/controllers/educode_sales/sale_trends_controller.rb +145 -30
- data/app/controllers/educode_sales/staffs_controller.rb +3 -4
- data/app/controllers/educode_sales/teacher_follows_controller.rb +1 -93
- data/app/models/educode_sales/business_export_record.rb +5 -0
- data/app/models/educode_sales/permission.rb +2 -1
- data/app/models/educode_sales/role_area.rb +1 -0
- data/app/views/educode_sales/activities/index.html.erb +7 -1
- data/app/views/educode_sales/activities/new.html.erb +1 -1
- data/app/views/educode_sales/businesses/_follows.html.erb +15 -15
- data/app/views/educode_sales/businesses/edit_follow_record.html.erb +13 -4
- data/app/views/educode_sales/businesses/edit_plan.html.erb +5 -2
- data/app/views/educode_sales/businesses/export_records.html.erb +53 -0
- data/app/views/educode_sales/businesses/export_records.json.jbuilder +11 -0
- data/app/views/educode_sales/businesses/file.html.erb +8 -4
- data/app/views/educode_sales/businesses/index.html.erb +121 -14
- data/app/views/educode_sales/businesses/index.json.jbuilder +34 -4
- data/app/views/educode_sales/businesses/new_follow_record.html.erb +10 -5
- data/app/views/educode_sales/businesses/show_follow.html.erb +1 -0
- data/app/views/educode_sales/commons/index.html.erb +7 -1
- data/app/views/educode_sales/customers/edit.html.erb +690 -10
- data/app/views/educode_sales/customers/edit_follow_record.html.erb +1 -1
- data/app/views/educode_sales/customers/index.json.jbuilder +2 -1
- data/app/views/educode_sales/customers/new.html.erb +691 -11
- data/app/views/educode_sales/customers/new_follow_record.html.erb +1 -1
- data/app/views/educode_sales/customers/show_follow.html.erb +1 -1
- data/app/views/educode_sales/money_plans/index.html.erb +222 -0
- data/app/views/educode_sales/money_plans/index.json.jbuilder +21 -0
- data/app/views/educode_sales/places/index.html.erb +16 -2
- data/app/views/educode_sales/places/index.json.jbuilder +3 -1
- data/app/views/educode_sales/plans/_monthPlan.html.erb +2 -1
- data/app/views/educode_sales/plans/_weekPlan.html.erb +2 -1
- data/app/views/educode_sales/recycles/business.json.jbuilder +2 -2
- data/app/views/educode_sales/roles/edit.html.erb +8 -0
- data/app/views/educode_sales/roles/index.html.erb +7 -1
- data/app/views/educode_sales/sale_trends/trends.html.erb +145 -33
- data/app/views/educode_sales/sale_trends/trends.json.jbuilder +4 -14
- data/app/views/educode_sales/sales/index.html.erb +2 -0
- data/app/views/educode_sales/sales/index.json.jbuilder +2 -2
- data/app/views/educode_sales/sales/operations.json.jbuilder +2 -2
- data/app/views/educode_sales/teachers/index.html.erb +15 -7
- data/app/views/layouts/educode_sales/application.html.erb +18 -2
- data/config/routes.rb +4 -0
- data/db/migrate/20210902064109_create_educode_sales_role_permissions.rb +10 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +9 -2
@@ -12,7 +12,7 @@
|
|
12
12
|
<%= select_tag "department_id",options_for_select(@school.departments.pluck(:name, :id)), { include_blank: true}%>
|
13
13
|
</div>
|
14
14
|
</div>
|
15
|
-
<div class="layui-form-item " style="padding-left:
|
15
|
+
<div class="layui-form-item " style="padding-left: 150px">
|
16
16
|
<button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="add_follow_up">提交
|
17
17
|
</button>
|
18
18
|
</div>
|
@@ -393,7 +393,7 @@
|
|
393
393
|
content = miniPage.getHrefContent('/missions/customers/edit_follow_record?id=' + data.id);
|
394
394
|
openWH = miniPage.getOpenWidthHeight();
|
395
395
|
editFollowIndex = layer.open({
|
396
|
-
title: '
|
396
|
+
title: '编辑跟进记录',
|
397
397
|
type: 1,
|
398
398
|
shade: 0.2,
|
399
399
|
maxmin: true,
|
@@ -0,0 +1,222 @@
|
|
1
|
+
<div style="margin: 10px 10px 10px 10px">
|
2
|
+
<form class="layui-form layui-form-pane" lay-filter="search_teachers">
|
3
|
+
<div class="layui-form-item">
|
4
|
+
<div class="layui-inline">
|
5
|
+
<label class="layui-form-label">所属商机</label>
|
6
|
+
<div class="layui-input-inline">
|
7
|
+
<input type="text" name="business" autocomplete="off" class="layui-input">
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
<div class="layui-inline">
|
11
|
+
<label class="layui-form-label">单位</label>
|
12
|
+
<div class="layui-input-inline">
|
13
|
+
<input type="text" name="school" autocomplete="off" class="layui-input">
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<div class="layui-inline">
|
17
|
+
<label class="layui-form-label">负责人</label>
|
18
|
+
<div class="layui-input-inline">
|
19
|
+
<%= select_tag "staff_id", options_for_select(@staffs, params[:staff_id]), { 'lay-filter': 'staff_id', include_blank: true } %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<div class="layui-inline">
|
23
|
+
<label class="layui-form-label">状态</label>
|
24
|
+
<div class="layui-input-inline">
|
25
|
+
<%= select_tag "clazz", options_for_select(['已完成','未完成']), { include_blank: true } %>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
<div class="layui-inline">
|
29
|
+
<label class="layui-form-label">回款时间</label>
|
30
|
+
<div class="layui-input-inline">
|
31
|
+
<input type="text" class="layui-input" id="date" name="date" placeholder=" - " autocomplete="off">
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
<div class="layui-inline">
|
35
|
+
<button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_business_search">重置
|
36
|
+
</button>
|
37
|
+
<button type="submit" class="layui-btn layui-btn-primary" id="search_bt" lay-submit lay-filter="search_teachers">搜 索
|
38
|
+
</button>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
</form>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<script type="text/html" id="toolbarDemo">
|
45
|
+
<div class="layui-btn-container">
|
46
|
+
<span class="table-label">回款计划</span>
|
47
|
+
</div>
|
48
|
+
</script>
|
49
|
+
|
50
|
+
<table class="layui-hide" id="place" lay-filter="place"></table>
|
51
|
+
|
52
|
+
<script type="text/html" id="currentTableBar">
|
53
|
+
</script>
|
54
|
+
<script type="text/html" id="business">
|
55
|
+
<a href="javascript:void(0);" lay-event="business" class="layui-table-link">{{ d.business }}</a>
|
56
|
+
</script>
|
57
|
+
|
58
|
+
<script type="text/html" id="school">
|
59
|
+
<a href="<%= base_url%>/colleges/{{d.school_id}}/statistics" class="layui-table-link" target="_blank">{{ d.school }}</a>
|
60
|
+
</script>
|
61
|
+
|
62
|
+
<script>
|
63
|
+
layui.use(['form', 'table', 'miniPage', 'element', 'request'], function () {
|
64
|
+
var $ = layui.jquery,
|
65
|
+
form = layui.form,
|
66
|
+
table = layui.table,
|
67
|
+
request = layui.request,
|
68
|
+
miniPage = layui.miniPage;
|
69
|
+
laydate = layui.laydate;
|
70
|
+
|
71
|
+
|
72
|
+
laydate.render({
|
73
|
+
elem: '#date',
|
74
|
+
range: true
|
75
|
+
});
|
76
|
+
|
77
|
+
table.render({
|
78
|
+
elem: '#place',
|
79
|
+
url: '/missions/money_plans',
|
80
|
+
toolbar: '#toolbarDemo',
|
81
|
+
totalRow: true,
|
82
|
+
defaultToolbar: ['filter'],
|
83
|
+
initSort: {
|
84
|
+
field: 'date_at' //排序字段,对应 cols 设定的各字段名
|
85
|
+
,type: 'desc' //排序方式 asc: 升序、desc: 降序、null: 默认排序
|
86
|
+
},
|
87
|
+
cols: [
|
88
|
+
[
|
89
|
+
{
|
90
|
+
field: 'id',
|
91
|
+
width: 80,
|
92
|
+
title:'序号',type: 'numbers',
|
93
|
+
totalRowText:'本页/总计'
|
94
|
+
},
|
95
|
+
{
|
96
|
+
field: 'date_at',
|
97
|
+
width: 120,
|
98
|
+
sort: true,
|
99
|
+
title: '回款时间'
|
100
|
+
},
|
101
|
+
{
|
102
|
+
field: 'amount',
|
103
|
+
width: 200,
|
104
|
+
sort: true,
|
105
|
+
totalRow:true,
|
106
|
+
title: '回款金额',
|
107
|
+
},
|
108
|
+
{
|
109
|
+
field: 'clazz',
|
110
|
+
width: 100,
|
111
|
+
title: '状态',
|
112
|
+
},
|
113
|
+
{
|
114
|
+
field: 'business',
|
115
|
+
title: '所属商机',
|
116
|
+
templet: "#business",
|
117
|
+
|
118
|
+
},
|
119
|
+
{
|
120
|
+
field: 'school',
|
121
|
+
title: '单位',
|
122
|
+
templet: "#school",
|
123
|
+
},
|
124
|
+
{
|
125
|
+
field: 'staff',
|
126
|
+
width: 90,
|
127
|
+
title: '负责人',
|
128
|
+
},
|
129
|
+
]
|
130
|
+
],
|
131
|
+
limit: 20,
|
132
|
+
limits: [10,15,20,30,40,50,60,70,80,90],
|
133
|
+
page: true
|
134
|
+
});
|
135
|
+
|
136
|
+
var sort = {}, search = {};
|
137
|
+
table.on('sort(place)', function (obj) {
|
138
|
+
sort.field = obj.field;
|
139
|
+
sort.order = obj.type;
|
140
|
+
table.reload('place', {
|
141
|
+
initSort: obj,
|
142
|
+
where: {
|
143
|
+
sort: sort,
|
144
|
+
q: search
|
145
|
+
}
|
146
|
+
});
|
147
|
+
})
|
148
|
+
|
149
|
+
// 监听搜索操作
|
150
|
+
form.on('submit(search_teachers)', function (data) {
|
151
|
+
search = data.field
|
152
|
+
table.reload('place', {
|
153
|
+
page: {
|
154
|
+
curr: 1
|
155
|
+
},
|
156
|
+
where: {q: search, sort: sort}
|
157
|
+
}, 'data');
|
158
|
+
return false;
|
159
|
+
});
|
160
|
+
|
161
|
+
form.on('submit(reset_business_search)', function (data) {
|
162
|
+
var field = data.field;
|
163
|
+
form.val('search_teachers', {
|
164
|
+
area: "",
|
165
|
+
date: "",
|
166
|
+
staff_id: "",
|
167
|
+
clazz: "",
|
168
|
+
professional_title: "",
|
169
|
+
school: "",
|
170
|
+
business: ""
|
171
|
+
});
|
172
|
+
return false;
|
173
|
+
});
|
174
|
+
|
175
|
+
table.on('tool(place)', function (obj) {
|
176
|
+
var data = obj.data;
|
177
|
+
id = data.id
|
178
|
+
if (obj.event === 'add_event') { // 监听添加操作
|
179
|
+
var content = miniPage.getHrefContent('/missions/businesses/show_follow_record?follow_up_id=' + data.id);
|
180
|
+
var openWH = miniPage.getOpenWidthHeight();
|
181
|
+
show_index = layer.open({
|
182
|
+
title: '查看商机跟进记录',
|
183
|
+
type: 1,
|
184
|
+
shade: 0.2,
|
185
|
+
maxmin: true,
|
186
|
+
shadeClose: true,
|
187
|
+
area: [openWH[0] + 'px', openWH[1] + 'px'],
|
188
|
+
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
189
|
+
content: content
|
190
|
+
});
|
191
|
+
$(window).on("resize", function () {
|
192
|
+
layer.full(index);
|
193
|
+
});
|
194
|
+
} else if (obj.event === 'business') {
|
195
|
+
console.log(data);
|
196
|
+
business_id = data.business_id
|
197
|
+
business_name = data.business
|
198
|
+
content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' + data.business_id);
|
199
|
+
openWH = miniPage.getOpenWidthHeight();
|
200
|
+
index = layer.open({
|
201
|
+
title: '商机列表/' + data.business + '的跟进记录',
|
202
|
+
type: 1,
|
203
|
+
shade: 0.2,
|
204
|
+
maxmin: true,
|
205
|
+
shadeClose: true,
|
206
|
+
area: [openWH[0] + 'px', openWH[1] + 'px'],
|
207
|
+
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
208
|
+
content: content
|
209
|
+
});
|
210
|
+
$(window).on("resize", function () {
|
211
|
+
layer.full(index);
|
212
|
+
});
|
213
|
+
}
|
214
|
+
});
|
215
|
+
|
216
|
+
});
|
217
|
+
</script>
|
218
|
+
<style>
|
219
|
+
.layui-table-tool-temp{
|
220
|
+
padding-right: 0px; !important;
|
221
|
+
}
|
222
|
+
</style>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
total_amount = 0
|
2
|
+
json.data do
|
3
|
+
json.array! @money_plans do |d|
|
4
|
+
json.id d.id
|
5
|
+
json.date_at d.date_at.to_s(:date)
|
6
|
+
json.amount d.amount
|
7
|
+
total_amount += d.amount
|
8
|
+
json.clazz d.clazz
|
9
|
+
json.business d.follow_up.business.name
|
10
|
+
json.business_id d.follow_up.business.id
|
11
|
+
json.school School.find(d.follow_up.business.school_id).name
|
12
|
+
json.school_id School.find(d.follow_up.business.school_id).id
|
13
|
+
json.staff d.staff.user.real_name
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
json.totalRow do
|
18
|
+
json.amount total_amount.round(2).to_s + '/' + @total_amount.round(2).to_s
|
19
|
+
end
|
20
|
+
json.code 0
|
21
|
+
json.count @money_plans.total_count
|
@@ -131,12 +131,26 @@
|
|
131
131
|
templet: "#business_a",
|
132
132
|
|
133
133
|
},
|
134
|
+
// {
|
135
|
+
// field: 'amount',
|
136
|
+
// width: 120,
|
137
|
+
// totalRow:true,
|
138
|
+
// sort: true,
|
139
|
+
// title: '中标金额'
|
140
|
+
// },
|
134
141
|
{
|
135
|
-
field: '
|
142
|
+
field: 'total_amount',
|
136
143
|
width: 120,
|
137
144
|
totalRow:true,
|
138
145
|
sort: true,
|
139
|
-
title: '
|
146
|
+
title: '项目总额'
|
147
|
+
},
|
148
|
+
{
|
149
|
+
field: 'divide_amount',
|
150
|
+
width: 120,
|
151
|
+
totalRow:true,
|
152
|
+
sort: true,
|
153
|
+
title: '渠道分成'
|
140
154
|
},
|
141
155
|
{
|
142
156
|
field: 'return_mount',
|
@@ -17,7 +17,9 @@ json.data do
|
|
17
17
|
business_count = EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id}").count
|
18
18
|
json.businesses_count business_count
|
19
19
|
all_businesses_count += business_count
|
20
|
-
json.amount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id} AND educode_sales_follow_ups.stage_id IN (?)", @stage_ids).sum("actual_amount - divide_amount").round(2)
|
20
|
+
# json.amount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id} AND educode_sales_follow_ups.stage_id IN (?)", @stage_ids).sum("actual_amount - divide_amount").round(2)
|
21
|
+
json.total_amount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id} AND educode_sales_follow_ups.stage_id IN (?)", @stage_ids).sum("total_amount").round(2)
|
22
|
+
json.divide_amount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id} AND educode_sales_follow_ups.stage_id IN (?)", @stage_ids).sum("divide_amount").round(2)
|
21
23
|
json.return_mount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id}").sum(:return_money).round(2)
|
22
24
|
end
|
23
25
|
end
|
@@ -249,7 +249,8 @@
|
|
249
249
|
});
|
250
250
|
return false;
|
251
251
|
} else if (obj.event === 'show_follow') {
|
252
|
-
|
252
|
+
business_id = obj.data.business_id
|
253
|
+
id = data.business_id
|
253
254
|
content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' + data.business_id);
|
254
255
|
openWH = miniPage.getOpenWidthHeight();
|
255
256
|
index = layer.open({
|
@@ -265,7 +265,8 @@
|
|
265
265
|
});
|
266
266
|
return false;
|
267
267
|
} else if (obj.event === 'show_follow') {
|
268
|
-
|
268
|
+
business_id = obj.data.business_id
|
269
|
+
// business_name = data.name
|
269
270
|
content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' + data.business_id);
|
270
271
|
openWH = miniPage.getOpenWidthHeight();
|
271
272
|
index = layer.open({
|
@@ -5,8 +5,8 @@ json.data do
|
|
5
5
|
json.name business.name
|
6
6
|
json.school business.department.school.name
|
7
7
|
json.department business.department.name
|
8
|
-
json.last_follow_person business.
|
9
|
-
json.latest_time business.
|
8
|
+
json.last_follow_person business.last_follow_up_id.present? ? EducodeSales::FollowUp.unscoped.find(business.last_follow_up_id).staff.user.real_name : EducodeSales::Staff.find(business.staff_id).user.real_name
|
9
|
+
json.latest_time business.last_follow_up_id.present? ? EducodeSales::FollowUp.unscoped.find(business.last_follow_up_id).created_at.to_s : business.created_at.to_s
|
10
10
|
json.deleter EducodeSales::Staff.find(d.deleter_id).user.real_name
|
11
11
|
json.delete_time d.created_at.to_s
|
12
12
|
end
|
@@ -36,6 +36,14 @@
|
|
36
36
|
<%= radio_button_tag("business", "全部", @areas.include?("商机管理-全部"), {title: '全部列表', id: 3}) %>
|
37
37
|
</div>
|
38
38
|
</div>
|
39
|
+
<div class="layui-form-item" style="border-top: 1px solid #ddd;">
|
40
|
+
<label class="layui-form-label">回款管理</label>
|
41
|
+
<div class="layui-input-block">
|
42
|
+
<%= radio_button_tag("money_plan", "自己", @areas.include?("回款管理-自己"), {title: '本人负责列表', id: 16}) %>
|
43
|
+
<%= radio_button_tag("money_plan", "区域", @areas.include?("回款管理-区域"), {title: '本人负责区域列表', id: 17}) %>
|
44
|
+
<%= radio_button_tag("money_plan", "全部", @areas.include?("回款管理-全部"), {title: '全部列表', id: 18}) %>
|
45
|
+
</div>
|
46
|
+
</div>
|
39
47
|
<div class="layui-form-item">
|
40
48
|
<label class="layui-form-label">客户管理</label>
|
41
49
|
<div class="layui-input-block">
|