信呼OA版本v2.3.8

This commit is contained in:
雨中磐石
2022-08-14 16:47:40 +08:00
parent 4640677d27
commit e3fcd913e3
1405 changed files with 133635 additions and 73 deletions

View File

@@ -0,0 +1,224 @@
<?php
class kaoqinjClassAction extends Action
{
public function kqjsndelAjax()
{
$id = (int)$this->post('id');
m('kqjsn')->delete("`id`='$id'");
showreturn();
}
public function kqjcmddelAjax()
{
$id = c('check')->onlynumber($this->post('id'));
m('kqjcmd')->delete("`id` in ($id)");
showreturn();
}
//设备搜索
public function kqjsnbefore($table)
{
$key = $this->post('key');
$where = '';
if(!isempt($key))$where = " and (`num`='$key' or `name` like '%$key%' or `company` like '%$key%')";
return $where;
}
//设备搜索命令
public function kqjcmdbefore($table)
{
$optdt= date('Y-m-d H:i:s', time()-10*60);
m($table)->update('status=5',"`status`=0 and `optdt`<'$optdt'");
$key = $this->post('key');
$snid = (int)$this->post('snid','0');
$where = '';
if(!isempt($key))$where = " and (`num`='$key' or `name` like '%$key%' or `company` like '%$key%')";
if($snid>0){
$where.=" and a.`snid`='$snid'";
}
return array(
'where' => $where,
'table' => '`[Q]kqjcmd` a left join `[Q]kqjsn` b on a.`snid`=b.`id`',
'fields'=> 'a.*,b.`name`,b.`num`,b.`company`'
);
}
public function kqjcmdafter($table,$rows)
{
$cmds = m('kqjcmd');
$time = time();
foreach($rows as $k=>$rs){
$zt = $rs['status'];
if($zt=='0')$zt = '<font color="blue">待发送</font>';
if($zt=='1')$zt = '<font color="green">处理成功</font>';
if($zt=='2')$zt = '<font color="#ff6600">已请求</font>';
if($zt=='3')$zt = '<font color="red">处理失败</font>';
if($zt=='5')$zt = '<font color="#888888">已过期</font>';
$rows[$k]['atype'] = $cmds->cmdtype($rs['atype']);
if($rs['status']=='5'){
$rows[$k]['ishui'] = 1;
}
$rows[$k]['status'] = $zt;
}
$kqsnarr = array();
if($this->loadci==1){
$where1 = m('admin')->getcompanywhere(1);
$kqsnarr = m('kqjsn')->getall('status=1 '.$where1.'','id,name,num','sort');
foreach($kqsnarr as $k=>$rs){
$kqsnarr[$k]['name'] = ''.$rs['id'].'.'.$rs['name'].'('.$rs['num'].')';
}
}
return array(
'rows' => $rows,
'kqsnarr' => $kqsnarr
);
}
//发送设备命令
public function sendcmdAjax()
{
$ids = $this->get('ids');
$type = $this->get('type');
$ida = explode(',', $ids);
$oi = 0;
$msg = '';
foreach($ida as $id1){
$barr = m('kqjcmd')->send($id1, $type);
if($barr['success']){
$oi++;
}else{
if(substr($type,0,6)=='advert')return $barr;
$msg .= ''.$barr['msg'].';';
}
}
if($oi==0 && $msg!='')return returnerror($msg);
return returnsuccess('成功发送'.$oi.'条命令,可到[考勤机命令查看]下查看结果<font color=red>'.$msg.'</font>');
}
//考勤机上人员管理
public function kquserafter($table,$rows)
{
$snid = (int)$this->post('snid','0');
$deptsdata = array();
if($rows && $snid>0 && $snrs = m('kqjcmd')->getsninfo($snid)){
$userids = $snrs['userids'];
$deptids = $snrs['deptids'];
$useridf = ','.$userids.','; //判断是否在考勤机上
$uids = '';
foreach($rows as $k=>$rs){
if(contain($useridf,','.$rs['id'].',')){
$kqjzt = '<font color=green>已上传</font>';
}else{
$kqjzt = '';//'<font color=red>未上传</font>';
}
$fingerprint1 = '';//'<font color=red>未采集</font>';
$fingerprint2 = '';//'<font color=#888888>未采集</font>';
$headpic = '';//'<font color=#888888>无</font>';
$rows[$k]['fingerprint1'] = $fingerprint1;
$rows[$k]['fingerprint2'] = $fingerprint2;
$rows[$k]['headpic'] = $headpic;
$rows[$k]['kqjzt'] = $kqjzt;
$uids .= ','.$rs['id'].'';
}
$uids = substr($uids, 1);
//显示已存在部门
if(!isempt($deptids)){
$detpros = m('dept')->getdeptrows($deptids);
$deptsdata = $this->depttreeshu($detpros,'0');
}
//判断指纹是否存在
$zwarr = $this->db->getarr('[Q]kqjuser','`snid`='.$snid.' and `uid` in('.$uids.')','fingerprint1,fingerprint2,headpic','uid');
if($zwarr)foreach($rows as $k=>$rs){
if(isset($zwarr[$rs['id']])){
$ztrs = $zwarr[$rs['id']];
if(!isempt($ztrs['fingerprint1'])){
$rows[$k]['fingerprint1'] = '<font color=green>已采集</font>';
}
if(!isempt($ztrs['fingerprint2'])){
$rows[$k]['fingerprint2'] = '<font color=green>已采集</font>';
}
if(!isempt($ztrs['headpic']) && file_exists($ztrs['headpic'])){
$rows[$k]['headpic'] = '<img onclick="$.imgview({url:this.src})" src="'.$ztrs['headpic'].'" height="24">';
}
}
}
$barr['nocunid'] = m('kqjcmd')->getnosys($snid);
$barr['nocunid'] = join(',', $barr['nocunid']);
}
$barr['rows'] = $rows;
if($this->loadci==1){
$drows = m('dept')->getdata('sd');
$fid = '0';
if(ISMORECOM)$fid = $drows[0]['pid'];
$barr['deptdata'] = $this->depttreeshu($drows, $fid);
$where1 = m('admin')->getcompanywhere(1);
$kqsnarr = m('kqjsn')->getall('status=1 '.$where1.'','id,name,num','sort');
foreach($kqsnarr as $k=>$rs){
$kqsnarr[$k]['name'] = ''.$rs['id'].'.'.$rs['name'].'('.$rs['num'].')';
}
$barr['kqsnarr'] = $kqsnarr;
}
$barr['deptsdata'] = $deptsdata;
return $barr;
}
public function kquserbefore($table)
{
$key = $this->post('key');
$snid = (int)$this->post('snid','0');
$detpid = (int)$this->post('deptid','0');
$where = '';
if(!isempt($key))$where = m('admin')->getkeywhere($key);
if($detpid>1){
$where.= " and instr(`deptpath`,'[$detpid]')>0";
}
if(ISMORECOM)$where .=' and `companyid` in('.m('admin')->getcompanyid().')';
return array(
'fields'=>'id,name,deptname,ranking,status,face',
'where'=>$where,
'order'=> 'sort'
);
}
//组织结构活动得到树形数据
private function depttreeshu($rows, $pid)
{
$barr = array();
foreach($rows as $k=>$rs){
if($rs['pid']==$pid){
$rs['children'] = $this->depttreeshu($rows, $rs['id']);
$rs['expanded'] = $pid=='0';
$barr[] = $rs;
}
}
return $barr;
}
//人员到设备上信息管理
public function sendusercmdAjax()
{
$uids = $this->get('uids'); //人员ID
$snid = $this->get('snid');
$type = $this->get('type');
$gtype = (int)$this->post('gtype','0'); //0选中,1全部
if($gtype==1)$uids = '0';
$barr = m('kqjcmd')->send($snid, $type, $uids);
if($barr['success'])$barr['data'] = '命令已发送,可到[考勤机命令查看]下查看结果';
return $barr;
}
}

View File

@@ -0,0 +1,76 @@
<?php if(!defined('HOST'))die('not access');?>
<script >
$(document).ready(function(){
var lobdds=false;
var a = $('#view_{rand}').bootstable({
tablename:'kqjcmd',celleditor:true,fanye:true,sort:'optdt',dir:'desc',
url:publicstore('{mode}','{dir}'),storeafteraction:'kqjcmdafter',storebeforeaction:'kqjcmdbefore',checked:true,
columns:[{
text:'设备名称',dataIndex:'name'
},{
text:'设备号',dataIndex:'num'
},{
text:'设备ID',dataIndex:'snid'
},{
text:'显示公司名称',dataIndex:'company'
},{
text:'命令类型',dataIndex:'atype',sortable:true
},{
text:'状态',dataIndex:'status',sortable:true
},{
text:'添加时间',dataIndex:'optdt',sortable:true
},{
text:'请求时间',dataIndex:'qjtime',sortable:true
},{
text:'设备回复时间',dataIndex:'cjtime',sortable:true
},{
text:'相关ID',dataIndex:'others'
},{
text:'ID',dataIndex:'id'
}],
load:function(d){
if(!lobdds){
js.setselectdata(get('snid_{rand}'),d.kqsnarr,'id');
}
lobdds=true;
}
});
var c = {
del:function(){
a.del({checked:true,url:js.getajaxurl('kqjcmddel','{mode}','{dir}')});
},
search:function(){
var s=get('key_{rand}').value;
a.setparams({key:s,snid:get('snid_{rand}').value},true);
}
};
js.initbtn(c);
});
</script>
<div>
<table width="100%"><tr>
<td>
<select class="form-control" style="width:300px" id="snid_{rand}" ><option value="0">-所有设备-</option></select>
</td>
<td style="padding-left:10px">
<input class="form-control" style="width:150px" id="key_{rand}" placeholder="关键词">
</td>
<td style="padding-left:10px">
<button class="btn btn-default" click="search" type="button">搜索</button>
</td>
<td width="100%"></td>
<td align="right" nowrap>
<button class="btn btn-danger" click="del" type="button"><i class="icon-trash"></i> 删除</button>
</td>
</tr></table>
</div>
<div class="blank10"></div>
<div id="view_{rand}"></div>

View File

@@ -0,0 +1,235 @@
<?php if(!defined('HOST'))die('not access');?>
<script >
$(document).ready(function(){
{params}
var xusnid = params.snid;if(!xusnid)xusnid='0';
var at = $('#optionview_{rand}').bootstree({
url:false,autoLoad:false,
columns:[{
text:'系统上部门',dataIndex:'name',align:'left',xtype:'treecolumn'
}],
itemdblclick:function(d){
a.setparams({'deptid':d.id}, true);
}
});
var ats = $('#optionviews_{rand}').bootstree({
url:false,autoLoad:false,
columns:[{
text:'选中考勤机设备上部门',dataIndex:'name',align:'left',xtype:'treecolumn'
}],
itemdblclick:function(d){
a.setparams({'deptid':d.id}, true);
}
});
var a = $('#admin_{rand}').bootstable({
tablename:'admin',sort:'sort',dir:'asc',fanye:true,url:publicstore('{mode}','{dir}'),
storeafteraction:'kquserafter',checked:true,storebeforeaction:'kquserbefore',autoLoad:false,
columns:[{
text:'头像',dataIndex:'face',renderer:function(v,d){
if(isempt(v))v='images/noface.png';
return '<img onclick="$.imgview({url:this.src})" src="'+v+'" height="24" width="24">';
}
},{
text:'姓名',dataIndex:'name',sortable:true
},{
text:'部门',dataIndex:'deptname',align:'left'
},{
text:'职位',dataIndex:'ranking',sortable:true
},{
text:'ID',dataIndex:'id',sortable:true
},{
text:'人员状态',dataIndex:'status',sortable:true,type:'checkbox'
},{
text:'考勤机状态',dataIndex:'kqjzt'
},{
text:'指纹1',dataIndex:'fingerprint1'
},{
text:'指纹2',dataIndex:'fingerprint2'
},{
text:'设备头像',dataIndex:'headpic'
}],
load:function(d){
if(d.deptdata){
at.loadData(d.deptdata);
}
if(d.kqsnarr){
js.setselectdata(get('snid_{rand}'),d.kqsnarr,'id');
get('snid_{rand}').value = xusnid;
if(xusnid>0)get('downbtn_{rand}').disabled = false;
}
if(d.deptsdata){
ats.loadData(d.deptsdata);
}
var str = '';
if(d.nocunid)str='该考勤机设备上人员<font color=red>['+d.nocunid+']</font>在系统上可能不存在。';
$('#tishi_{rand}').html(str);
}
});
var c = {
search:function(){
var s=get('key_{rand}').value;
a.setparams({key:s,snid:get('snid_{rand}').value},true);
},
init:function(){
a.setparams({snid:xusnid},true);
},
changesnid:function(o1,lx){
var snid = get('snid_{rand}').value;
get('downbtn_{rand}').disabled = (snid=='0');
this.search();
},
sendcmd:function(lx, name){
var snid = get('snid_{rand}').value;
if(snid=='0'){js.msg('msg','没有选中考勤机设备');return;}
var ids = a.getchecked();
var nopd = ',getuser,delsuser,';//不需要判断
if(nopd.indexOf(','+lx+',')<0){
if(ids==''){js.msg('msg','没用复选框选中记录');return;}
var len = ids.split(',').length;
if(len>20){js.msg('msg','一次最多只能选择20个人员');return;}
}
if(lx=='getclockin' || lx=='getpic' || lx=='delclockin' || lx=='delpic'){
this.getdakjil(name, lx, ids, snid);
return;
}
if(name.indexOf('删除')>=0){
js.confirm('确定要发送命令['+name+']吗?命令运行成功就不能恢复了,谨慎操作!', function(jg){
if(jg=='yes')c.sendcmds(ids, snid,lx);
});
}else{
this.sendcmds(ids, snid,lx);
}
},
sendcmds:function(ids,snid,lx){
js.ajax(js.getajaxurl('sendusercmd','{mode}','{dir}'),{uids:ids,snid:snid,'type':lx},function(ret){
if(!ret.success){
js.msg('msg', ret.msg);
}else{
a.reload();
js.msg('success', ret.data);
}
},'get,json',false,'发送中...,已发送');
},
getdakjil:function(name,lxs,uids, snid){
var h = $.bootsform({
title:name,height:400,width:400,
tablename:'getclockin',isedit:2,
url:js.getajaxurl('sendusercmd','{mode}','{dir}',{'uids':uids,'type':lxs,'snid':snid}),
submitfields:'startdt,enddt',
items:[{
labelText:'要获取人员',name:'gtype',type:'select',valuefields:'id',displayfields:'name',store:[{name:'选中人员',id:0},{name:'设备上所有人员',id:1}],required:true,value:'0'
},{
labelText:'日期从',name:'startdt',type:'date'
},{
labelText:'到',name:'endddt',type:'date'
}],
success:function(d){
js.msg('success',d.data);
a.reload();
}
});
h.form.endddt.value = js.now();
h.form.startdt.value = js.now();
h.isValid();
}
};
js.initbtn(c);
$('#optionview_{rand}').css('height',''+(viewheight-25)+'px');
$('#optionviews_{rand}').css('height',''+(viewheight-25)+'px');
$('#snid_{rand}').change(function(){
c.changesnid();
});
$('#downbtn_{rand}').rockmenu({
width:230,top:35,donghua:false,
data:[{
name:'上传人员到设备',lx:'user'
},{
name:'上传人员指纹到设备',lx:'fingerprint'
},{
name:'从设备上获取所有人员',lx:'getuser'
},{
name:'系统不存在人员在设备上删除',lx:'delsuser'
},{
name:'设备上人员删除...',lx:'deluser'
},{
name:'从设备上获取指纹',lx:'getfingerprint'
},{
name:'从设备上获取头像',lx:'getheadpic'
},{
name:'系统头像上传到设备',lx:'headpic'
},{
name:'获取打卡记录...',lx:'getclockin'
},{
name:'获取打卡记录和现场照片...',lx:'getpic'
},{
name:'删除打卡记录...',lx:'delclockin'
},{
name:'删除现场照片...',lx:'delpic'
}],
itemsclick:function(d, i){
c.sendcmd(d.lx, d.name);
}
});
c.init();
});
</script>
<div>
<table width="100%">
<tr valign="top">
<td>
<div style="border:1px #cccccc solid;width:220px">
<div id="optionview_{rand}" style="height:400px;overflow:auto;"></div>
</div>
</td>
<td width="10" nowrap><div style="width:10px">&nbsp;</div></td>
<td width="95%">
<table width="100%"><tr>
<td>
<select class="form-control" style="width:270px" id="snid_{rand}" ><option value="0">-选择要操作的考勤机设备-</option></select>
</td>
<td style="padding-left:10px">
<button class="btn btn-default" disabled id="downbtn_{rand}" type="button">选中设备操作 <i class="icon-angle-down"></i></button>
</td>
<td style="padding-left:10px">
<input class="form-control" style="width:160px" id="key_{rand}" placeholder="姓名/部门/职位">
</td>
<td style="padding-left:10px">
<button class="btn btn-default" click="search" type="button">搜索</button>
</td>
<td width="80%">
</td>
<td align="right" nowrap>
</td>
</tr>
</table>
</div>
<div class="blank10"></div>
<div id="admin_{rand}"></div>
<div id="tishi_{rand}" class="tishi"></div>
</td>
<td width="10" nowrap><div style="width:10px">&nbsp;</div></td>
<td>
<div style="border:1px #cccccc solid;width:220px">
<div id="optionviews_{rand}" style="height:400px;overflow:auto;"></div>
</div>
</td>
</tr>
</table>