Merge branch 'dev_partners' into develop

dev_local
daiao 6 years ago
commit d02fec75db

@ -1,6 +1,36 @@
class CooperatesController < ApplicationController class CooperatesController < ApplicationController
before_filter :require_login
before_filter :find_partner, only: [:partner_list]
before_filter :is_admin, only: [:partner_list]
def show def partner_list
search = params[:search]
@schools = School.where(customer_id: @partner.customer_ids)
@all_count = @schools.size
unless search.blank?
@schools = @schools.where("name like ?", "%#{search}%")
end
@search_count = @schools.size
@schools = paginateHelper @schools, 15
@schools = @schools.includes(:courses, users: :user_extensions)
respond_to do |format|
format.js
format.html{render :layout => "base_edu"}
end
end
def find_partner
@partner = Partner.find_by_id(params[:id])
render_404 if @partner.nil?
rescue ActiveRecord::RecordNotFound
render_404
end
def is_admin
unless User.current.admin? || (User.current.partner.present? && User.current.partner == @partner)
render_403
end
end end
end end

@ -792,12 +792,22 @@ class ManagementsController < ApplicationController
@menu_type = 8 @menu_type = 8
@sub_type = 2 @sub_type = 2
@search = params[:search] @search = params[:search]
@beginTime = params[:beginTime]
@endTime = params[:endTime]
if @search.present? if @search.present?
shixun_ids = Shixun.where("name like ?", "%#{params[:search]}%").pluck(:id) shixun_ids = Shixun.where("name like ?", "%#{params[:search]}%").pluck(:id)
@discusses = Discuss.where(:dis_type => "Shixun", :dis_id => shixun_ids).reorder("created_at desc") @discusses = Discuss.where(:dis_type => "Shixun", :dis_id => shixun_ids).reorder("created_at desc")
else else
@discusses = Discuss.where(:dis_type => "Shixun").reorder("created_at desc") @discusses = Discuss.where(:dis_type => "Shixun").reorder("created_at desc")
end 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 @all_discusses = @discusses
@discusses_count = @discusses.count @discusses_count = @discusses.count
@limit = 20 @limit = 20
@ -1171,6 +1181,131 @@ end
end end
end end
def partners
@menu_type = 6
@sub_type = 3
@partners = Partner.includes(:school).order("created_at desc")
@current_partner = nil
if params[:partner]
@current_partner = @partners.find params[:partner]
else
@current_partner = @partners[0] if @partners.size > 0
end
@partners.each do |part|
part.active = "active" if part.id == @current_partner.id
end
end
def get_partner
@partner = Partner.find partner
end
# 添加客户
def customers_list
@search = params[:search]
@province = params[:province]
partner_id = params[:partner_id]
@partner = Partner.find partner_id
@customers = @partner.customers
if @customers.present?
@schools = School.where("(partner_id != ? or partner_id is NULL) and (customer_id is NULL or customer_id not in(#{@customers.map(&:id).join(",")}))", @partner.id)
else
@schools = School.where("partner_id != ? or partner_id is NULL", @partner.id)
end
if params[:search]
@schools = @schools.where("name like ?", "%#{@search}%")
end
if params[:province] && params[:province] != '0'
@schools = @schools.where("province like ?", "%#{@province}%")
end
@limit = 10
@page = params[:page] || 1
@schools_count = @schools.count
@total_pages = (@schools_count / 10.0).ceil
@schools = paginateHelper @schools, @limit
respond_to do |format|
format.js
format.json {
render json: @schools
}
end
end
def add_customers
school_ids = params[:school_ids]
if school_ids.length > 0
school_ids.each do |s|
school = School.where("id = ?",s).first
if school.present?
customer = Customer.new(partner_id: params[:partner_id])
customer.save!
school.update_attributes(:customer_id => customer.id)
end
end
render :json => {status: 1, message: "创建成功!"}
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]
@schools = School.where("partner_id IS NULL")
if params[:search]
@schools = @schools.where("name like ?", "%#{@search}%")
end
if params[:province] && params[:province] != '0'
@schools = @schools.where("province like ?", "%#{@province}%")
end
@limit = 10
@page = params[:page] || 1
@schools_count = @schools.count
@total_pages = (@schools_count / 10.0).ceil
@schools = paginateHelper @schools, @limit
respond_to do |format|
format.js
format.json {
render json: @schools
}
end
end
def add_partner
school_ids = params[:school_ids]
if school_ids.length > 0
school_ids.each do |s|
school = School.where("id = ?",s).first
if school.present?
partner = Partner.new(name: school.name)
partner.save
school.update_attributes(:partner_id => partner.id)
end
end
end
end
# 删除部门管理员 # 删除部门管理员
def delete_depart_member def delete_depart_member
DepartmentMember.where(:department_id => params[:depart], :user_id => params[:user_id]).destroy_all DepartmentMember.where(:department_id => params[:depart], :user_id => params[:user_id]).destroy_all
@ -1198,8 +1333,55 @@ end
@department.department_members << DepartmentMember.new(:user_id => member) @department.department_members << DepartmentMember.new(:user_id => member)
end end
end end
redirect_to partners_managments_path
# respond_to do |format|
# format.html {render :layout => "base_edu"}
# format.js
# end
end
# 添加合作伙伴管理员- 弹框
def add_partner_member_box
@partner = Partner.where(:id => params[:partner]).first
@members =
if params[:search]
User.where("LOWER(concat(lastname, firstname, nickname, mail)) LIKE '%#{params[:search]}%' AND partner_id is NULL")
else
User.where(:certification => 1, :partner_id => nil )
end
@total_pages = (@members.count / 10.0).ceil
@members = paginateHelper @members, 10
respond_to do |format|
format.js
format.json {
render json: member_json_data(@members)
}
end
end end
# 合作伙伴添加管理员
def add_partner_member
if params[:partner] && params[:partner_member]
@partner = Partner.find_by_id params[:partner]
params[:partner_member].each do |member|
user = User.find_by_id member
user.update_attributes(partner_id: @partner.id) if !@partner.nil? && !user.nil?
end
end
end
# 合作伙伴删除管理员
def delete_partner_member
if params[:partner] && params[:partner_member]
@partner = Partner.find_by_id params[:partner]
user = User.find_by_id params[:partner_member]
user.update_attributes(partner_id: nil) if !@partner.nil? && !user.nil?
end
end
# check 部门 identifier是否重复 # check 部门 identifier是否重复
def check_depart_identifier def check_depart_identifier
logger.info("###############{params}") logger.info("###############{params}")
@ -4078,7 +4260,8 @@ end
sheet1[count_row, 5] = discusses.count sheet1[count_row, 5] = discusses.count
discusses.each_with_index do |discuss, j| discusses.each_with_index do |discuss, j|
user = discuss.user user = discuss.user
sheet1[count_row, 6] = discuss.content.gsub(/<img.*\/>/, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】") content = discuss.content.gsub(/<img.*\/>/, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】")
sheet1[count_row, 6] = strip_html content
sheet1[count_row, 7] = "#{discuss.position}" sheet1[count_row, 7] = "#{discuss.position}"
sheet1[count_row, 8] = user.show_real_name sheet1[count_row, 8] = user.show_real_name
sheet1[count_row, 9] = user.identity sheet1[count_row, 9] = user.identity
@ -4217,4 +4400,19 @@ end
book.write xls_report book.write xls_report
xls_report.string xls_report.string
end end
def member_json_data mmebers
mmebers.map do |member|
real_name = member.show_real_name
identity = member.identity
school_name = member.school_name
user_phone = member.phone || ""
member.attributes.dup.except("login", "hashed_password", "salt", "status", "mail", "experience", "grade",
"authentication", "professional_certification").merge({real_name: real_name,
identity: identity,
school_name: school_name,
user_phone: user_phone})
end
end
end end

