单位申请列表修改
This commit is contained in:
parent
38f9bf0482
commit
1f47eb5ea8
|
@ -210,4 +210,61 @@ class SchoolController < ApplicationController
|
|||
|
||||
render :json =>status
|
||||
end
|
||||
|
||||
def edit_apply_name
|
||||
name = params[:name] || ""
|
||||
status = -1
|
||||
|
||||
if name != ""
|
||||
applyschool = ApplyAddSchools.where("id=?",params[:id]).first
|
||||
|
||||
applyschool.name = name.strip
|
||||
|
||||
if applyschool.school
|
||||
applyschool.school.name = name
|
||||
applyschool.school.pinyin = Pinyin.t(name.strip, splitter: '')
|
||||
applyschool.school.save!
|
||||
end
|
||||
applyschool.save!
|
||||
status = 0
|
||||
end
|
||||
|
||||
render :json=>{:status=>status,:id=>params[:id],:address=>name}
|
||||
end
|
||||
|
||||
def edit_apply_address
|
||||
address = params[:address] || ""
|
||||
|
||||
status = -1
|
||||
|
||||
if address != ""
|
||||
applyschool = ApplyAddSchools.where("id=?",params[:id]).first
|
||||
applyschool.address = address
|
||||
applyschool.save!
|
||||
status = 0
|
||||
end
|
||||
|
||||
render :json=>{:status=>status,:id=>params[:id],:address=>address}
|
||||
end
|
||||
|
||||
def edit_apply_province
|
||||
province = params[:province] || ""
|
||||
city = params[:city] || ""
|
||||
status = -1
|
||||
|
||||
if(province != "") &&(city != "")
|
||||
applyschool = ApplyAddSchools.where("id=?",params[:id]).first
|
||||
applyschool.province = province
|
||||
applyschool.city = city
|
||||
|
||||
if applyschool.school
|
||||
applyschool.school.province = province
|
||||
applyschool.school.save!
|
||||
end
|
||||
applyschool.save!
|
||||
status = 0
|
||||
end
|
||||
|
||||
render :json=>{:status=>status,:id=>params[:id],:province=>province,:city=>city}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -53,8 +53,9 @@
|
|||
<td style="text-align: center;">
|
||||
<%= apply.id %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' id="apply_title_<%= apply.id %>">
|
||||
<%= apply.name %>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' >
|
||||
<span title="双击可编辑" ondblclick = "show_edit_school_name('<%= apply.id %>');" id="apply_title_<%= apply.id %>"><%= apply.name %></span>
|
||||
<textarea style="display: none; width:100px; height:16px; border:1px solid #ddd; outline:none; padding:0 0 0 5px; resize:none; overflow:hidden;" placeholder="请编辑单位名称" id="school_name_edit_<%=apply.id%>" onblur="edit_school_name('<%= edit_apply_name_school_path(apply.id)%>','<%= apply.id %>');"><%= apply.name %></textarea>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% user = User.where("id=?", apply.user_id).first %>
|
||||
|
@ -63,10 +64,51 @@
|
|||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<span ondblclick = "show_edit_school_province('<%= apply.id %>');" id="apply_province_<%= apply.id %>">
|
||||
<%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
|
||||
</span>
|
||||
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%=apply.id%>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:50px; height:18px; display: none">
|
||||
<option value="北京">北京</option>
|
||||
<option value="上海">上海</option>
|
||||
<option value="广东">广东</option>
|
||||
<option value="江苏">江苏</option>
|
||||
<option value="浙江">浙江</option>
|
||||
<option value="重庆">重庆</option>
|
||||
<option value="安徽">安徽</option>
|
||||
<option value="福建">福建</option>
|
||||
<option value="甘肃">甘肃</option>
|
||||
<option value="广西">广西</option>
|
||||
<option value="贵州">贵州</option>
|
||||
<option value="海南">海南</option>
|
||||
<option value="河北">河北</option>
|
||||
<option value="黑龙江">黑龙江</option>
|
||||
<option value="河南">河南</option>
|
||||
<option value="湖北">湖北</option>
|
||||
<option value="湖南">湖南</option>
|
||||
<option value="江西">江西</option>
|
||||
<option value="吉林">吉林</option>
|
||||
<option value="辽宁">辽宁</option>
|
||||
<option value="内蒙古">内蒙古</option>
|
||||
<option value="宁夏">宁夏</option>
|
||||
<option value="青海">青海</option>
|
||||
<option value="山东">山东</option>
|
||||
<option value="山西">山西</option>
|
||||
<option value="陕西">陕西</option>
|
||||
<option value="四川">四川</option>
|
||||
<option value="天津">天津</option>
|
||||
<option value="新疆">新疆</option>
|
||||
<option value="西藏">西藏</option>
|
||||
<option value="云南">云南</option>
|
||||
<option value="香港">香港特别行政区</option>
|
||||
<option value="澳门">澳门特别行政区</option>
|
||||
<option value="台湾">台湾</option>
|
||||
<option value="海外">海外</option>
|
||||
</select>
|
||||
<select onchange="edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="city" id="schoolCity_<%=apply.id%>" class="fl ml5" style="width:50px; height:18px; display: none"></select>
|
||||
</td>
|
||||
<td align="left" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<%= apply.address %>
|
||||
<span title="双击可编辑" ondblclick = "show_edit_school_address('<%= apply.id %>');" id="apply_address_<%= apply.id %>"><%= apply.address %></span>
|
||||
<textarea style="display: none; width:100px; height:16px; border:1px solid #ddd; outline:none; padding:0 0 0 5px; resize:none; overflow:hidden;" placeholder="请编辑单位地址" id="school_address_edit_<%=apply.id%>" onblur="edit_school_address('<%= edit_apply_address_school_path(apply.id)%>','<%= apply.id %>');"><%= apply.address %></textarea>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% count = UserExtensions.where("school_id = #{apply.school_id}").count %>
|
||||
|
@ -82,6 +124,9 @@
|
|||
|
||||
</td>
|
||||
</tr>
|
||||
<script>
|
||||
init_province_and_city(document.getElementById('school_province_edit_<%=apply.id%>'), '<%=apply.province%>', document.getElementById('schoolCity_<%=apply.id%>'), '<%=apply.city%>');
|
||||
</script>
|
||||
<% unless apply.remarks.blank? %>
|
||||
<tr class="odd">
|
||||
<td>
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
<td style="text-align: center;">
|
||||
<%= apply.id %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' id="apply_title_<%= apply.id %>">
|
||||
<td ondblclick = "show_edit_school_name('<%= apply.id %>');" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' id="apply_title_<%= apply.id %>">
|
||||
<% unless apply.school_id.nil? %>
|
||||
<% school_name = School.where("id=?", apply.school_id).first %>
|
||||
<%= school_name.name %>
|
||||
|
|
|
@ -226,6 +226,9 @@ RedmineApp::Application.routes.draw do
|
|||
member do
|
||||
get 'upload_logo'
|
||||
post 'upload'
|
||||
get 'edit_apply_name'
|
||||
get 'edit_apply_address'
|
||||
get 'edit_apply_province'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1880,3 +1880,124 @@ function updateCourseName(){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function edit_school_name(url,id){
|
||||
if($("#school_name_edit_"+id).val() == ""){
|
||||
$("#apply_title_"+id).show();
|
||||
$("#school_name_edit_"+id).hide();
|
||||
return;
|
||||
}
|
||||
$.get(
|
||||
url,
|
||||
{id: id ,name: $("#school_name_edit_"+id).val() },
|
||||
function (data) {
|
||||
if(data.status == 0){
|
||||
$("#apply_title_"+data.id).show();
|
||||
$("#school_name_edit_"+data.id).hide();
|
||||
$("#apply_title_"+data.id).text(data.name);
|
||||
}
|
||||
else{
|
||||
$("#apply_title_"+data.id).show();
|
||||
$("#school_name_edit_"+data.id).hide();
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function show_edit_school_name(id){
|
||||
$("#apply_title_"+id).hide();
|
||||
$("#school_name_edit_"+id).val($("#apply_title_"+id).text());
|
||||
$("#school_name_edit_"+id).show();
|
||||
$("#school_name_edit_"+id).focus();
|
||||
|
||||
|
||||
}
|
||||
|
||||
function edit_school_address(url,id){
|
||||
if($("#school_address_edit_"+id).val() == ""){
|
||||
$("#apply_address_"+id).show();
|
||||
$("#school_address_edit_"+id).hide();
|
||||
return;
|
||||
}
|
||||
$.get(
|
||||
url,
|
||||
{id: id ,address: $("#school_address_edit_"+id).val() },
|
||||
function (data) {
|
||||
if(data.status == 0){
|
||||
$("#apply_address_"+data.id).show();
|
||||
$("#school_address_edit_"+data.id).hide();
|
||||
$("#apply_address_"+data.id).text(data.address);
|
||||
}
|
||||
else{
|
||||
$("#apply_address_"+data.id).show();
|
||||
$("#school_address_edit_"+data.id).hide();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function show_edit_school_address(id){
|
||||
$("#apply_address_"+id).hide();
|
||||
$("#school_address_edit_"+id).val($("#apply_address_"+id).text());
|
||||
$("#school_address_edit_"+id).show();
|
||||
$("#school_address_edit_"+id).focus();
|
||||
}
|
||||
|
||||
function edit_school_province(url,id){
|
||||
|
||||
var province = $("#school_province_edit_"+id).val();
|
||||
var city = $("#schoolCity_"+id).val();
|
||||
|
||||
if((province == "")||(city == "")){
|
||||
$("#apply_province_"+id).show();
|
||||
$("#school_province_edit_"+id).hide();
|
||||
$("#schoolCity_"+id).hide();
|
||||
return;
|
||||
}
|
||||
|
||||
$.get(
|
||||
url,
|
||||
{id: id ,province: province,city:city },
|
||||
function (data) {
|
||||
if(data.status == 0){
|
||||
$("#apply_province_"+data.id).show();
|
||||
$("#school_province_edit_"+data.id).hide();
|
||||
$("#schoolCity_"+data.id).hide();
|
||||
init_province_and_city(document.getElementById('school_province_edit_'+data.id), data.province, document.getElementById('schoolCity_'+data.id), data.city);
|
||||
$("#apply_province_"+data.id).text(data.province+data.city);
|
||||
|
||||
}
|
||||
else{
|
||||
$("#apply_province_"+data.id).show();
|
||||
$("#school_province_edit_"+data.id).hide();
|
||||
$("#schoolCity_"+data.id).hide();
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function init_province_and_city(pField, province, cField, city) {
|
||||
for (var i = 0; i < pField.options.length; i++) {
|
||||
if (pField.options[i].value == province) {
|
||||
pField.selectedIndex = i;
|
||||
}
|
||||
}
|
||||
showcity(province, cField);
|
||||
for (var i = 0; i < cField.options.length; i++) {
|
||||
if (cField.options[i].value == city) {
|
||||
cField.selectedIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function show_edit_school_province(id){
|
||||
$("#apply_province_"+id).hide();
|
||||
$("#school_province_edit_"+id).show();
|
||||
$("#schoolCity_"+id).show();
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue