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.
70 lines
2.7 KiB
70 lines
2.7 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-horizontal" id="theFrm" onsubmit="return false;">
|
|
<input type="hidden" name="id" value="<?=$id?>">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label">搜索工号</label>
|
|
<div class="col-sm-3">
|
|
<input type="text" id="username" name="username" class="form-control" autocomplete="off">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label">选择员工</label>
|
|
<div class="col-sm-9" 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 () {
|
|
$('#username').change(function() {
|
|
var key = $(this).val();
|
|
|
|
$('#users').html('');
|
|
$.get('/marketing-strategy/search-user?key=' + key, 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.id + '">';
|
|
html += '<label for="user_' + item.id + '"> ' + item.name + ' </label>';
|
|
html += '</div>';
|
|
$('#users').html( $('#users').html() + html);
|
|
});
|
|
}
|
|
},'json');
|
|
});
|
|
|
|
//提交按钮
|
|
$(".btn-save").click(function(){
|
|
parent.layer.confirm('是否确认提交?', {
|
|
btn: ['确认','取消'], //按钮
|
|
shade: false //不显示遮罩
|
|
}, function(){
|
|
var params = $("#theFrm").serialize();
|
|
$.post('/marketing-strategy/users-add',params,function(obj){
|
|
if(obj.success) {
|
|
parent.layer.msg('保存成功');
|
|
parent.readUsers();
|
|
layer_close();
|
|
} else {
|
|
layer.msg(data.msg);
|
|
}
|
|
},'json');
|
|
}, function(){
|
|
//
|
|
});
|
|
});
|
|
})
|
|
</script>
|
|
<?php $this->endBlock('footer_js'); ?>
|
|
|