@ -0,0 +1,29 @@
class PartnersController < ApplicationController
layout 'base_management'
def index
@menu_type = 6
@sub_type = 3
@partners = Partner.includes(:school)
end
def new
end
def edit
end
def create
end
def destroy
end
private
end

@ -9,6 +9,7 @@ class PollController < ApplicationController
before_filter :require_login, :only => [:student_poll_list, :show] before_filter :require_login, :only => [:student_poll_list, :show]
include PollHelper include PollHelper
include ApplicationHelper include ApplicationHelper
def index def index
if @course.is_public == 0 && !(User.current.member_of_course?(@course)||User.current.admin?) if @course.is_public == 0 && !(User.current.member_of_course?(@course)||User.current.admin?)
render_403 render_403
@ -18,13 +19,13 @@ class PollController < ApplicationController
if @is_teacher if @is_teacher
polls = @course.polls.order("IF(ISNULL(publish_time),0,1), publish_time DESC, created_at DESC") polls = @course.polls.order("IF(ISNULL(publish_time),0,1), publish_time DESC, created_at DESC")
elsif User.current.member_of_course?(@course) elsif User.current.member_of_course?(@course) # 课堂成员显示为发布的和已发布的
member = @course.members.where(:user_id => User.current.id).first member = @course.members.where(:user_id => User.current.id).first
if member.try(:course_group_id).to_i == 0 if member.try(:course_group_id).to_i == 0
polls = @course.polls.where("publish_time <= '#{Time.now}' and unified_setting = 1").order("IF(ISNULL(publish_time),0,1),publish_time DESC, created_at DESC") polls = @course.polls.where("publish_time <= '#{Time.now}' and unified_setting = 1").order("IF(ISNULL(publish_time),0,1),publish_time DESC, created_at DESC")
else else # 已分班的成员
not_poll_ids = @course.poll_group_settings.where("course_group_id = #{member.try(:course_group_id)} and (publish_time > '#{Time.now}' or publish_time is null)") not_poll_ids = @course.poll_group_settings.where("course_group_id = #{member.try(:course_group_id)} and (publish_time > '#{Time.now}' or publish_time is null)")
not_poll_ids = not_poll_ids.blank? ? "(-1)" : "(" + not_poll_ids.map(&:poll_id).join(",") + ")" not_poll_ids = not_poll_ids.blank? ? "(-1)" : "(" + not_poll_ids.map(&:poll_id).join(",") + ")" # 已分班,但是成员不再
polls = @course.polls.where("publish_time <= '#{Time.now}' and id not in #{not_poll_ids}").order("IF(ISNULL(publish_time),0,1),publish_time DESC, created_at DESC") polls = @course.polls.where("publish_time <= '#{Time.now}' and id not in #{not_poll_ids}").order("IF(ISNULL(publish_time),0,1),publish_time DESC, created_at DESC")
end end
else else
@ -414,7 +415,6 @@ class PollController < ApplicationController
def update_poll_question def update_poll_question
@poll_question = PollQuestion.find params[:poll_question] @poll_question = PollQuestion.find params[:poll_question]
@poll = @poll_question.poll @poll = @poll_question.poll
@poll_question.is_necessary = params[:is_necessary] == "1" ? 1 : 0
@poll_question.question_title = params[:question_title].nil? || params[:question_title].empty? ? l(:label_enter_single_title) : params[:question_title] @poll_question.question_title = params[:question_title].nil? || params[:question_title].empty? ? l(:label_enter_single_title) : params[:question_title]
@poll_question.max_choices = params[:max_choices].to_i || 0 @poll_question.max_choices = params[:max_choices].to_i || 0
@poll_question.min_choices = params[:min_choices].to_i || 0 @poll_question.min_choices = params[:min_choices].to_i || 0

@ -708,6 +708,8 @@ module ApplicationHelper
when 6 when 6
if sub_type == 1 if sub_type == 1
link_to('单位列表', departments_part_managements_path()) + "#{grandchild_type[:next_type] == 1 ? " > #{grandchild_type[:school].name}" : ""}" link_to('单位列表', departments_part_managements_path()) + "#{grandchild_type[:next_type] == 1 ? " > #{grandchild_type[:school].name}" : ""}"
elsif sub_type == 3
"合作伙伴"
else else
"单位部门列表" "单位部门列表"
end end

@ -20,11 +20,11 @@
module PollHelper module PollHelper
def un_commit_num poll def un_commit_num poll
course = poll.course course = poll.course
member = course.members.where(:user_id => User.current.id).first member = course.members.where(:user_id => User.current.id).first ## 当前用户是否为课堂成员
poll_users = poll.poll_users poll_users = poll.poll_users # 问卷的全部用户,包含已回答的/为回答,但是浏览的
student_count = course.student.count student_count = course.student.count # 课堂的学生数
if member.present? && member.teacher_course_groups.count > 0 if member.present? && member.teacher_course_groups.count > 0
group_students = course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id) group_students = course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id) ## 统计当前用户所在班级的全部学生
student_count = group_students.size student_count = group_students.size
poll_users = poll_users.where(:user_id => group_students) poll_users = poll_users.where(:user_id => group_students)
end end

@ -0,0 +1,5 @@
class Customer < ActiveRecord::Base
belongs_to :partner
has_one :school
has_many :users
end

@ -53,6 +53,7 @@ class Message < ActiveRecord::Base
has_many :tidings, :as => :container , :dependent => :destroy has_many :tidings, :as => :container , :dependent => :destroy
belongs_to :reply, :class_name => 'Message', :foreign_key => 'reply_id' belongs_to :reply, :class_name => 'Message', :foreign_key => 'reply_id'
has_one :message_detail, :dependent => :destroy
#转发表 #转发表
has_many :forwards, :as => :from, :dependent => :destroy has_many :forwards, :as => :from, :dependent => :destroy
@ -117,6 +118,10 @@ class Message < ActiveRecord::Base
self.content self.content
end end
def content
self.message_detail.try(:content)
end
def topic? def topic?
parent_id.nil? parent_id.nil?
end end

@ -0,0 +1,8 @@
class Partner < ActiveRecord::Base
# attr_accessible :name, :active
attr_accessor :active
has_one :school
has_many :customers
has_many :users
end

