From 1b57593e997159584d2e5b779f793cfe3e540ea1 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 4 Apr 2019 16:04:51 +0800
Subject: [PATCH 1/9] =?UTF-8?q?=E5=AE=8C=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/managements/_partner_member_list.html.erb | 3 ++-
app/views/managements/partners.html.erb | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/views/managements/_partner_member_list.html.erb b/app/views/managements/_partner_member_list.html.erb
index 2c4aa79e..d4384c27 100644
--- a/app/views/managements/_partner_member_list.html.erb
+++ b/app/views/managements/_partner_member_list.html.erb
@@ -1,7 +1,8 @@
<% partner.users.each do |user| %>
<%= image_tag(url_to_avatar(user)) %>
-
+
diff --git a/app/views/managements/partners.html.erb b/app/views/managements/partners.html.erb
index 4b2850ad..0f1af899 100644
--- a/app/views/managements/partners.html.erb
+++ b/app/views/managements/partners.html.erb
@@ -49,7 +49,7 @@
删除
- 2019-04-03 16:04
+ <%= format_time customer.created_at %>
<% end %>
From c18c99c7a73614378fd871dd46de4026a89e9f77 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 4 Apr 2019 16:05:45 +0800
Subject: [PATCH 2/9] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E5=91=98=E6=B6=88=E6=81=AF=E7=9A=84=E5=AE=9E=E8=AE=AD=E5=8F=8D?=
=?UTF-8?q?=E9=A6=88=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E6=8C=89=E7=85=A7?=
=?UTF-8?q?=E8=AF=84=E8=AE=BA=E6=97=B6=E9=97=B4=E6=A3=80=E7=B4=A2=E7=9A=84?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 13 +++++++++++-
.../shixun_feedback_message.html.erb | 20 ++++++++++++++++++-
.../shixun_feedback_message.js.erb | 2 +-
3 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index f571b47c..372c2bac 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -792,12 +792,22 @@ class ManagementsController < ApplicationController
@menu_type = 8
@sub_type = 2
@search = params[:search]
+ @beginTime = params[:beginTime]
+ @endTime = params[:endTime]
if @search.present?
shixun_ids = Shixun.where("name like ?", "%#{params[:search]}%").pluck(:id)
@discusses = Discuss.where(:dis_type => "Shixun", :dis_id => shixun_ids).reorder("created_at desc")
else
@discusses = Discuss.where(:dis_type => "Shixun").reorder("created_at desc")
end
+
+ if params[:beginTime] && params[:beginTime].strip != ""
+ @discusses = @discusses.where("created_at >= '#{Time.parse(params[:beginTime])}'")
+ end
+ if params[:endTime] && params[:endTime].strip != ""
+ @discusses = @discusses.where("created_at <= '#{Time.parse(params[:endTime])}'")
+ end
+
@all_discusses = @discusses
@discusses_count = @discusses.count
@limit = 20
@@ -4230,7 +4240,8 @@ end
sheet1[count_row, 5] = discusses.count
discusses.each_with_index do |discuss, j|
user = discuss.user
- sheet1[count_row, 6] = discuss.content.gsub(/ /, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】")
+ content = discuss.content.gsub(/ /, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】")
+ sheet1[count_row, 6] = strip_html content
sheet1[count_row, 7] = "第#{discuss.position}关"
sheet1[count_row, 8] = user.show_real_name
sheet1[count_row, 9] = user.identity
diff --git a/app/views/managements/shixun_feedback_message.html.erb b/app/views/managements/shixun_feedback_message.html.erb
index c987f283..ff4ecebe 100644
--- a/app/views/managements/shixun_feedback_message.html.erb
+++ b/app/views/managements/shixun_feedback_message.html.erb
@@ -2,11 +2,17 @@
<%= form_tag(url_for(shixun_feedback_message_managements_path), :id => "managements_shixuns_search", :method => "post", :remote => true ) do %>
<% end %>
@@ -17,4 +23,16 @@
function clearSearchCondition(){
$("#shixun_Look_name").val('')
}
+ $("input[name='beginTime']").datetimepicker({
+ allowBlank:true,
+ lang:'ch',
+ format:'Y-m-d H:i',
+ validateOnBlur:false
+ });
+ $("input[name='endTime']").datetimepicker({
+ allowBlank:true,
+ lang:'ch',
+ format:'Y-m-d H:i',
+ validateOnBlur:false
+ });
\ No newline at end of file
diff --git a/app/views/managements/shixun_feedback_message.js.erb b/app/views/managements/shixun_feedback_message.js.erb
index 135f4107..89ead852 100644
--- a/app/views/managements/shixun_feedback_message.js.erb
+++ b/app/views/managements/shixun_feedback_message.js.erb
@@ -1,2 +1,2 @@
$("#management_shixun_feedback_list").html("<%= j(render :partial => 'shixun_feedback_list') %>");
-$("#shixun_search").attr("href", "<%= shixun_feedback_message_managements_path(:search => @search, :format => "xls") %>")
\ No newline at end of file
+$("#shixun_search").attr("href", "<%= shixun_feedback_message_managements_path(:search => @search, :beginTime => @beginTime, :endTime => @endTime,:format => "xls") %>")
\ No newline at end of file
From d1d28d22093b1cacb43c3ded1bfb2c33f54bcdc2 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 4 Apr 2019 16:06:29 +0800
Subject: [PATCH 3/9] =?UTF-8?q?=E5=A4=B4=E5=83=8F=E5=90=8D=E7=A7=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/managements/_partner_member_list.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/managements/_partner_member_list.html.erb b/app/views/managements/_partner_member_list.html.erb
index 17e01136..daf382d1 100644
--- a/app/views/managements/_partner_member_list.html.erb
+++ b/app/views/managements/_partner_member_list.html.erb
@@ -5,6 +5,6 @@
partner_member: user.id) %>', '确定要删除该管理员吗')" class="removeImg">
-
胡莎莎
+
<%= user.show_real_name %>
<% end %>
\ No newline at end of file
From 096dd01b8af29c2f40da99d3b7fe9fef089d732f Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 4 Apr 2019 16:18:07 +0800
Subject: [PATCH 4/9] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AE=A2=E6=88=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/cooperates_controller.rb | 2 +-
app/controllers/managements_controller.rb | 9 ++++++++
.../_partner_customer_list.html.erb | 20 ++++++++++++++++
app/views/managements/delete_customers.js.erb | 1 +
app/views/managements/partners.html.erb | 23 ++-----------------
config/routes.rb | 1 +
6 files changed, 34 insertions(+), 22 deletions(-)
create mode 100644 app/views/managements/_partner_customer_list.html.erb
create mode 100644 app/views/managements/delete_customers.js.erb
diff --git a/app/controllers/cooperates_controller.rb b/app/controllers/cooperates_controller.rb
index 8a014d62..12467a36 100644
--- a/app/controllers/cooperates_controller.rb
+++ b/app/controllers/cooperates_controller.rb
@@ -23,7 +23,7 @@ class CooperatesController < ApplicationController
def find_partner
@partner = Partner.find_by_id(params[:id])
- render_404 if @partner.nil? || @partner.status == -1
+ render_404 if @partner.nil?
rescue ActiveRecord::RecordNotFound
render_404
end
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index daecbe75..8ff3e358 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -1251,6 +1251,15 @@ end
end
end
+ def delete_customers
+ if params[:customer]
+ customer = Customer.where(id: params[:customer]).first
+ @current_partner = customer.partner
+ customer.school.update_attributes(:customer_id => nil)
+ customer.destroy if customer && @current_partner
+ end
+ end
+
def all_partners
@search = params[:search]
@province = params[:province]
diff --git a/app/views/managements/_partner_customer_list.html.erb b/app/views/managements/_partner_customer_list.html.erb
new file mode 100644
index 00000000..4720fc96
--- /dev/null
+++ b/app/views/managements/_partner_customer_list.html.erb
@@ -0,0 +1,20 @@
+
+ 序号
+ 客户名称
+ +添加
+ 添加时间
+
+<% @current_partner.try(:customers).try(:each) do |customer| %>
+
+ <%= customer.school.id %>
+ <%= customer.school.name %>
+
+ 删除
+
+
+ <%= format_time customer.created_at %>
+
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/managements/delete_customers.js.erb b/app/views/managements/delete_customers.js.erb
new file mode 100644
index 00000000..6c72d223
--- /dev/null
+++ b/app/views/managements/delete_customers.js.erb
@@ -0,0 +1 @@
+$("#partner_customer_list").html("<%= j(render :partial => "partner_customer_list") %>")
\ No newline at end of file
diff --git a/app/views/managements/partners.html.erb b/app/views/managements/partners.html.erb
index 0f1af899..824c6093 100644
--- a/app/views/managements/partners.html.erb
+++ b/app/views/managements/partners.html.erb
@@ -33,27 +33,8 @@
-
-
- 序号
- 客户名称
- +添加
- 添加时间
-
- <% @current_partner.try(:customers).try(:each) do |customer| %>
-
- <%= customer.school.id %>
- <%= customer.school.name %>
-
- 删除
-
-
- <%= format_time customer.created_at %>
-
-
- <% end %>
-
+
+ <%= render :partial => "partner_customer_list" %>
diff --git a/config/routes.rb b/config/routes.rb
index ff0be82f..3acb9123 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -713,6 +713,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
post 'delete_subject_level'
post 'update_level_for_subject'
post :add_customers
+ delete :delete_customers
get :customers_list
end
end
From c95a8c60fdfa5a881de45b326a1121f9ef045401 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 4 Apr 2019 16:47:39 +0800
Subject: [PATCH 5/9] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 3 ++-
app/views/managements/_customer_addUnit.html.erb | 2 +-
app/views/managements/_partner_addManage.html.erb | 2 +-
app/views/managements/_partner_addUnit.html.erb | 2 +-
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index 8ff3e358..56d0fc72 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -1293,13 +1293,14 @@ end
if school_ids.length > 0
school_ids.each do |s|
school = School.where("id = ?",s).first
- if school.present?
+ if school.present? && school.partner_id.nil?
partner = Partner.new(name: school.name)
partner.save
school.update_attributes(:partner_id => partner.id)
end
end
end
+ render :json => {status: 1, message: "创建成功!"}
end
diff --git a/app/views/managements/_customer_addUnit.html.erb b/app/views/managements/_customer_addUnit.html.erb
index 28ff3f36..82f880f4 100644
--- a/app/views/managements/_customer_addUnit.html.erb
+++ b/app/views/managements/_customer_addUnit.html.erb
@@ -61,7 +61,7 @@
s_html = s_html+ "" +
" " +
" " +
- " " +
+ " " +
" "+array["school"]["name"]+" " +
" \n" +
" \n" +
diff --git a/app/views/managements/_partner_addManage.html.erb b/app/views/managements/_partner_addManage.html.erb
index 54a141a4..91eb6898 100644
--- a/app/views/managements/_partner_addManage.html.erb
+++ b/app/views/managements/_partner_addManage.html.erb
@@ -60,7 +60,7 @@
$.each(members,function (index,array) {
s_html = s_html+ "
" +
" " +
- " " +
+ " " +
" "+array["real_name"]+" " +
" \n" +
""+array["identity"]+" " +
diff --git a/app/views/managements/_partner_addUnit.html.erb b/app/views/managements/_partner_addUnit.html.erb
index 0d80e5a7..cb1ac7c5 100644
--- a/app/views/managements/_partner_addUnit.html.erb
+++ b/app/views/managements/_partner_addUnit.html.erb
@@ -59,7 +59,7 @@
s_html = s_html+ "
" +
" " +
" " +
- " " +
+ " " +
" "+array["school"]["name"]+" " +
" \n" +
" \n" +
From 962269895386555743b93629073ce946002a3f57 Mon Sep 17 00:00:00 2001
From: jasder
Date: Thu, 4 Apr 2019 16:50:40 +0800
Subject: [PATCH 6/9] FIX
---
app/controllers/managements_controller.rb | 1 +
app/views/managements/partners.html.erb | 8 ++++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index 69f7bdbc..6db6647d 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -1175,6 +1175,7 @@ end
@menu_type = 6
@sub_type = 3
@partners = Partner.includes(:school).order("created_at desc")
+ @partners = @partners.where("concat(schools.name) like ? ", "%#{params[:search]}%") unless params[:search].blank?
@current_partner = nil
if params[:partner]
diff --git a/app/views/managements/partners.html.erb b/app/views/managements/partners.html.erb
index 7ba9fecb..f2805058 100644
--- a/app/views/managements/partners.html.erb
+++ b/app/views/managements/partners.html.erb
@@ -1,7 +1,7 @@
@@ -75,4 +75,8 @@
})
+
+ function submit_search_partner(){
+ $.get("/managements/partners?search="+$("#partner_search").val());
+ }
\ No newline at end of file
From 14be55dca854219762d72ab7581b3f414865e45a Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 4 Apr 2019 16:55:24 +0800
Subject: [PATCH 7/9] =?UTF-8?q?=E6=9D=83=E9=99=90=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/colleges_controller.rb | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb
index c814d957..eafc1c62 100644
--- a/app/controllers/colleges_controller.rb
+++ b/app/controllers/colleges_controller.rb
@@ -254,7 +254,10 @@ class CollegesController < ApplicationController
def manager_auth
# unless (User.current.admin? || DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present?)
- unless (User.current.admin? || DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present? || (User.current.user_extensions.try(:school_id) == @department.school_id && User.current.user_extensions.try(:identity) == 0))
+ unless (User.current.admin? ||
+ DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present? ||
+ (User.current.user_extensions.try(:school_id) == @department.school_id && User.current.user_extensions.try(:identity) == 0) ||
+ @department.school.try(:partner_id) == User.current.partner_id)
render_403
end
end
From 2e3c438d79d9ac03911d60ba2b0123e2574c33f1 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 4 Apr 2019 16:59:01 +0800
Subject: [PATCH 8/9] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=A4=9A=E4=BD=99?=
=?UTF-8?q?=E7=9A=84=E5=AE=A2=E6=88=B7=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/_logined_header.html.erb | 2 --
1 file changed, 2 deletions(-)
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb
index 9e07db32..0cfd2916 100644
--- a/app/views/layouts/_logined_header.html.erb
+++ b/app/views/layouts/_logined_header.html.erb
@@ -57,8 +57,6 @@
<% end %>
<%= link_to '我的项目', user_path(User.current, :type => 'a_project') %>
-
客户管理
-
<% if User.current.department_members.count > 0 %>
<%= link_to '学院统计', statistics_college_path(User.current.department_members.first.try(:department)) %>
<% end %>
From 80cdbd6ad357ce60e8e15c52350e26236d802f4b Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 4 Apr 2019 17:11:57 +0800
Subject: [PATCH 9/9] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index 733cd1fb..31e42f05 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -1257,7 +1257,7 @@ end
customer = Customer.where(id: params[:customer]).first
@current_partner = customer.partner
customer.school.update_attributes(:customer_id => nil)
- customer.destroy if customer && @current_partner
+ customer.destroy
end
end