1、juqery全选
全选按钮
<input type="checkbox" id="check_box" onclick="selectall('lead_id[]');"/>
列表按钮
<input name="lead_id[]" type="checkbox" value="<?php echo $value['lead_id'];?>" />
function selectall(name) {
if ($("#check_box").prop("checked")==false) {
$("input[name='"+name+"']").each(function() {
this.checked = false;
});
} else {
$("input[name='"+name+"']").each(function() {
this.checked = true;
});
}
}
2、post删除
function del_many(){
var ids='';
$("input:checkbox[name='lead_id[]']:checked").each(function(i, n){
ids += $(n).val() + ',';
});
if( ids ){
if ( confirm( '确定删除吗?' ) )
{
location.href = '?m=party_admin&c=leader_admin&a=dele_leader&leader_id=' + ids;
}
}else{
alert('请选择要删除的记录!');return false;
}
}
3、编辑信息
function edit( id ){
$.post("?m=party_admin&c=activity_admin&a=activity_info",{activity_id:id},function(msg){
var data = eval('('+msg+')');
$('#edit_activitytitle').val( data.activity_name );
$('#edit_party_name').val( data.party_name );
$("select[name ='edit_activity_type'] option[value='"+data.activity_type+"']").attr('selected','selected');
$('#edit_activity_time').val( data.activity_time );
$('#edit_activity_palce').val( data.activity_place );
$('#edit_activity_partypeople').val( data.party_should_num );
$('#edit_activity_vilpeople').val( data.villager_should_num );
$('#edit_activity_leadpeople').val( data.leader_should_num );
$('#edit_activity_content').val( data.activity_contents );
$('#edit_activity_id').val( data.activity_id );
$('#upload_pics').val( data.activity_pic );
/* 照片显示 */
if ( data.activity_pic != '' )
{
$( '#upload_pics' ).val( data.activity_pic );
}
/* 党员显示 未到 + 已到 */
var party_people_arr = data['party_people'];
var new_party_people = '';
var sign_party_people = '';
if ( party_people_arr != undefined )
{
$.each( party_people_arr, function( key, value ) {
if ( value['is_sign'] == '0' )
{
new_party_people += "<span id="+ 'not_party_id_'+ value['person_id'] +">";
new_party_people += value['person_name'];
new_party_people += "</span>";
}
else
{
sign_party_people += "<span id="+ 'party_id_'+ value['person_id'] +">";
sign_party_people += value['person_name'];
sign_party_people += "</span>";
}
});
$( '#party_not_to' ).html( new_party_people );
$( '#party_sign_name' ).html( sign_party_people );
}
/* 手机端操作 1、启用 0、关闭 2、已完成 */
var mobile_operate_msg = '';
switch( data['mobile_operate'] )
{
case '0':
mobile_operate_msg = '启动手机端操作';
$( '#button_mobile_operate' ).attr( 'onclick', 'open_mobile_operate( '+ id +' );' );
break;
case '1':
mobile_operate_msg = '手机端操作已开启';
break;
case '2':
mobile_operate_msg = '手机端操作已完成';
break;
}
$( '#mobile_operate' ).html( mobile_operate_msg );
});
$( '#determine' ).attr( 'onclick', 'edit_submit();' );
/* 开始签到的方法绑定 */
$( '#start_sign' ).attr( 'onclick', "begin_start_sign( "+ id +" );" );
}