提交 a98c0571 authored 作者: chengye's avatar chengye 提交者: wangkr

test

上级 830b9b07
...@@ -199,6 +199,7 @@ class Staff extends Base ...@@ -199,6 +199,7 @@ class Staff extends Base
$data = StaffModel::with('roles')->select(); $data = StaffModel::with('roles')->select();
$this->assign('data',$data); $this->assign('data',$data);
$this->assign('empty','<span class="layui-bg-orange">[没有权限]</span>'); $this->assign('empty','<span class="layui-bg-orange">[没有权限]</span>');
dd(123);
return $this->fetch('role'); return $this->fetch('role');
} }
......
{extend name="public:form" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form">
</form>
</div>
<div class="layui-card-header">
<button class="layui-btn" onclick="synUser()" id="sameIsadmin"><i class="layui-icon layui-icon-refresh"></i>同步</button>
<button class="layui-btn" id="EmImport">
<i class="layui-icon iconfont">&#xe7e4;</i></button>
</div>
<div class="layui-card-body ">
<table class="layui-table layui-form">
<thead>
<tr>
<th>姓名</th>
<th>部门</th>
<th>角色权限</th>
<th>操作</th>
</thead>
<tbody>
{foreach $data as $item}
<tr>
<td>{$item.name}</td>
<td>{$item.department.name|default='广厦网络'}</td>
<td>
{volist name="$item.roles" id="role" empty="$empty"}
[{$role.title}]
{/volist}
</td>
<td class="td-manage">
<a title="设置功能权限" onclick="xadmin.open('设置功能权限','/staff_role_edit/{$item.id}')" href="javascript:;">
<i class="layui-icon">&#xe642;</i>
</a>
<a title="设置数据权限" onclick="xadmin.open('数据权限配置','/staff_role_department/{$item.id}')" href="javascript:;">
<i class="layui-icon iconfont">&#xe70c;</i>
</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</body>
<script src="dist/js/api.js"></script>
<script src="dist/js/layer.js"></script>
<script src="dist/js/md5.js"></script>
<script src="dist/js/sha1.js"></script>
<script src="dist/js/util.js"></script>
<script src="dist/js/getUserToken.js"></script>
<script>
layui.use(['laydate','form','upload'], function(){
var laydate = layui.laydate;
var form = layui.form;
upload = layui.upload;
//执行一个laydate实例
laydate.render({
elem: '#start' //指定元素
});
//执行一个laydate实例
laydate.render({
elem: '#end' //指定元素
});
var EmImport = upload.render({
elem: '#EmImport' ,
url: '/basestation_import',
accept:'file',
field: 'file_name',
done: function (res) {
if(res.status == 1){
layer.open({
content: res.message,
btn: ['确定'],
yes: function() {
layer.closeAll();
window.location.reload();
}
});
}
if(res.status == 0){
layer.open({
content: res.message,
btn: ['确定'],
yes: function() {
layer.closeAll();
window.location.reload();
}
});
}
else {
//layMsg(res.message,5)
return;
}
}
});
});
/*用户-停用*/
function member_stop(obj,id){
layer.confirm('确认要停用吗?',function(index){
if($(obj).attr('title')=='启用'){
//发异步把用户状态进行更改
$(obj).attr('title','停用')
$(obj).find('i').html('&#xe62f;');
$(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
layer.msg('已停用!',{icon: 5,time:1000});
}else{
$(obj).attr('title','启用')
$(obj).find('i').html('&#xe601;');
$(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
layer.msg('已启用!',{icon: 5,time:1000});
}
});
}
/*用户-删除*/
function member_del(obj,id){
layer.confirm('确认要删除吗?',function(index){
//发异步删除数据
var url = '/staff_role_del';
$.ajax({
url: url,
method: "POST",
data: {id:id},
dataType: "json",
success: function (data) {
if(data.status == 1){
layer.msg(data.message,{icon:1,time:1000});
location.reload()
} else {
layer.alert(data.message, {
icon: 5
});
}
},
error : function (XMLHttpRequest, textStatus, errorThrow ) {
console.log('AJAX 执行删除失败...');
}
});
});
}
function delAll (argument) {
var data = tableCheck.getData();
layer.confirm('确认要删除吗?'+data,function(index){
//捉到所有被选中的,发异步进行删除
layer.msg('删除成功', {icon: 1});
$(".layui-form-checked").not('.header').parents('tr').remove();
});
}
function synUser() {
layer.confirm('确定要同步吗?', {skin: 'layui-layer-lan',btn:['取消','确认'],icon: 3, title:'提示'},
function(index,layero){
layer.close(index);
},
function(index,layero){
var indexload = layer.load(0, {
shade: [0.7,'#fff'] //0.7透明度的白色背景
});
let time = Math.round(new Date().getTime()/1000);
let app_secret = '4d8e605fa7ed546c4bcb33dee1381179';
let serverAuthenticateStaticKey= 'de5kio2f';
var temp = hex_sha1(app_secret+time+serverAuthenticateStaticKey);
var sign= hex_md5(temp);
util.ajax({
type:'get',
dataType: 'json',
url: util.interfaceUrl + interfacenName.synSuser ,
data: {
timestamp:time,
sign: sign
},
success: (res) => {
if(res.code == "200"){
setTimeout(function () {
layer.close(indexload)
},1500)
layer.msg("同步成功")
} else {
setTimeout(function () {
layer.close(indexload)
},1500)
layer.msg(res.message)
}
},
error:function (err) {
layer.msg('网络接口异常')
}
});
})
}
</script>
{/block}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论