Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_item_bank

mast_item_banktwo
杨树林 5 years ago
commit 4839338a6a

@ -1,16 +1,16 @@
$(document).on('turbolinks:load', function() {
if ($('body.admins-salesmans-index-page').length > 0) {
if ($('body.admins-salesman-customers-index-page').length > 0) {
// ============= 添加销售人员 ==============
var $addMemberModal = $('.admin-add-salesman-customer-user-modal');
var $addMemberForm = $addMemberModal.find('.admin-add-salesman-customer-user-form');
var $memberSelect = $addMemberModal.find('.salesman-user-select');
// var $salesmanIdInput = $addMemberForm.find('input[name="salesman_id"]')
var $memberSelect = $addMemberModal.find('.salesman-customer-user-select');
var $salesmanIdInput = $('.salesman-customer-list-form').find(".btn-primary");
$addMemberModal.on('show.bs.modal', function(event){
var $link = $(event.relatedTarget);
var salesmanId = $link.data('salesman-id');
$salesmanIdInput.val(salesmanId);
// var salesmanId = $link.data('salesman_id');
// $salesmanIdInput.val(salesmanId);
$memberSelect.select2('val', ' ');
});
@ -52,7 +52,7 @@ $(document).on('turbolinks:load', function() {
method: 'POST',
dataType: 'json',
url: '/admins/salesman_customers/batch_add',
data: { user_ids: memberIds },
data: { salesman_id: $salesmanIdInput.data("salesman-id"), user_ids: memberIds },
success: function(){
$.notify({ message: '创建成功' });
$addMemberModal.modal('hide');

@ -5,6 +5,21 @@ class Admins::SalesmanCustomersController < Admins::BaseController
@customers = @salesman.salesman_customers.includes(:user, :school)
end
def batch_add
customer_ids = @salesman.salesman_customers.pluck(:user_id)
user_ids = params[:user_ids] - customer_ids
user_ids.each do |user_id|
user = UserExtension.find_by(user_id: user_id)
next if user.blank?
@salesman.salesman_customers.create!(user_id: user.user_id, school_id: user.school_id)
end
render_ok
end
def destroy
@salesman.salesman_customers.find_by!(id: params[:id]).destroy
end
private
def set_salesman
@salesman = Salesman.find params[:salesman_id]

@ -0,0 +1,2 @@
$.notify({ message: '操作成功' },{ type: 'success' });
$("<%= params[:element]%>").remove();

@ -4,8 +4,9 @@
<th width="6%">序号</th>
<th width="20%" class="text-left">名称</th>
<th width="30%" class="text-left">单位</th>
<th width="22%" class="text-left">课堂数</th>
<th width="22%">实训数</th>
<th width="12%" class="text-left">课堂数</th>
<th width="12%">实训数</th>
<th width="20%">操作</th>
</tr>
</thead>
<tbody>
@ -25,6 +26,9 @@
<td>
<%= customer.shixuns_count %>
</td>
<td>
<%= delete_link '删除', admins_salesman_customer_path(customer, salesman_id: customer.salesman_id, element: ".salesman-customer-item-#{customer.id}"), class: 'delete-salesman--action' %>
</td>
</tr>
<% end %>
<% else %>

@ -1,3 +1,2 @@
$.notify({ message: '操作成功' },{ type: 'success' });
console.log()
$(".salesman-item-<%= params[:id]%>").remove();

@ -1361,7 +1361,9 @@ Rails.application.routes.draw do
post :batch_add, on: :collection
end
resources :salesman_channels, only: [:index, :create, :edit, :update, :destroy]
resources :salesman_customers, only: [:index, :create, :edit, :update, :destroy]
resources :salesman_customers, only: [:index, :create, :edit, :update, :destroy] do
post :batch_add, on: :collection
end
end
namespace :cooperative do

@ -277,7 +277,7 @@ class ShixunhomeWorkItem extends Component{
/*list style*/
.boardsList {
display: flex;
align-items: center;
align-items: flex-start;
padding-top: 8px;
padding-bottom: 10px;
@ -297,12 +297,12 @@ class ShixunhomeWorkItem extends Component{
`}</style>
{this.props.isAdmin?
<span className={`shixunitem${index} fl`} style={{"height":"55px"}}>{checkBox}</span>
<span className={`shixunitem${index} fl`} style={{"height":"55px",paddingTop:"2px"}}>{checkBox}</span>
:
""
}
<div className="clearfix ds pr pt5 contentSection" >
<div className="clearfix ds pr contentSection" >
<style>{`
.maxwidth333{
max-width: 333px;
@ -404,14 +404,21 @@ class ShixunhomeWorkItem extends Component{
</h6>
{/* style={discussMessage.time_status===1||discussMessage.time_status===2||discussMessage.time_status===3||discussMessage.time_status===4||discussMessage.time_status===5||discussMessage.time_status===6?{"maxWidth":"216px"}:{"maxWidth":"550px"}} */}
{
discussMessage && discussMessage.upper_category_name &&
// <ConditionToolTip title={discussMessage.upper_category_name} condition={ discussMessage.upper_category_name.length > 22 }>
<div className="color-grey9 task-hide mt5" title={discussMessage.upper_category_name}>所属目录{discussMessage.upper_category_name}</div>
// </ConditionToolTip>
}
<div className="cl"></div>
<p className="color-grey mt16 fl" style={{"width":"820px"}}>
<p className="color-grey mt15 fl" style={{"width":"820px"}}>
<span >
{/* <a href="/users/innov" className="panel-name-small hide fl mr15 mr30 color-grey3">{discussMessage.author.name}</a> */}
{ discussMessage.author && <span className="mr15 color-grey-3">{discussMessage.author}</span> }
{discussMessage.commit_count===undefined?"":<span className="mr15 color-grey9">已开始做题 {discussMessage.commit_count}</span>}
{discussMessage.uncommit_count===undefined?"":<span className="mr15 color-grey9">未开始做题 {discussMessage.uncommit_count}</span>}
{discussMessage.uncommit_count===undefined?"":<span className="mr15 color-grey9">未开始做题 {discussMessage.uncommit_count}</span>}
{discussMessage.compelete_count===undefined?"":<span className="mr15 color-grey9">已完成做题 {discussMessage.compelete_count}</span>}
{/*<span className="mr15 color-grey9">{discussMessage.replies_count} 3 未评</span>*/}
{
@ -426,12 +433,7 @@ class ShixunhomeWorkItem extends Component{
:
<span className="mr15 color-grey9">{discussMessage.status_time}</span>
}
{
discussMessage && discussMessage.upper_category_name &&
<ConditionToolTip title={discussMessage.upper_category_name} condition={ discussMessage.upper_category_name.length > 22 }>
{ <div className=" color-grey9 task-hide fr" style={discussMessage.time_status===1||discussMessage.time_status===2||discussMessage.time_status===3||discussMessage.time_status===4||discussMessage.time_status===5||discussMessage.time_status===6?{"maxWidth":"216px"}:{"maxWidth":"550px"}} title={discussMessage.upper_category_name}>所属目录{discussMessage.upper_category_name}</div>}
</ConditionToolTip>
}

Loading…
Cancel
Save