@ -3,7 +3,8 @@
class School < ActiveRecord::Base class School < ActiveRecord::Base
attr_accessible :name, :province, :pinyin, :city, :address, :logo_link, attr_accessible :name, :province, :pinyin, :city, :address, :logo_link,
:auto_users_trial, :shool_code, :authorization_time, :auto_users_trial, :shool_code, :authorization_time,
:identifier, :is_online, :video_desc, :video_name,:course_link, :course_name :identifier, :is_online, :video_desc, :video_name,:course_link,
:course_name, :partner_id, :customer_id
has_many :courses has_many :courses
has_many :departments, :dependent => :destroy has_many :departments, :dependent => :destroy
has_many :shixun_schools, :dependent => :destroy has_many :shixun_schools, :dependent => :destroy
@ -15,6 +16,9 @@ class School < ActiveRecord::Base
has_many :ec_majors, :through => :ec_major_schools has_many :ec_majors, :through => :ec_major_schools
has_many :ec_major_schools, :dependent => :destroy has_many :ec_major_schools, :dependent => :destroy
belongs_to :partner
belongs_to :customer
# banner图片信息 # banner图片信息
has_many :school_images, :dependent => :destroy has_many :school_images, :dependent => :destroy
@ -26,4 +30,40 @@ class School < ActiveRecord::Base
def to_s def to_s
self.name.to_s self.name.to_s
end end
def teacher_count
User.find_by_sql("SELECT COUNT(users.`id`) AS teacher_count FROM users LEFT JOIN user_extensions ON
users.id=user_extensions.user_id WHERE user_extensions.`school_id` = #{self.id} AND
user_extensions.`identity` = 0").first.try(:teacher_count)
end
def student_count
User.find_by_sql("SELECT COUNT(users.`id`) AS student_count FROM users LEFT JOIN user_extensions ON
users.id=user_extensions.user_id WHERE user_extensions.`school_id` = #{self.id} AND
user_extensions.`identity` = 1").first.try(:student_count)
end
def course_count
Course.find_by_sql("SELECT COUNT(courses.`id`) AS course_count FROM courses LEFT JOIN user_extensions ON
courses.tea_id=user_extensions.user_id WHERE user_extensions.`school_id` = #{self.id} AND
courses.id != 1309").first.try(:course_count)
end
def shixun_count
Shixun.find_by_sql("select count(s.id) as shixun_count from users u right join shixuns s on u.id=s.user_id and
s.status in (2, 3) inner join user_extensions ue on u.id=ue.user_id and
ue.school_id=#{self.id}").first.try(:shixun_count)
end
def shixun_report_count
StudentWork.find_by_sql("SELECT count(*) as sw_count FROM `student_works` where user_id in
(SELECT users.id FROM users RIGHT JOIN user_extensions ON users.id=user_extensions.user_id
WHERE user_extensions.`school_id`=#{self.id}) and work_status between 1 and 2 and
myshixun_id !=0").first.try(:sw_count)
end
def statistic_url
dep = departments.where("identifier is not null").first
url = dep.present? ? "/colleges/#{dep.identifier}/statistics" : ""
end
end end

@ -160,6 +160,7 @@ class User < Principal
## added by xianbo for delete ## added by xianbo for delete
# has_many :biding_projects, :dependent => :destroy # has_many :biding_projects, :dependent => :destroy
belongs_to :softapplication, :foreign_key => 'id', :dependent => :destroy belongs_to :softapplication, :foreign_key => 'id', :dependent => :destroy
belongs_to :partner
##ended by xianbo ##ended by xianbo
#####fq #####fq

@ -9,29 +9,26 @@
<span class="column-2 fr">使用详情</span> <span class="column-2 fr">使用详情</span>
</p> </p>
<ul class="minH-560 edu-back-white pb20 courselist"> <ul class="minH-560 edu-back-white pb20 courselist">
<% @schools.each_with_index do |school, index| %>
<li class="clearfix bor-bottom-greyE" id="major_list"> <li class="clearfix bor-bottom-greyE" id="major_list">
<span class="column-No major_index">1</span> <span class="column-No major_index"><%= index + 1 %></span>
<span class="column-2">国防科技大学</span> <span class="column-2"><%= school.name %></span>
<span class="column-2">22</span> <span class="column-2"><%= school.teacher_count %></span>
<span class="column-2"> <span class="column-2"><%= school.student_count %></span>
33 <span class="column-2"><%= school.course_count %></span>
</span> <span class="column-2"><%= school.shixun_count %></span>
<span class="column-2"> <span class="column-2"><%= school.shixun_report_count %></span>
44
</span>
<span class="column-2">
55
</span>
<span class="column-2">
66
</span>
<span class="column-2 fr"> <span class="column-2 fr">
<a href="" class="color-blue">查看</a> <% if school.statistic_url != "" %>
<a href="<%= school.statistic_url %>" target="_blank" class="color-blue">查看</a>
<% else %>
--
<% end %>
</span> </span>
</li> </li>
<% end %>
</ul> </ul>
<div class="educontent edu-txt-center mb80 mt20"> <div class="educontent edu-txt-center mb80 mt20">
<div class="inline pages_user_show"> <div class="inline pages_user_show">
<ul> <ul>

@ -0,0 +1,42 @@
<div id="Auth_main">
<div class="educontent mb30 mt20">
<div class="clearfix padding20-30 bor-bottom-greyE edu-back-white">
<span class="fl font-12 mt5">
<span class="color-orange-tip mr3" id="search_partner_count"><%= @obj_count %></span>
<span class="color-grey-9">个检索结果(<span id="all_major_count"><%= @all_count %></span> 单位)</span>
</span>
<div class="fr" id="pollingPanel">
<input type="text" name="search" maxlength="20" placeholder="请输入单位名称搜索" />
<a href="javascript:void(0)" onclick="submit_search_major()"><i class="iconfont icon-sousuo font-16 color-grey-9"></i></a>
</div>
</div>
<div class="ListTableLine ListTableLines" id="partner_school_list">
<%= render :partial => "partner_item" %>
</div>
</div>
</div>
<script>
$(function(){
$("#pollingPanel").on("keydown", "input[name='search']", function(e){
// 兼容FF和IE和Opera
var theEvent = e || window.event;
var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
if (code == 13) {
//回车执行查询
submit_search_major()
}
});
});
function submit_search_major(){
$.get('/cooperates/partner_list',
{ search: $("input[name='search']").val().trim()});
}
</script>

@ -0,0 +1,2 @@
$("#partner_school_list").html("<%= j(render :partial => "partner_item") %>");
$("#search_partner_count").html("<%= @obj_count %>");

@ -52,6 +52,9 @@
<li><%= link_to '我的课堂', user_path(User.current) %></li> <li><%= link_to '我的课堂', user_path(User.current) %></li>
<li><%= link_to '我的实训', user_path(User.current, :type => 'a_shixun') %></li> <li><%= link_to '我的实训', user_path(User.current, :type => 'a_shixun') %></li>
<li><%= link_to '我的实训课程', user_path(User.current, :type => 'a_path') %></li> <li><%= link_to '我的实训课程', user_path(User.current, :type => 'a_path') %></li>
<% if User.current.partner.present? %>
<li><%= link_to '客户管理', partner_list_cooperate_path(User.current.partner) %></li>
<% end %>
<li><%= link_to '我的项目', user_path(User.current, :type => 'a_project') %></li> <li><%= link_to '我的项目', user_path(User.current, :type => 'a_project') %></li>
<li><a>客户管理</a></li> <li><a>客户管理</a></li>

@ -13,6 +13,10 @@
<%= javascript_include_tag "edu/application",'edu/base_edu','edu/account', 'baiduTemplate', 'jquery.datetimepicker.js', "edu/management", 'educoder/edu_application' %> <%= javascript_include_tag "edu/application",'edu/base_edu','edu/account', 'baiduTemplate', 'jquery.datetimepicker.js', "edu/management", 'educoder/edu_application' %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%> <%= yield :header_tags -%>
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</head> </head>
<body onload="prettyPrint();" style="height: 100%"> <body onload="prettyPrint();" style="height: 100%">
<div class="newContainer"> <!-- 页面全部内容 --> <div class="newContainer"> <!-- 页面全部内容 -->
@ -71,6 +75,7 @@
<ul class="edu-admin-nav-inner edu-absolute"> <ul class="edu-admin-nav-inner edu-absolute">
<li><%= link_to "单位列表", departments_part_managements_path, :class => "edu-admin-nav-a" %></li> <li><%= link_to "单位列表", departments_part_managements_path, :class => "edu-admin-nav-a" %></li>
<li><%= link_to "单位部门列表", departments_managements_path %></li> <li><%= link_to "单位部门列表", departments_managements_path %></li>
<li><%= link_to "合作伙伴", partners_managements_path %></li>
</ul> </ul>
</li> </li>
<li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 7 %>"><a href="javascript:void(0);" class="edu-admin-nav-a">用户</a> <li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 7 %>"><a href="javascript:void(0);" class="edu-admin-nav-a">用户</a>

@ -0,0 +1,100 @@
<div class="task-popup" style="width: 572px;">
<div class="task-popup-title clearfix">添加客户</div>
<div class="task_popup_con">
<div class="clearfix mb5 df">
<div class="flex1">
<%= render partial: "managements/customers_search_form" %>
</div>
<a href="javascript:void(0);" onclick="$('#partners_search_form').submit()" class="white-btn mt6 edu-blueback-btn fl ml15 mt55">搜索</a>
</div>
<div class="mb4 clearfix">
<p class="pl10 color-grey-6 clearfix">
<span class="fl ml25">单位</span>
<span class="fr with30">地区</span>
</p>
<div class="edu-back-skyblue clearfix pl10 over280" id="search_customers_list">
<%= render :partial => "partners_list" %>
</div>
<p class="clearfix" style="height: 20px;"><span class="fl lineh-20 none color-red" id="checkNotice"></span></p>
</div>
<li class="clearfix mt10 edu-txt-center">
<a href="javascript:void(0);" class="task-btn mr10" onclick="hideModal()">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_add_partner()">确定</a>
</li>
</div>
</div>
<script>
var i = 1; //设置当前页数
var msg_list_loading = false;
$(function() {
$(function() {
var totalpage = <%= @total_pages.to_i %>; //总页数,防止超过总页数继续滚动
var winH = $(window).height(); //页面可视区域高度
$("#search_customers_list").scroll(function() {
if (i < totalpage) { // 当滚动的页数小于总页数的时候,继续加载
var pageH = $(document.body).height();
var scrollT = $(window).scrollTop(); //滚动条top
var aa = (pageH - winH - scrollT) / winH;
console.log(aa);
if ( !msg_list_loading ){
if (aa < 0.01 ) {
get_schools(i+1)
}
}
}
});
});
});
function get_schools(page) {
var msg_list = $('#search_customers_list');
if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight - 60) {
msg_list_loading = true;
$.getJSON("<%= all_path %>?partner_id=<%= @partner.id %>page="+page+"&search="+$("#partner_name_search").val()+"&province="+$("#partner_province").val(), function(schools) {
if (schools) {
msg_list_loading = false;
var s_html = "";
$.each(schools,function (index,array) {
s_html = s_html+ "<p class='clearfix mt5'>" +
" <span class='fl with70'>" +
" <span>" +
" <input type='checkbox' name='school[id]' value='"+array["school"]["id"]+"' id='school_'"+array["school"]["id"]+"'class='magic-checkbox'>" +
" <label for='school_'"+array["school"]["id"]+">"+array["school"]["name"]+"</label>" +
" </span>\n" +
" </span>\n" +
" <span class='fl with30'>"+array["school"]["province"]+"</span>" +
" </p>"
});
$("#search_customers_list").append(s_html);
i ++;
}
});
}
}
function submit_add_partner(){
if($("input[name='school[]']:checked").length==0){
$("#checkNotice").html("请选择需要添加的内容").removeClass("none");
return;
}else{
var checked_array = [];
$("input[name='school[]']:checked").each(function () {
checked_array.push($(this).val())
});
$.ajax({
url: "/managements/add_customers",
type: 'POST',
data: {school_ids: checked_array, partner_id: <%= @partner.id %>},
success: function (e) {
if(e.status === 1){
hideModal();
window.location.href = "<%= partners_managements_path(partner: @partner.id) %>";
}
}
})
}
}
</script>

@ -0,0 +1,19 @@
<%= form_for "", :url => {:controller=> 'managements', :action => 'customers_list', :partner_id => @partner.id}, :html => {:id => 'partners_search_form'}, :method => "get", :remote => true do |f| %>
<div class="df">
<span class="fl lineh-35">地区:</span>
<select placeholder="请选择地区" name="province" id="partner_province" class="flex1"></select>
</div>
<div class="df mt15">
<span class="fl lineh-35">单位:</span>
<input type="text" class="input-flex-35" name="search" placeholder="请输入单位关键字" id="partner_name_search"/>
</div>
<% end %>
<script>
$(function () {
unitDownOption();
showprovince("partner_province");
})
</script>

@ -1,29 +1,9 @@
<div class="task-popup" style="width: 572px;"> <div class="task-popup" style="width: 572px;">
<div class="task-popup-title clearfix">添加管理员</div> <div class="task-popup-title clearfix">添加管理员</div>
<div class="task_popup_con"> <div class="task_popup_con">
<div class="clearfix mb20" id="add_major_manager"> <div class="df mb20" id="add_major_manager">
<li class=""> <input type="text" class="input-flex-35 color-grey-3" name="search" id="partner_member_search" placeholder="输入用户的姓名、昵称、邮箱进行搜索"/>
<input id="object_id" type="hidden" value=""> <a href="javascript:void(0);" onclick="submit_search_user()" class="white-btn mt6 edu-blueback-btn ml15">搜索</a>
<input id="object_type" type="hidden" value="">
<p class="clearfix mb15">
<span class="fl">姓名:<input placeholder="请输入真实姓名" type="text" name="name" class="winput-120-30 greyInput"/></span>
<span class="ml20 fl">单位:<input placeholder="请输入单位名称" name="school" value="" type="text" class="winput-240-30 greyInput"/></span>
</p>
<div class="df">
<span class="fl lineh-35">职业:</span>
<div class="pr flex1" select-for>
<input type="hidden" name="identity">
<input type="text" class="input-100-35 color-grey-3" readonly value="请选择职业" placeholder="请选择职业"/>
<div class="down-select bor-grey-e user_bg_shadow" id="vecation_option">
<p>请选择职业</p>
<p data-shixun-value="0">教师</p>
<p data-shixun-value="1">学生</p>
<p data-shixun-value="2">专业人士</p>
</div>
</div>
<a href="javascript:void(0);" onclick="submit_search_user()" class="white-btn mt6 edu-blueback-btn fl ml15">搜索</a>
</div>
</li>
</div> </div>
<div class="mb20 clearfix"> <div class="mb20 clearfix">
<p class="pl10 color-grey-6 clearfix"> <p class="pl10 color-grey-6 clearfix">
@ -32,28 +12,14 @@
<span class="fl edu-txt-w200 edu-txt-left">单位</span> <span class="fl edu-txt-w200 edu-txt-left">单位</span>
<span class="fl edu-txt-w100 edu-txt-center">手机号</span> <span class="fl edu-txt-w100 edu-txt-center">手机号</span>
</p> </p>
<div class="edu-back-skyblue clearfix pl10 over280" id="serch_user_list"> <%= form_for @partner, :url => add_partner_member_managements_path,:html => {:id => 'add_partner_member_form', :remote => true, :method => :post} do |f| %>
<p class="clearfix"> <input type="hidden" value="<%= @partner.id %>" name="partner">
<span class="fl edu-txt-w90"> <div class="edu-back-skyblue clearfix pl10 over280" id="member_search_user_list">
<input type="checkbox" name="user_id[]" value="12545" id="user_12545" class="magic-checkbox"> <%= render :partial => "partner_member_search_list" %>
<label for="user_12545">李健</label>
</span>
<span class="fl edu-txt-w90 mt5 edu-txt-center color-grey-6 pointer">学生</span>
<span class="fl task-hide edu-txt-w200 mt5 edu-txt-left color-grey-9">湖北工业大学 </span>
<span class="fl edu-txt-w100 mt5 edu-txt-center color-grey-9">156****9087</span>
</p>
<p class="clearfix">
<span class="fl edu-txt-w90">
<input type="checkbox" name="user_id[]" value="12545" id="user_12545" class="magic-checkbox">
<label for="user_12545">李健</label>
</span>
<span class="fl edu-txt-w90 mt5 edu-txt-center color-grey-6 pointer">学生</span>
<span class="fl task-hide edu-txt-w200 mt5 edu-txt-left color-grey-9">湖北工业大学 </span>
<span class="fl edu-txt-w100 mt5 edu-txt-center color-grey-9"></span>
</p>
</div> </div>
<% end %>
</div> </div>
<p class="color-orange-tip" id="form_notice"></p> <p class="clearfix none color-red edu-txt-left" id="form_notice">请至少选择一个用户</p>
<li class="clearfix mt10 edu-txt-center"> <li class="clearfix mt10 edu-txt-center">
<a href="javascript:void(0);" class="task-btn mr10" onclick="hideModal()">取消</a> <a href="javascript:void(0);" class="task-btn mr10" onclick="hideModal()">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_add_manager()">确定</a> <a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_add_manager()">确定</a>
@ -61,10 +27,68 @@
</div> </div>
</div> </div>
<script> <script>
var member_i = 1; //设置当前页数
var msg_list_loading = false;
$(function() {
var totalpage = <%= @total_pages.to_i %>; //总页数,防止超过总页数继续滚动
var winH = $(window).height(); //页面可视区域高度
$("#member_search_user_list").scroll(function() {
if (member_i < totalpage) { // 当滚动的页数小于总页数的时候,继续加载
var pageH = $(document.body).height();
var scrollT = $(window).scrollTop(); //滚动条top
var aa = (pageH - winH - scrollT) / winH;
console.log(aa);
if ( !msg_list_loading ){
if (aa < 0.01 ) {
get_schools(member_i+1)
}
}
}
});
});
function get_schools(page) {
var msg_list = $('#member_search_user_list');
if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight - 60) {
msg_list_loading = true;
$.getJSON("/managements/add_partner_member_box?partner=<%= @partner.id %>&search="+$("#partner_member_search").val()+"&page="+page, function(members) {
if (members) {
msg_list_loading = false;
var s_html = "";
$.each(members,function (index,array) {
s_html = s_html+ "<p class='clearfix'>" +
" <span class='fl edu-txt-w90'>" +
" <input type='checkbox' name='partner_member[]' value='"+array["id"]+"' id='user_'"+array["id"]+"'class='magic-checkbox'>" +
" <label for='user_'"+array["id"]+">"+array["real_name"]+"</label>" +
" </span>\n" +
"<span class='fl edu-txt-w90 mt5 edu-txt-center color-grey-6 pointer'>"+array["identity"]+"</span>" +
"<span class=\"fl task-hide edu-txt-w200 mt5 edu-txt-left color-grey-9\">"+array["school_name"]+"</span>" +
"<span class=\"fl edu-txt-w100 mt5 edu-txt-center color-grey-9\">"+array["user_phone"]+"</span>" +
" </p>"
});
$("#member_search_user_list").append(s_html);
member_i ++;
}
});
}
}
function submit_add_manager(){
if($("input[name='partner_member[]']:checked").length == 0){
$("#form_notice").show();
} else {
$("#form_notice").hide();
$("#add_partner_member_form").submit();
hideModal();
}
}
$(function() { $(function() {
unitDownOption(); unitDownOption();
$("#add_major_manager").on("keydown", "input[name='name'],input[name='school']", function(e){ $("#add_major_manager").on("keydown", "input[name='search']", function(e){
// 兼容FF和IE和Opera // 兼容FF和IE和Opera
var theEvent = e || window.event; var theEvent = e || window.event;
var code = theEvent.keyCode || theEvent.which || theEvent.charCode; var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
@ -73,12 +97,10 @@
submit_search_user(); submit_search_user();
} }
}); });
})
function submit_search_user(){ function submit_search_user(){
if($("input[name='name']").val()==""){ $.get("/managements/add_partner_member_box?partner=<%= @partner.id %>&search="+$("#partner_member_search").val());
$("input[name='name']").addClass("bor-red");
return;
}
} }
})
</script> </script>

@ -1,55 +1,23 @@
<div class="task-popup" style="width: 572px;"> <div class="task-popup" style="width: 572px;">
<div class="task-popup-title clearfix">添加合作伙伴</div> <div class="task-popup-title clearfix">添加合作伙伴</div>
<div class="task_popup_con"> <div class="task_popup_con">
<div class="clearfix mb20 df"> <div class="clearfix mb5 df">
<div class="flex1"> <div class="flex1">
<div class="df"> <%= render partial: "managements/partner_search_form" %>
<span class="fl lineh-35">地区:</span>
<select placeholder="请选择地区" id="province" class="flex1"></select>
</div> </div>
<div class="df mt15"> <a href="javascript:void(0);" onclick="$('#partners_search_form').submit()" class="white-btn mt6 edu-blueback-btn fl ml15 mt55">搜索</a>
<span class="fl lineh-35">单位:</span>
<input placeholder="请输入单位关键字" class="input-flex-35"/>
</div> </div>
</div> <div class="mb4 clearfix">
<a href="javascript:void(0);" onclick="submit_search_user()" class="white-btn mt6 edu-blueback-btn fl ml15 mt55">搜索</a>
</div>
<div class="mb20 clearfix">
<p class="pl10 color-grey-6 clearfix"> <p class="pl10 color-grey-6 clearfix">
<span class="fl ml25">单位</span> <span class="fl ml25">单位</span>
<span class="fr with30">地区</span> <span class="fr with30">地区</span>
</p> </p>
<div class="edu-back-skyblue clearfix pl10 over280" id="serch_user_list"> <div class="edu-back-skyblue clearfix pl10 over280" id="search_user_list">
<p class="clearfix mt5"> <%= render :partial => "partners_list" %>
<span class="fl with70">
<span>
<input type="checkbox" name="user_id[]" value="1" id="user_1" class="magic-checkbox">
<label for="user_1">国防科技大学</label>
</span>
</span>
<span class="fl with30">湖南</span>
</p>
<p class="clearfix mt5">
<span class="fl with70">
<span>
<input type="checkbox" name="user_id[]" value="12" id="user_12" class="magic-checkbox">
<label for="user_12">国防科技大学</label>
</span>
</span>
<span class="fl with30">湖南</span>
</p>
<p class="clearfix mt5">
<span class="fl with70">
<span>
<input type="checkbox" name="user_id[]" value="125" id="user_125" class="magic-checkbox">
<label for="user_125">国防科技大学</label>
</span>
</span>
<span class="fl with30">湖南</span>
</p>
</div> </div>
<p class="clearfix" style="height: 20px;"><span class="fl lineh-20 none color-red" id="checkNotice"></span></p> <p class="clearfix" style="height: 20px;"><span class="fl lineh-20 none color-red" id="checkNotice"></span></p>
</div> </div>
<li class="clearfix mt10 edu-txt-center"> <li class="clearfix mt10 edu-txt-center">
<a href="javascript:void(0);" class="task-btn mr10" onclick="hideModal()">取消</a> <a href="javascript:void(0);" class="task-btn mr10" onclick="hideModal()">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_add_partner()">确定</a> <a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_add_partner()">确定</a>
@ -57,15 +25,74 @@
</div> </div>
</div> </div>
<script> <script>
var i = 1; //设置当前页数
var msg_list_loading = false;
$(function() { $(function() {
unitDownOption(); var totalpage = <%= @total_pages.to_i %>; //总页数,防止超过总页数继续滚动
showprovince("province"); var winH = $(window).height(); //页面可视区域高度
})
$("#search_user_list").scroll(function() {
if (i < totalpage) { // 当滚动的页数小于总页数的时候,继续加载
var pageH = $(document.body).height();
var scrollT = $(window).scrollTop(); //滚动条top
var aa = (pageH - winH - scrollT) / winH;
console.log(aa);
if ( !msg_list_loading ){
if (aa < 0.01 ) {
get_schools(i+1)
}
}
}
});
});
function get_schools(page) {
var msg_list = $('#search_user_list');
if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight - 60) {
msg_list_loading = true;
$.getJSON("<%= all_path %>?page="+page+"&search="+$("#partner_name_search").val()+"&province="+$("#partner_province").val(), function(schools) {
if (schools) {
msg_list_loading = false;
var s_html = "";
$.each(schools,function (index,array) {
s_html = s_html+ "<p class='clearfix mt5'>" +
" <span class='fl with70'>" +
" <span>" +
" <input type='checkbox' name='school[id]' value='"+array["school"]["id"]+"' id='school_'"+array["school"]["id"]+"'class='magic-checkbox'>" +
" <label for='school_'"+array["school"]["id"]+">"+array["school"]["name"]+"</label>" +
" </span>\n" +
" </span>\n" +
" <span class='fl with30'>"+array["school"]["province"]+"</span>" +
" </p>"
});
$("#search_user_list").append(s_html);
i ++;
}
});
}
}
function submit_add_partner(){ function submit_add_partner(){
if($("input[name='user_id[]']:checked").length==0){ if($("input[name='school[]']:checked").length==0){
$("#checkNotice").html("请选择需要添加的内容").removeClass("none"); $("#checkNotice").html("请选择需要添加的内容").removeClass("none");
return; return;
}else{
var checked_array = [];
$("input[name='school[]']:checked").each(function () {
checked_array.push($(this).val())
});
$.ajax({
url: "/managements/add_partner",
type: 'POST',
data: {school_ids: checked_array},
success: function (e) {
if(e.status === 1){
hideModal();
window.location.href = "<%= partners_managements_path %>";
} }
} }
})
}
}
</script> </script>

@ -0,0 +1,20 @@
<li class="clearfix tableHead">
<span>序号</span>
<span>客户名称</span>
<span><a href="<%= customers_list_managements_path(:partner_id => @current_partner.try(:id)) %>"
data-remote="true" class="color-blue">+添加</a></span>
<span>添加时间</span>
</li>
<% @current_partner.try(:customers).try(:each) do |customer| %>
<li>
<span><%= customer.school.id %></span>
<span class="task-hide"><%= customer.school.name %></span>
<span>
<a href="javascript:void(0)" onclick="delete_confirm_box_2('<%= delete_customers_managements_path(customer: customer.id) %>',
'确定要删除该客户吗')" class="color-grey-9">删除</a>
</span>
<span>
<%= format_time customer.created_at %>
</span>
</li>
<% end %>

@ -0,0 +1,10 @@
<% partner.users.each do |user| %>
<li>
<%= image_tag(url_to_avatar(user)) %>
<a href="javascript:void(0)" onclick="delete_confirm_box_2('<%= delete_partner_member_managements_path(partner: partner.id,
partner_member: user.id) %>', '确定要删除该管理员吗')" class="removeImg">
<i class="iconfont icon-htmal5icon19 color-grey-9"></i>
</a>
<span class="task-hide managementName"><%= user.show_real_name %></span>
</li>
<% end %>

@ -0,0 +1,11 @@
<% @members.each do |member| %>
<p class="clearfix">
<span class="fl edu-txt-w90">
<input type="checkbox" name="partner_member[]" value="<%= member.id %>" id="user_<%= member.id %>" class="magic-checkbox">
<label for="user_<%= member.id %>"><%= member.show_real_name %></label>
</span>
<span class="fl edu-txt-w90 mt5 edu-txt-center color-grey-6 pointer"><%= member.identity %></span>
<span class="fl task-hide edu-txt-w200 mt5 edu-txt-left color-grey-9"><%= member.school_name %> </span>
<span class="fl edu-txt-w100 mt5 edu-txt-center color-grey-9"><%= member.phone %></span>
</p>
<% end %>

@ -0,0 +1,19 @@
<%= form_for "", :url => {:controller=> 'managements', :action => 'all_partners', :type => @type}, :html => {:id => 'partners_search_form'}, :method => "get", :remote => true do |f| %>
<div class="df">
<span class="fl lineh-35">地区:</span>
<select placeholder="请选择地区" name="province" id="partner_province" class="flex1"></select>
</div>
<div class="df mt15">
<span class="fl lineh-35">单位:</span>
<input type="text" class="input-flex-35" name="search" placeholder="请输入单位关键字" id="partner_name_search"/>
</div>
<% end %>
<script>
$(function () {
unitDownOption();
showprovince("partner_province");
})
</script>

