educode_sales 0.1.0 → 0.1.4
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/stylesheets/educode_sales/app.css +2 -1
- data/app/controllers/educode_sales/activities_controller.rb +7 -1
- data/app/controllers/educode_sales/application_controller.rb +0 -1
- data/app/controllers/educode_sales/businesses_controller.rb +16 -9
- data/app/controllers/educode_sales/follow_ups_controller.rb +12 -8
- data/app/controllers/educode_sales/operation_plans_controller.rb +155 -0
- data/app/controllers/educode_sales/operation_reports_controller.rb +125 -0
- data/app/controllers/educode_sales/places_controller.rb +3 -4
- data/app/controllers/educode_sales/plans_controller.rb +12 -10
- data/app/controllers/educode_sales/roles_controller.rb +11 -0
- data/app/controllers/educode_sales/sale_reports_controller.rb +5 -4
- data/app/controllers/educode_sales/sales_controller.rb +4 -1
- data/app/controllers/educode_sales/sessions_controller.rb +2 -1
- data/app/controllers/educode_sales/teacher_follows_controller.rb +146 -0
- data/app/controllers/educode_sales/teachers_controller.rb +113 -11
- data/app/models/ability.rb +0 -1
- data/app/models/educode_sales/activity.rb +2 -1
- data/app/models/educode_sales/business.rb +0 -1
- data/app/models/educode_sales/common.rb +1 -0
- data/app/models/educode_sales/course_subject.rb +1 -1
- data/app/models/educode_sales/money_plan.rb +3 -3
- data/app/models/educode_sales/operation_plan.rb +2 -0
- data/app/models/educode_sales/place.rb +1 -0
- data/app/models/educode_sales/sale_plan.rb +2 -0
- data/app/models/educode_sales/staff.rb +5 -3
- data/app/models/educode_sales/teacher.rb +20 -1
- data/app/views/educode_sales/activities/edit.html.erb +4 -4
- data/app/views/educode_sales/activities/index.html.erb +23 -8
- data/app/views/educode_sales/activities/index.json.jbuilder +1 -1
- data/app/views/educode_sales/activities/new.html.erb +4 -3
- data/app/views/educode_sales/businesses/edit_follow_record.html.erb +2 -2
- data/app/views/educode_sales/businesses/edit_plan.html.erb +12 -7
- data/app/views/educode_sales/businesses/index.html.erb +137 -141
- data/app/views/educode_sales/businesses/index.json.jbuilder +2 -1
- data/app/views/educode_sales/businesses/new.html.erb +1 -1
- data/app/views/educode_sales/businesses/show_follow.html.erb +18 -3
- data/app/views/educode_sales/businesses/show_follow_record.html.erb +1 -1
- data/app/views/educode_sales/home/search_users.json.jbuilder +1 -1
- data/app/views/educode_sales/operation_plans/_monthPlan.html.erb +82 -88
- data/app/views/educode_sales/operation_plans/_monthly.html.erb +126 -97
- data/app/views/educode_sales/operation_plans/_weekPlan.html.erb +103 -90
- data/app/views/educode_sales/operation_plans/_weekly.html.erb +116 -87
- data/app/views/educode_sales/operation_plans/edit_month.html.erb +44 -32
- data/app/views/educode_sales/operation_plans/edit_monthly.html.erb +1 -1
- data/app/views/educode_sales/operation_plans/edit_week.html.erb +49 -39
- data/app/views/educode_sales/operation_plans/edit_weekly.html.erb +1 -1
- data/app/views/educode_sales/operation_plans/index.html.erb +35 -5
- data/app/views/educode_sales/operation_plans/index.json.jbuilder +19 -0
- data/app/views/educode_sales/operation_plans/my_month.json.jbuilder +18 -0
- data/app/views/educode_sales/operation_plans/my_week.json.jbuilder +19 -0
- data/app/views/educode_sales/operation_plans/new_month.html.erb +13 -10
- data/app/views/educode_sales/operation_plans/new_monthly.html.erb +162 -72
- data/app/views/educode_sales/operation_plans/new_week.html.erb +14 -7
- data/app/views/educode_sales/operation_plans/new_weekly.html.erb +205 -120
- data/app/views/educode_sales/operation_plans/show_month.html.erb +4 -10
- data/app/views/educode_sales/operation_plans/show_week.html.erb +20 -25
- data/app/views/educode_sales/operation_plans/show_weekly.html.erb +6 -6
- data/app/views/educode_sales/operation_reports/audit.html.erb +214 -0
- data/app/views/educode_sales/operation_reports/edit.html.erb +234 -0
- data/app/views/educode_sales/operation_reports/index.json.jbuilder +18 -0
- data/app/views/educode_sales/operation_reports/plans.json.jbuilder +19 -0
- data/app/views/educode_sales/operation_reports/show.html.erb +139 -0
- data/app/views/educode_sales/operations/trends.html.erb +8 -0
- data/app/views/educode_sales/places/index.html.erb +6 -0
- data/app/views/educode_sales/places/index.json.jbuilder +1 -1
- data/app/views/educode_sales/plans/_monthPlan.html.erb +9 -1
- data/app/views/educode_sales/plans/_monthly.html.erb +10 -2
- data/app/views/educode_sales/plans/_weekPlan.html.erb +17 -5
- data/app/views/educode_sales/plans/_weekly.html.erb +10 -2
- data/app/views/educode_sales/plans/audit_weekly.html.erb +6 -0
- data/app/views/educode_sales/plans/edit_monthly.html.erb +8 -0
- data/app/views/educode_sales/plans/edit_week.html.erb +8 -2
- data/app/views/educode_sales/plans/edit_weekly.html.erb +8 -0
- data/app/views/educode_sales/plans/index.json.jbuilder +1 -1
- data/app/views/educode_sales/plans/my_month.json.jbuilder +1 -1
- data/app/views/educode_sales/plans/my_week.json.jbuilder +1 -1
- data/app/views/educode_sales/plans/new_month.html.erb +7 -3
- data/app/views/educode_sales/plans/new_monthly.html.erb +8 -0
- data/app/views/educode_sales/plans/new_week.html.erb +8 -2
- data/app/views/educode_sales/plans/new_weekly.html.erb +7 -1
- data/app/views/educode_sales/roles/index.html.erb +33 -2
- data/app/views/educode_sales/sale_reports/index.json.jbuilder +1 -1
- data/app/views/educode_sales/sale_trends/trends.html.erb +8 -0
- data/app/views/educode_sales/sales/index.html.erb +2 -1
- data/app/views/educode_sales/sales/operations.html.erb +5 -2
- data/app/views/educode_sales/sessions/login.html.erb +1 -1
- data/app/views/educode_sales/staffs/edit.html.erb +2 -3
- data/app/views/educode_sales/staffs/index.html.erb +4 -4
- data/app/views/educode_sales/staffs/new.html.erb +1 -1
- data/app/views/educode_sales/teachers/add_courses.html.erb +100 -19
- data/app/views/educode_sales/teachers/course_subject.json.jbuilder +10 -0
- data/app/views/educode_sales/teachers/edit.html.erb +54 -18
- data/app/views/educode_sales/teachers/edit_follow_record.html.erb +49 -30
- data/app/views/educode_sales/teachers/index.html.erb +20 -11
- data/app/views/educode_sales/teachers/index.json.jbuilder +2 -0
- data/app/views/educode_sales/teachers/new.html.erb +8 -6
- data/app/views/educode_sales/teachers/new_follow_record.html.erb +54 -29
- data/app/views/educode_sales/teachers/show_follow.html.erb +150 -170
- data/app/views/educode_sales/teachers/show_follow.json.jbuilder +20 -0
- data/app/views/educode_sales/teachers/show_follow_record.html.erb +11 -42
- data/app/views/educode_sales/teachers/unfinish_plans.json.jbuilder +14 -0
- data/app/views/layouts/educode_sales/application.html.erb +23 -2
- data/config/routes.rb +22 -4
- data/db/migrate/20210915061738_add_students_count_teacher_follow_ups.rb +9 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +19 -6
data/app/models/ability.rb
CHANGED
@@ -12,10 +12,10 @@ module EducodeSales
|
|
12
12
|
private
|
13
13
|
|
14
14
|
def update_return_money
|
15
|
-
if
|
15
|
+
if follow_up.business.last_follow_up_id == self.follow_up_id
|
16
|
+
follow_up.business.update(return_money: MoneyPlan.where(clazz: '已完成', follow_up_id: self.follow_up_id).sum(:amount))
|
17
|
+
else
|
16
18
|
follow_up.update(return_money: follow_up.money_plans.where(clazz: '已完成').sum(:amount))
|
17
|
-
all_follow_ups_ids = follow_up.business.follow_ups.pluck(:id)
|
18
|
-
follow_up.business.update(return_money: EducodeSales::MoneyPlan.where(clazz: '已完成', follow_up_id: all_follow_ups_ids).sum(:amount))
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -4,7 +4,9 @@ module EducodeSales
|
|
4
4
|
belongs_to :role, optional: true
|
5
5
|
|
6
6
|
has_many :market_areas, dependent: :destroy
|
7
|
-
has_many :
|
7
|
+
has_many :follow_ups, dependent: :restrict_with_exception
|
8
|
+
has_many :operation_plans, dependent: :restrict_with_exception
|
9
|
+
has_many :operation_reports, dependent: :restrict_with_exception
|
8
10
|
has_many :sale_reports, dependent: :restrict_with_exception
|
9
11
|
has_many :follow_ups, dependent: :restrict_with_exception
|
10
12
|
has_many :teacher_follows, dependent: :restrict_with_exception
|
@@ -12,7 +14,7 @@ module EducodeSales
|
|
12
14
|
has_many :places, dependent: :restrict_with_exception
|
13
15
|
has_many :businesses
|
14
16
|
has_many :activities
|
15
|
-
has_many :
|
17
|
+
has_many :sale_plans, dependent: :destroy
|
16
18
|
|
17
19
|
has_many :areas, through: :market_areas
|
18
20
|
validates :user_id, uniqueness: { message: '已存在' }
|
@@ -31,7 +33,7 @@ module EducodeSales
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def month
|
34
|
-
if expired_at.present?
|
36
|
+
if expired_at.present? && enabled_at.present?
|
35
37
|
(expired_at.year * 12 + expired_at.month) - (enabled_at.year * 12 + enabled_at.month)
|
36
38
|
else
|
37
39
|
nil
|
@@ -2,11 +2,30 @@ module EducodeSales
|
|
2
2
|
class Teacher < ApplicationRecord
|
3
3
|
has_many :activity_teachers
|
4
4
|
has_many :activities, through: :activity_teachers
|
5
|
+
has_many :teacher_follows, dependent: :destroy
|
6
|
+
has_many :operation_plans, dependent: :destroy
|
7
|
+
has_many :course_subjects, dependent: :destroy
|
5
8
|
belongs_to :department, optional: true
|
6
9
|
belongs_to :staff
|
7
10
|
belongs_to :user, optional: true
|
8
11
|
belongs_to :follow_up, counter_cache: true, optional: true
|
9
12
|
|
10
13
|
validates :user_id, uniqueness: { allow_blank: true, message: '已存在老师列表'}
|
14
|
+
|
15
|
+
|
16
|
+
def teacher_used_of_department
|
17
|
+
if user_id.present?
|
18
|
+
user_ids = User.joins(:user_extension).where(user_extensions: {department_id: self.department_id, identity: 0}).pluck(:id)
|
19
|
+
course_ids = CourseMember.where(role: "CREATOR", user_id: user_ids).pluck(:course_id)
|
20
|
+
if course_ids.present?
|
21
|
+
else
|
22
|
+
0
|
23
|
+
end
|
24
|
+
course_members = CourseMember.joins(course: :practice_homework_shixuns).where(course_id: course_ids).group("course_id").having("COUNT(homework_commons_shixuns.id) > 100 AND COUNT(course_members.user_id) > 30").select("COUNT(*) AS count")
|
25
|
+
course_members.present? ? course_members[0]['count'] : 0
|
26
|
+
else
|
27
|
+
0
|
28
|
+
end
|
29
|
+
end
|
11
30
|
end
|
12
|
-
end
|
31
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<%#= Gon::Base.render_data %>
|
2
|
-
<
|
2
|
+
<div class="layuimini-main">
|
3
|
+
<form class="layui-form layuimini-form" action="">
|
3
4
|
<div class="layui-form-item" style="padding: 25px">
|
4
5
|
<div class="layui-inline">
|
5
6
|
<label class="layui-form-label required">活动名称</label>
|
@@ -28,8 +29,7 @@
|
|
28
29
|
</div>
|
29
30
|
</div>
|
30
31
|
</form>
|
31
|
-
|
32
|
-
|
32
|
+
</div>
|
33
33
|
<script>
|
34
34
|
|
35
35
|
layui.use(['form', 'table', 'upload', 'laytpl', 'request', 'selectInput', 'transfer'], function () {
|
@@ -73,7 +73,7 @@
|
|
73
73
|
layer.alert(res.msg)
|
74
74
|
} else {
|
75
75
|
layer.closeAll(); //关闭所有层
|
76
|
-
table.reload('
|
76
|
+
table.reload('activities_table')
|
77
77
|
}
|
78
78
|
})
|
79
79
|
return false;
|
@@ -1,15 +1,21 @@
|
|
1
1
|
<script type="text/html" id="activity_toolbar">
|
2
2
|
<div class="layui-btn-container">
|
3
3
|
<span class="table-label">活动列表</span>
|
4
|
+
<% if can? :create, EducodeSales::Activity %>
|
4
5
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加活动</button>
|
6
|
+
<% end %>
|
5
7
|
</div>
|
6
8
|
</script>
|
7
9
|
|
8
|
-
<table class="layui-hide" id="
|
10
|
+
<table class="layui-hide" id="activities_table" lay-filter="activities_table"></table>
|
9
11
|
|
10
12
|
<script type="text/html" id="currentTableBar">
|
13
|
+
<% if can? :update, EducodeSales::Activity %>
|
11
14
|
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
|
15
|
+
<% end %>
|
16
|
+
<% if can? :destroy, EducodeSales::Activity %>
|
12
17
|
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
|
18
|
+
<% end %>
|
13
19
|
</script>
|
14
20
|
|
15
21
|
<script type="text/html" id="teachers">
|
@@ -28,7 +34,7 @@
|
|
28
34
|
miniPage = layui.miniPage;
|
29
35
|
|
30
36
|
table.render({
|
31
|
-
elem: '#
|
37
|
+
elem: '#activities_table',
|
32
38
|
url: '/educode_sales/activities',
|
33
39
|
toolbar: '#activity_toolbar',
|
34
40
|
defaultToolbar: [],
|
@@ -47,6 +53,7 @@
|
|
47
53
|
},
|
48
54
|
{
|
49
55
|
field: 'start_at',
|
56
|
+
width: 180,
|
50
57
|
title: '时间',
|
51
58
|
sort: true,
|
52
59
|
},
|
@@ -85,10 +92,18 @@
|
|
85
92
|
page: true
|
86
93
|
});
|
87
94
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
95
|
+
var sort = {};
|
96
|
+
table.on('sort(activities_table)', function (obj) {
|
97
|
+
sort.field = obj.field;
|
98
|
+
sort.order = obj.type;
|
99
|
+
table.reload('activities_table', {
|
100
|
+
initSort: obj,
|
101
|
+
where: {
|
102
|
+
sort: sort
|
103
|
+
}
|
104
|
+
});
|
105
|
+
})
|
106
|
+
table.on('toolbar(activities_table)', function (obj) {
|
92
107
|
if (obj.event === 'add') { // 监听添加操作
|
93
108
|
var content = miniPage.getHrefContent('/educode_sales/activities/new');
|
94
109
|
var openWH = miniPage.getOpenWidthHeight();
|
@@ -111,7 +126,7 @@
|
|
111
126
|
}
|
112
127
|
});
|
113
128
|
|
114
|
-
table.on('tool(
|
129
|
+
table.on('tool(activities_table)', function (obj) {
|
115
130
|
var data = obj.data;
|
116
131
|
var id = data.id
|
117
132
|
if (obj.event === 'edit') {
|
@@ -141,7 +156,7 @@
|
|
141
156
|
layer.confirm('确定删除' + data.name, function (index) {
|
142
157
|
request.delete('educode_sales/activities/' + data.id, {}, function (res) {
|
143
158
|
layer.close(index);
|
144
|
-
table.reload("
|
159
|
+
table.reload("activities_table")
|
145
160
|
})
|
146
161
|
});
|
147
162
|
} else if (obj.event === 'teachers') {
|
@@ -5,7 +5,7 @@ json.data do
|
|
5
5
|
json.days d.days
|
6
6
|
json.teachers_count d.activity_teachers_count
|
7
7
|
json.return_rate d.return_rate
|
8
|
-
json.students_count d.students_count
|
8
|
+
json.students_count d.students_count || 0
|
9
9
|
json.course_rate d.course_rate
|
10
10
|
json.start_at d.start_at ? d.start_at.to_s(:date) : ''
|
11
11
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<%#= Gon::Base.render_data %>
|
2
|
-
<
|
2
|
+
<div class="layuimini-main">
|
3
|
+
<form class="layui-form layuimini-form" action="">
|
3
4
|
<div class="layui-form-item" style="padding: 25px">
|
4
5
|
<div class="layui-inline">
|
5
6
|
<label class="layui-form-label required">活动名称</label>
|
@@ -27,7 +28,7 @@
|
|
27
28
|
</div>
|
28
29
|
</div>
|
29
30
|
</form>
|
30
|
-
|
31
|
+
</div>
|
31
32
|
|
32
33
|
<script>
|
33
34
|
|
@@ -72,7 +73,7 @@
|
|
72
73
|
layer.alert(res.msg)
|
73
74
|
} else {
|
74
75
|
layer.closeAll(); //关闭所有层
|
75
|
-
table.reload('
|
76
|
+
table.reload('activities_table')
|
76
77
|
}
|
77
78
|
})
|
78
79
|
return false;
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<div class="layui-inline">
|
18
18
|
<label class="layui-form-label required">项目类型</label>
|
19
19
|
<div class="layui-input-inline">
|
20
|
-
<%= select_tag "clazz_id", options_for_select(@clazz, @follow_up.
|
20
|
+
<%= select_tag "clazz_id", options_for_select(@clazz, @follow_up.clazz_id), class: 'required' %>
|
21
21
|
</div>
|
22
22
|
</div>
|
23
23
|
<div class="layui-inline">
|
@@ -51,7 +51,7 @@
|
|
51
51
|
<div class="layui-inline">
|
52
52
|
<label class="layui-form-label">实额</label>
|
53
53
|
<div class="layui-input-inline">
|
54
|
-
<input name="actual_amount" type="number" class="layui-input" value="<%= @follow_up.
|
54
|
+
<input name="actual_amount" type="number" class="layui-input" value="<%= @follow_up.actual_amount %>">
|
55
55
|
</div>
|
56
56
|
</div>
|
57
57
|
<br>
|
@@ -39,7 +39,7 @@
|
|
39
39
|
|
40
40
|
<script type="text/html" id="return_money_select">
|
41
41
|
<div class="layui-input-block table-select">
|
42
|
-
<select name="
|
42
|
+
<select name="clazz" lay-filter="return_money_select">
|
43
43
|
{{# layui.each(['未完成', '已完成'], function(i, data) { }}
|
44
44
|
{{# if (data == d.clazz) { }}
|
45
45
|
<option value="{{data}}" selected="{{d.clazz}}">{{data}}</option>
|
@@ -81,9 +81,10 @@
|
|
81
81
|
if (res.success == false) {
|
82
82
|
layer.alert(res.msg)
|
83
83
|
} else {
|
84
|
-
layer.close(parent.plan_index);
|
84
|
+
// layer.close(parent.plan_index);
|
85
85
|
parent.table.reload('sale_plan_follow_table');
|
86
86
|
parent.table.reload('businesses_table');
|
87
|
+
table.reload('return_money_list');
|
87
88
|
}
|
88
89
|
})
|
89
90
|
return false;
|
@@ -146,23 +147,27 @@
|
|
146
147
|
|
147
148
|
table.on('tool(return_money_list)', function (obj) {
|
148
149
|
var data = obj.data;
|
149
|
-
data.clazz = clazz;
|
150
|
+
data.clazz = clazz ? clazz : obj.data.clazz;
|
150
151
|
data.plan_id = obj.data.id
|
151
152
|
if (obj.event === 'edit') {
|
152
153
|
request.authPut('educode_sales/follow_ups/' + parent.follow_up_id + "/update_money", data,
|
153
154
|
function (res) {
|
154
155
|
if (res.success) {
|
155
|
-
|
156
|
+
layer.alert('保存成功');
|
157
|
+
table.reload('return_money_list');
|
158
|
+
table.reload("sale_plan_follow_table");
|
159
|
+
table.reload("businesses_table");
|
156
160
|
} else {
|
157
|
-
layer.alert(res.msg)
|
161
|
+
layer.alert(res.msg);
|
158
162
|
}
|
159
|
-
|
160
163
|
})
|
161
164
|
} else if (obj.event == 'delete') {
|
162
165
|
layer.confirm('确定删除回款金额为' + data.amount + "的计划", function (index) {
|
163
166
|
request.delete('educode_sales/follow_ups/' + parent.follow_up_id + "/delete_money?plan_id=" + data.id, {}, function (res) {
|
164
167
|
layer.close(index);
|
165
|
-
table.reload("return_money_list")
|
168
|
+
table.reload("return_money_list");
|
169
|
+
table.reload("sale_plan_follow_table");
|
170
|
+
table.reload("businesses_table");
|
166
171
|
})
|
167
172
|
});
|
168
173
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div class="
|
1
|
+
<div class="min-height-table">
|
2
2
|
<div style="margin: 10px 10px 10px 10px">
|
3
3
|
<form class="layui-form layui-form-pane" lay-filter="search_form">
|
4
4
|
<div class="layui-form-item">
|
@@ -65,14 +65,22 @@
|
|
65
65
|
<script type="text/html" id="bussinessBar">
|
66
66
|
<div class="layui-btn-container">
|
67
67
|
<span class="table-label">商机列表</span>
|
68
|
+
<% if can? :create, EducodeSales::Business %>
|
68
69
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加商机</button>
|
70
|
+
<% end %>
|
69
71
|
</div>
|
70
72
|
</script>
|
71
73
|
<script type="text/html" id="currentTableBar">
|
74
|
+
<% if can? :create, EducodeSales::SalePlan %>
|
72
75
|
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="addWeek">添加周计划</a>
|
73
76
|
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="addMonth">添加月计划</a>
|
77
|
+
<% end %>
|
78
|
+
<% if can? :update, EducodeSales::Business %>
|
74
79
|
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
|
80
|
+
<% end %>
|
81
|
+
<% if can? :destroy, EducodeSales::SalePlan %>
|
75
82
|
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
|
83
|
+
<% end %>
|
76
84
|
</script>
|
77
85
|
<script type="text/html" id="show_keys">
|
78
86
|
<a href="javascript:void(0);" lay-event="show_keys" class="layui-table-link">{{ d.teachers_count }}</a>
|
@@ -83,154 +91,146 @@
|
|
83
91
|
|
84
92
|
|
85
93
|
<script>
|
86
|
-
layui.use('laydate', function () {
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
});
|
93
|
-
})
|
94
|
+
layui.use(['form', 'table', 'miniPage', 'element', 'request', 'laydate'], function () {
|
95
|
+
var $ = layui.jquery,
|
96
|
+
form = layui.form,
|
97
|
+
request = layui.request,
|
98
|
+
miniPage = layui.miniPage,
|
99
|
+
laydate = layui.laydate;
|
94
100
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
miniPage = layui.miniPage;
|
101
|
+
laydate.render({
|
102
|
+
elem: '#date',
|
103
|
+
range: true
|
104
|
+
});
|
100
105
|
|
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
|
-
|
106
|
+
table = layui.table;
|
107
|
+
table.render({
|
108
|
+
elem: '#businesses_table',
|
109
|
+
url: '/educode_sales/businesses',
|
110
|
+
where: {q: form.val('search_form')},
|
111
|
+
toolbar: '#bussinessBar',
|
112
|
+
defaultToolbar: [],
|
113
|
+
cols: [
|
114
|
+
[
|
115
|
+
{
|
116
|
+
field: 'id',
|
117
|
+
width: 60,
|
118
|
+
title: '序号',
|
119
|
+
},
|
120
|
+
{
|
121
|
+
field: 'name',
|
122
|
+
width: 170,
|
123
|
+
title: '名称'
|
124
|
+
},
|
125
|
+
{
|
126
|
+
field: 'school',
|
127
|
+
width: 200,
|
128
|
+
title: '单位',
|
129
|
+
},
|
130
|
+
{
|
131
|
+
field: 'department',
|
132
|
+
width: 140,
|
133
|
+
title: '部门'
|
134
|
+
},
|
135
|
+
{
|
136
|
+
field: 'follow_ups_count',
|
137
|
+
title: '跟进',
|
138
|
+
width: 60,
|
139
|
+
templet: '#show_follow'
|
140
|
+
},
|
141
|
+
{
|
142
|
+
field: 'teachers_count',
|
143
|
+
width: 100,
|
144
|
+
title: '关键人',
|
145
|
+
templet: '#show_keys'
|
146
|
+
},
|
147
|
+
{
|
148
|
+
field: 'clazz',
|
149
|
+
width: 80,
|
150
|
+
title: '类型'
|
151
|
+
},
|
152
|
+
{
|
153
|
+
field: 'stage',
|
154
|
+
width: 100,
|
155
|
+
title: '阶段'
|
156
|
+
},
|
157
|
+
{
|
158
|
+
field: 'invitation_at',
|
159
|
+
width: 120,
|
160
|
+
title: '招标时间',
|
161
|
+
sort: true
|
162
|
+
},
|
163
|
+
{
|
164
|
+
field: 'reception_at',
|
165
|
+
width: 120,
|
166
|
+
title: '验收时间',
|
167
|
+
sort: true
|
168
|
+
},
|
169
|
+
{
|
170
|
+
field: 'total_amount',
|
171
|
+
width: 100,
|
172
|
+
title: '总额(万)',
|
173
|
+
sort: true
|
174
|
+
},
|
175
|
+
{
|
176
|
+
field: 'return_money',
|
177
|
+
width: 100,
|
178
|
+
title: '回款(万)',
|
179
|
+
sort: true
|
180
|
+
},
|
181
|
+
{
|
182
|
+
field: 'place',
|
183
|
+
width: 110,
|
184
|
+
title: '渠道'
|
185
|
+
},
|
186
|
+
{
|
187
|
+
title: '操作',
|
188
|
+
minWidth: 300,
|
189
|
+
toolbar: '#currentTableBar',
|
190
|
+
align: "center",
|
191
|
+
fixed: 'right'
|
192
|
+
}
|
193
|
+
]
|
194
|
+
],
|
195
|
+
page: true,
|
196
|
+
skin: 'line'
|
197
|
+
});
|
141
198
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
},
|
153
|
-
{
|
154
|
-
field: 'invitation_at',
|
155
|
-
width: 120,
|
156
|
-
title: '招标时间',
|
157
|
-
sort: true
|
158
|
-
},
|
159
|
-
{
|
160
|
-
field: 'reception_at',
|
161
|
-
width: 120,
|
162
|
-
title: '验收时间',
|
163
|
-
sort: true
|
164
|
-
},
|
165
|
-
{
|
166
|
-
field: 'total_amount',
|
167
|
-
width: 100,
|
168
|
-
title: '总额(万)',
|
169
|
-
sort: true
|
170
|
-
},
|
171
|
-
{
|
172
|
-
field: 'return_money',
|
173
|
-
width: 100,
|
174
|
-
title: '回款(万)',
|
175
|
-
sort: true
|
176
|
-
},
|
177
|
-
{
|
178
|
-
field: 'place',
|
179
|
-
width: 110,
|
180
|
-
title: '渠道'
|
181
|
-
},
|
182
|
-
{
|
183
|
-
title: '操作',
|
184
|
-
minWidth: 300,
|
185
|
-
toolbar: '#currentTableBar',
|
186
|
-
align: "center",
|
187
|
-
fixed: 'right'
|
188
|
-
}
|
189
|
-
]
|
190
|
-
],
|
191
|
-
page: true,
|
192
|
-
skin: 'line'
|
199
|
+
var sort = {}, search = {};
|
200
|
+
table.on('sort(businesses_table)', function (obj) {
|
201
|
+
sort.field = obj.field;
|
202
|
+
sort.order = obj.type;
|
203
|
+
table.reload('businesses_table', {
|
204
|
+
initSort: obj,
|
205
|
+
where: {
|
206
|
+
sort: sort,
|
207
|
+
q: search
|
208
|
+
}
|
193
209
|
});
|
194
|
-
|
195
|
-
var sort = {}, search = {};
|
196
|
-
table.on('sort(businesses_table)', function (obj) {
|
197
|
-
sort.field = obj.field;
|
198
|
-
sort.order = obj.type;
|
199
|
-
table.reload('businesses_table', {
|
200
|
-
initSort: obj,
|
201
|
-
where: {
|
202
|
-
sort: sort,
|
203
|
-
q: search
|
204
|
-
}
|
205
|
-
});
|
206
|
-
})
|
210
|
+
})
|
207
211
|
|
208
212
|
// 监听搜索操作
|
209
213
|
form.on('submit(search_bussiness)', function (data) {
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
}, 'data');
|
214
|
+
search = data.field
|
215
|
+
table.reload('businesses_table', {
|
216
|
+
page: {
|
217
|
+
curr: 1
|
218
|
+
},
|
219
|
+
where: {q: search, sort: sort}
|
220
|
+
}, 'data');
|
218
221
|
|
219
|
-
|
222
|
+
return false;
|
220
223
|
});
|
221
224
|
|
222
225
|
form.on('submit(reset_business_search)', function (data) {
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
226
|
+
var field = data.field;
|
227
|
+
form.val('search_form', {
|
228
|
+
name: '', department: '', staff_id: '', business_type: '', business_step: '',
|
229
|
+
place_id: '', date: '', area: ''
|
230
|
+
})
|
231
|
+
return false;
|
229
232
|
});
|
230
233
|
|
231
|
-
/**
|
232
|
-
* toolbar事件监听
|
233
|
-
*/
|
234
234
|
table.on('toolbar(businesses_table)', function (obj) {
|
235
235
|
if (obj.event === 'add') { // 监听添加操作
|
236
236
|
var content = miniPage.getHrefContent('/educode_sales/businesses/new');
|
@@ -348,11 +348,7 @@
|
|
348
348
|
shadeClose: true,
|
349
349
|
area: [openWH[0] + 'px', openWH[1] + 'px'],
|
350
350
|
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
351
|
-
content: content
|
352
|
-
success: function (layero, index) {
|
353
|
-
// 重新渲染弹层中的下拉选择框select
|
354
|
-
// form.render('select');
|
355
|
-
}
|
351
|
+
content: content
|
356
352
|
});
|
357
353
|
$(window).on("resize", function () {
|
358
354
|
layer.full(index);
|