信呼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,109 @@
<?php if(!defined('HOST'))die('not access');?>
<script >
$(document).ready(function(){
var a = $('#viewshow_{rand}').bootstable({
tablename:'userinfo',modedir:'userinfo:main',storebeforeaction:'useranaybefore',storeafteraction:'useranayafter',
columns:[{
text:'名称',dataIndex:'name'
},{
text:'数值',dataIndex:'value'
},{
text:'比例',dataIndex:'bili'
}],
load:function(a){
c.loadcharts();
}
});
var myChart=false;
var c={
search:function(){
a.setparams({
'type' : get('type_{rand}').value,
'dt' : get('dt_{rand}').value,
},true);
},
loadcharts:function(){
var rows = a.getData('rows'),i,len=rows.length,v;
var xAxis=[],data=[];
for(i=0;i<len;i++){
xAxis.push(rows[i].name);
v = rows[i].value;if(v=='')v=0;
data.push({value:parseFloat(v),name:rows[i].name});
}
var o1 = get('type_{rand}');
if(!myChart)myChart = echarts.init(get('main_show{rand}'));
var ss = o1.options[o1.selectedIndex].text;
var option = {
title: {
text: '按'+ss+'人员分析',
left: 'center'
},
tooltip : {
trigger: 'item',
formatter: "{b} : {c}人 ({d}%)"
},
series: [{
name: '数值',
type: 'pie',
data: data
}]
};
myChart.setOption(option);
},
daochu:function(){
var o1 = get('type_{rand}');
var ss = o1.options[o1.selectedIndex].text;
a.exceldown(''+ss+'人员分析');
}
}
js.initbtn(c);
});
</script>
<div>
<table width="100%">
<tr>
<td nowrap>按照&nbsp;</td>
<td>
<select class="form-control" id="type_{rand}" style="width:150px;">
<option value="deptname">部门</option>
<option value="sex">性别</option>
<option value="xueli">学历</option>
<option value="nian">年龄</option>
<option value="year">入职年份</option>
<option value="nianxian">入职年限</option>
<option value="state">人员状态</option>
<option value="ranking">职位</option>
</select>
</td>
<td style="padding-left:10px">
<div style="width:140px" class="input-group">
<input placeholder="入职日期" readonly class="form-control" id="dt_{rand}" >
<span class="input-group-btn">
<button class="btn btn-default" onclick="js.selectdate(this,'dt_{rand}')" type="button"><i class="icon-calendar"></i></button>
</span>
</div>
</td>
<td style="padding-left:10px">
<button class="btn btn-default" click="search" type="button">分析</button>
</td>
<td width="90%"></td>
<td align="right" nowrap>
<button class="btn btn-default" click="daochu,1" type="button">导出</button>
</td>
</tr>
</table>
</div>
<div class="blank10"></div>
<table width="100%">
<tr valign="top">
<td width="80%">
<div id="main_show{rand}" style="width:100%;height:480px"></div>
</td>
<td>
<div style="width:350px" id="viewshow_{rand}"></div>
</td>
</tr>
</table>
<div class="blank10"></div>

View File

@@ -0,0 +1,73 @@
<?php if(!defined('HOST'))die('not access');?>
<script >
$(document).ready(function(){
var modenum='userinfo';
var a = $('#view_{rand}').bootstable({
tablename:'userinfo',modenum:modenum,params:{atype:'my'},
columns:[{
text:'部门',dataIndex:'deptname',align:'left',sortable:true
},{
text:'姓名',dataIndex:'name',sortable:true
},{
text:'性别',dataIndex:'sex'
},{
text:'职位',dataIndex:'ranking'
},{
text:'状态',dataIndex:'state',sortable:true
},{
text:'入职日期',dataIndex:'workdate',sortable:true
},{
text:'转正日期',dataIndex:'positivedt',sortable:true
},{
text:'电话',dataIndex:'tel'
},{
text:'手机号',dataIndex:'mobile'
},{
text:'ID',dataIndex:'id'
}],
itemclick:function(){
btn(false);
},
beforeload:function(){
btn(true);
}
});
function btn(bo){
get('xiang_{rand}').disabled = bo;
get('edit_{rand}').disabled = bo;
}
var c = {
view:function(){
var d=a.changedata;
openxiangs('个人资料',modenum,d.id);
},
edit:function(){
openinput('个人资料',modenum,a.changeid+'&optlx=my');
}
};
js.initbtn(c);
});
</script>
<div>
<table width="100%">
<tr>
<td nowrap>
</td>
<td style="padding-left:10px">
</td>
<td width="90%"></td>
<td align="right" nowrap>
<button class="btn btn-default" id="xiang_{rand}" click="view" disabled type="button">详情</button> &nbsp;
<button class="btn btn-default" id="edit_{rand}" click="edit" disabled type="button">编辑</button>
</td>
</tr>
</table>
</div>
<div class="blank10"></div>
<div id="view_{rand}"></div>
<div class="tishi">个人资料请认真填写!</div>