@ -0,0 +1,11 @@
<% @schools.each do |school| %>
<p class='clearfix mt5'>
<span class='fl with70'>
<span>
<input type='checkbox' name='school[]' value='<%= school.id %>' id='school_<%= school.id %>' class='magic-checkbox'>
<label for='school_<%= school.id %>'><%= school.name %></label>
</span>
</span>
<span class='fl with30'><%= school.province %></span>
</p>
<% end %>

@ -37,13 +37,13 @@
<td><%= format_time career.created_at %></td> <td><%= format_time career.created_at %></td>
<td><%= format_time career.published_at %></td> <td><%= format_time career.published_at %></td>
<td> <td>
<% if !career.status %> <%# if !career.status %>
<a href="javascript:void(0)" class="color-grey-6" onclick="post_confirm_box('<%= published_career_managements_path(:id => career.id) %>', '是否确定执行发布操作?')">发布</a> <!-- <a href="javascript:void(0)" class="color-grey-6" onclick="post_confirm_box('<%= published_career_managements_path(:id => career.id) %>', '是否确定执行发布操作?')">发布</a>-->
<% end %> <%# end %>
<a href="<%= edit_introduction_career_path(career) %>" class="color-grey-6" target="_blank">编辑</a> <!-- <a href="<%#= edit_introduction_career_path(career) %>" class="color-grey-6" target="_blank">编辑</a>-->
<% if !career.status %> <%# if !career.status %>
<a href="javascript:void(0)" class="color-grey-6" onclick="delete_confirm_box_2('<%= delete_career_managements_path(:id => career.id) %>', '是否确定执行删除操作?')">删除</a> <!-- <a href="javascript:void(0)" class="color-grey-6" onclick="delete_confirm_box_2('<%= delete_career_managements_path(:id => career.id) %>', '是否确定执行删除操作?')">删除</a>-->
<% end %> <%# end %>
</td> </td>
</tr> </tr>
<% end %> <% end %>

@ -24,7 +24,11 @@
<span class="mr45 color-grey-9 fl">管理员</span> <span class="mr45 color-grey-9 fl">管理员</span>
<ul class="manageList"> <ul class="manageList">
<li><a href="javascript:void(0)" class="addManage">+</a></li> <li><a href="javascript:void(0)" class="addManage">+</a></li>
<li><img src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=105293018,2500805440&fm=27&gp=0.jpg"/><a href="javascript:void(0)" class="removeImg"><i class="iconfont icon-htmal5icon19 color-grey-9"></i></a></li> <li>
<img src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=105293018,2500805440&fm=27&gp=0.jpg"/>
<a href="javascript:void(0)" class="removeImg"><i class="iconfont icon-htmal5icon19 color-grey-9"></i></a>
<span class="task-hide manageName">胡莎莎</span>
</li>
</ul> </ul>
</div> </div>
</div> </div>

@ -0,0 +1 @@
$("#partner_member_list").html("<%= j(render :partial => "partner_member_list", :locals => {partner: @partner}) %>")

@ -0,0 +1,6 @@
<% if params[:search] %>
$("#member_search_user_list").html("<%= j(render :partial => "partner_member_search_list") %>")
<% else %>
var html="<%= escape_javascript(render :partial => "managements/partner_addManage") %>";
pop_box_new(html,572,500);
<% end %>

