educode_sales 0.3.6 → 0.4.0
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/indexlogo.png +0 -0
- data/app/assets/javascripts/educode_sales/extent/xm-select.js +8 -0
- data/app/assets/stylesheets/educode_sales/public.css +2 -1
- data/app/controllers/educode_sales/businesses_controller.rb +33 -11
- data/app/controllers/educode_sales/follow_ups_controller.rb +10 -1
- data/app/controllers/educode_sales/home_controller.rb +10 -1
- data/app/controllers/educode_sales/import_teachers_controller.rb +68 -0
- data/app/controllers/educode_sales/key_person_controller.rb +1 -1
- data/app/controllers/educode_sales/places_controller.rb +1 -0
- data/app/controllers/educode_sales/plans_controller.rb +1 -1
- data/app/controllers/educode_sales/sale_trends_controller.rb +8 -6
- data/app/controllers/educode_sales/sales_controller.rb +1 -0
- data/app/controllers/educode_sales/teachers_controller.rb +35 -11
- data/app/models/educode_sales/assign_follow_up.rb +6 -0
- data/app/models/educode_sales/follow_up.rb +1 -0
- data/app/models/educode_sales/key_person.rb +1 -1
- data/app/models/educode_sales/teacher_follow.rb +1 -0
- data/app/views/educode_sales/activities/edit.html.erb +0 -1
- data/app/views/educode_sales/activities/index.html.erb +32 -11
- data/app/views/educode_sales/activities/show_teachers.html.erb +1 -1
- data/app/views/educode_sales/businesses/edit.html.erb +15 -4
- data/app/views/educode_sales/businesses/edit_follow_record.html.erb +52 -4
- data/app/views/educode_sales/businesses/index.html.erb +160 -14
- data/app/views/educode_sales/businesses/index.json.jbuilder +4 -0
- data/app/views/educode_sales/businesses/new.html.erb +11 -1
- data/app/views/educode_sales/businesses/new_follow_record.html.erb +53 -15
- data/app/views/educode_sales/businesses/show_follow.html.erb +12 -5
- data/app/views/educode_sales/businesses/show_follow_record.html.erb +6 -0
- data/app/views/educode_sales/commons/edit.html.erb +0 -1
- data/app/views/educode_sales/commons/index.html.erb +1 -0
- data/app/views/educode_sales/follow_ups/teachers.json.jbuilder +3 -2
- data/app/views/educode_sales/home/sales_staff.json.jbuilder +9 -0
- data/app/views/educode_sales/operation_plans/_monthPlan.html.erb +2 -2
- data/app/views/educode_sales/operation_plans/_monthly.html.erb +3 -2
- data/app/views/educode_sales/operation_plans/_weekPlan.html.erb +2 -1
- data/app/views/educode_sales/operation_plans/_weekly.html.erb +4 -2
- data/app/views/educode_sales/operation_plans/edit_week.html.erb +1 -0
- data/app/views/educode_sales/operation_plans/new_month.html.erb +2 -0
- data/app/views/educode_sales/operation_reports/edit.html.erb +27 -1
- data/app/views/educode_sales/places/edit.html.erb +0 -2
- data/app/views/educode_sales/places/index.html.erb +1 -0
- data/app/views/educode_sales/places/index.json.jbuilder +3 -3
- data/app/views/educode_sales/places/new.html.erb +0 -1
- data/app/views/educode_sales/plans/_monthPlan.html.erb +2 -2
- data/app/views/educode_sales/plans/_monthly.html.erb +2 -1
- data/app/views/educode_sales/plans/_weekPlan.html.erb +2 -1
- data/app/views/educode_sales/plans/_weekly.html.erb +3 -1
- data/app/views/educode_sales/plans/new_month.html.erb +3 -2
- data/app/views/educode_sales/roles/edit.html.erb +0 -1
- data/app/views/educode_sales/roles/index.html.erb +1 -1
- data/app/views/educode_sales/sale_reports/edit.html.erb +26 -0
- data/app/views/educode_sales/sales/index.html.erb +1 -0
- data/app/views/educode_sales/sales/index.json.jbuilder +2 -2
- data/app/views/educode_sales/sales/operations.html.erb +1 -0
- data/app/views/educode_sales/sales/trends.html.erb +0 -4
- data/app/views/educode_sales/staffs/index.html.erb +1 -0
- data/app/views/educode_sales/teachers/add_courses.html.erb +0 -1
- data/app/views/educode_sales/teachers/add_keys.html.erb +53 -8
- data/app/views/educode_sales/teachers/edit.html.erb +4 -2
- data/app/views/educode_sales/teachers/import.html.erb +41 -0
- data/app/views/educode_sales/teachers/index.html.erb +140 -27
- data/app/views/educode_sales/teachers/index.json.jbuilder +2 -1
- data/app/views/educode_sales/teachers/new.html.erb +1 -1
- data/app/views/layouts/educode_sales/login.html.erb +1 -1
- data/config/routes.rb +5 -0
- data/db/migrate/20211009031109_add_tel_key_peoples.rb +5 -0
- data/db/migrate/20211009063423_add_source_businesses.rb +5 -0
- data/db/migrate/20211013060712_create_educode_sales_assign_follow_ups.rb +10 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +10 -2
@@ -1,3 +1,4 @@
|
|
1
|
+
<%= Gon::Base.render_data %>
|
1
2
|
<h1 class="m-t-20 text-center"><%= @business.name %></h1>
|
2
3
|
<div class="layui-form layuimini-form">
|
3
4
|
<div class="layui-form-item" style="padding: 25px">
|
@@ -16,9 +17,15 @@
|
|
16
17
|
<br>
|
17
18
|
<div class="layui-inline">
|
18
19
|
<label class="layui-form-label required">项目类型</label>
|
20
|
+
<%if @last_follow_up&.clazz&.name == "O类" %>
|
19
21
|
<div class="layui-input-inline">
|
20
|
-
<%= select_tag "clazz_id", options_for_select(
|
22
|
+
<%= select_tag "clazz_id", options_for_select([['O类',EducodeSales::Common.find_by(name: "O类").id]]),:disabled => true, class: 'required' %>
|
21
23
|
</div>
|
24
|
+
<%else %>
|
25
|
+
<div class="layui-input-inline">
|
26
|
+
<%= select_tag "clazz_id", options_for_select(@clazz, @last_follow_up&.clazz_id), class: 'required' %>
|
27
|
+
</div>
|
28
|
+
<%end %>
|
22
29
|
</div>
|
23
30
|
<div class="layui-inline">
|
24
31
|
<label class="layui-form-label required">项目阶段</label>
|
@@ -71,6 +78,12 @@
|
|
71
78
|
<input name="divide_rate" class="layui-input" value="<%= @last_follow_up&.divide_rate%>">
|
72
79
|
</div>
|
73
80
|
<span style="margin-top: 10px; float:left;">%</span>
|
81
|
+
</div>
|
82
|
+
<div class="layui-form-item">
|
83
|
+
<label class="layui-form-label">指定跟进人</label>
|
84
|
+
<div class="layui-input-inline">
|
85
|
+
<div id="assign_follow" style="width: 512px;"></div>
|
86
|
+
</div>
|
74
87
|
</div>
|
75
88
|
<div class="layui-form-item layui-form-text">
|
76
89
|
<label class="layui-form-label required">商机说明</label>
|
@@ -104,15 +117,16 @@
|
|
104
117
|
</div>
|
105
118
|
|
106
119
|
<script>
|
107
|
-
layui.use(['form', 'table', 'upload', 'layer', 'laytpl', 'request', 'laydate'], function () {
|
120
|
+
layui.use(['form', 'table', 'upload', 'layer', 'laytpl', 'request', 'laydate', 'xmSelect'], function () {
|
108
121
|
var form = layui.form,
|
109
122
|
layer = layui.layer,
|
110
123
|
table = layui.table,
|
111
124
|
laytpl = layui.laytpl,
|
112
125
|
request = layui.request,
|
113
126
|
laydate = layui.laydate,
|
127
|
+
xmSelect = layui.xmSelect,
|
114
128
|
$ = layui.$;
|
115
|
-
|
129
|
+
|
116
130
|
laydate.render({
|
117
131
|
elem: '#invitation_at_add'
|
118
132
|
})
|
@@ -120,22 +134,46 @@
|
|
120
134
|
laydate.render({
|
121
135
|
elem: '#reception_at_add'
|
122
136
|
});
|
137
|
+
var sales_list = xmSelect.render({
|
138
|
+
el: '#assign_follow',
|
139
|
+
remoteSearch: true,
|
140
|
+
clickClose: true,
|
141
|
+
delay: 1000,
|
142
|
+
paging: true,
|
143
|
+
pageRemote: true,
|
144
|
+
filterable: true,
|
145
|
+
remoteMethod: function (val, cb, show, pageIndex) {
|
146
|
+
$.ajax( '/missions/sales_staff', {
|
147
|
+
method: 'get',
|
148
|
+
data: {
|
149
|
+
q: val,
|
150
|
+
page: pageIndex
|
151
|
+
},
|
152
|
+
dataType: 'json',
|
153
|
+
success: function (res) {
|
154
|
+
var data = res.data;
|
155
|
+
if (res.code == 0) {
|
156
|
+
cb(res.data, res.count);
|
157
|
+
} else {
|
158
|
+
layer.msg(res.msg, {time: 2000, icon: 2, shade: 0.01});
|
159
|
+
}
|
123
160
|
|
161
|
+
}
|
162
|
+
})
|
163
|
+
}
|
164
|
+
})
|
165
|
+
|
166
|
+
sales_list.setValue(gon.sales);
|
124
167
|
form.render();
|
125
168
|
|
126
169
|
form.on('submit(add_follow_up)', function (data) {
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
// layer.alert(res.msg)
|
135
|
-
// } else {
|
136
|
-
// }
|
137
|
-
// })
|
138
|
-
request.authPost("missions/follow_ups", data.field, function (res) {
|
170
|
+
var assign_follow = [];
|
171
|
+
sales_list.getValue().forEach(function(d) {
|
172
|
+
assign_follow.push(d.value);
|
173
|
+
})
|
174
|
+
data.field.assign_follow_up = assign_follow;
|
175
|
+
data.field.business_id = "<%= @business.id %>";
|
176
|
+
request.authPost("missions/follow_ups", data.field, function (res) {
|
139
177
|
if (res.success == false) {
|
140
178
|
layer.alert(res.msg)
|
141
179
|
} else {
|
@@ -2,7 +2,11 @@
|
|
2
2
|
<div class="layui-btn-container">
|
3
3
|
<span class="table-label">跟进记录</span>
|
4
4
|
<% if can? :add_follow, EducodeSales::Business %>
|
5
|
-
|
5
|
+
<% if @current_admin.is_admin %>
|
6
|
+
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加跟进记录</button>
|
7
|
+
<% elsif @business.staff_id == @current_admin.id || @business.last_follow_up.nil? || @business.last_follow_up.assign_follow_ups.blank? || (@business.last_follow_up.assign_follow_ups.pluck(:staff_id).include?(@current_admin.id)) %>
|
8
|
+
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加跟进记录</button>
|
9
|
+
<% end %>
|
6
10
|
<% end %>
|
7
11
|
</div>
|
8
12
|
</script>
|
@@ -16,7 +20,11 @@
|
|
16
20
|
<% end %>
|
17
21
|
{{# if(d.is_latest){ }}
|
18
22
|
<% if can? :update_follow, EducodeSales::Business %>
|
19
|
-
|
23
|
+
<% if @current_admin.is_admin %>
|
24
|
+
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
|
25
|
+
<% elsif @business.staff_id == @current_admin.id || @business.last_follow_up.nil? || @business.last_follow_up.assign_follow_ups.blank? || (@business.last_follow_up.assign_follow_ups.pluck(:staff_id).include?(@current_admin.id)) %>
|
26
|
+
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
|
27
|
+
<% end %>
|
20
28
|
<% end %>
|
21
29
|
<% if can? :destroy_follow, EducodeSales::Business %>
|
22
30
|
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
|
@@ -142,7 +150,7 @@
|
|
142
150
|
},
|
143
151
|
{
|
144
152
|
title: '操作',
|
145
|
-
minWidth:
|
153
|
+
minWidth: 200,
|
146
154
|
toolbar: '#currentTableBar_follow',
|
147
155
|
align: "center",
|
148
156
|
fixed: 'right'
|
@@ -150,6 +158,7 @@
|
|
150
158
|
]
|
151
159
|
],
|
152
160
|
limit: 20,
|
161
|
+
limits: [10,15,20,30,40,50,60,70,80,90],
|
153
162
|
page: true,
|
154
163
|
skin: 'line',
|
155
164
|
// done: function (obj, first) {
|
@@ -173,7 +182,6 @@
|
|
173
182
|
|
174
183
|
table.on('toolbar(sale_plan_follow_table)', function (obj) {
|
175
184
|
if (obj.event === 'add') { // 监听添加操作
|
176
|
-
console.log(parent.business_id);
|
177
185
|
business_id = parent.business_id
|
178
186
|
var content = miniPage.getHrefContent('/missions/businesses/new_follow_record?id=' + parent.id);
|
179
187
|
var openWH = miniPage.getOpenWidthHeight();
|
@@ -200,7 +208,6 @@
|
|
200
208
|
var data = obj.data;
|
201
209
|
follow_up_id = obj.data.id;
|
202
210
|
if (obj.event === 'delete') {
|
203
|
-
console.log(data);
|
204
211
|
layer.confirm('确定删除ID为' + data.id + "的跟进记录", function (index) {
|
205
212
|
request.authDelete("missions/follow_ups/" + data.id, {}, function() {
|
206
213
|
obj.del();
|
@@ -65,6 +65,12 @@
|
|
65
65
|
<%= @follow_up.divide_rate %>%
|
66
66
|
</div>
|
67
67
|
</div>
|
68
|
+
<div class="ayui-form-item">
|
69
|
+
<label class="layui-form-label" style="width: 85px;">指定跟进人:</label>
|
70
|
+
<div class="layui-input-inline">
|
71
|
+
<%= @follow_up.assign_follow_ups.map{|d| d.staff.user.full_name}.join("、") %>
|
72
|
+
</div>
|
73
|
+
</div>
|
68
74
|
<div class="layui-form-item layui-form-text">
|
69
75
|
<label class="layui-form-label">商机说明:</label>
|
70
76
|
<div class="layui-input-block" style="padding-right: 20px;">
|
@@ -4,11 +4,12 @@ json.data do
|
|
4
4
|
json.name d.teacher.name
|
5
5
|
json.professional_title d.professional_title
|
6
6
|
json.job d.job
|
7
|
-
json.attitude_id d.attitude_id
|
8
|
-
json.attitude d.attitude
|
7
|
+
json.attitude_id d.attitude_id.present? ? d.attitude_id : ''
|
8
|
+
json.attitude d.attitude&.name
|
9
9
|
json.sex d.sex
|
10
10
|
json.birth_date d.birth_date
|
11
11
|
json.remark d.remark
|
12
|
+
json.tel d.tel
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
@@ -129,7 +129,7 @@
|
|
129
129
|
},
|
130
130
|
{
|
131
131
|
title: '操作',
|
132
|
-
minWidth:
|
132
|
+
minWidth: 200,
|
133
133
|
toolbar: '#currentTableBar',
|
134
134
|
align: "center",
|
135
135
|
fixed: 'right'
|
@@ -138,6 +138,7 @@
|
|
138
138
|
],
|
139
139
|
|
140
140
|
limit: 20,
|
141
|
+
limits: [10,15,20,30,40,50,60,70,80,90],
|
141
142
|
page: true,
|
142
143
|
skin: 'line'
|
143
144
|
});
|
@@ -179,7 +180,6 @@
|
|
179
180
|
*/
|
180
181
|
table.on('toolbar(currentTableFilter3)', function (obj) {
|
181
182
|
if (obj.event === 'add') { // 监听添加操作
|
182
|
-
console.log("a");
|
183
183
|
var content = miniPage.getHrefContent('/missions/operation_plans/new_month');
|
184
184
|
var openWH = miniPage.getOpenWidthHeight();
|
185
185
|
monthPlanIndex = layer.open({
|
@@ -132,7 +132,7 @@
|
|
132
132
|
},
|
133
133
|
{
|
134
134
|
title: '操作',
|
135
|
-
minWidth:
|
135
|
+
minWidth: 220,
|
136
136
|
toolbar: '#monthlyTableBar',
|
137
137
|
align: "center",
|
138
138
|
fixed: 'right'
|
@@ -166,6 +166,7 @@
|
|
166
166
|
},
|
167
167
|
|
168
168
|
limit: 20,
|
169
|
+
limits: [10,15,20,30,40,50,60,70,80,90],
|
169
170
|
page: true
|
170
171
|
});
|
171
172
|
|
@@ -240,7 +241,7 @@
|
|
240
241
|
|
241
242
|
var content = miniPage.getHrefContent('/missions/operation_reports/' + data.id + '/edit');
|
242
243
|
var openWH = miniPage.getOpenWidthHeight();
|
243
|
-
|
244
|
+
from_edit_monthly = true
|
244
245
|
MonthlyIndex = layer.open({
|
245
246
|
title: '编辑',
|
246
247
|
type: 1,
|
@@ -140,7 +140,7 @@
|
|
140
140
|
},
|
141
141
|
{
|
142
142
|
title: '操作',
|
143
|
-
minWidth:
|
143
|
+
minWidth: 200,
|
144
144
|
toolbar: '#week_plan_currentTableBar',
|
145
145
|
align: "center",
|
146
146
|
fixed: 'right'
|
@@ -149,6 +149,7 @@
|
|
149
149
|
],
|
150
150
|
|
151
151
|
limit: 20,
|
152
|
+
limits: [10,15,20,30,40,50,60,70,80,90],
|
152
153
|
page: true,
|
153
154
|
skin: 'line'
|
154
155
|
});
|
@@ -133,7 +133,7 @@
|
|
133
133
|
},
|
134
134
|
{
|
135
135
|
title: '操作',
|
136
|
-
|
136
|
+
minWidth: 220,
|
137
137
|
toolbar: '#currentWeekTableBar',
|
138
138
|
align: "center",
|
139
139
|
fixed: 'right'
|
@@ -167,6 +167,7 @@
|
|
167
167
|
},
|
168
168
|
|
169
169
|
limit: 20,
|
170
|
+
limits: [10,15,20,30,40,50,60,70,80,90],
|
170
171
|
page: true,
|
171
172
|
});
|
172
173
|
|
@@ -243,7 +244,8 @@
|
|
243
244
|
if (obj.event === 'edit') {
|
244
245
|
var content = miniPage.getHrefContent('/missions/operation_reports/' + data.id + '/edit')
|
245
246
|
var openWH = miniPage.getOpenWidthHeight();
|
246
|
-
|
247
|
+
from_edit_monthly = false
|
248
|
+
WeeklyIndex = layer.open({
|
247
249
|
title: '编辑周报',
|
248
250
|
type: 1,
|
249
251
|
shade: 0.2,
|
@@ -73,8 +73,10 @@
|
|
73
73
|
layer.close(parent.new_monthly_index)
|
74
74
|
layer.close(parent.monthPlanIndex)
|
75
75
|
layer.close(parent.teacherindex2)
|
76
|
+
layer.close(parent.sindex)
|
76
77
|
table.reload('monthPlanTable')
|
77
78
|
table.reload("newMonthlyTable")
|
79
|
+
table.reload("newWeeklyTable")
|
78
80
|
}
|
79
81
|
})
|
80
82
|
return false;
|
@@ -1,7 +1,12 @@
|
|
1
1
|
<script type="text/html" id="newWeeklyToolbar">
|
2
2
|
<div class="layui-btn-container">
|
3
|
+
{{# if(parent.from_edit_monthly){ }}
|
4
|
+
<span class="table-label">本月计划列表</span>
|
5
|
+
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add_month"> 添加计划</button>
|
6
|
+
{{# } else { }}
|
3
7
|
<span class="table-label">本周计划列表</span>
|
4
8
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加计划</button>
|
9
|
+
{{# } }}
|
5
10
|
</div>
|
6
11
|
</script>
|
7
12
|
<form class="layui-form layui-form-pane">
|
@@ -162,6 +167,27 @@
|
|
162
167
|
$(window).on("resize", function () {
|
163
168
|
layer.full(sindex);
|
164
169
|
});
|
170
|
+
}else if (obj.event === 'add_month') { // 监听添加操作
|
171
|
+
from_weekly = true;
|
172
|
+
var content = miniPage.getHrefContent('/missions/operation_plans/new_month');
|
173
|
+
var openWH = miniPage.getOpenWidthHeight();
|
174
|
+
sindex = layer.open({
|
175
|
+
title: '添加计划',
|
176
|
+
type: 1,
|
177
|
+
shade: 0.2,
|
178
|
+
maxmin: true,
|
179
|
+
shadeClose: true,
|
180
|
+
area: [openWH[0] + 'px', openWH[1] + 'px'],
|
181
|
+
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
182
|
+
content: content,
|
183
|
+
success: function (layero, index) {
|
184
|
+
// 重新渲染弹层中的下拉选择框select
|
185
|
+
form.render('select');
|
186
|
+
}
|
187
|
+
});
|
188
|
+
$(window).on("resize", function () {
|
189
|
+
layer.full(sindex);
|
190
|
+
});
|
165
191
|
}
|
166
192
|
});
|
167
193
|
table.on('tool(newWeeklyTable)', function (obj) {
|
@@ -196,7 +222,7 @@
|
|
196
222
|
from_sales = true;
|
197
223
|
content = miniPage.getHrefContent('/missions/operation_plans/edit_week?id=' + id);
|
198
224
|
openWH = miniPage.getOpenWidthHeight();
|
199
|
-
|
225
|
+
edit_week_index = layer.open({
|
200
226
|
title: '编辑',
|
201
227
|
type: 1,
|
202
228
|
shade: 0.2,
|
@@ -75,9 +75,7 @@
|
|
75
75
|
return false;
|
76
76
|
}
|
77
77
|
data.field['area_ids'] = area_ids;
|
78
|
-
console.log(data.field);
|
79
78
|
request.authPut("missions/places/" + data.field.id, data.field, function (res) {
|
80
|
-
console.log(res.success == false)
|
81
79
|
if (res.success == false) {
|
82
80
|
layer.alert(res.msg)
|
83
81
|
} else {
|
@@ -3,9 +3,9 @@ json.data do
|
|
3
3
|
json.id d.id
|
4
4
|
json.name d.name
|
5
5
|
json.area_id d.areas.present? ? d.areas.pluck(:name).join("、") : ''
|
6
|
-
json.businesses_count EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.place_id = #{d.id}").count
|
7
|
-
json.amount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.place_id = #{d.id} AND educode_sales_follow_ups.stage_id IN (?)", @stage_ids).sum(:profit_amount).round(2)
|
8
|
-
json.return_mount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.place_id = #{d.id}").sum(:return_money)
|
6
|
+
json.businesses_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
|
7
|
+
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(:profit_amount).round(2)
|
8
|
+
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)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -133,7 +133,7 @@
|
|
133
133
|
},
|
134
134
|
{
|
135
135
|
title: '操作',
|
136
|
-
minWidth:
|
136
|
+
minWidth: 200,
|
137
137
|
toolbar: '#week_plan_currentTableBar',
|
138
138
|
align: "center",
|
139
139
|
fixed: 'right'
|
@@ -142,6 +142,7 @@
|
|
142
142
|
],
|
143
143
|
|
144
144
|
limit: 20,
|
145
|
+
limits: [10,15,20,30,40,50,60,70,80,90],
|
145
146
|
page: true,
|
146
147
|
});
|
147
148
|
|
@@ -258,7 +259,6 @@
|
|
258
259
|
});
|
259
260
|
} else if (obj.event === 'delete') {
|
260
261
|
layer.confirm('确定删除' + data.id, function (index) {
|
261
|
-
console.log("aaaaa");
|
262
262
|
request.delete('missions/plans/' + data.id, {}, function (res) {
|
263
263
|
layer.close(index);
|
264
264
|
table.reload("monthPlanTable")
|
@@ -136,7 +136,7 @@
|
|
136
136
|
},
|
137
137
|
{
|
138
138
|
title: '操作',
|
139
|
-
|
139
|
+
minWidth: 220,
|
140
140
|
toolbar: '#currentmonthlyTableBar',
|
141
141
|
align: "center",
|
142
142
|
fixed: 'right'
|
@@ -171,6 +171,7 @@
|
|
171
171
|
},
|
172
172
|
|
173
173
|
limit: 20,
|
174
|
+
limits: [10,15,20,30,40,50,60,70,80,90],
|
174
175
|
page: true
|
175
176
|
});
|
176
177
|
|
@@ -138,7 +138,7 @@
|
|
138
138
|
},
|
139
139
|
{
|
140
140
|
title: '操作',
|
141
|
-
minWidth:
|
141
|
+
minWidth: 200,
|
142
142
|
toolbar: '#week_plan_currentTableBar',
|
143
143
|
align: "center",
|
144
144
|
fixed: 'right'
|
@@ -147,6 +147,7 @@
|
|
147
147
|
],
|
148
148
|
|
149
149
|
limit: 20,
|
150
|
+
limits: [10,15,20,30,40,50,60,70,80,90],
|
150
151
|
page: true,
|
151
152
|
skin: 'line'
|
152
153
|
});
|
@@ -138,7 +138,7 @@
|
|
138
138
|
},
|
139
139
|
{
|
140
140
|
title: '操作',
|
141
|
-
|
141
|
+
minWidth: 220,
|
142
142
|
toolbar: '#currentWeeklyTableBar',
|
143
143
|
align: "center",
|
144
144
|
fixed: 'right'
|
@@ -172,6 +172,7 @@
|
|
172
172
|
},
|
173
173
|
|
174
174
|
limit: 20,
|
175
|
+
limits: [10,15,20,30,40,50,60,70,80,90],
|
175
176
|
page: true
|
176
177
|
});
|
177
178
|
|
@@ -243,6 +244,7 @@
|
|
243
244
|
if (obj.event === 'edit') {
|
244
245
|
var content = miniPage.getHrefContent('/missions/sale_reports/' + data.id + "/edit");
|
245
246
|
var openWH = miniPage.getOpenWidthHeight();
|
247
|
+
from_edit_monthly = false
|
246
248
|
sindex = layer.open({
|
247
249
|
title: '编辑周报',
|
248
250
|
type: 1,
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<div class="layui-inline">
|
10
10
|
<label class="layui-form-label required">商机</label>
|
11
11
|
<div class="layui-input-inline">
|
12
|
-
<%= select_tag "business_id", options_for_select(@businesses, @business&.id),
|
12
|
+
<%= select_tag "business_id", options_for_select(@businesses, @business&.id), {"lay-verify": "required", include_blank: true} %>
|
13
13
|
</div>
|
14
14
|
</div>
|
15
15
|
<div class="layui-form-item layui-form-text">
|
@@ -76,10 +76,11 @@
|
|
76
76
|
parent.table.reload('newmonthlyTable')
|
77
77
|
} else if (parent.from_monthly) {
|
78
78
|
parent.table.reload('monthlyTable')
|
79
|
-
}
|
79
|
+
}
|
80
80
|
else {
|
81
81
|
parent.table.reload('businesses_table')
|
82
82
|
}
|
83
|
+
parent.table.reload('newWeeklyTable')
|
83
84
|
}
|
84
85
|
})
|
85
86
|
return false;
|
@@ -48,6 +48,7 @@
|
|
48
48
|
}]
|
49
49
|
],
|
50
50
|
limit: 20,
|
51
|
+
limits: [10,15,20,30,40,50,60,70,80,90],
|
51
52
|
page: true
|
52
53
|
})
|
53
54
|
|
@@ -60,7 +61,6 @@
|
|
60
61
|
var value = obj.value //得到修改后的值
|
61
62
|
,data = obj.data //得到所在行所有键值
|
62
63
|
,field = obj.field; //得到字段
|
63
|
-
console.log(obj.data);
|
64
64
|
request.authPut('missions/roles/' + data.id + '/update_role/', data,
|
65
65
|
function(res) {
|
66
66
|
if (res.success) {
|
@@ -1,7 +1,12 @@
|
|
1
1
|
<script type="text/html" id="newWeeklyToolbar">
|
2
2
|
<div class="layui-btn-container">
|
3
|
+
{{# if(parent.from_edit_monthly){ }}
|
4
|
+
<span class="table-label">本月计划列表</span>
|
5
|
+
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add_month"> 添加计划</button>
|
6
|
+
{{# } else { }}
|
3
7
|
<span class="table-label">本周计划列表</span>
|
4
8
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加计划</button>
|
9
|
+
{{# } }}
|
5
10
|
</div>
|
6
11
|
</script>
|
7
12
|
<form class="layui-form layui-form-pane">
|
@@ -168,6 +173,27 @@
|
|
168
173
|
$(window).on("resize", function () {
|
169
174
|
layer.full(sindex);
|
170
175
|
});
|
176
|
+
}else if (obj.event === 'add_month') { // 监听添加操作
|
177
|
+
from_weekly = true;
|
178
|
+
var content = miniPage.getHrefContent('/missions/plans/new_month');
|
179
|
+
var openWH = miniPage.getOpenWidthHeight();
|
180
|
+
sindex = layer.open({
|
181
|
+
title: '添加计划',
|
182
|
+
type: 1,
|
183
|
+
shade: 0.2,
|
184
|
+
maxmin: true,
|
185
|
+
shadeClose: true,
|
186
|
+
area: [openWH[0] + 'px', openWH[1] + 'px'],
|
187
|
+
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
188
|
+
content: content,
|
189
|
+
success: function (layero, index) {
|
190
|
+
// 重新渲染弹层中的下拉选择框select
|
191
|
+
form.render('select');
|
192
|
+
}
|
193
|
+
});
|
194
|
+
$(window).on("resize", function () {
|
195
|
+
layer.full(sindex);
|
196
|
+
});
|
171
197
|
}
|
172
198
|
});
|
173
199
|
table.on('tool(newWeeklyTable)', function (obj) {
|
@@ -6,8 +6,8 @@ json.data do
|
|
6
6
|
json.area d.areas.present? ? d.areas.pluck(:name).join("、") : ''
|
7
7
|
json.business_a d.businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id = ?", @a_clazz&.id).count
|
8
8
|
json.business_b d.businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id = ?", @b_clazz&.id).count
|
9
|
-
json.goal d.businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.stage_id in (?)", @step_ids).sum(:total_amount).round(2)
|
10
|
-
json.return_money d.businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").sum("educode_sales_businesses.return_money")
|
9
|
+
json.goal d.businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.stage_id in (?)", @x, @step_ids).sum(:total_amount).round(2)
|
10
|
+
json.return_money d.businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id != ?", @x).sum("educode_sales_businesses.return_money").round(2)
|
11
11
|
json.a_clazz_id @a_clazz&.id
|
12
12
|
json.b_clazz_id @b_clazz&.id
|
13
13
|
end
|