You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
simple-yewu/frontend/views/finance/sel-user-dlg.php

74 lines
2.8 KiB

<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-content">
<form role="form" class="form-inline" id="searchFrm">
<div class="form-group">
<label for="username">搜索工号</label>
<input type="text" id="username" name="username" class="form-control" autocomplete="off">
</div>
<div class="form-group">
<label for="group_id">级别</label>
<select name="group_id" id="group_id" class="form-control">
<option value="0">全部</option>
<?php
foreach($group_items as $item) {
echo '<option value="'.$item->id.'"';
if($item->id == $group_id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}
?>
</select>
</div>
<button type="button" onclick="search()" class="form-control">搜索</button>
</form>
<hr>
<form role="form" id="theFrm" class="form-horizontal">
<div class="form-group">
<div class="col-sm-12" id="users"></div>
</div>
<button type="button" class="col-sm-offset-2 btn btn-primary btn-save">添加</button>
</form>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript">
function search() {
var params = $('#searchFrm').serialize();
$('#users').html('');
$.get('/finance/sel-user-search?' + params, function(obj) {
if(obj.success) {
obj.users.forEach(function(item, index) {
var html = '<div class="checkbox checkbox-inline">';
html += '<input type="checkbox" id="user_' + item.id + '" name="ids[]" value="' + item.username + '">';
html += '<label for="user_' + item.id + '"> ' + item.name + ' </label>';
html += '</div>';
$('#users').html( $('#users').html() + html);
});
}
},'json');
}
$(function () {
search();
//提交按钮
$(".btn-save").click(function(){
var str = [];
$('input:checkbox:checked').each(function(index, item) {
str.push($(item).val());
});
parent.$('#<?=$id_name?>').val(str.join(','));
layer_close();
});
})
</script>
<?php $this->endBlock('footer_js'); ?>