@ -0,0 +1,6 @@
<% if params[:search] %>
$("#search_user_list").html("<%= j(render :partial => "partners_list") %>")
<% else %>
var html="<%= escape_javascript(render :partial => "managements/partner_addUnit",locals: {all_path: all_partners_managements_path}) %>";
pop_box_new(html,572,500);
<% end %>

@ -0,0 +1,6 @@
<% if params[:search] %>
$("#search_customers_list").html("<%= j(render :partial => "partners_list") %>")
<% else %>
var html="<%= escape_javascript(render :partial => "managements/customer_addUnit",locals: {all_path: customers_list_managements_path}) %>";
pop_box_new(html,572,500);
<% end %>

@ -0,0 +1 @@
$("#partner_customer_list").html("<%= j(render :partial => "partner_customer_list") %>")

@ -0,0 +1 @@
$("#partner_member_list").html("<%= j(render :partial => "partner_member_list", :locals => {partner: @partner}) %>")

@ -0,0 +1,53 @@
<div class="mt20">
<div class="clearfix edu-back-white padding20-30">
<input class="fl task-form-20 task-height-30" placeholder="输入合作伙伴名称进行搜索">
<a href="javascript:void(0)" class="fl task-btn task-btn-orange ml10">搜索</a>
<a href="javascript:void(0)" class="fl task-btn ml10">清除</a>
</div>
<div class="clearfix mt20">
<div class="with25 fl edu-back-white">
<%= link_to "+添加",all_partners_managements_path,remote:true,class:"color-blue addOperation" %>
<ul class="partnerList">
<% @partners.each_with_index do |partner,index| %>
<li>
<%= link_to "#{partner.name}", partners_managements_path(:partner => partner), :class => "#{partner.active}" %>
</li>
<% end %>
</ul>
</div>
<% if @current_partner.present? %>
<div class="with75 fl pl20">
<div class="edu-back-white">
<div>
<div class="padding10-20">
<p class="mb20"><span class="mr30 color-grey-9">添加时间</span><span class="color-grey-6"><%= format_time @current_partner.try(:created_at) %></span></p>
<div class="clearfix">
<span class="mr45 color-grey-9 fl">管理员</span>
<ul class="manageList">
<li>
<%= link_to '+', add_partner_member_box_managements_path(:partner => @current_partner.try(:id)), :remote => true, :class => "addManage" %>
</li>
<div id="partner_member_list" class="fl">
<%= render :partial => "partner_member_list", :locals => {partner: @current_partner} %>
</div>
</ul>
</div>
</div>
<div class="tableList" id="partner_customer_list">
<%= render :partial => "partner_customer_list" %>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
<script>
$(function(){
$(".partnerList li").on("click","a",function(){
$(".partnerList li a").removeClass("active");
$(this).addClass("active");
})
})
</script>