View File

@@ -0,0 +1,168 @@
<?php
class userinfoClassAction extends Action
{
public function userinfobefore($table)
{
$table = '`[Q]admin` a left join `[Q]userinfo` b on a.id=b.id';
$s = '';
$key = $this->post('key');
if($key!=''){
$s = " and (a.`name` like '%$key%' or a.`user` like '%$key%' or a.`ranking` like '%$key%' or a.`deptname` like '%$key%') ";
}
if(ISMORECOM)$s.= ' and a.`companyid`='.m('admin')->getcompanyid().'';
return array(
'table' => $table,
'where' => $s,
'fields'=> 'a.name,a.deptname,a.id,a.status,a.ranking,b.id as ids,b.dkip,b.dkmac,b.iskq,b.isdwdk,b.isdaily,b.finger'
);
}
public function userinfoafter($table, $rows)
{
$db = m($table);
foreach($rows as $k=>$rs){
if(isempt($rs['ids'])){
$db->insert(array(
'id' => $rs['id'],
'name' => $rs['name'],
'deptname' => $rs['deptname'],
'ranking' => $rs['ranking']
));
}
}
return array('rows'=>$rows);
}
public function fieldsafters($table, $fid, $val, $id)
{
$fields = 'sex,ranking,tel,mobile,workdate,email,quitdt';
if(contain($fields, $fid)){
if($fid=='quitdt'){
$dbs = m($table);
if(isempt($val)){
$dbs->update('`state`=0', "`id`='$id' and `state`=5");
}else{
$dbs->update('`state`=5', "`id`='$id'");
}
}
m('admin')->update(array($fid=>$val), $id);
}
}
public function userinfobeforegeren()
{
return ' and id='.$this->adminid.'';
}
//人员分析
public function useranaybefore()
{
return 'and 1=2';
}
public function useranayafter($table, $rows)
{
$type = $this->post('type','deptname');
$dt = $this->post('dt');
$db = m('userinfo');
$where = 'and state<>5';
if($dt !=''){
$where = "and ((state<>5 and workdate<='$dt') or (state=5 and workdate<='$dt' and quitdt>'$dt'))";
}
$where .= m('admin')->getcompanywhere();
$rows = $db->getall("id>0 $where",'deptname,sex,xueli,state,birthday,workdate,quitdt,ranking');
$nianls = array(
array(0,'16-20岁',16,20),
array(0,'21-25岁',21,25),
array(0,'26-30岁',26,30),
array(0,'31-40岁',31,40),
array(0,'41岁以上',41,9999),
array(0,'其他',-555,15),
);
$yearls = array(
array(0,'1年以下',0,1),
array(0,'1-3年',1,3),
array(0,'3-5年',3,5),
array(0,'5-10年',5,10),
array(0,'10年以上',10,9999)
);
$atatea = explode(',', '试用期,正式,实习生,兼职,临时工,离职');
foreach($rows as $k=>$rs){
$year = '';
if(!$this->isempt($rs['workdate'])) $year = substr($rs['workdate'],0,4);
$rows[$k]['year'] = $year;
$lian = $this->jsnianl($rs['birthday']);
foreach($nianls as $n=>$nsa){
if( $lian >= $nsa[2] && $lian <= $nsa[3]){
$rows[$k]['nian'] = $nsa[1];
break;
}
}
$state = (int)$rs['state'];
$rows[$k]['state'] = $atatea[$state];
//入职连
$nan = $this->worknx($rs['workdate']);
foreach($yearls as $n=>$nsa){
if( $nan >= $nsa[2] && $nan < $nsa[3]){
$rows[$k]['nianxian'] = $nsa[1];
break;
}
}
}
$arr = array();
$total = $this->db->count;
foreach($rows as $k=>$rs){
$val = $rs[$type];
if($this->isempt($val))$val = '其他';
if(!isset($arr[$val]))$arr[$val]=0;
$arr[$val]++;
}
$a = array();
foreach($arr as $k=>$v){
$a[] = array(
'name' => $k,
'value' => $v,
'bili' => ($this->rock->number($v/$total*100)).'%'
);
}
return array(
'rows' => $a,
'totalCound' => count($a)
);
}
private function jsnianl($dt)
{
$nY = date('Y')+1;
$lx = 0;
if(!$this->isempt($dt) && !$this->contain($dt, '0000')){
$ss = explode('-', $dt);
$saa = (int)$ss[0];
$lx = $nY - $saa;
}
return $lx ;
}
//计算工作年限的
private function worknx($dt)
{
$w = 0;
if(!$this->isempt($dt) && !$this->contain($dt, '0000')){
$startt = strtotime($dt);
$date = date('Y-m-d');
$endtime = strtotime($date);
$w = (int)(($endtime - $startt) / (24*3600) / 365);
}
return $w;
}
}