作者 niuyongqing

人事系统

... ... @@ -66,15 +66,7 @@ class Mechanism extends BaseController
public function mechanism_add(Request $request)
{
$data = $request->param();
$row['username']=$data['username'];
$list= Db::table('sos_user_mechanism')->where($row)->select()->toArray();
if($list){
$data=[
'code'=>100,
'msg'=>'登录账号已存在'
];
return $data;
}
if(isset($data['password']) && !empty($data['password']) && $data['password']!='******'){
$data['password']=md5(md5($data['password']));
}
... ... @@ -85,6 +77,15 @@ class Mechanism extends BaseController
unset($data['mechanism_id']);
$res = Db::table('sos_user_mechanism')->where($where)->update($data);
}else{
$row['username']=$data['username'];
$list= Db::table('sos_user_mechanism')->where($row)->select()->toArray();
if($list){
$data=[
'code'=>100,
'msg'=>'登录账号已存在'
];
return $data;
}
unset($data['mechanism_id']);
$data['createTime']=time();
... ...
... ... @@ -9,6 +9,7 @@
namespace app\products\controller;
use app\web\controller\BaseController;
use think\Cache;
use think\Db;
use think\Request;
... ... @@ -16,6 +17,8 @@ class Role extends BaseController
{
//获取用户列表
public function getUsers(Request $request){
$data = $request->param();
$page = isset($_POST['page']) ? intval($_POST['page']) : 1;
$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
... ... @@ -23,6 +26,13 @@ class Role extends BaseController
$data['offset']=$offset;
$data['rows']=$rows;
$where=[];
$user=Cache::get('name');
$user_id=Cache::get('id');
if($user !='admin'){
$where['mechanism']=$user_id;
}
if(!empty($data['id']) && isset($data['id'])){
$where['id']=$data['id'];
}
... ... @@ -82,7 +92,14 @@ class Role extends BaseController
*/
public function getMechanism(){
$list= Db::table('sos_user_mechanism')->select()->toArray();
$user=Cache::get('name');
$user_id=Cache::get('id');
if($user !='admin'){
$where['id']=$user_id;
}
$list= Db::table('sos_user_mechanism')->where($where)->select()->toArray();
echo json_encode($list);
}
... ...
... ... @@ -21,11 +21,7 @@
var oltTarget, logTarget, logGridTarget;
var num = 0;
var iCount;
var user= localStorage.getItem("user");
if(user != 'admin'){
$('#shouUser').attr("style","display:none;");
}
$(function () {
oltTarget = $("#operation_log_txt");
... ... @@ -71,16 +67,7 @@
title: '人员管理'
}
});
if(user == 'admin'){
$('#main_iframe').attr('src','__MODEL__/role/index');
}else{
$('#main_iframe').attr('src','__MODEL__/Fu_ji_tong/index');
}
$.h.index.setOperateInfo(null, false);
... ... @@ -279,19 +266,14 @@
<div data-options="iconCls:'icon-reload'" id="shouUser">
<span>管理员</span>
<div style="width:180px;">
<div onclick="$.h.menu.onMenuRoleManage();"><b>人员管理</b></div>
<div onclick="$.h.menu.onMenuMechanismManage();"><b>机构管理</b></div>
<div data-options="iconCls:'icon-reload'" onclick="$.h.menu.onMenuRoleManage();">
<b >人员管理</b>
</div>
<div data-options="iconCls:'icon-reload'" id="shouUser" onclick="$.h.menu.onMenuMechanismManage();">
<b >机构管理</b>
</div>
<div data-options="iconCls:'icon-reload'">
<span>二级菜单</span>
<div style="width:180px;">
<div onclick="$.h.menu.onMenuPersonnelManage();"><b>人员管理</b></div>
<div onclick="$.h.menu.onMenuDepartmentManage();"><b>部门管理</b></div>
</div>
<div data-options="iconCls:'icon-reload'" onclick="$.h.menu.onMenuDepartmentManage();">
<b >部门管理</b>
</div>
</div>
</div>
... ... @@ -310,5 +292,10 @@
</div>
</body>
<script>
var user= localStorage.getItem("user");
if(user != 'admin'){
$('#shouUser').attr("style","display:none;");
}
</script>>
</html>
\ No newline at end of file
... ...