@ -2,11 +2,17 @@
<%= form_tag(url_for(shixun_feedback_message_managements_path), :id => "managements_shixuns_search", :method => "post", :remote => true ) do %> <%= form_tag(url_for(shixun_feedback_message_managements_path), :id => "managements_shixuns_search", :method => "post", :remote => true ) do %>
<div class="edu-con-top clearfix mb20"> <div class="edu-con-top clearfix mb20">
<input class="fl task-form-20 task-height-30 ml25" id="shixun_Look_name" name="search" maxlength="" placeholder="输入实训名称关键字进行搜索" type="text" style="height: 21px;"> <input class="fl task-form-20 task-height-30 ml25" id="shixun_Look_name" name="search" maxlength="" placeholder="输入实训名称关键字进行搜索" type="text" style="height: 21px;">
<li class="fl">
<span class="mr10 ml10 font-14">发布时间</span>
<input type="text" name="beginTime" readonly placeholder="请选择开始时间" class="winput-150-30 mr10"/>
<input type="text" name="endTime" readonly placeholder="请选择结束时间" class="winput-150-30"/>
</li>
<li class="fl ml10"> <li class="fl ml10">
<a href="javascript:void(0)" class="task-btn task-btn-orange" onclick="$('#managements_shixuns_search').submit();">搜索</a> <a href="javascript:void(0)" class="task-btn task-btn-orange" onclick="$('#managements_shixuns_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="task-btn mr10">清除</a> <a href="javascript:clearSearchCondition();" class="task-btn mr10">清除</a>
</li> </li>
<a href="<%= shixun_feedback_message_managements_path(:search => @search, :format => "xls") %>" id="shixun_search" class="task-btn mr10 task-btn-orange fr">导出</a> <a href="<%= shixun_feedback_message_managements_path(:search => @search, :beginTime => @beginTime, :endTime => @endTime,:format => "xls") %>" id="shixun_search" class="task-btn mr10 task-btn-orange fr">导出</a>
</div> </div>
<% end %> <% end %>
<div class="ex_container" id="management_shixun_feedback_list"> <div class="ex_container" id="management_shixun_feedback_list">
@ -17,4 +23,16 @@
function clearSearchCondition(){ function clearSearchCondition(){
$("#shixun_Look_name").val('') $("#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
});
</script> </script>

@ -1,2 +1,2 @@
$("#management_shixun_feedback_list").html("<%= j(render :partial => 'shixun_feedback_list') %>"); $("#management_shixun_feedback_list").html("<%= j(render :partial => 'shixun_feedback_list') %>");
$("#shixun_search").attr("href", "<%= shixun_feedback_message_managements_path(:search => @search, :format => "xls") %>") $("#shixun_search").attr("href", "<%= shixun_feedback_message_managements_path(:search => @search, :beginTime => @beginTime, :endTime => @endTime,:format => "xls") %>")

@ -1,86 +0,0 @@
<div id="Auth_main">
<div class="educontent clearfix edu-back-white bor-bottom-greyE">
<div class="padding20-30">
<!-- <p class="mb20"><span class="font-18 mr20">管理员</span><span class="font-12 color-grey-9"></span></p>-->
<!-- <ul class="clearfix managerPanels">-->
<!-- <a class="fl relative">-->
<!-- <img alt="头像" class="radius" height="48" src="https://www.educoder.net/images/avatars/User/6?1543479003" width="48" />-->
<!-- <i class="iconfont icon-shanchudiao userimg color-grey-9" ></i>-->
<!-- <span class="color-black">达达老师</span>-->
<!-- </a>-->
<!-- <a class="fl relative">-->
<!-- <i class="iconfont icon-tianjiafangda useradd color-grey-9"></i>-->
<!-- </a>-->
<!-- </ul>-->
<!-- <ul class="clearfix managerPanels">-->
<!-- <a class="fl font-16 padding5-20 block mr30 navItem active color-blue"><span class="fl">实训回复</span></a>-->
<!-- </ul>-->
</div>
</div>
<div class="educontent mb30">
<div class="clearfix padding20-30 bor-bottom-greyE edu-back-white">
<span class="fl font-12 mt5">
<span class="color-orange-tip mr3" id="search_major_count"><%= @obj_count %></span>
<span class="color-grey-9">个检索结果(<span id="all_major_count"><%= @major_count %></span> 单位)</span>
</span>
<div class="fr" id="pollingPanel">
<input type="text" name="search" placeholder="请输入单位名称搜索" />
<a href="javascript:void(0)" onclick="submit_search_major()"><i class="iconfont icon-sousuo font-16 color-grey-9"></i></a>
</div>
</div>
<div class="ListTableLine ListTableLines" id="school_major_list">
<%= render :partial => "department_list" %>
</div>
</div>
</div>
<script>
$(function(){
$(".MajorName i").click(function(){
$(this).parents(".MajorName").remove();
});
$("#school_major_list").on("click", ".addMajorManager", function(){
if($("#major_managers_"+$(this).attr("data-major-id")).children("span").length < 5){
var html="<%= escape_javascript(render :partial => "ecs/authList_addUnit") %>";
pop_box_new(html,572,500);
$("#object_id").val($(this).attr("data-major-id"));
$("#object_type").val('major');
$("input[name='school']").val('<%= @school.name %>');
} else {
notice_box("只能配置5个专业管理员");
}
});
$("#pollingPanel").on("keydown", "input[name='search']", function(e){
// 兼容FF和IE和Opera
var theEvent = e || window.event;
var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
if (code == 13) {
//回车执行查询
submit_search_major()
}
});
});
function submit_search_major(){
$.get('/ecs/department?school_id=<%= @school.id %>',
{ search: $("input[name='search']").val().trim()});
}
</script>

@ -40,6 +40,15 @@ RedmineApp::Application.routes.draw do ## oauth相关
post 'ecloud/ps_update', to: 'ecloud#ps_update' post 'ecloud/ps_update', to: 'ecloud#ps_update'
resources :cooperates do
member do
get 'partner_list'
end
collection do
end
end
resources :ec_course_evaluations do resources :ec_course_evaluations do
member do member do
match 'import_score', :via => [:post] match 'import_score', :via => [:post]
@ -544,6 +553,13 @@ RedmineApp::Application.routes.draw do ## oauth相关
match 'classroom', :via => [:get, :post] match 'classroom', :via => [:get, :post]
post 'import_departments' post 'import_departments'
match 'departments', :via => [:get, :post] match 'departments', :via => [:get, :post]
get 'partners'
get 'add_partner_member_box'
post 'add_partner_member'
delete 'delete_partner_member'
get 'get_partner'
get 'all_partners'
post 'add_partner'
delete 'delete_depart_member' delete 'delete_depart_member'
get 'add_depart_member_box' get 'add_depart_member_box'
post 'add_depart_member' post 'add_depart_member'
@ -696,6 +712,9 @@ RedmineApp::Application.routes.draw do ## oauth相关
post 'rename_subject_level' post 'rename_subject_level'
post 'delete_subject_level' post 'delete_subject_level'
post 'update_level_for_subject' post 'update_level_for_subject'
post :add_customers
delete :delete_customers
get :customers_list
end end
end end
# Enable Grack support # Enable Grack support

@ -0,0 +1,9 @@
class CreatePartners < ActiveRecord::Migration
def change
create_table :partners do |t|
t.string :name
t.timestamps
end
end
end

@ -0,0 +1,10 @@
class CreateCustomers < ActiveRecord::Migration
def change
create_table :customers do |t|
t.references :partner
t.timestamps
end
add_index :customers, :partner_id
end
end

@ -0,0 +1,8 @@
class AddPartnerIdAndCustomerIdToSchools < ActiveRecord::Migration
def change
add_column :schools, :partner_id, :integer
add_index :schools, :partner_id
add_column :schools, :customer_id, :integer
add_index :schools, :customer_id
end
end

@ -0,0 +1,6 @@
class AddPartnerIdToUsers < ActiveRecord::Migration
def change
add_column :users, :partner_id, :integer
add_index :users, :partner_id
end
end

@ -4,4 +4,4 @@ You are allowed to:
1. Remove rake task 1. Remove rake task
2. Add existing rake tasks 2. Add existing rake tasks
To add existing rake tasks automatically delete this file and reload the project. To add existing rake tasks automatically delete this file and reload the project.
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Run the given task for all appraisals" fullCmd="appraisal" taksId="appraisal" /><RakeGroup description="" fullCmd="" taksId="appraisal"><RakeTask description="DEPRECATED: Remove all generated gemfiles from gemfiles/ folder" fullCmd="appraisal:cleanup" taksId="cleanup" /><RakeTask description="DEPRECATED: Generate a Gemfile for each appraisal" fullCmd="appraisal:gemfiles" taksId="gemfiles" /><RakeTask description="DEPRECATED: Resolve and install dependencies for each appraisal" fullCmd="appraisal:install" taksId="install" /><RakeTask description="" fullCmd="appraisal:all" taksId="all" /></RakeGroup><RakeTask description="Run tests for bench" fullCmd="bench" taksId="bench" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Remove RDoc HTML files" fullCmd="clobber_rdoc" taksId="clobber_rdoc" /><RakeTask description="Build RDoc HTML files" fullCmd="rdoc" taksId="rdoc" /><RakeTask description="Rebuild RDoc HTML files" fullCmd="rerdoc" taksId="rerdoc" /><RakeTask description="Run tests" fullCmd="test" taksId="test" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="html" taksId="html" /><RakeTask description="" fullCmd="html/index.html" taksId="html/index.html" /><RakeTask description="" fullCmd="file" taksId="file" /><RakeTask description="" fullCmd="test_all" taksId="test_all" /></RakeGroup></Settings> --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>

@ -4,4 +4,4 @@ You are allowed to:
1. Remove rake task 1. Remove rake task
2. Add existing rake tasks 2. Add existing rake tasks
To add existing rake tasks automatically delete this file and reload the project. To add existing rake tasks automatically delete this file and reload the project.
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build gitlab-3.2.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install gitlab-3.2.0.gem into system gems" fullCmd="install" taksId="install" /><RakeTask description="Create tag v3.2.0 and build and push gitlab-3.2.0.gem to Rubygems" fullCmd="release" taksId="release" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /></RakeGroup></Settings> --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build gitlab-3.2.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install gitlab-3.2.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install gitlab-3.2.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v3.2.0 and build and push gitlab-3.2.0.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>

@ -2984,9 +2984,10 @@ a.singlepublishtwo{
} }
.partnerList{max-height: 500px;overflow-y: auto;} .partnerList{max-height: 500px;overflow-y: auto;}
.manageList{float: left} .manageList{float: left}
.manageList li{width: 60px;height: 60px;float: left;margin-right: 15px;border-radius: 50%;text-align: center;position: relative;margin-bottom: 10px;} .manageList li{width: 60px;float: left;margin-right: 15px;border-radius: 50%;text-align: center;position: relative;margin-bottom: 10px;}
.manageList li>a.addManage,.manageList li>img{width: 60px;height: 60px;line-height: 49px;float: left;margin-right: 10px;border-radius: 50%;} .manageList li>a.addManage,.manageList li>img{width: 60px;height: 60px;line-height: 49px;margin-right: 10px;border-radius: 50%;display: block}
.addManage{display: block;background: #cdcdcd;color: #fff!important;font-size: 55px;} .addManage{display: block;background: #cdcdcd;color: #fff!important;font-size: 55px;}
.managementName{display: block;width: 60px;color: #666;}
.removeImg{position: absolute;right: 1px;top: -12px;} .removeImg{position: absolute;right: 1px;top: -12px;}
.tableList .tableHead{background: #fafafa} .tableList .tableHead{background: #fafafa}
.tableList{min-height: 400px;} .tableList{min-height: 400px;}

Loading…
Cancel
Save