educode_sales 1.10.58 → 1.10.59
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/educode_sales/indexlogo.png +0 -0
- data/app/controllers/educode_sales/plans_controller.rb +392 -9
- data/app/models/educode_sales/permission.rb +7 -0
- data/app/models/educode_sales/sales_target_history.rb +11 -0
- data/app/views/educode_sales/plans/_year_execute.html.erb +293 -0
- data/app/views/educode_sales/plans/_year_target.html.erb +677 -0
- data/app/views/educode_sales/plans/index.html.erb +104 -81
- data/app/views/educode_sales/plans/year_execute.js.erb +1 -0
- data/app/views/educode_sales/plans/year_target.js.erb +1 -0
- data/app/views/educode_sales/plans/year_target.json.jbuilder +48 -0
- data/app/views/educode_sales/plans/years_all_target.json.jbuilder +53 -0
- data/app/views/layouts/educode_sales/application.html.erb +1 -1
- data/config/routes.rb +7 -2
- data/db/migrate/20230729085359_create_educode_sales_sales_target_histories.rb +45 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +14 -7
- data/app/views/educode_sales/plans/_target_track.html.erb +0 -178
- data/app/views/educode_sales/plans/target_track.js.erb +0 -1
@@ -0,0 +1,293 @@
|
|
1
|
+
<%= Gon::Base.render_data %>
|
2
|
+
<div id="year_execute_wraper">
|
3
|
+
<div class="layuimini-main min-height-table" id="year_execute_table_wraper">
|
4
|
+
<form class="layui-form layui-form-pane" lay-filter="assessment_progress_form">
|
5
|
+
<div class="layui-form-item">
|
6
|
+
<div class="layui-inline">
|
7
|
+
<label class="layui-form-label">人员</label>
|
8
|
+
<div class="layui-input-inline large-select">
|
9
|
+
<%= select_tag "staff_id", options_for_select(@staffs), { id: 'execute_staff_id', include_blank: true} %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
<div class="layui-inline">
|
13
|
+
<label class="layui-form-label">年度</label>
|
14
|
+
<div class="layui-input-inline">
|
15
|
+
<input type="text" class="layui-input" autocomplete="off" name="year" value="<%= Time.now.year %>" id="assessment_year">
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<div class="layui-inline">
|
19
|
+
<label class="layui-form-label">客户类型</label>
|
20
|
+
<div class="layui-input-inline">
|
21
|
+
<div id="execute_property" style="width: 190px;"></div>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
<div class="layui-inline">
|
25
|
+
<label class="layui-form-label">目标类别</label>
|
26
|
+
<div class="layui-input-inline">
|
27
|
+
<div id="execute_clazz" style="width: 190px;"></div>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
<div class="layui-inline">
|
31
|
+
<button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="progress_resert_btn">重置
|
32
|
+
</button>
|
33
|
+
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="progress_search_btn">检索
|
34
|
+
</button>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
</form>
|
38
|
+
<table class="layui-tab" id="finished_table" lay-filter="progressTable"></table>
|
39
|
+
</div>
|
40
|
+
<script type="text/html" id="progress_Toolbar">
|
41
|
+
<div class="layui-btn-container">
|
42
|
+
<span class="table-label">年度销售执行情况</span>
|
43
|
+
<button class="layui-btn layui-btn-primary layui-btn-sm pull-right" lay-event="export"> 导出</button>
|
44
|
+
<button class="layui-btn layui-btn-primary layui-btn-sm pull-right" lay-event="show_all" id="show_all"> 分类显示</button>
|
45
|
+
<button class="layui-btn layui-btn-default layui-btn-sm pull-right" lay-event="show_staff" id="show_staff"> 人员显示</button>
|
46
|
+
</div>
|
47
|
+
</script>
|
48
|
+
|
49
|
+
<script>
|
50
|
+
layui.use(['form', 'table', 'miniPage', 'element', 'rate', 'laydate', 'request', 'xmSelect'], function () {
|
51
|
+
|
52
|
+
var $ = layui.jquery,
|
53
|
+
form = layui.form,
|
54
|
+
laydate = layui.laydate,
|
55
|
+
request = layui.request,
|
56
|
+
table = layui.table,
|
57
|
+
rate = layui.rate,
|
58
|
+
xmSelect = layui.xmSelect,
|
59
|
+
miniPage = layui.miniPage,
|
60
|
+
dropdown = layui.dropdown;
|
61
|
+
|
62
|
+
|
63
|
+
laydate.render({
|
64
|
+
elem: '#assessment_year',
|
65
|
+
type: 'year'
|
66
|
+
});
|
67
|
+
|
68
|
+
var execute_property = xmSelect.render({
|
69
|
+
el: '#execute_property',
|
70
|
+
name: 'target_property',
|
71
|
+
data: gon.school_tags
|
72
|
+
})
|
73
|
+
|
74
|
+
var execute_clazz = xmSelect.render({
|
75
|
+
el: '#execute_clazz',
|
76
|
+
name: 'target_clazz',
|
77
|
+
data: [{value: '中标', name: '中标'}, {value: '回款', name: '回款'}, {value: '商机', name: '商机'}]
|
78
|
+
})
|
79
|
+
form.render();
|
80
|
+
form.on('submit(progress_resert_btn)', function (data) {
|
81
|
+
execute_property.setValue([]);
|
82
|
+
execute_clazz.setValue([]);
|
83
|
+
return false;
|
84
|
+
})
|
85
|
+
|
86
|
+
table.render({
|
87
|
+
elem: '#finished_table'
|
88
|
+
, toolbar: '#target_progress_toolbar'
|
89
|
+
, totalRow: true
|
90
|
+
, url: '/missions/plans/years_all_target'
|
91
|
+
, page: true
|
92
|
+
, title: "绩效考核指标完成情况" // 目前发现的作用(导出文件的文件名)
|
93
|
+
, defaultToolbar: ['exports']
|
94
|
+
, height: 'full-200'
|
95
|
+
, cols: [
|
96
|
+
[ //标题栏
|
97
|
+
{field: 'id', group: 'id', align: 'center', title: '序号', width: 80, totalRowText: '合计', rowspan: 3}
|
98
|
+
, {field: 'name', align: 'center', title: '姓名', width: 100, rowspan: 3}
|
99
|
+
, {field: 'target_clazz', align: 'center', title: '类别', width: 100, rowspan: 3}
|
100
|
+
, {field: 'year_target', align: 'center', title: '年度目标', width: 100, rowspan: 3, totalRow: true}
|
101
|
+
, {field: 'school_tag_name', align: 'center', title: '客户类型', width: 100, rowspan: 3}
|
102
|
+
, {field: 'year_clazz_target', align: 'center', title: '分项目标', width: 100, rowspan: 3, totalRow: true}
|
103
|
+
, {field: 'year_plan', title: '年度计划', width: 100, rowspan: 3, totalRow: true}
|
104
|
+
, {field: 'year_finish', title: '年度完成', width: 100, rowspan: 3, totalRow: true}
|
105
|
+
|
106
|
+
,{align: 'center', title: '1月', colspan: 3}
|
107
|
+
,{align: 'center', title: '2月', colspan: 3}
|
108
|
+
,{align: 'center', title: '3月', colspan: 3}
|
109
|
+
,{align: 'center', title: '4月', colspan: 3}
|
110
|
+
,{align: 'center', title: '5月', colspan: 3}
|
111
|
+
,{align: 'center', title: '6月', colspan: 3}
|
112
|
+
,{align: 'center', title: '7月', colspan: 3}
|
113
|
+
,{align: 'center', title: '8月', colspan: 3}
|
114
|
+
,{align: 'center', title: '9月', colspan: 3}
|
115
|
+
,{align: 'center', title: '10月', colspan: 3}
|
116
|
+
,{align: 'center', title: '11月', colspan: 3}
|
117
|
+
,{align: 'center', title: '12月', colspan: 3}
|
118
|
+
],
|
119
|
+
[
|
120
|
+
{field: 'target_1', title: '目标', width: 100, totalRow:true, hidden: true}
|
121
|
+
,{field: 'plan_1', title: '计划', width: 100, totalRow:true, hidden: true}
|
122
|
+
,{field: 'finish_1', title: '完成', width: 100, totalRow:true}
|
123
|
+
|
124
|
+
,{field: 'target_2', title: '目标', width: 100, totalRow:true}
|
125
|
+
,{field: 'plan_2', title: '计划', width: 100, totalRow:true}
|
126
|
+
,{field: 'finish_2', title: '完成', width: 100, totalRow:true}
|
127
|
+
|
128
|
+
,{field: 'target_3', title: '目标', width: 100, totalRow:true}
|
129
|
+
,{field: 'plan_3', title: '计划', width: 100, totalRow:true}
|
130
|
+
,{field: 'finish_3', title: '完成', width: 100, totalRow:true}
|
131
|
+
|
132
|
+
,{field: 'target_4', title: '目标', width: 100, totalRow:true}
|
133
|
+
,{field: 'plan_4', title: '计划', width: 100, totalRow:true}
|
134
|
+
,{field: 'finish_4', title: '完成', width: 100, totalRow:true}
|
135
|
+
|
136
|
+
,{field: 'target_5', title: '目标', width: 100, totalRow:true}
|
137
|
+
,{field: 'plan_5', title: '计划', width: 100, totalRow:true}
|
138
|
+
,{field: 'finish_5', title: '完成', width: 100, totalRow:true}
|
139
|
+
|
140
|
+
,{field: 'target_6', title: '目标', width: 100, totalRow:true}
|
141
|
+
,{field: 'plan_6', title: '计划', width: 100, totalRow:true}
|
142
|
+
,{field: 'finish_6', title: '完成', width: 100, totalRow:true}
|
143
|
+
|
144
|
+
,{field: 'target_7', title: '目标', width: 100, totalRow:true}
|
145
|
+
,{field: 'plan_7', title: '计划', width: 100, totalRow:true}
|
146
|
+
,{field: 'finish_7', title: '完成', width: 100, totalRow:true}
|
147
|
+
|
148
|
+
,{field: 'target_8', title: '目标', width: 100, totalRow:true}
|
149
|
+
,{field: 'plan_8', title: '计划', width: 100, totalRow:true}
|
150
|
+
,{field: 'finish_8', title: '完成', width: 100, totalRow:true}
|
151
|
+
|
152
|
+
,{field: 'target_9', title: '目标', width: 100, totalRow:true}
|
153
|
+
,{field: 'plan_9', title: '计划', width: 100, totalRow:true}
|
154
|
+
,{field: 'finish_9', title: '完成', width: 100, totalRow:true}
|
155
|
+
|
156
|
+
,{field: 'target_10', title: '目标', width: 100, totalRow:true}
|
157
|
+
,{field: 'plan_10', title: '计划', width: 100, totalRow:true}
|
158
|
+
,{field: 'finish_10', title: '完成', width: 100, totalRow:true}
|
159
|
+
|
160
|
+
,{field: 'target_11', title: '目标', width: 100, totalRow:true}
|
161
|
+
,{field: 'plan_11', title: '计划', width: 100, totalRow:true}
|
162
|
+
,{field: 'finish_11', title: '完成', width: 100, totalRow:true}
|
163
|
+
|
164
|
+
,{field: 'target_12', title: '目标', width: 100, totalRow:true}
|
165
|
+
,{field: 'plan_12', title: '计划', width: 100, totalRow:true}
|
166
|
+
,{field: 'finish_12', title: '完成', width: 100, totalRow:true}
|
167
|
+
|
168
|
+
]],
|
169
|
+
done : function(res, curr, count) {
|
170
|
+
var id = res.data[0]['id'];
|
171
|
+
merge(res);
|
172
|
+
if (!id) {
|
173
|
+
$("[data-field='id']").css('display', 'none');
|
174
|
+
$("[data-field='name']").css('display', 'none');
|
175
|
+
}
|
176
|
+
table.render('select');
|
177
|
+
}
|
178
|
+
|
179
|
+
});
|
180
|
+
function merge(res, id) {
|
181
|
+
var data = res.data;
|
182
|
+
var mergeIndex = 0;//定位需要添加合并属性的行数
|
183
|
+
var mark = 1; //这里涉及到简单的运算,mark是计算每次需要合并的格子数
|
184
|
+
var columsName = ['id','name','target_clazz',{name:'year_target',mergeBase:'target_clazz',valueBase:'year_clazz_target'}];//需要合并的列名称
|
185
|
+
var columsIndex = [0,1,2,3];//需要合并的列索引值
|
186
|
+
|
187
|
+
for (var k = 0; k < columsName.length; k++) { //这里循环所有要合并的列
|
188
|
+
var trArr = $(".layui-table-body>.layui-table").find("tr");//所有行
|
189
|
+
for (var i = 1; i < res.data.length; i++) { //这里循环表格当前的数据
|
190
|
+
var tdCurArr = trArr.eq(i).find("td").eq(columsIndex[k]);//获取当前行的当前列
|
191
|
+
var tdPreArr = trArr.eq(mergeIndex).find("td").eq(columsIndex[k]);//获取相同列的第一列
|
192
|
+
|
193
|
+
var opt = columsName[k];
|
194
|
+
var name = opt.name;
|
195
|
+
var mergeBase = opt.mergeBase;
|
196
|
+
var valueBase = opt.valueBase;
|
197
|
+
|
198
|
+
if(name && mergeBase){
|
199
|
+
tdCurValue = parseFloat(tdPreArr[0].querySelector('.layui-table-cell').textContent) || 0;
|
200
|
+
if(valueBase && !tdCurValue){
|
201
|
+
tdPreArr[0].querySelector('.layui-table-cell').innerHTML = data[i-1][valueBase];
|
202
|
+
}
|
203
|
+
|
204
|
+
if (data[i][mergeBase] === data[i-1][mergeBase]) { //后一行的值与前一行的值做比较,相同就需要合并
|
205
|
+
mark += 1;
|
206
|
+
tdPreArr.each(function (a,b) {//相同列的第一列增加rowspan属性
|
207
|
+
$(this).attr("rowspan", mark);
|
208
|
+
|
209
|
+
var oldV = parseFloat($(this).find('.layui-table-cell').html()) || 0;
|
210
|
+
var curentV = 0;
|
211
|
+
if(valueBase){
|
212
|
+
curentV = parseFloat(data[i][valueBase]) || 0;
|
213
|
+
}else{
|
214
|
+
curentV = parseFloat(data[i][name]) || 0;
|
215
|
+
}
|
216
|
+
var newV = oldV + curentV;
|
217
|
+
$(this).find('.layui-table-cell').html(newV);
|
218
|
+
});
|
219
|
+
tdCurArr.each(function () {//当前行隐藏
|
220
|
+
$(this).css("display", "none");
|
221
|
+
});
|
222
|
+
}else {
|
223
|
+
mergeIndex = i;
|
224
|
+
mark = 1;//一旦前后两行的值不一样了,那么需要合并的格子数mark就需要重新计算
|
225
|
+
}
|
226
|
+
}else{
|
227
|
+
if (data[i][columsName[k]] === data[i-1][columsName[k]]) { //后一行的值与前一行的值做比较,相同就需要合并
|
228
|
+
mark += 1;
|
229
|
+
tdPreArr.each(function () {//相同列的第一列增加rowspan属性
|
230
|
+
$(this).attr("rowspan", mark);
|
231
|
+
});
|
232
|
+
tdCurArr.each(function () {//当前行隐藏
|
233
|
+
$(this).css("display", "none");
|
234
|
+
});
|
235
|
+
}else {
|
236
|
+
mergeIndex = i;
|
237
|
+
mark = 1;//一旦前后两行的值不一样了,那么需要合并的格子数mark就需要重新计算
|
238
|
+
}
|
239
|
+
}
|
240
|
+
}
|
241
|
+
mergeIndex = 0;
|
242
|
+
mark = 1;
|
243
|
+
}
|
244
|
+
}
|
245
|
+
table.on('toolbar(year_all_target_form)', function (obj) {
|
246
|
+
search = form.val('assessment_progress_form')
|
247
|
+
var event = obj.event;
|
248
|
+
switch (event) {
|
249
|
+
case 'show_staff':
|
250
|
+
search.type = 'staff';
|
251
|
+
break;
|
252
|
+
case 'show_all':
|
253
|
+
search.type = 'all';
|
254
|
+
search.staff_id = '';
|
255
|
+
break;
|
256
|
+
case 'export':
|
257
|
+
layer.load(0, {});
|
258
|
+
request.authGet("missions/plans/years_all_target?=" + $.param({q: search}), {}, function (res) {
|
259
|
+
data = res.data
|
260
|
+
table.exportFile(target_table.config.id, data, 'xls');
|
261
|
+
layer.closeAll('loading');
|
262
|
+
});
|
263
|
+
break;
|
264
|
+
}
|
265
|
+
if (event === 'show_staff' || event === 'show_all') {
|
266
|
+
loadFinishTable(search);
|
267
|
+
var $ = layui.$;
|
268
|
+
var buttonId = `#${event}`;
|
269
|
+
// 移除所有按钮的 layui-btn-default 类名,添加 layui-btn-primary 类名
|
270
|
+
$(buttonId).siblings('.layui-btn').removeClass('layui-btn-default').addClass('layui-btn-primary');
|
271
|
+
$(buttonId).removeClass('layui-btn-primary').addClass('layui-btn-default');
|
272
|
+
}
|
273
|
+
});
|
274
|
+
|
275
|
+
//loadFinishTable(form.val('assessment_progress_form'))
|
276
|
+
|
277
|
+
form.on('submit(progress_search_btn)', function (data) {
|
278
|
+
var search = data.field;
|
279
|
+
loadFinishTable(search);
|
280
|
+
return false;
|
281
|
+
})
|
282
|
+
|
283
|
+
function loadFinishTable(search) {
|
284
|
+
table.reload('finished_table', {
|
285
|
+
where: search,
|
286
|
+
url: '/missions/plans/years_all_target'
|
287
|
+
});
|
288
|
+
}
|
289
|
+
|
290
|
+
})
|
291
|
+
|
292
|
+
</script>
|
293
|
+
</div>
|