提交 11af9747 authored 作者: wangkr's avatar wangkr

update

上级 8907a146
......@@ -12,7 +12,7 @@ ini_set('session.save_handler', 'redis');
ini_set('session.save_path', 'tcp://192.168.1.222:6379');
ini_set('session.cookie_path', '/');
ini_set('session.cookie_domain', 'gonn.com.cn');
ini_set('session.cookie_lifetime', '1800');
ini_set('session.cookie_lifetime', '7200');
@session_start();
if(function_exists('date_default_timezone_set'))date_default_timezone_set('Asia/Shanghai'); //设置默认时区
......
......@@ -25,3 +25,12 @@
客户名称:易电务(北京)科技有限公司保存接口失败 客户编号:CUST24050保存接口成功 执行时间:1.4224369525909 s
客户编号:CUST24050提交接口成功 执行时间:0.11602902412415 s
客户编号:CUST24050审核接口成功 执行时间:0.18425989151001 s
客户编号:CUST24051保存接口成功 执行时间:2.1835269927979 s
客户编号:CUST24051提交接口成功 执行时间:0.084365844726562 s
客户编号:CUST24051审核接口成功 执行时间:0.15912199020386 s
客户编号:CUST24052保存接口成功 执行时间:4.1266798973083 s
客户编号:CUST24052提交接口成功 执行时间:0.37966990470886 s
客户编号:CUST24052审核接口成功 执行时间:0.15844106674194 s
客户编号:CUST24053保存接口成功 执行时间:4.3511328697205 s
客户编号:CUST24053提交接口成功 执行时间:0.45927286148071 s
客户编号:CUST24053审核接口成功 执行时间:0.14415597915649 s
......@@ -119,4 +119,21 @@
供应商编号:VEN04996保存接口成功 执行时间:0.3246431350708 s
供应商编号:VEN04996提交接口成功 执行时间:0.059867143630981 s
供应商编号:VEN04996审核接口成功 执行时间:0.097572088241577 s
供应商名称:北京敬美定建材经营部保存接口失败
\ No newline at end of file
供应商名称:北京敬美定建材经营部保存接口失败 供应商名称:北京海科之园园林绿化有限公司保存接口失败 供应商编号:VEN04999保存接口成功 执行时间:0.35171103477478 s
供应商编号:VEN04999提交接口成功 执行时间:1.264858007431 s
供应商编号:VEN04999审核接口成功 执行时间:0.16371202468872 s
供应商名称:北京盘天地信息技术有限公司保存接口失败 供应商名称:北京英创嘉友知识产权代理事务所保存接口失败 解析字段(Key:注册资金(万元),name:FRegisterFund)时发生异常,异常信息:解析字段(Key:注册资金(万元),name:FRegisterFund)时发生异常,异常信息:输入字符串的格式不正确。 在 Kingdee.BOS.WebApi.FormService.MapPropertyService.MapComplexProperty(String pkProperty, Dictionary`2 sourceObj, DynamicObject targetObj, Int32 rowIndex, HashSet`1 NeedUpDateFields)
在 Kingdee.BOS.WebApi.FormService.Save.Revole()
在 Kingdee.BOS.WebApi.FormService.Save.Execute()
在 Kingdee.BOS.WebApi.FormService.BillOperationService.ExecuteOperation(FormOperation op, String data)供应商编号:VEN05001保存接口成功 执行时间:3.0436930656433 s
供应商编号:VEN05001提交接口成功 执行时间:1.258975982666 s
供应商编号:VEN05001审核接口成功 执行时间:0.17937803268433 s
供应商名称:北京万航博通科技有限公司保存接口失败 供应商编号:VEN05003保存接口成功 执行时间:0.34562993049622 s
供应商编号:VEN05003提交接口成功 执行时间:1.2431640625 s
供应商编号:VEN05003审核接口成功 执行时间:0.23087501525879 s
供应商编号:VEN05004保存接口成功 执行时间:0.31795811653137 s
供应商编号:VEN05004提交接口成功 执行时间:0.062644004821777 s
供应商编号:VEN05004审核接口成功 执行时间:0.10247111320496 s
供应商名称:中铁六局集团电务工程有限公司保存接口失败 供应商编号:VEN05006保存接口成功 执行时间:1.6346430778503 s
供应商编号:VEN05006提交接口成功 执行时间:1.1099901199341 s
供应商编号:VEN05006审核接口成功 执行时间:0.17360591888428 s
......@@ -17,6 +17,9 @@ class inputAction extends Action
private $fieldarr = array();
private $ismobile = 0;
private $subdata = []; //子表数据
private $maindata = [];
protected $moders = array();
......@@ -188,6 +191,9 @@ class inputAction extends Action
//判断保存前的
$ss = '';
$befa = $this->savebefore($table, $this->getsavenarr($uaarr, $oldrs), $id, $addbo);
$this->maindata = $this->getsavenarr($uaarr, $oldrs); //缓存主表数据
$notsave= array();//不保存的字段
if(is_string($befa)){
$ss = $befa;
......@@ -247,8 +253,10 @@ class inputAction extends Action
//保存后处理
$this->saveafter($table,$this->getsavenarr($uaarr, $oldrs), $id, $addbo);
//保存修改记录
$this->record($id); //保存日志
//保存修改记录
$editcont = '';
if($oldrs){
$newrs = $db->getone($id);
......@@ -258,9 +266,19 @@ class inputAction extends Action
$this->flow->editcont = $editcont;
$this->flow->loaddata($id, false);
$this->flow->submit($subna);
$this->backmsg('', $subna, $id);
$this->backmsg('', $subna, $id);
}
private function record($id){
$type = empty($id) ? '插入数据' : '修改数据';
$data['main'] = $this->maindata;
$data['sub'] = $this->subdata;
$data = json_encode($data);
m('log')->addlog($type,$data,[]);
}
private function getsavenarr($nsrr, $bos=false)
{
......@@ -315,7 +333,9 @@ class inputAction extends Action
$idss = '0';
$whes = '';
$allfields = $this->db->getallfields('[Q]'.$tables.'');
$this->subdata[$tables] = $data; //缓存子表数据
$allfields = $this->db->getallfields('[Q]'.$tables.'');
$oarray = array();
if(in_array('optdt', $allfields))$oarray['optdt'] = $this->now;
if(in_array('optid', $allfields))$oarray['optid'] = $this->adminid;
......@@ -336,7 +356,6 @@ class inputAction extends Action
$uaarr['mid'] = $mid;
if($sid==0)$where = '';
foreach($oarray as $k1=>$v1)$uaarr[$k1]=$v1;
$dbs->record($uaarr, $where);
if($sid==0)$sid = $this->db->insert_id();
$idss.=','.$sid.'';
......
<?php
class inputAction extends Action
{
public $mid = 0;
public $flow;
public $rs = array();
public function initAction()
{
/*
$aid = (int)$this->get('adminid');
$token = $this->get('token');
$uid = m('login')->autologin($aid, $token);
$this->getlogin();
$this->loginnot();*/
}
private $fieldarr = array();
private $ismobile = 0;
protected $moders = array();
//保存前处理,主要用于判断是否可以保存
protected function savebefore($table,$arr, $id, $addbo){}
//保存后处理,主要用于判断是否可以保存
protected function saveafter($table,$arr, $id, $addbo){}
//子表保存前的处理
protected function savesubbefore($data,$tables){return $data;}
//生成列表页,数据读取前处理
protected function storebefore($table){}
//生成列表页,数据读取后处理
protected function storeafter($table, $rows){}
//过滤html代码
private function xxsstolt($uaarr)
{
foreach($uaarr as $k=>$v){
$vss = strtolower($v);
if(contain($vss, '<script')){
$uaarr[$k] = str_replace(array('<','>'),array('&lt;','&gt;'), $v);
}
}
return $uaarr;
}
/**
* 录入的保存
*/
public function saveAjax()
{
$id = (int)$this->request('id');
$modenum = $this->request('sysmodenum');
$uid = $this->adminid;
$this->flow = m('flow')->initflow($modenum);
$this->moders = $this->flow->moders;
$modeid = $this->moders['id'];
$isflow = (int)$this->moders['isflow'];
$flownum = $this->moders['num'];
$table = $this->moders['table'];
$sysisturn = (int)$this->post('istrun','1');
$checkobj = c('check');
if($this->isempt($table))$this->backmsg('模块未设置表名');
$fieldsarr = array();
$fiexar = $this->flow->flowfieldarr($this->flow->fieldsarra, 2);
foreach($fiexar as $k2=>$rs2)if($rs2['islu']==1)$fieldsarr[]=$rs2;
if(!$fieldsarr)$this->backmsg('没有录入元素');
$db = m($table);$subna = '提交';$addbo = false;$where = "`id`='$id'"; $oldrs = false;
$this->mdb = $db;
if($id==0){
$where = '';
$addbo = true;
$isadd = m('view')->isadd($modeid, $uid);
if(!$isadd)$this->backmsg('无权添加['.$this->moders['name'].']的数据1;');
}else{
$oldrs = $db->getone($id);
if(!$oldrs)$this->backmsg('记录不存在');
$this->flow->loaddata($id);
if(!$this->flow->iseditqx())
$this->backmsg('无权编辑['.$this->moders['name'].']的数据;');
if($isflow>0){
if($oldrs['uid']==$uid || $oldrs['optid']==$uid || $this->flow->floweditother){
}else{
$this->backmsg('不是你提交/申请的单据,不允许编辑');
}
if($oldrs['status']==1)$this->backmsg('单据已审核完成,不允许编辑');
}
$subna = '编辑';
}
if($oldrs)$this->rs = $oldrs;
$uaarr = $farrs = array();
$lvls = array('textarea','htmlediter');
foreach($fieldsarr as $k=>$rs){
$fid = $rs['fields'];
$fi1 = substr($fid, 0, 5);
if($fi1=='temp_' || $fi1=='base_')continue;
$val = $this->post($fid);
if($rs['isbt']==1 && isempt($val))$this->backmsg(''.$rs['name'].'不能为空');
if(!isempt($val) && $rs['fieldstype']=='email'){
if(!$checkobj->isemail($val))$this->backmsg(''.$rs['name'].'格式不对');
}
//if(!in_array($rs['fieldstype'], $lvls))$val = htmlspecialchars($val);
$uaarr[$fid] = $val;
$farrs[$fid] = array('name' => $rs['name']);
}
//人员选择保存的
$otherfileid = '';
foreach($fieldsarr as $k=>$rs){
if(substr($rs['fieldstype'],0,6)=='change'){
if(!$this->isempt($rs['data'])){
$fid = $rs['data'];
if(isset($uaarr[$fid]))continue;
$val = $this->post($fid);
if($rs['isbt']==1&&$this->isempt($val))$this->backmsg(''.$rs['name'].'id不能为空');
$uaarr[$fid] = $val;
$farrs[$fid] = array('name' => $rs['name'].'id');
}
}
if($rs['fieldstype']=='num'){
$fid = $rs['fields'];
if($this->flow->rows("`$fid`='{$uaarr[$fid]}' and `id`<>$id")>0)$uaarr[$fid]=$this->flow->createbianhao($rs['data'], $fid);
}
if($rs['fieldstype']=='uploadfile'){
$_val= arrvalue($uaarr, $rs['fields']);
if(!isempt($_val))$otherfileid.=','.$_val.'';
}
}
//默认字段保存
$allfields = $this->db->getallfields('[Q]'.$table.'');
if(in_array('optdt', $allfields))$uaarr['optdt'] = $this->now;
if(in_array('optid', $allfields))$uaarr['optid'] = $this->adminid;
if(in_array('optname', $allfields))$uaarr['optname'] = $this->adminname;
if(in_array('uid', $allfields) && $addbo){
$uaarr['uid'] = $this->post('uid', $this->adminid);
}
if(isset($uaarr['uid'])){
$urs = $this->flow->adminmodel->getone($uaarr['uid']);
in_array('applyname', $allfields) and $uaarr['applyname'] = $urs['name'];
in_array('applydeptname', $allfields) and $uaarr['applydeptname'] = $urs['deptname'];
}
if(in_array('applydt', $allfields) && $id==0)
$uaarr['applydt'] = $this->post('applydt', $this->date);
if($addbo){
if(in_array('createdt', $allfields))$uaarr['createdt'] = $this->now;
if(in_array('adddt', $allfields))$uaarr['adddt'] = $this->now;
if(in_array('createid', $allfields))$uaarr['createid'] = $this->adminid;
if(in_array('createname', $allfields))$uaarr['createname'] = $this->adminname;
}
//保存公司的
if(in_array('comid', $allfields)){
if($addbo)$uaarr['comid'] = m('admin')->getcompanyid();
if(arrvalue($oldrs,'comid')=='0')$uaarr['comid'] = m('admin')->getcompanyid();
}
if($isflow>0){
$uaarr['status']= '0';
if($sysisturn==0){
$uaarr['isturn']= '0';
$subna = '保存';
}
}else{
if(in_array('status', $allfields))$uaarr['status'] = (int)$this->post('status', '1');
if(in_array('isturn', $allfields))$uaarr['isturn'] = (int)$this->post('isturn', '1');
}
//保存条件的判断
foreach($fieldsarr as $k=>$rs){
$ss = '';
if(isset($uaarr[$rs['fields']]))$ss = $this->flow->savedatastr($uaarr[$rs['fields']], $rs, $uaarr);
if($ss!='')$this->backmsg($ss);
}
//判断保存前的
$ss = '';
$befa = $this->savebefore($table, $this->getsavenarr($uaarr, $oldrs), $id, $addbo);
$notsave= array();//不保存的字段
if(is_string($befa)){
$ss = $befa;
}else{
if(isset($befa['msg']))$ss=$befa['msg'];
if(isset($befa['rows'])){
if(is_array($befa['rows']))foreach($befa['rows'] as $bk=>$bv)$uaarr[$bk]=$bv;
}
if(isset($befa['notsave'])){
$notsave=$befa['notsave'];
if(is_string($notsave))$notsave = explode(',', $notsave);
}
}
if(!$this->isempt($ss))$this->backmsg($ss);
//不保存字段过滤掉
if(is_array($notsave))foreach($notsave as $nofild)if(isset($uaarr[$nofild]))unset($uaarr[$nofild]);
$uaarr = $this->xxsstolt($uaarr);//过滤特殊文字
foreach($uaarr as $kf=>$kv){
if(!in_array($kf, $allfields)){
$this->backmsg('模块主表['.$this->flow->mtable.']上字段['.$kf.']不存在');
}
}
//isonly唯一值的判断
foreach($fieldsarr as $k=>$rs){
$fiesd = $rs['fields'];
if($rs['isonly']=='1' && isset($uaarr[$fiesd])){
$dval = $uaarr[$fiesd];
if(!isempt($dval)){
if($db->rows("`id`<>'$id' and `$fiesd`='$dval'")>0)$this->backmsg(''.$rs['name'].'['.$dval.']已存在了');
}
}
}
$bo = $db->record($uaarr, $where);;
if(!$bo)$this->backmsg($this->db->error());
if($id==0)$id = $this->db->insert_id();
m('file')->addfile($this->post('fileid'), $table, $id, $modenum);
if($otherfileid!='')m('file')->addfile(substr($otherfileid,1), '', $id, $modenum);
$newrs = $db->getone($id);
$this->companyid = isset($newrs['companyid']) ? (int)$newrs['companyid'] : (int)arrvalue($newrs, 'comid', '0');
if($this->companyid==0)$this->companyid = m('admin')->getcompanyid();
//保存多行子表
$tabless = $this->moders['tables'];
if(!isempt($tabless)){
$tablessa = explode(',', $tabless);
foreach($tablessa as $zbx=>$tablessas){
$this->savesubtable($tablessas, $id, $zbx, $addbo);
}
}
//保存后处理
$this->saveafter($table,$this->getsavenarr($uaarr, $oldrs), $id, $addbo);
//保存修改记录
$editcont = '';
if($oldrs){
$newrs = $db->getone($id);
$editcont = m('edit')->recordsave($farrs, $table, $id, $oldrs, $newrs);
}
$msg = '';
$this->flow->editcont = $editcont;
$this->flow->loaddata($id, false);
$this->flow->submit($subna);
$this->backmsg('', $subna, $id);
}
private function getsavenarr($nsrr, $bos=false)
{
if(!is_array($bos))$bos = array();
if($nsrr)foreach($nsrr as $k=>$v)$bos[$k]=$v;
return $bos;
}
public function getsubtabledata($xu)
{
$arr = array();
$oi = (int)$this->post('sub_totals'.$xu.'');
if($oi<=0)return $arr;
$modeid = $this->moders['id'];
$iszb = $xu+1;
$farr = m('flow_element')->getrows("`mid`='$modeid' and `islu`=1 and `iszb`=$iszb",'`name`,`fields`,`isbt`,`fieldstype`,`savewhere`,`dev`,`data`','`sort`');
$sort = 0;
for($i=0; $i<$oi; $i++){
$sid = (int)$this->post('sid'.$xu.'_'.$i.'');
$bos = true;
$uaarr['id'] = $sid;
foreach($farr as $k=>$rs){
$fid= $rs['fields'];
$flx= $rs['fieldstype'];
if(substr($fid,0,5)=='temp_')continue;
$na = ''.$fid.''.$xu.'_'.$i.'';
$val= $this->post($na);
if($rs['isbt']==1&&$this->isempt($val))$bos=false;
$uaarr[$fid] = $val;
if(substr($flx,0,6)=='change' && !isempt($rs['data'])){
$na = ''.$rs['data'].''.$xu.'_'.$i.'';
$val= $this->post($na);
$uaarr[$rs['data']] = $val;
}
}
if(!$bos)continue;
$uaarr['sort'] = $sort;
$sort++;
$arr[] = $uaarr;
}
return $arr;
}
//多行子表的保存
private function savesubtable($tables, $mid, $xu, $addbo)
{
$dbs = m($tables);
$data = $this->getsubtabledata($xu);
$data = $this->savesubbefore($data,$tables);
$len = count($data);
$idss = '0';
$whes = '';
$allfields = $this->db->getallfields('[Q]'.$tables.'');
$oarray = array();
if(in_array('optdt', $allfields))$oarray['optdt'] = $this->now;
if(in_array('optid', $allfields))$oarray['optid'] = $this->adminid;
if(in_array('optname', $allfields))$oarray['optname'] = $this->adminname;
if(in_array('uid', $allfields) && $addbo)$oarray['uid'] = $this->post('uid', $this->adminid);
if(in_array('applydt', $allfields) && $addbo)$oarray['applydt'] = $this->post('applydt', $this->date);
if(in_array('status', $allfields))$oarray['status'] = 0;
if(in_array('sslx', $allfields)){
$oarray['sslx'] = $xu;
$whes = ' and `sslx`='.$xu.'';
}
if(in_array('comid', $allfields))$oarray['comid'] = $this->companyid;
if($data)foreach($data as $k=>$uaarr){
$sid = $uaarr['id'];
$where = "`id`='$sid'";
$uaarr['mid'] = $mid;
if($sid==0)$where = '';
foreach($oarray as $k1=>$v1)$uaarr[$k1]=$v1;
$dbs->record($uaarr, $where);
if($sid==0)$sid = $this->db->insert_id();
$idss.=','.$sid.'';
}
$delwhere = "`mid`='$mid'".$whes." and `id` not in($idss)";
$dbs->delete($delwhere);
}
//获取数据
public function getdataAjax()
{
$flownum = $this->request('flownum');
$id = (int)$this->request('mid');
$arr = m('flow')->getdataedit($flownum, $id);
$this->backmsg('', '', $arr);
}
public function lumAction()
{
$this->ismobile = 1;
$this->luactions();
}
public function luAction()
{
$this->ismobile = 0;
$this->luactions();
}
public function lusAction()
{
$this->ismobile = 1;
$menuid = (int)$this->get('menuid');
$fields = m('flow_menu')->getmou('fields', $menuid);
if(isempt($fields))exit('sorry;');
$fields = str_replace(',',"','", $fields);
$stwhe = "and `fields` in('$fields')";
$this->luactions(1, $stwhe);
}
//高级搜索显示框
public function highsouAction()
{
$this->displayfile = ''.P.'/flow/input/tpl_input_lus.html';
$this->ismobile = 1;
$this->luactions(0, '', 1);
}
//$lutype=1高级搜索用的
private function luactions($slx=0, $stwhe='', $lutype=0)
{
$this->tpltype = 'html';
$uid = $this->adminid;
$num = $this->jm->gettoken('num');
$mid = (int)$this->jm->gettoken('mid');
$this->mid = $mid;
$this->rs = array();
$this->flow = m('flow')->initflow($num);
$moders = $this->flow->moders;
$modename = $moders['name'];
if($moders['status']=='0')exit('模块['.$modename.']已停用了;');
$apaths = ''.P.'/flow/input/mode_'.$moders['num'].'Action.php';
if(!file_exists($apaths))exit('没有创建布局录入页面,无法打开,请到【流程模块→表单元素管理】下的点按钮“PC端录入页面布局”,更多查看'.c('xinhu')->helpstr('bwb3mf').'。');
$isflow = (int)$moders['isflow'];
$this->smartydata['moders'] = array(
'num' => $moders['num'],
'id' => $moders['id'],
'name' => $moders['name'],
'names' => $moders['names'],
'isflow'=> $isflow,
'iscs' => $moders['iscs'],
'isbxs' => $moders['isbxs'],
);
$this->smartydata['chao'] = $this->flow->getcsname($mid);
$modeid = $moders['id'];
if($mid==0 && $lutype==0){
$isadd = m('view')->isadd($modeid, $uid);
if(!$isadd)exit('无权添加['.$modename.']的数据;');
}
$content = '';
$oldrs = m($moders['table'])->getone($mid);
$this->rs = $oldrs;
$this->gongsiarr = array();
$fieldarr = m('flow_element')->getrows("`mid`='$modeid' and `iszb`=0 $stwhe",'fields,fieldstype,name,dev,data,isbt,islu,attr,iszb,issou,gongsi,placeholder','`sort`');
$fieldarr = $this->flow->flowfieldarr($fieldarr, $this->ismobile);
$modelu = '';
foreach($fieldarr as $k=>$rs){
if($slx==1 && $oldrs){
$rs['value'] = $oldrs[$rs['fields']];
}
if($lutype==1){
$rs['isbt'] = 0;
if($rs['issou']==1)$modelu.='{'.$rs['fields'].'}';
}else{
if($rs['islu'] || $stwhe!='')$modelu.='{'.$rs['fields'].'}';
if(!isempt($rs['gongsi']) && contain($rs['gongsi'],'{'))$this->gongsiarr[] = array(
'iszb' => 0,
'fields' => $rs['fields'],
'gongsi' => $rs['gongsi'],
);
}
$this->fieldarr[$rs['fields']] = $rs;
}
$this->smartydata['fieldsjson'] = json_encode($fieldarr);
$this->moders = $moders;
$zbshu = 0;
$tableas = false;
if(!isempt($moders['tables'])){
$tableas = explode(',', $moders['tables']);
$zbshu = count($tableas);
}
$path = ''.P.'/flow/page/input_'.$num.'.html';
$pclucont = '';
if(file_exists($path))$pclucont = file_get_contents($path);
$isupfile = 0;
$nameaas = explode(',', $moders['names']); //子表名
//PC端
if($this->ismobile==0){
$content = $pclucont;
}else{
$content = $modelu;
if($tableas && $slx==0){
foreach($tableas as $k1=>$tableass){
$zbstr = m('input')->getsubtable($modeid,$k1+1,1,1);
if($zbstr!=''){
$content.='<tr><td style="padding:5px;" colspan="2"><div><b>'.arrvalue($nameaas, $k1).'</b></div>';
if($this->flow->minwidth>300){
$content.='<div tmp="mobilezbiao" style="width:280px;overflow:auto;"><div
style="min-width:'.$this->flow->minwidth.'px">'.$zbstr.'</div></div>';
}else{
$content.='<div>'.$zbstr.'</div>';
}
$content.= '</td></tr>';
}
}
}
$isupfile = contain($pclucont, '{file_content}') ? 1 : 0;
}
if($content=='')exit('未设置录入页面,请到[流程模块→表单元素管理]下设置');
$content = $this->flow->flowinputtpl($content, $this->ismobile);
$this->actclss = $this;
$pathss = ''.P.'/flow/input/mode_'.$num.'Action.php';
if(file_exists($pathss)){
include_once($pathss);
$clsnam = 'mode_'.$num.'ClassAction';
$this->actclss = new $clsnam();
$this->actclss->flow = $this->flow;
$this->actclss->mid = $this->mid;
$this->actclss->rs = $this->rs;
$this->actclss->ismobile= $this->ismobile;
}
//初始表单插件元素
$this->inputobj = c('input');
$this->inputobj->ismobile = $this->ismobile;
$this->inputobj->fieldarr = $this->fieldarr;
$this->inputobj->flow = $this->flow;
$this->inputobj->mid = $this->mid;
$this->inputobj->initUser($this->adminid);
preg_match_all('/\{(.*?)\}/', $content, $list);
foreach($list[1] as $k=>$nrs){
$str = $this->inputobj->getfieldcont($nrs, $this->actclss);
$content = str_replace('{'.$nrs.'}', $str, $content);
}
$this->subfielsa = array();
$content = $this->pisubduolie($content, $modeid, $nameaas);//多列子表匹配的是[]
$content = str_replace('*','<font color=red>*</font>', $content);
$course = array();
$nowcourseid = 0;
if($isflow>0 && $lutype==0){
$course[]= array('name'=>'提交','id'=>0);
$courses = $this->flow->getflowpipei($this->adminid);
if($mid>0){
$nowcourseid = $this->flow->billmodel->getmou('nowcourseid',"`table`='".$this->flow->mtable."' and `mid`='$mid'");
}
foreach($courses as $k=>$rs1){
$na = $rs1['name'];
if(!$this->isempt($rs1['explain']))$na.= '<br><span style="font-size:12px">('.$rs1['explain'].')</span>';
$rs1['name'] = $na;
$rs1['k'] = $k;
$rs1['isnow']= $rs1['id']==$nowcourseid;
if(arrvalue($moders,'isflowlx')=='1'){
$rs1['isnow'] = $k==0; //如果走重头审批第一步就是第一步的
}
//读取上次选择的2019-03-06 23:10:00添加
$cuid = $name = '';
if($rs1['isnow'] && $rs1['checktype']=='change' && $mid>0){
$cheorws= $this->flow->checksmodel->getall("`table`='".$this->flow->mtable."' and `mid`='$mid' and `courseid`=".$rs1['id']."",'checkid,checkname');
if($cheorws){
foreach($cheorws as $k3=>$rs3){
$cuid.=','.$rs3['checkid'].'';
$name.=','.$rs3['checkname'].'';
}
if($cuid != ''){
$cuid = substr($cuid, 1);
$name = substr($name, 1);
}
}
}
$rs1['sysnextoptid']= $cuid;
$rs1['sysnextopt'] = $name;
$course[]=$rs1;
}
$course[]= array('name'=>'结束','id'=>-1);
}
$this->title = $this->flow->inputtitle();//录入页面的标题
$this->smartydata['content'] = $content;
$this->smartydata['gongsiarr'] = $this->gongsiarr;
$this->smartydata['subfielsa'] = $this->subfielsa;
$this->smartydata['mid'] = $mid;
$this->smartydata['isflow'] = $isflow;
$this->smartydata['zbnamearr'] = $nameaas;
$this->smartydata['zbshu'] = $zbshu;//子表数
$this->smartydata['isupfile'] = $isupfile;//是否有上传
$this->assign('inputobj', c('input'));
$this->smartydata['course'] = $course;
$this->smartydata['inputwidth'] = $this->option->getval('inputwidth', 750);
}
//多行子表内替换
private function pisubduolie($content, $modeid, $nameaas)
{
$fieldarr = m('flow_element')->getrows("`mid`='$modeid' and `iszb`>0",'fields,fieldstype,name,dev,data,isbt,islu,attr,iszb,gongsi','`sort`');
if(!$fieldarr)return $content;
$this->fieldarr = array();
foreach($fieldarr as $k=>$rs){
$oi = $rs['iszb']-1;
$this->fieldarr['xuhao'.$oi.''] = array(
'fields' => 'xuhao'.$oi.'',
'fieldstype'=> 'xuhao',
'data' => '',
'attr' => 'style="text-align:center" readonly temp="xuhao"',
'dev' => '1',
'isbt' => '0',
'fieldss' => 'sid'.$oi.''
);
$this->fieldarr[$rs['fields'].''.$oi.''] = $rs;
if(!isempt($rs['gongsi']))$this->gongsiarr[] = array(
'iszb' => $rs['iszb'],
'fields' => $rs['fields'],
'gongsi' => $rs['gongsi'],
);
if($rs['isbt']=='1'){
$this->subfielsa[] = array(
'name' => $rs['name'],
'fields' => $rs['fields'],
'type' => $rs['fieldstype'],
'isbt' => $rs['isbt'],
'iszb' => (int)$rs['iszb'],
'zbname'=> arrvalue($nameaas, $oi)
);
}
}
$this->inputobj->fieldarr = $this->fieldarr;
preg_match_all('/\[(.*?)\]/', $content, $list);
foreach($list[1] as $k=>$nrs){
if(!$this->isempt($nrs)){
$fida= explode(',', $nrs);$xu0='0';
if(isset($fida[1]))$xu0=$fida[1];
$iszb = floatval(substr($fida[0],-1))+1;//第几个子表如果超过第10个子表就麻烦了
$str = $this->inputobj->getfieldcont($fida[0], $this->actclss,'_'.$xu0.'', $iszb);
$content = str_replace('['.$nrs.']', $str, $content);
}
}
return $content;
}
public function getselectdataAjax()
{
$rows = array();
$act = $this->get('act');
$modenum= $this->get('sysmodenum');
//用:读取model上的数据
if(!isempt($act) && contain($act,':')){
$acta = explode(':', $act);
$objs = m($acta[0]);
$tacs = $acta[1];
if(method_exists($objs, $tacs)){
$rows = $objs->$tacs();
}
}
if(!$rows && !isempt($act) && method_exists($this, $act)){
$rows = $this->$act();
}
//从Model上读取
if(!$rows && !isempt($modenum)){
$this->flow = m('flow')->initflow($modenum);
if(method_exists($this->flow, $act)){
$rows = $this->flow->$act();
}
}
return $rows;
}
/**
* 公共读取数据之前处理
*/
public function storebeforeshow($table)
{
$this->atypearr = false;
$this->modeid = (int)$this->get('modeid');
$pnum = $this->get('pnum');
if($this->post('atype')=='grant'){
$this->atypearr = array();
$this->atypearr[] = array(
'id' => 0,
'num' => 'grant',
'name' => ''.$this->flow->modename.'授权查看',
);
}else if($this->loadci==1 && $this->adminid>0){
$this->atypearr = m('where')->getmywhere($this->modeid, $this->adminid, $pnum);
if(isempt($pnum)){
$mors = $this->flow->moders;
if((int)arrvalue($mors,'iscs','0')>0)$this->atypearr[] = array(
'id' => 0,
'num' => 'chaos',
'name' => ''.$mors['name'].'抄送给我',
);
// if($mors['isflow']>0){
// $this->atypearr[] = array(
// 'id' => 0,
// 'num' => 'mychuli',
// 'name' => ''.$mors['name'].'经我处理',
// );
// }
}
}
$this->initAtypeArr();
return $this->storebefore($table);
}
/**
* 公共读取数据之后处理,展示列数
*/
public function storeaftershow($table, $rows)
{
$barr['rows'] = $rows;
$barr['atypearr'] = $this->atypearr;
if($this->loadci==1){
$vobj = m('view');
$barr['isadd'] = $vobj->isadd($this->modeid, $this->adminid); //判断是否可添加
$barr['isdaoru'] = $vobj->isdaoru($this->modeid, $this->adminid); //判断是否可导入
$barr['isdaochu'] = $vobj->isdaochu($this->modeid, $this->adminid); //判断是否可导入
}
$barr['souarr'] = $this->flow->flowsearchfields();
$rows = $this->flow->viewjinfields($rows);//禁看字段处理
$farrl = array();
foreach($this->flow->fieldsarra as $k2=>$rs2){
if($rs2['fieldstype']=='uploadimg')$farrl[$rs2['fields']]=$rs2['fieldstype'];
}
if($rows)foreach($rows as $k1=>$rs1){
foreach($farrl as $fid=>$flx){
if(isset($rs1[$fid])){
$val = $rs1[$fid];
if($flx=='uploadimg'){
$val = $this->rock->gethttppath($val);
$rows[$k1][$fid] = $val;
//if($this->flow->modeid>92)$val='<img src="'.$val.'" height="60">';
}
}
}
}
$barr['rows'] = $rows;
$scarr = $this->storeafter($table, $rows);
if(is_array($scarr))foreach($scarr as $k=>$v)$barr[$k]=$v;
return $barr;
}
//获取可搜索列表
public function getcolumnsAjax()
{
$modeid = (int)$this->get('modeid');
$modenum = $this->get('modenum');
$flow = m('flow')->initflow($modenum);
$souarr = array();
$this->input= c('input');
foreach($flow->fieldsarra as $k=>$rs){
if($rs['issou']==1){
$rs['store'] = $this->input->getdatastore($rs['fieldstype'], $this, $rs['data']);
$souarr[] = $rs;
}
}
$this->returnjson($souarr);
}
//初始化导入
public function initdaoruAjax()
{
$modenum = $this->get('modenum');
$flow = m('flow')->initflow($modenum);
$rows = m('flow_element')->getall('mid='.$flow->modeid.' and `isdr`=1 and `iszb`=0','name,isbt,fields','`sort`,`id`');
return $rows;
}
//确定导入数据
public function daorudataAjax()
{
$modenum = $this->post('modenum');
$flow = m('flow')->initflow($modenum);
$rows = m('flow_element')->getall('mid='.$flow->modeid.' and `isdr`=1 and `iszb`=0','name,isbt,fields,isonly','`sort`,`id`');
$fields = $fieldss = '';
if(!$rows)return returnerror('没有导入的字段');
$onlyfield = array();
foreach($rows as $k=>$rs){
$fields.=','.$rs['fields'].'';
if($rs['isbt']=='1')$fieldss.=','.$rs['fields'].'';
if($rs['isonly']=='1')$onlyfield[] = $rs['fields']; //唯一字段
}
$fields = substr($fields, 1);
if($fieldss!='')$fieldss = substr($fieldss,1);
$data = c('html')->importdata($fields, $fieldss); //获取提交过来要导入的数据库
if(!$data)return returnerror('没有可导入的数据,注意*是必填的哦');
$msgstr = '';
//保存前判断
if(method_exists($flow,'flowdaorubefore')){
$data = $flow->flowdaorubefore($data);
if(is_string($data))return returnerror($data);
}
//判断是否有重复
$ldata = array();
foreach($data as $k=>$rs){
$bos = true;
foreach($onlyfield as $onid){
$val = arrvalue($rs, $onid);
if(!isempt($val)){
$tos = $flow->rows("`$onid`='$val'");
if($tos>0){
$bos = false;
$msgstr.='行'.($k+1).'的字段'.$onid.'存在重复;';
break;
}
}
}
if($bos)$ldata[] = $rs;
}
if(!$ldata)return returnerror('没有可导入的数据'.$msgstr.'');
$allfields = $this->db->getallfields('[Q]'.$flow->mtable.'');
$oi = 0;
$dorudat= array();
foreach($ldata as $k=>$rs){
$id = (int)arrvalue($rs,'id','0');
$where = '';
if($id>0){
if($flow->rows($id)>0){
$where='`id`='.$id.'';
}else{
$id = 0;
}
}
if($id==0){
if(!isset($rs['createid']) && in_array('createid', $allfields))$rs['createid'] = $this->adminid;
if(!isset($rs['createname']) && in_array('createname', $allfields))$rs['createname'] = $this->adminname;
if(!isset($rs['adddt']) && in_array('adddt', $allfields))$rs['adddt'] = $this->now;
if(!isset($rs['createdt']) && in_array('createdt', $allfields))$rs['createdt'] = $this->now;
if(!isset($rs['comid']) && in_array('comid', $allfields))$rs['comid'] = m('admin')->getcompanyid();
}
if(!isset($rs['uid']) && in_array('uid', $allfields))$rs['uid'] = $this->adminid;
if(!isset($rs['optid']) && in_array('optid', $allfields))$rs['optid'] = $this->adminid;
if(!isset($rs['optname']) && in_array('optname', $allfields))$rs['optname'] = $this->adminname;
if(!isset($rs['optdt']) && in_array('optdt', $allfields))$rs['optdt'] = $this->now;
if(!isset($rs['applydt']) && in_array('applydt', $allfields))$rs['applydt'] = $this->date;
if($id==0){
$bo = $flow->insert($rs);
}else{
$bo = $id;
$flow->update($rs, $where);
}
if($bo){
$rs['id'] = $bo;
$dorudat[]= $rs;
$oi++;
//有流程的模块就要提交操作
$status = arrvalue($rs,'status','0'); //状态
$isturn = arrvalue($rs,'isturn','1'); //默认是提交的
if($flow->isflow>0 && $status=='0'){
$flow->loaddata($rs['id'], false);
$na = ($isturn=='1') ? '提交' : '保存';
$flow->submit($na);
}
}else{
$msgstr.='行'.($k+1).'保存数据库错误;';
}
}
if($oi==0)return returnerror('导入数据为0条'.$msgstr.'');
//保存后判断
if(method_exists($flow,'flowdaoruafter')){
$flow->flowdaoruafter($dorudat);
}
return returnsuccess('成功导入'.$oi.'条数据'.$msgstr.'');
}
//读取导入的excel数据
public function readxlsAjax()
{
$fileid = (int)$this->get('fileid','0');
$fpath = m('file')->getmou('filepath', $fileid);
if(isempt($fpath))return returnerror('文件不存在了');
$phpexcel = c('PHPExcelReader');
$rows = $phpexcel->reader($fpath);
if(is_string($rows))return returnerror('无法读取Excel文件('.$rows.')');
$modenum= $this->get('modenum');
$flow = m('flow')->initflow($modenum);
$dtarr = array();//日期读取需要判断
$xuha = -1;
foreach($flow->fieldsarra as $k2=>$rs2){
if($rs2['isdr']=='1' && $rs2['iszb']=='0'){
$xuha++;
if(in_array($rs2['fieldstype'], array('date','datetime'))){
$dtarr[$phpexcel->A[$xuha]] = $rs2['fieldstype'];
}
}
}
$str = '';
foreach($rows as $k=>$rs){
$str1 = '';
$xi = 0;
foreach($rs as $k1=>$v1){
if($xi>0)$str1.=' ';
if(isset($dtarr[$k1]) && is_numeric($v1)){
$v1 = $phpexcel->ExcelToDate($dtarr[$k1], $v1);
}
$v1 = str_replace("\n", '[XINHUBR]', $v1); //有\n转
$str1.=''.$v1.'';
$xi++;
}
if($k>0)$str.="\n";
$str.=$str1;
}
return returnsuccess($str);
}
//下载导入的模版
public function daoruexcelAction()
{
$this->display = false;
$modenum = $this->get('modenum');
$flow = m('flow')->initflow($modenum);
$rows = m('flow_element')->getall('mid='.$flow->modeid.' and `isdr`=1 and `iszb`=0','name,isbt,fields','`sort`,`id`');
if(!$rows)return '对应模块没有设置导入字段';
$testdata = $texdata = array();
if(method_exists($flow,'flowdaorutestdata')){
$testdata = $flow->flowdaorutestdata();
}
m('file')->fileheader(''.$modenum.'import.xls');
$str1 = '';
$str2 = '';
$col = 0;
$headArr = array();
foreach($rows as $k=>$rs){
$col++;
$xi = $rs['isbt']=='1'? '<font color=red>*</font>' : '';
$x1 = $rs['isbt']=='1'? '*' : '';
$str1.='<td style="border:.5pt #000000 solid; background:#cdf79e" height="30" align="center">'.$xi.'<b>'.$rs['name'].'('.$rs['fields'].')</b></td>';
$headArr[$rs['fields']] = ''.$x1.''.$rs['name'].'('.$rs['fields'].')';
}
if($testdata){
$texdata = $testdata;
if(!isset($testdata[0]))$texdata = array($testdata);
foreach($texdata as $j=>$jrs){
$str2.='<tr>';
foreach($rows as $k=>$rs){
$val = arrvalue($jrs, $rs['fields']);
$str2.='<td style="border:.5pt #000000 solid;" height="30" align="center">'.$val.'</td>';
}
$str2.='</tr>';
}
}
$str = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<table style="border-spacing: 0;border-collapse: collapse;"><tr bgcolor="#f1f1f1">'.$str1.'</tr>'.$str2.'';
for($i=1;$i<=100;$i++){
$str.='<tr>';
for($j=1;$j<=$col; $j++){
$str.='<td style="border:.5pt #000000 solid" height="30" align="center"></td>';
}
$str.='</tr>';
}
$str.= '</table>';
$pexecl = c('PHPExcel');
if($pexecl->isBool()){
$pexecl->title = ''.$modenum.'_import';
$pexecl->titlebool = false;
$pexecl->borderbool = false;
$pexecl->headArr = $headArr;
$pexecl->rows = $texdata;
$pexecl->display('xls', 'down');
}else{
return $str;
}
}
public function getuinfoAjax()
{
$uid = $this->post('uid', $this->adminid);
$rs = m('admin')->getone($uid,'id,name,deptname,deptallname,ranking,workdate,pingyin');
$unrs= m('userinfo')->getone($uid, 'syenddt,positivedt');
if($unrs)foreach($unrs as $k=>$v)$rs[$k] =$v;
return $rs;
}
public function upimagepathAjax()
{
$fileid = (int)$this->get('fileid');
$fid = $this->get('fid');
$frs = m('file')->getone($fileid);
$path = '';
if(!isempt($frs['thumbplat'])){
$path = str_replace('_s.','.',$frs['thumbplat']);
}
return returnsuccess(array(
'path' => $path,
'fid' => $fid,
));
}
//数据字典
public function getuids($num){
$numarr = m('option')->getone('num = "'.$num.'"','id');
$data = m('option')->getall('pid = "'.$numarr['id'].'"','id,num');
$ids = [];
foreach ($data as $v){
$ids[] = $v['num'];
}
return $ids;
}
private function initAtypeArr(){
$uid = $this->adminid;
$num = $this->post('modenum');
//1.获取数据字典
$dd = m('option')->getall('pid = 1186');
$nd = []; //节点数据
$tagarr[] = 'my'; //tags
//2.获取编号
foreach ($dd as $k1 => $v1){
if($v1['name'] == $num){
$nd = m('option')->getall('pid = '.$v1['id']); //all,archive
foreach ($nd as $k2 => $v2){
$tag = m('option')->getone('`name` = "'.$v2['num'].'"'); //$v['num'] = ug_htall
$users = m('option')->getall('pid = '.$tag['id']); //uids
foreach ($users as $u) {
if($uid == $u['num']){
$tagarr[] = $v2['name'];
continue;
}
}
}
}
}
foreach ($this->atypearr as $k => $value){ //all my
$flag = 0;
foreach ($tagarr as $aty){ //my all archive
if($value['num'] == $aty){
$flag = 1;
continue;
}
}
if($flag == 0){
unset($this->atypearr[$k]);
}
}
$this->atypearr = array_values($this->atypearr);
}
}
class inputClassAction extends inputAction{}
\ No newline at end of file
......@@ -11,7 +11,7 @@ $(document).ready(function(){
{params}
var modenum = 'hisoa',modename='历史OA信息展示',isflow=0,modeid='112',atype = params.atype,pnum=params.pnum,modenames='';
if(!atype)atype='';if(!pnum)pnum='';
var fieldsarr = [{"name":"\u7533\u8bf7\u4eba","fields":"base_name"},{"name":"\u7533\u8bf7\u4eba\u90e8\u95e8","fields":"base_deptname"},{"name":"\u5355\u53f7","fields":"sericnum"},{"fields":"his_oa_numb","name":"\u5386\u53f2OA\u6d41\u6c34\u53f7","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"payment_type","name":"\u4ed8\u6b3e\u7c7b\u578b","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"project_name","name":"\u9879\u76ee\u540d\u79f0","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"amount","name":"\u4ed8\u6b3e\u91d1\u989d","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"payee","name":"\u6536\u6b3e\u4eba","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"payment_mode","name":"\u4ed8\u6b3e\u65b9\u5f0f","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"applicant","name":"\u7533\u8bf7\u4eba","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"department","name":"\u6240\u5c5e\u90e8\u95e8","fieldstype":"changedept","ispx":"0","isalign":"0","islb":"1"},{"fields":"create_time","name":"\u7533\u8bf7\u65f6\u95f4","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"final_status","name":"\u6700\u7ec8\u72b6\u6001","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"contract","name":"\u6240\u5c5e\u5408\u540c\u7f16\u53f7","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"pay_explain","name":"\u4ed8\u6b3e\u8bf4\u660e","fieldstype":"textarea","ispx":"0","isalign":"0","islb":"1"},{"fields":"project_numb","name":"\u76f8\u5173\u9879\u76ee\u7f16\u53f7","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"his_dept","name":"\u5386\u53f2\u5f52\u5c5e\u90e8\u95e8","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"}],fieldsselarr= [];
var fieldsarr = [{"name":"\u7533\u8bf7\u4eba","fields":"base_name"},{"name":"\u7533\u8bf7\u4eba\u90e8\u95e8","fields":"base_deptname"},{"name":"\u5355\u53f7","fields":"sericnum"},{"fields":"his_oa_numb","name":"\u5386\u53f2OA\u6d41\u6c34\u53f7","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"payment_type","name":"\u4ed8\u6b3e\u7c7b\u578b","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"project_name","name":"\u9879\u76ee\u540d\u79f0","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"amount","name":"\u4ed8\u6b3e\u91d1\u989d","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"payee","name":"\u6536\u6b3e\u4eba","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"uid","name":"\u5458\u5de5ID","fieldstype":"number","ispx":"0","isalign":"0","islb":"0"},{"fields":"payment_mode","name":"\u4ed8\u6b3e\u65b9\u5f0f","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"applicant","name":"\u7533\u8bf7\u4eba","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"department","name":"\u6240\u5c5e\u90e8\u95e8","fieldstype":"changedept","ispx":"0","isalign":"0","islb":"1"},{"fields":"create_time","name":"\u7533\u8bf7\u65f6\u95f4","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"final_status","name":"\u6700\u7ec8\u72b6\u6001","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"contract","name":"\u6240\u5c5e\u5408\u540c\u7f16\u53f7","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"pay_explain","name":"\u4ed8\u6b3e\u8bf4\u660e","fieldstype":"textarea","ispx":"0","isalign":"0","islb":"1"},{"fields":"project_numb","name":"\u76f8\u5173\u9879\u76ee\u7f16\u53f7","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"his_dept","name":"\u5386\u53f2\u5f52\u5c5e\u90e8\u95e8","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"}],fieldsselarr= [];
var c = {
reload:function(){
......
......@@ -11,7 +11,7 @@ $(document).ready(function(){
{params}
var modenum = 'oayfk',modename='预付款申请单',isflow=1,modeid='103',atype = params.atype,pnum=params.pnum,modenames='';
if(!atype)atype='';if(!pnum)pnum='';
var fieldsarr = [{"name":"\u7533\u8bf7\u4eba","fields":"base_name"},{"name":"\u7533\u8bf7\u4eba\u90e8\u95e8","fields":"base_deptname"},{"name":"\u5355\u53f7","fields":"sericnum"},{"fields":"fkinfo","name":"\u6536\u6b3e\u4eba\u4fe1\u606f","fieldstype":"textarea","ispx":"0","isalign":"0","islb":"0"},{"fields":"userid","name":"\u7528\u6237\u7f16\u53f7","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"paymentMethod","name":"\u4ed8\u6b3e\u65b9\u5f0f","fieldstype":"rockcombo","ispx":"0","isalign":"0","islb":"0"},{"fields":"payee","name":"\u6536\u6b3e\u65b9","fieldstype":"selectdatafalse","ispx":"1","isalign":"0","islb":"0"},{"fields":"paymentBy","name":"\u4ed8\u6b3e\u4e8b\u7531","fieldstype":"textarea","ispx":"1","isalign":"0","islb":"0"},{"fields":"fkorg","name":"\u4ed8\u6b3e\u7ec4\u7ec7","fieldstype":"rockcombo","ispx":"0","isalign":"0","islb":"0"},{"fields":"applicant","name":"\u7533\u8bf7\u4eba","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"application","name":"\u7533\u8bf7\u90e8\u95e8","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"fujian","name":"\u9644\u4ef6","fieldstype":"uploadfile","ispx":"0","isalign":"0","islb":"0"},{"fields":"applydate","name":"\u7533\u8bf7\u65e5\u671f","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"docnum","name":"\u5355\u636e\u7f16\u53f7","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"yfkname","name":"\u6807\u9898","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"amountOfThisPayment","name":"\u4ed8\u6b3e\u91d1\u989d","fieldstype":"text","ispx":"1","isalign":"0","islb":"1"}],fieldsselarr= {"columns_oayfk_all":"base_name,base_deptname,applydate,docnum,yfkname,amountOfThisPayment,caozuo"};
var fieldsarr = [{"name":"\u7533\u8bf7\u4eba","fields":"base_name"},{"name":"\u7533\u8bf7\u4eba\u90e8\u95e8","fields":"base_deptname"},{"name":"\u5355\u53f7","fields":"sericnum"},{"fields":"fkinfo","name":"\u6536\u6b3e\u4eba\u4fe1\u606f","fieldstype":"textarea","ispx":"0","isalign":"0","islb":"0"},{"fields":"userid","name":"\u7528\u6237\u7f16\u53f7","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"paymentMethod","name":"\u4ed8\u6b3e\u65b9\u5f0f","fieldstype":"rockcombo","ispx":"0","isalign":"0","islb":"0"},{"fields":"payee","name":"\u6536\u6b3e\u65b9","fieldstype":"selectdatafalse","ispx":"1","isalign":"0","islb":"0"},{"fields":"paymentBy","name":"\u4ed8\u6b3e\u4e8b\u7531","fieldstype":"textarea","ispx":"1","isalign":"0","islb":"0"},{"fields":"fkorg","name":"\u4ed8\u6b3e\u7ec4\u7ec7","fieldstype":"rockcombo","ispx":"0","isalign":"0","islb":"0"},{"fields":"applicant","name":"\u7533\u8bf7\u4eba","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"application","name":"\u7533\u8bf7\u90e8\u95e8","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"fujian","name":"\u9644\u4ef6","fieldstype":"uploadfile","ispx":"0","isalign":"0","islb":"0"},{"fields":"applydate","name":"\u7533\u8bf7\u65e5\u671f","fieldstype":"text","ispx":"1","isalign":"0","islb":"1"},{"fields":"docnum","name":"\u5355\u636e\u7f16\u53f7","fieldstype":"text","ispx":"1","isalign":"0","islb":"1"},{"fields":"yfkname","name":"\u6807\u9898","fieldstype":"text","ispx":"1","isalign":"0","islb":"1"},{"fields":"amountOfThisPayment","name":"\u4ed8\u6b3e\u91d1\u989d","fieldstype":"text","ispx":"1","isalign":"0","islb":"1"}],fieldsselarr= {"columns_oayfk_all":"base_name,base_deptname,applydate,docnum,yfkname,amountOfThisPayment,caozuo"};
var c = {
reload:function(){
......@@ -210,7 +210,7 @@ $(document).ready(function(){
fanye:true,modenum:modenum,modename:modename,statuschange:false,tablename:jm.base64decode('Y19maW5pbmZvbV9vYXlmaw::'),
url:c.storeurl(),storeafteraction:'storeaftershow',storebeforeaction:'storebeforeshow',
params:{atype:atype},
columns:[{text:"申请人",dataIndex:"base_name",sortable:true},{text:"申请人部门",dataIndex:"base_deptname",sortable:true},{text:"单号",dataIndex:"sericnum"},{text:"申请日期",dataIndex:"applydate"},{text:"单据编号",dataIndex:"docnum"},{text:"标题",dataIndex:"yfkname"},{text:"付款金额",dataIndex:"amountOfThisPayment",sortable:true},{text:"状态",dataIndex:"statustext"},{
columns:[{text:"申请人",dataIndex:"base_name",sortable:true},{text:"申请人部门",dataIndex:"base_deptname",sortable:true},{text:"单号",dataIndex:"sericnum"},{text:"申请日期",dataIndex:"applydate",sortable:true},{text:"单据编号",dataIndex:"docnum",sortable:true},{text:"标题",dataIndex:"yfkname",sortable:true},{text:"付款金额",dataIndex:"amountOfThisPayment",sortable:true},{text:"状态",dataIndex:"statustext"},{
text:'',dataIndex:'caozuo',callback:'opegs{rand}'
}],
itemdblclick:function(){
......
......@@ -2267,8 +2267,17 @@ sssss;
$this->rs['now_adminname'] = $this->adminname;
$this->rs['now_modename'] = $modename;
$cont = $this->rock->reparr($cont, $this->rs);
$contt = strip_tags($cont);
#var_dump($contt);
$date = date("Y/m/d H:i:s");
if(strpos($contt,'北京广厦网络技术股份公司 GONN Network Technology Inc OA系统提示,') !== false){
$contt=str_replace('北京广厦网络技术股份公司 GONN Network Technology Inc OA系统提示,','',$contt);
$contt=str_replace('链 接:>>> 更多信息请登录&nbsp;广厦网络OA办公系统&nbsp;进行查看,感谢您的使用和支持。 通过邮件或电话(010-62419724转829)联系我们,获得更多帮助。 OA办公系统本邮件由系统自动发出,请勿直接回复 ','',$contt);
$contt=str_replace('更多信息请登录&nbsp;广厦网络OA办公系统&nbsp;进行查看,感谢您的使用和支持。 通过邮件或电话(010-62419724转829)联系我们,获得更多帮助。 OA办公系统本邮件由系统自动发出,请勿直接回复 ','',$contt);
}
$receid = $this->adminmodel->gjoins($receid);
$uids = m('todo')->addtodo($receid, $modename, $cont, $modenum, $id);
$uids = m('todo')->addtodo($receid, $modename, $contt, $modenum, $id);
if($uids!='' && $moders['type'] != '系统' && $id > 0)$this->todosmodel->addtotouids($uids, array(
'table' => $this->mtable,
'mid' => $id,
......
......@@ -19,7 +19,7 @@ class flowModel extends Model
public $drs = array(); //当前单据对应用户
public $fieldsarr = array(); //主表元素字段数组
public $fieldsarra = array(); //元素数组
public $mwhere;
public $mwhere;
public $mtable; //当前模块对应表
public $uname; //当前单据对应用户姓名
public $uid = 0; //当前单据对应用户Id
......@@ -30,127 +30,128 @@ class flowModel extends Model
public $atype = '';
public $daochubo= false; //是否导出操作
public $companyid= 1; //默认单位Id
/**------------------------------扩展字段开始--------------------------------**/
public $_customerTable = 'customer' ;
public $_contractTable = 'c_contract' ;
public $_supplierTable = 'supplier' ;
public $emurl = '';
/**------------------------------扩展字段结束--------------------------------**/
//当初始化模块后调用
protected function flowinit(){}
//当初始化单据调用
protected function flowchangedata(){}
//当触发通知时处理
protected function flowchangetodo(){}
//删除单据时调用,$sm删除说明
protected function flowdeletebill($sm){}
//作废单据时调用,$sm作废说明
protected function flowzuofeibill($sm){}
//提交时调用
protected function flowsubmit($na, $sm){}
//添加日志记录调用$arr 添加数组
protected function flowaddlog($arr){}
protected function flowdatalog($arr){}
//审核之前调用$zt 状态, $sm说明
protected function flowcheckbefore(){}
//审核完成后调用
protected function flowcheckafter($zt, $sm){}
//流程全部完成后调用
protected function flowcheckfinsh($zt){}
protected function flowgetfields($lx){}
protected function flowgetoptmenu($opt){}
//自定义审核人重新的方法$num 步骤单号
protected function flowcheckname($num){}
//审核步骤根据$num 编号判断是否需要审核
protected function flowcoursejudge($num){}
//操作单据
protected function flowoptmenu($ors, $crs){}
//自定义是否可查看本单据
protected function flowisreadqx(){return false;}
//自定义是否可以删除权限,如返回0不能删除,1可删除,其他值无效
protected function flowisdeleteqx(){return false;}
//已弃用
protected function flowprintrows($r){return $r;}
//子表数据替换处理$lx=0编辑时,1展示时
protected function flowsubdata($r, $lx=0){return $r;}
//默认推送格式从写
protected function flownexttodo($type){return false;}
//单据判断条件从写$lx类型,$uid用户Id
protected function flowbillwhere($lx, $uid){return '';}
protected $flowweixinarr = array();
protected $flowviewufieds = 'uid';
//关联单位id字段默认是comid
protected $flowcompanyidfieds = 'comid';
protected $flowcompanyidfieds = 'comid';
protected $flowfieldstype = 0; //获取字段类型0默认*,1根据字段元素设置得到字段
//初始化单据可替换其他属性,$lx,0默认,1详情展示,2列表显示
public function flowrsreplace($rs){return $rs;}
//编辑的时候替换
protected function flowrsreplaceedit($rs){return $rs;}
//默认状态1时可以就算审核通过,默认是1
protected $flowstatusarr = array(1);
//子表样式,可以改成print打印
protected $subsubdatastyle = '';
//关联其他模块
protected $wherejoin = array();
//默认排序如:id,desc
public $defaultorder = '';
//是否可编辑别人单据
public $floweditother = false;
//详情边框元素
public $xiangbordercolor = '';
public function echomsg($msg)
{
if(!isajax())exit($msg);
showreturn('', $msg, 201);
exit();
}
//字段处理$farr字段,$lx=0pc,1移动
public function flowfieldarr($farr, $lx){return $farr;}
//自定义录入模版$lx=0pc,1移动
public function flowinputtpl($cont, $lx){return $cont;}
public function flowviewtpl($cont, $lx){return $cont;}
//在线编辑单据下附件
public function floweditoffice($frs, $ofrs){}
/**
* 初始化流程信息
*/
......@@ -190,7 +191,7 @@ class flowModel extends Model
$this->loaddata($id, true);
return $this;
}
private function tfieldsarra()
{
$rows = m('flow_element')->getrows("`mid`='$this->modeid' and `iszb`=0",'`name`,`fields`,`isbt`,`iszs`,`fieldstype`,`savewhere`,`data`,`isdr`,`iszb`,`issou`,`islu`,`islb`,`isonly`','`sort`');
......@@ -200,13 +201,13 @@ class flowModel extends Model
}
$this->fieldsarra = $rows;
}
//录入页上的标题
public function inputtitle()
{
return $this->moders['name'];
}
/**
* 列表上要搜索的的,此方法仅用到在:webmain/flow/input/inputAction.php 行607上返回,模块接口可重写这个方法
*/
......@@ -219,7 +220,7 @@ class flowModel extends Model
}
return $arr;
}
/**
* 初始化单据数据
* id 单据Id $ispd 是否判断有查看权限
......@@ -228,7 +229,7 @@ class flowModel extends Model
{
$this->id = (int)$id;
$this->mwhere = "`table`='$this->mtable' and `mid`='$id'";
//防止同主表模块串数据
$swhere = "`id`='$id'";
$wherestr = $this->moders['where'];
......@@ -236,7 +237,7 @@ class flowModel extends Model
$wherestr = $this->rock->covexec($wherestr);
$swhere .= ' and '.$wherestr;
}
$this->rs = $this->getone($swhere);
$this->uname = '';
if(!$this->rs)$this->echomsg('数据记录不存在了');
......@@ -284,13 +285,13 @@ class flowModel extends Model
$this->rssust = $this->rs;
$this->flowchangedata();
$this->rs['base_systitle'] = TITLE;//系统名称
$this->rs['base_modename'] = $this->modename;
$this->rs['base_sericnum'] = $this->sericnum;
$this->rs['base_summary'] = $this->getsummary();
}
/**
* 当前模块我待办数量
*/
......@@ -300,7 +301,7 @@ class flowModel extends Model
$to = $this->billmodel->rows('`modeid`='.$this->modeid.' and `isdel`=0 and `status` not in(1,2) and '.$s.'');
return $to;
}
/**
* 判断单据是否可以查看
*/
......@@ -334,7 +335,7 @@ class flowModel extends Model
$tos = $this->db->rows('[Q]todo', "`uid`='$this->adminid' and ".$this->mwhere."");
if($tos>0)$bo=true;
}
if(!$bo)$bo = $this->flowisreadqx(); //自定义查看权限
//权限设置上的
if(!$bo){
......@@ -345,11 +346,11 @@ class flowModel extends Model
$tos = $this->isjiankongqx();
if($tos>0)$bo=true;
}
if($glx==1)return $bo;
if(!$bo)$this->echomsg('无权限查看模块['.$this->modenum.'.'.$this->modename.']'.$this->uname.'的数据,请联系管理员到[流程模块→流程模块权限]下设置');
}
/**
* 从权限上看是否有查看权限
*/
......@@ -362,7 +363,7 @@ class flowModel extends Model
if($tos>0)$bo=true;
return $bo;
}
/**
* 判断单据是否可以编辑
*/
......@@ -385,7 +386,7 @@ class flowModel extends Model
}
return $bo;
}
/**
* 判断当前单据是否可以删除
*/
......@@ -406,13 +407,13 @@ class flowModel extends Model
$tos = $this->rows("`id`='$this->id' $where ");
if($tos>0)$bo=1;
}
$isd = $this->flowisdeleteqx();
if(is_numeric($isd) && $isd <= 1)$bo = $isd;
return $bo;
}
/**
* 判断是否监控权限
*/
......@@ -427,7 +428,7 @@ class flowModel extends Model
}
return $bo;
}
/**
* 获取详情展示字段
*/
......@@ -440,7 +441,7 @@ class flowModel extends Model
if(is_array($fters))$fields = array_merge($fields, $fters);
return $fields;
}
/**
* 获取录入页面地址
*/
......@@ -457,14 +458,14 @@ class flowModel extends Model
}
return $url;
}
public function replacepbr(&$arr, $k)
{
$val = arrvalue($arr, $k);
if(!c('html')->ishtml($val))$arr[$k] = str_replace("\n",'<br>', $val);
return $arr;
}
/**
* 读取展示数据
* $lx 0pc, 1移动
......@@ -490,14 +491,14 @@ class flowModel extends Model
if($fstr != ''){
$this->rs['file_content'] = $fstr;
}
//$this->replacepbr($this->rs, 'explain');
//$this->replacepbr($this->rs, 'content');
$data = $this->flowrsreplace($this->rs, 1);
$dataa = $this->viewjinfields(array($data));
$data = $dataa[0];
//读取多行子表
$subdata = $this->getsuballdata(1);
foreach($subdata as $zb=>$da){
......@@ -505,7 +506,7 @@ class flowModel extends Model
$data[$sub] = $this->getsubdata($zb,$da['data'],arrvalue($data,'subdatays'.$zb.'',$lx));
$data[''.$sub.'_style'] = 'padding:0';
}
//文件字段替换上传和上传图片的
foreach($this->fieldsarra as $k=>$rs){
$fid = $rs['fields'];
......@@ -522,7 +523,7 @@ class flowModel extends Model
$fval = $this->rock->arrvalue($data, $fid);
if(!isempt($fval) && substr($fval,0,4)!='<img'){
$fval = $this->rock->gethttppath($fval);
$data[$fid] = '<img src="'.$fval.'" onclick="c.showviews(this)" height="100">';
$data[$fid] = '<img src="'.$fval.'" onclick="c.showviews(this)" height="100">';
}
}
//文本域自动换行
......@@ -532,7 +533,7 @@ class flowModel extends Model
}
$_logarr = $qfields = array();
foreach($arr['logarr'] as $k1=>$rs1)$_logarr[$rs1['id']] = $rs1;
foreach($arr['logarr'] as $k1=>$rs1)$_logarr[$rs1['id']] = $rs1;
//读取流程审核步骤信息,只显示同意的
$logrows = $this->flogmodel->getrows($this->mwhere.' and `modeid`='.$this->modeid.' and `courseid`>0 and `courseid`<88888 and `status`>0 and `valid`=1');
foreach($logrows as $k2=>$rs2){
......@@ -552,7 +553,7 @@ class flowModel extends Model
$data[''.$key1.'_sm'] .= ','.$rs3['sm'];
$data[''.$key1.'_dt'] = $rs3['checkdt'];
}
//全部处理意见
$key2 = ''.$key1.'_all';
if(!isset($data[$key2])){
......@@ -560,7 +561,7 @@ class flowModel extends Model
$data[$key2]='';
}
$str1 = $rs3['name'].' <font color="'.$rs3['color'].'">'.$rs3['statusname'].'</font> '.$rs3['checkdt'].'';
if(!isempt($rs3['sm']))$str1.=','.$rs3['sm'].'';
if($data[$key2]!='')$data[$key2].='<hr size="1">';
$data[$key2].= $str1;
......@@ -587,13 +588,13 @@ class flowModel extends Model
}
if($qfields)$fields = array_merge($fields,$qfields);//审核的字段显示到详情里
if(method_exists($this, 'flowxiangfields'))$this->flowxiangfields($fields);
if($lx==0)foreach($fields as $k=>$rs){$data[''.$k.'_style'] = 'width:75%';break;}
$_colsr = $this->xiangbordercolor;
if($_colsr=='')$_colsr = getconfig('bcolorxiang');
$contvimr = c('html')->xiangtable($fields, $data, $_colsr);
$contvimr = '<div align="center">'.$contvimr.'</div>';
//移动默认展示
if($lx==1){
$contvimr = '';
......@@ -626,24 +627,24 @@ class flowModel extends Model
if(isempt($contview))$contview = $contvimr;
$contview = str_replace('$contview$',$contvimr, $contview);
}
$arr['contview'] = $contview;
$arr['readarr'] = m('log')->getreadarr($this->mtable, $this->id); //已读人员
$arr['isedit'] = $this->iseditqx();
$arr['isdel'] = $this->isdeleteqx();
$arr['isflow'] = $this->isflow;
$arr['modename'] = $this->modename;
$arr['ischehui'] = $this->ischehui();
$ztass = $this->getnowstatus();
$arr['statustext'] = $ztass[0];
$arr['statuscolor'] = $ztass[1];
$arr['optmenu'] = $this->getoptmenu(1); //获取在详情上展示菜单
$arr['isgbjl'] = (int)$this->rock->arrvalue($this->moders,'isgbjl','0'); //是否关闭操作记录
$arr['isgbcy'] = (int)$this->rock->arrvalue($this->moders,'isgbcy','0'); //是否不显示查阅记录
//判断是否需要回执(2018-07-06)新增
$receiptrs = false;
$receiptrow = m('receipt')->getall("`modenum`='$this->modenum' and `mid`='$this->id' and `status`=1");
......@@ -658,12 +659,12 @@ class flowModel extends Model
break;
}
}
$arr['flowinfor'] = array(); //流程信息
$arr['readunarr'] = array(); //未读人员
$arr['receiptrs'] = $receiptrs; //回执确认
if($this->isflow>0){
$arr['flowinfor']= $this->getflowinfor();
if($arr['flowinfor']['ischeck']==1){
......@@ -673,18 +674,18 @@ class flowModel extends Model
if(isset($data['title']))$arr['title'] = $data['title'];
$_oarr = $this->flowdatalog($arr);
if(is_array($_oarr))foreach($_oarr as $k=>$v)$arr[$k]=$v;
$conta = $this->rock->matcharr($contview,2);
$edbof = false;
foreach($conta as $fids){
$thnr = '';
$contview = str_replace('`'.$fids.'`', $thnr, $contview);
}
$arr['contview'] = $contview;
return $arr;
}
......@@ -708,7 +709,7 @@ class flowModel extends Model
}
return $cont;
}
/**
* 判断当前是否可以撤回
* 撤回条件,审核未同意,最后一步是当前人审核的而为同意,2小时之内
......@@ -720,12 +721,12 @@ class flowModel extends Model
$where = "".$this->mwhere." and `valid`=1 order by `id` desc";
$rs = $this->flogmodel->getone($where);
$time = time()-2*3600;
if($rs && $rs['status']=='1' && $rs['checkid']==$this->adminid && strtotime($rs['optdt'])>$time &&
if($rs && $rs['status']=='1' && $rs['checkid']==$this->adminid && strtotime($rs['optdt'])>$time &&
($rs['courseid']>0 || $rs['iszb']=='1' ))
$is = $rs['id'];
return $is;
}
/**
* 撤回操作
*/
......@@ -749,7 +750,7 @@ class flowModel extends Model
$this->getflowsave($barr);
return 'ok';
}
/**
* 读取编辑数据
*/
......@@ -763,19 +764,19 @@ class flowModel extends Model
$arr['isedit'] = $this->iseditqx();
$arr['isflow'] = $this->isflow;
$arr['user'] = $this->urs;
$arr['status'] = $this->rs['status'];
$arr['status'] = $this->rs['status'];
$filers = $fobj->getfile($this->mtable,$this->id);
foreach($filers as $fk=>$frs1)$filers[$fk]['thumbpath']=$fobj->getthumbpath($frs1);//缩略图显示
$arr['filers'] = $filers;
$arr['subdata'] = $this->getsuballdata();
$uploadfile = $this->rock->post('uploadfile');
$filearr = array();
foreach($this->fieldsarr as $k=>$rs){
$fid = $rs['fields'];
$flx = $rs['fieldstype'];
//读取文件详情
if($flx=='uploadfile'){
$fval = arrvalue($this->rssust, $fid);
......@@ -789,7 +790,7 @@ class flowModel extends Model
}
}
}
if($flx=='uploadimg'){
$arr['data'][''.$fid.'_view'] = $this->rock->gethttppath($arr['data'][$fid]);
}
......@@ -800,7 +801,7 @@ class flowModel extends Model
$arr['statuscolor'] = $ztarr[1];
return $arr;
}
/*
* 读取流程信息
*/
......@@ -834,7 +835,7 @@ class flowModel extends Model
if($sarr['iszhuanban']==2)$sarr['zbrangelx']='';//转办单选
}
if($isturn==0)$sarr['nstatustext'] = '<font color="#ff6600">待提交</font>';
//读取当前审核表单,必填字段|选填字段
$_checkfields = arrvalue($nowcur,'checkfields');
$checkfields = array();
......@@ -858,7 +859,7 @@ class flowModel extends Model
$_val = arrvalue($this->rssust, $_sfes);
$cheo = (substr($_type,0,6)=='change' && !isempt($fsva['data']));
if($cheo)$_val.='|'.arrvalue($this->rssust, $fsva['data']).''; //默认值
$checkfields[$_sfes] = array(
'inputstr' => $inputobj->getfieldcontval($_sfes, $_val),
'name' => $fsva['name'],
......@@ -911,11 +912,11 @@ class flowModel extends Model
$str.='</span>';
}
}
}
}
$sarr['flowcoursestr'] = $str;
if($nstatus==1)$sarr['nstatustext'] = $this->getnowstatus(1); //完成后状态
$actstr = ',同意|green,不同意|red';
if(isset($nowcur['courseact']) ){
$actstrt = $nowcur['courseact'];
......@@ -927,17 +928,17 @@ class flowModel extends Model
$nowstatus = $this->rs['status'];
if($this->isflow>0 && $this->rs['isturn']==0)$nowstatus=3;
$sarr['nowstatus'] = $nowstatus;
//不同意退回可选择人员
$step = $this->rock->arrvalue($nowcur, 'step','0');
$tuicourse = $this->flogmodel->getall($this->mwhere.' and `courseid`>0 and `valid`=1 and `status`=1 and `step`<'.$step.'','`id`,`checkname`,`name`','`step` desc');
$sarr['tuicourse'] = $tuicourse;
return $sarr;
}
/**
* 更新单据状态
*/
......@@ -946,7 +947,7 @@ class flowModel extends Model
$this->update('`status`='.$zt.'', $this->id);
$this->billmodel->update('`status`='.$zt.'', $this->mwhere);
}
/**
* 获取状态列表数组
*/
......@@ -954,7 +955,7 @@ class flowModel extends Model
{
return $this->getstatus(null, '','',2);
}
/**
* 获取某单据当前状态
* $rs 单据数据,$statusstr设置的状态,$other 当前审核人
......@@ -967,7 +968,7 @@ class flowModel extends Model
$colorsa = array('blue','green','red','#ff6600','#526D08','#888888','','','','','','','','','','','','','');
if(isempt($statusstr)){
$statussst = '不同意';
$statusstr = '待?处理|blue,已审核|green,'.$statussst.'|red';
}
$nowcheckname= arrvalue($rs,'nowcheckname');
......@@ -981,7 +982,7 @@ class flowModel extends Model
$statusara[5] = array('已作废','#888888');
$statusara[23] = array('退回','#17B2B7');
if($glx==2)return $statusara;
$isturn = -1;
if(isset($rs['isturn']))$isturn = (int)$rs['isturn'];
$zt = $this->rock->arrvalue($rs, 'status');
......@@ -994,7 +995,7 @@ class flowModel extends Model
$statuscolor = $statusara[$zt][1];
}
}
if(contain($statustext,'?')){
$statusstr = str_replace('?', '<font color="'.$statuscolor.'">'.$other.'</font>', $statustext);
}else{
......@@ -1005,12 +1006,12 @@ class flowModel extends Model
}
return array(str_replace('?', $other, $statustext), $statuscolor, $zt, $statusstr);
}
public function getstatusstr($rs)
{
return $this->getstatus($rs, '','', 1);
}
/**
* 当前单击状态
*/
......@@ -1018,7 +1019,7 @@ class flowModel extends Model
{
return $this->getstatus($this->rs, '','', $glx);
}
private $getlogrows = array();
public function getlog()
{
......@@ -1035,7 +1036,7 @@ class flowModel extends Model
if(contain($rs['statusname'],'不') || $rs['status']=='2')$col='red';
$rows[$k]['color'] = $col;
$rows[$k]['checkdt'] = $rs['optdt'];
$rows[$k]['sm'] = $rs['explain'];
$rows[$k]['sm'] = $rs['explain'];
if(!isempt($rs['qmimg'])){
//签名是手写的
if(!contain($rs['qmimg'],'.')){
......@@ -1059,9 +1060,9 @@ class flowModel extends Model
}
}
$rows[$k]['qmimg'] = $qmimg;
if(!isempt($qmimg))$rows[$k]['explain']= '<img height="30" width="70" src="'.$qmimg.'">'.$rs['explain'].'';
}
if(!isempt($qmimg))$rows[$k]['explain']= '<img height="30" width="70" src="'.$qmimg.'">'.$rs['explain'].'';
}
}
//读取相关文件
if($idss!=''){
......@@ -1078,14 +1079,14 @@ class flowModel extends Model
$this->getlogrows = $rows;
return $rows;
}
public function addlog($arr=array())
{
$addarr = array(
'table' => $this->mtable,
'mid' => $this->id,
'checkname' => $this->adminname,
'checkid' => $this->adminid,
'checkname' => $this->adminname,
'checkid' => $this->adminid,
'optdt' => $this->rock->now,
'courseid' => '0',
'status' => '1',
......@@ -1105,7 +1106,7 @@ class flowModel extends Model
$this->getlogrows = array();
return $ssid;
}
public function submit($na='', $sm='')
{
if($na=='')$na='提交';
......@@ -1120,16 +1121,16 @@ class flowModel extends Model
$marr['status'] = 0;
$this->rs['status'] = 0;
$this->update($marr, $this->id);
//每次编辑判断是否重新开始走审批。
if(arrvalue($this->moders,'isflowlx')=='1' || $this->isflow>=3){
$this->checksmodel->delete($this->mwhere);
$this->flogmodel->update('`valid`=0', ''.$this->mwhere.' and `courseid`>0 and `valid`=1');
}
$farr = $this->getflow();
//第一步自定义审核人
if($farr['nowcourseid']>0){
......@@ -1169,7 +1170,7 @@ class flowModel extends Model
$this->gettodosend('boturn');//提交
}
}
/**
* 获取抄送人姓名
*/
......@@ -1192,7 +1193,7 @@ class flowModel extends Model
'id' => $id,
);
}
/**
* 追加说明
*/
......@@ -1215,7 +1216,7 @@ class flowModel extends Model
}
$this->gettodosend('bozhui','', $sm);
}
/**
* 催办
*/
......@@ -1230,7 +1231,7 @@ class flowModel extends Model
$this->nexttodo($farr['nowcheckid'],'cuiban', $sm);
$this->gettodosend('cuiban','', $sm);
}
/**
* 匹配流程读取
*/
......@@ -1240,9 +1241,9 @@ class flowModel extends Model
if(!$urs)$urs = $uid;
if(!is_array($urs))$urs = $this->db->getone('[Q]admin', "`id`='$urs'", '`deptid`,`deptpath`,`id`');
$coursedb = m('flowcourse');
$barr = $coursedb->pipeiCourse($this->modeid);
$rows = $barr['rows'];
$this->pipeiCoursearrc = $barr['rowd'];
......@@ -1260,51 +1261,51 @@ class flowModel extends Model
$defix = $xuhao = 0; //默认是0的
$uid = arrvalue($urs,'id',0);
$zshu = count($rows);
foreach($rows as $k=>$rs){
$whereid = (int)$rs['whereid'];
$receid = $rs['receid'];
$wherestr= arrvalue($rs, 'where');
//停用了
if($rs['status']=='0')continue;
//where条件字段
if(!isempt($wherestr)){
$wherestr = m('base')->strreplace($this->rock->jm->base64decode($wherestr), $uid);
$to = $this->rows("`id`='$this->id' and $wherestr ");
if($to==0)continue;//条件不成立
}
//有条件的【流程模块条件】下的ID
if($whereid > 0){
$bo = $this->wheremanzhu($whereid);
if(!$bo)continue;
}
//特殊判断过滤
if(!isempt($rs['num'])){
$bo = $this->flowcoursejudge($rs['num'], $rs);
if(is_bool($bo) && !$bo)continue;
}
$xuhao++;
if($defix==0 && (isempt($receid) || contain($receid,'all'))){
$defix = $xuhao;
}
//当有设置审核条件满足时就用这个做默认,2018-07-10 新增,如果是多个满足就取最后一个
if(isempt($receid) && (!isempt($wherestr) || $whereid > 0)){
$defix = $xuhao;
}
$rs['xuhao'] = $xuhao;
$shiyong[] = $rs;
}
//在根据receid匹配到哪个流程
$pboss = false;//是否有匹配到
if($shiyong){
......@@ -1327,7 +1328,7 @@ class flowModel extends Model
unset($prs['children']);
$this->pipeiCoursearrs[]= $prs['id'];
$this->pipeiCoursearr[] = $prs;
if($prs['childshu']>0){
$this->getflowpipeis($prsnrs['children'], $urs, $kqobj);
}else{
......@@ -1338,7 +1339,7 @@ class flowModel extends Model
}
}
}
/*
* 获取流程
*/
......@@ -1352,13 +1353,13 @@ class flowModel extends Model
$this->nowcourse = array();
$this->nextcourse = array();
$this->flowisend = 0;
$curs = $this->flogmodel->getrows($this->mwhere,'checkid,checkname,courseid,`valid`,`status`,`statusname`,`name`,`iszb`','id desc');
$cufss = $ztnas = $chesarr = array();
foreach($curs as $k=>$rs){
if($rs['iszb']=='1' && !in_array($rs['checkid'], $allcheckids))$allcheckids[] = $rs['checkid']; //转办也记录到经我处理的
if($rs['courseid']=='0')continue;
$_su = ''.$rs['courseid'].'';
$_su1 = ''.$rs['courseid'].'_'.$rs['checkid'].'';
......@@ -1386,7 +1387,7 @@ class flowModel extends Model
$coursea = $nrows = array();
foreach($checksa as $k=>$rs)$coursea[$rs['courseid']]='1';
$nrows = array();
//获取审核人
$allcheckid = '';
$isoptsuperbo = false;
......@@ -1397,7 +1398,7 @@ class flowModel extends Model
$allcheckid .= ','.$uarr[0].'';
if($rs['checktype']=='optsuper' && isempt($uarr[0]))$isoptsuperbo=true;//有操作人上级
}
//有需要读取上一步
if($isoptsuperbo)foreach($rows as $k=>$rs){
if($rs['checktype']=='optsuper'){
......@@ -1420,11 +1421,11 @@ class flowModel extends Model
}
}
//print_r($rows);
foreach($rows as $k=>$rs){
$nrows[] = $rs;
//全部直属上级
if($rs['checktype']=='superall'){
$ids1 = $rs['id'];
......@@ -1447,32 +1448,32 @@ class flowModel extends Model
}
}
}
$yisheh = '';
if($this->isflow==2){
$logdsar = $this->getlog();
foreach($logdsar as $k1=>$rs1)
if($rs1['courseid']>0 && $rs1['status']==1 && $rs1['valid']==1)$yisheh .= ','.$rs1['checkid'].'';
if($rs1['courseid']>0 && $rs1['status']==1 && $rs1['valid']==1)$yisheh .= ','.$rs1['checkid'].'';
}
foreach($nrows as $k=>$rs){
$whereid = (int)$rs['whereid'];
$checkshu = $rs['checkshu'];
$checkid = $rs['checkid'];
$checkname = $rs['checkname'];
$checktype = $rs['checktype'];
//顺序前缀审批,申请人提交人不参与审批
if($this->isflow==2 && !isempt($checkid) && isempt($rs['checkfields'])){
if(($checkid==$this->uid || $checkid==$this->optid) )continue; //申请人
//已经处理就不处理
if(contain(','.$yisheh.',',','.$checkid.','))continue;
if(contain(','.$yisheh.',',','.$checkid.','))continue;
}
if(!isempt($checkid))$yisheh .= ','.$checkid.'';
//不在审核人子表中
/*
if(!isset($coursea[$rs['id']])){
......@@ -1480,27 +1481,27 @@ class flowModel extends Model
$bo = $this->wheremanzhu($whereid);
if(!$bo)continue;
}
if(!isempt($rs['num'])){
$bo = $this->flowcoursejudge($rs['num']);
if(is_bool($bo) && !$bo)continue;
}
}
*/
$zongsetp++;
$ischeck = 0;
$checkids = $checknames = '';
$_su = ''.$rs['id'].'';
$nowshu = 0;
if(isset($cufss[$_su]))$nowshu = $cufss[$_su];
if(!$this->isempt($checkid)){
$checkida = explode(',', $checkid);
$checkidna = explode(',', $checkname);
$_chid = $_chna = '';
foreach($checkida as $k1=>$chkid){
$_su1 = ''.$rs['id'].'_'.$chkid.'';
if(!in_array($chkid, $allcheckids))$allcheckids[] = $chkid;
......@@ -1511,7 +1512,7 @@ class flowModel extends Model
}
if($_chid!='')$_chid = substr($_chid, 1);
if($_chna!='')$_chna = substr($_chna, 1);
if($_chid==''){
$ischeck = 1;
}else{
......@@ -1520,15 +1521,15 @@ class flowModel extends Model
$checkids = $_chid;
$checknames = $_chna;
}else{
if($checkshu>0&&$nowshu>=$checkshu)$ischeck = 1;
if($checkshu>0&&$nowshu>=$checkshu)$ischeck = 1;
//需要全部审核时 同时已有审核过了 也没有审核人了
if($checkshu == 0 && $nowshu>0)$ischeck = 1;
}
if($ischeck==0 && $coutye==0){
if((int)arrvalue($rs,'coursetype','0')>0)$coutye = 1;
}
$rs['ischeck'] = $ischeck;
$rs['islast'] = 0;
$rs['checkid'] = $checkid;
......@@ -1538,7 +1539,7 @@ class flowModel extends Model
$rs['isnow'] = 0;
$rs['nowstep'] = $zongsetp;
$rs['step'] = $k+1;
if($ischeck==0 && $nowstep==-1){
$rs['isnow']= 1;
$nowstep = $zongsetp;
......@@ -1547,14 +1548,14 @@ class flowModel extends Model
$nowcheckid = $checkids;
$nowcheckname = $checknames;
}
if($nowstep>-1 && $zongsetp==$nowstep+1)$this->nextcourse = $rs; //下一步信息
$this->flowarr[]= $rs;
}
}
if($zongsetp>-1)$this->flowarr[$zongsetp]['islast']=1;
if($nowstep == -1){
$isend = 1;
......@@ -1596,21 +1597,21 @@ class flowModel extends Model
}
return true;
}
public function getflowsave($sarr, $suvu=false)
{
if(!$sarr)return;
if($suvu)$sarr['updt'] = $this->rock->now;
$this->billmodel->update($sarr, $this->mwhere);
}
//获取审核人
private function getcheckname($crs)
{
$type = $crs['checktype'];
$cuid = $name = '';
$courseid= $crs['id'];
$cheorws = $this->checksmodel->getall($this->mwhere.' and `courseid`='.$courseid.'','checkid,checkname');
if($cheorws){
foreach($cheorws as $k=>$rs){
......@@ -1625,7 +1626,7 @@ class flowModel extends Model
return array($cuid, $name);
}
}
//自定义审核人读取
if(!$this->isempt($crs['num'])){
$uarr = $this->flowcheckname($crs['num']);
......@@ -1633,7 +1634,7 @@ class flowModel extends Model
if(!$this->isempt($uarr[0]))return $uarr;
}
}
if($type=='super' || $type=='superall'){
$cuid = $this->urs['superid'];
$name = $this->urs['superman'];
......@@ -1680,7 +1681,7 @@ class flowModel extends Model
$cuid = arrvalue($cnbar, 0);
$name = arrvalue($cnbar, 1);
}
//主表上字段,一般都是ID字段
if($type=='field'){
$fids = $crs['checktypeid'];
......@@ -1705,13 +1706,13 @@ class flowModel extends Model
}
}
}
$cuid = $this->rock->repempt($cuid);
$name = $this->rock->repempt($name);
return array($cuid, $name);
}
/**
* 创建编号
*/
......@@ -1724,7 +1725,7 @@ class flowModel extends Model
$num = str_replace('Ymd',$apdt,$num);
return $this->db->sericnum($num,'[Q]'.$this->mtable.'', $fid, $wshu);
}
/**
* 录入页上编号
*/
......@@ -1756,7 +1757,7 @@ class flowModel extends Model
return $this->createbianhao($num, $fid);
}
}
/**
* 创建流程单号
*/
......@@ -1803,77 +1804,92 @@ class flowModel extends Model
$dbs->record($arr, $whes);
return $arr;
}
/**
* 下一步发通知
*/
public function nexttodo($nuid, $type, $sm='', $act='')
{
$date = date("Y/m/d H:i:s");
$cont = '';
$tit = '';
$emurl = $this->getxiangurl($modenum, $id, 'a');
$emurl = arrvalue($params, 'emurl', $emurl);
$tit = 'OA系统提示:您有一条待办需要处理';
$gname = '流程待办';
$summary= $this->getsummary();
if($type=='submit' || $type=='next' || $type == 'cuiban'){
$cont = '您有['.$this->uname.']的['.$this->modename.',单号:'.$this->sericnum.']需要处理';
if($sm!='')$cont.=',说明:'.$sm.'';
$tit = ''.$this->uname.'的'.$this->modename.'';
$cont=<<<sss
<table class="ke-zeroborder" style="width:600px;font-family:Microsoft YaHei;"><tbody><tr><td style="background-color:#666666;text-align:center;vertical-align:bottom;"><img src="http://oa.gonn.com.cn/images/logo.png" width="40" height="40" title="" alt="" align="left" /> <div style="text-align:right;"><span style="color:#FFFFFF;font-size:14px;font-family:Microsoft YaHei;">北京广厦网络技术股份公司</span> </div><div style="text-align:right;"><span style="color:#FFFFFF;font-size:14px;font-family:Microsoft YaHei;">GONN Network Technology Inc</span> </div></td></tr><tr><td><br /><span style="font-size:14px;font-family:Microsoft YaHei;">OA系统提示,您有一条审批需要处理。</span><br /><br /><ul><li><span style="font-size:14px;font-family:Microsoft YaHei;">来 自:$this->uname</span> </li><li><span style="font-size:14px;font-family:Microsoft YaHei;">类 型:$this->modename</span> </li><li><span style="font-size:14px;font-family:Microsoft YaHei;">单 号:<u><a href="$emurl" target="_blank">$this->sericnum</a></u></span> </li><li><span style="font-size:14px;font-family:Microsoft YaHei;">日 期:$date</span> </li><li><span style="font-size:14px;">链 接:<a href="$emurl" style='text-decoration:none;'>>>></a></span> </li></ul><p><span style="font-size:14px;font-family:Microsoft YaHei;">更多信息请登录&nbsp;<a href="http://oa.gonn.com.cn/" target="_blank">广厦网络OA办公系统</a>&nbsp;进行查看,感谢您的使用和支持。</span> </p><p><span style="font-size:12px;font-family:Microsoft YaHei;">通过<a href="mailto:it@gonn.com.cn">邮件</a>或电话(010-62419724转829)联系我们,获得更多帮助。</span> </p></td></tr><tr><td style="background-color:#666666;text-align:left;"><span style="font-size:14px;color:#FFFFFF;font-family:Microsoft YaHei;">OA办公系统</span><br /><span style="font-size:10px;color:#FFFFFF;font-family:Microsoft YaHei;">本邮件由系统自动发出,请勿直接回复</span> </td></tr></tbody></table>
sss;
// if($sm!='')$cont.=',说明:'.$sm.'';
// $tit = ''.$this->uname.'的'.$this->modename.'';
//短信提醒
if($type != 'cuiban'){
$txnum = $this->option->getval('sms_txnum');
if(!isempt($txnum)){
$mknum = $this->option->getval('sms_mknum');
if($mknum=='all' || contain(','.$mknum.',',','.$this->modenum.',')){
$wxurl = $this->getxiangurlx();
$barr = c('xinhuapi')->sendsms($nuid, '', $txnum, array(
'modename' => $this->modename,
'sericnum' => $this->sericnum,
'applyname'=> $this->uname,
'deptname' => $this->rs['base_deptname'],
),$wxurl);
}
}
}
$type = 'daiban';
// if($type != 'cuiban'){
// $txnum = $this->option->getval('sms_txnum');
// if(!isempt($txnum)){
// $mknum = $this->option->getval('sms_mknum');
// if($mknum=='all' || contain(','.$mknum.',',','.$this->modenum.',')){
// $wxurl = $this->getxiangurlx();
// $barr = c('xinhuapi')->sendsms($nuid, '', $txnum, array(
// 'modename' => $this->modename,
// 'sericnum' => $this->sericnum,
// 'applyname'=> $this->uname,
// 'deptname' => $this->rs['base_deptname'],
// ),$wxurl);
// }
// }
// }
// $type = 'daiban';
}
//审核不同意
if($type == 'nothrough'){
$cont = '你提交['.$this->modename.',单号:'.$this->sericnum.']'.$this->adminname.'处理['.$act.'],原因:['.$sm.']';
$cont=<<<ssss
<table class="ke-zeroborder" style="width:600px;font-family:Microsoft YaHei;"><tbody><tr><td style="background-color:#666666;text-align:center;vertical-align:bottom;"><img src="http://oa.gonn.com.cn/images/logo.png" width="40" height="40" title="" alt="" align="left" /> <div style="text-align:right;"><span style="color:#FFFFFF;font-size:14px;font-family:Microsoft YaHei;">北京广厦网络技术股份公司</span> </div><div style="text-align:right;"><span style="color:#FFFFFF;font-size:14px;font-family:Microsoft YaHei;">GONN Network Technology Inc</span> </div></td></tr><tr><td><br/><span style="font-size:14px;font-family:Microsoft YaHei;">OA系统提示,您有一条审批<span style="color:#E53333;"><strong>被拒绝</strong></span>。</span><br/><br/> <ul><li><span style="font-size:14px;font-family:Microsoft YaHei;">处 理 人:$this->adminname</span></li><li><span style="font-size:14px;font-family:Microsoft YaHei;">类 型:$this->modename</span> </li><li><span style="font-size:14px;font-family:Microsoft YaHei;">单 号:<u><a href="$emurl" target="_blank">$this->sericnum</a></u></span> </li><li><span style="font-size:14px;font-family:Microsoft YaHei;">原 因:$sm</span></li><li><span style="font-size:14px;font-family:Microsoft YaHei;">日 期:$date</span><br/></li></ul><p><span style="font-size:14px;font-family:Microsoft YaHei;">更多信息请登录&nbsp;<a href="http://oa.gonn.com.cn/" target="_blank">广厦网络OA办公系统</a>&nbsp;进行查看,感谢您的使用和支持。</span> </p><p><span style="font-size:12px;font-family:Microsoft YaHei;">通过<a href="mailto:it@gonn.com.cn">邮件</a>或电话(010-62419724转829)联系我们,获得更多帮助。</span> </p></td></tr><tr><td style="background-color:#666666;text-align:left;"><span style="font-size:14px;color:#FFFFFF;font-family:Microsoft YaHei;">OA办公系统</span><br/><span style="font-size:10px;color:#FFFFFF;font-family:Microsoft YaHei;">本邮件由系统自动发出,请勿直接回复</span> </td></tr></tbody></table>
ssss;
//'你提交['.$this->modename.',单号:'.$this->sericnum.']'.$this->adminname.'处理['.$act.'],原因:['.$sm.']';
$gname= '流程申请';
}
if($type == 'finish'){
$cont = '你提交的['.$this->modename.',单号:'.$this->sericnum.']已全部处理完成';
}
if($type == 'zhui'){
$cont = ''.$this->adminname.'追加单据说明['.$this->modename.',单号:'.$this->sericnum.'],说明:['.$sm.']';
$cont=<<<sssss
<table class="ke-zeroborder" style="width:600px;font-family:Microsoft YaHei;"><tbody><tr><td style="background-color:#666666;text-align:center;vertical-align:bottom;"><img src="http://oa.gonn.com.cn/images/logo.png" width="40" height="40" title="" alt="" align="left" /> <div style="text-align:right;"><span style="color:#FFFFFF;font-size:14px;font-family:Microsoft YaHei;">北京广厦网络技术股份公司</span> </div><div style="text-align:right;"><span style="color:#FFFFFF;font-size:14px;font-family:Microsoft YaHei;">GONN Network Technology Inc</span> </div></td></tr><tr><td><br /><span style="font-size:14px;font-family:Microsoft YaHei;">OA系统提示,您有一条审批<span style="color:#009900;"><span style="color:#009900;"><strong>已完成</strong></span></span>。</span><br /><br /><ul><li><span style="font-size:14px;font-family:Microsoft YaHei;">处 理 人:$this->adminname</span> </li><li><span style="font-size:14px;font-family:Microsoft YaHei;">类 型:$this->modename</span> </li><li><span style="font-size:14px;font-family:Microsoft YaHei;">单 号:<u><a href="$emurl" target="_blank">$this->sericnum</a></u></span> </li><li><span style="font-size:14px;font-family:Microsoft YaHei;">备 注:$sm</span> </li><li><span style="font-size:14px;font-family:Microsoft YaHei;">日 期:$date</span><br /></li></ul><p><span style="font-size:14px;font-family:Microsoft YaHei;">更多信息请登录&nbsp;<a href="http://oa.gonn.com.cn/" target="_blank">广厦网络OA办公系统</a>&nbsp;进行查看,感谢您的使用和支持。</span> </p><p><span style="font-size:12px;font-family:Microsoft YaHei;">通过<a href="mailto:it@gonn.com.cn">邮件</a>或电话(010-62419724转829)联系我们,获得更多帮助。</span> </p></td></tr><tr><td style="background-color:#666666;text-align:left;"><span style="font-size:14px;color:#FFFFFF;font-family:Microsoft YaHei;">OA办公系统</span><br /><span style="font-size:10px;color:#FFFFFF;font-family:Microsoft YaHei;">本邮件由系统自动发出,请勿直接回复</span> </td></tr></tbody></table>
sssss;
//'你提交的['.$this->modename.',单号:'.$this->sericnum.']已全部处理完成';
}
// if($type == 'zhui'){
// $cont = ''.$this->adminname.'追加单据说明['.$this->modename.',单号:'.$this->sericnum.'],说明:['.$sm.']';
// }
//退回
if($type == 'tui'){
$cont = '['.$this->adminname.']退回单据['.$this->modename.',单号:'.$this->sericnum.']到你这请及时处理,说明:'.$sm.'';
}
// if($type == 'tui'){
// $cont = '['.$this->adminname.']退回单据['.$this->modename.',单号:'.$this->sericnum.']到你这请及时处理,说明:'.$sm.'';
// }
//提交抄送
if($type == 'chao'){
$cont = ''.$this->adminname.''.$sm.'了“'.$this->modename.'”';
if(!isempt($summary))$cont.=',摘要“'.$summary.'”';
if($this->isflow>0)$cont.=',单号“'.$this->sericnum.'”';
$gname= '';
}
//评论
if($type=='pinglun'){
$cont = ''.$this->adminname.''.$act.'你的['.$this->modename.']单据,说明:'.$sm.'';
$gname = '';
}
// if($type == 'chao'){
// $cont = ''.$this->adminname.''.$sm.'了“'.$this->modename.'”';
// if(!isempt($summary))$cont.=',摘要“'.$summary.'”';
// if($this->isflow>0)$cont.=',单号“'.$this->sericnum.'”';
// $gname= '';
// }
// //评论
// if($type=='pinglun'){
// $cont = ''.$this->adminname.''.$act.'你的['.$this->modename.']单据,说明:'.$sm.'';
// $gname = '';
// }
//回执确认
if($type=='receipt'){
$cont = ''.$this->adminname.''.$act.'['.$this->modename.']的单据';
if($sm!='')$cont.=',说明:'.$sm.'';
$gname = '回执确认';
$tit = '回执确认';
}
// if($type=='receipt'){
// $cont = ''.$this->adminname.''.$act.'['.$this->modename.']的单据';
// if($sm!='')$cont.=',说明:'.$sm.'';
// $gname = '回执确认';
// $tit = '回执确认';
// }
$nbis = $this->flownexttodo($type); //自定义推送内容
if($nbis){
if(is_string($nbis))$cont = $nbis;
......@@ -1883,9 +1899,11 @@ class flowModel extends Model
$cont = arrvalue($nbis, 'cont', $cont);
}
}
if($type == 'finish')$tit="OA系统提示:您有一条审批已完成";
if($type == 'nothrough')$tit="OA系统提示:您有一条审批被拒绝";
if($cont!='')$this->push($nuid, $gname, $cont, $tit);
}
/**
* 获取摘要
*/
......@@ -1893,7 +1911,7 @@ class flowModel extends Model
{
return $this->rock->reparr($this->moders['summary'], $this->rs);
}
public function addcheckname($courseid, $uid, $uname, $onbo=false, $addlx=0)
{
if(isempt($uid)){$uid = '0';$uname= 'auto';}
......@@ -1920,8 +1938,8 @@ class flowModel extends Model
}
if($addlx==4)$this->checksmodel->delete($this->mwhere.' and `checkid`='.$this->adminid.' and `courseid`='.$courseid.'');//删除别人转给我的
}
/**
* 判断保存的数据是否
*/
......@@ -1956,7 +1974,7 @@ class flowModel extends Model
}
return $str;
}
/**
* 重写更新一下方法
*/
......@@ -1967,7 +1985,7 @@ class flowModel extends Model
}
return parent::update($arr,$where);
}
/**
* 将操作记录标识无效状态
*/
......@@ -1975,7 +1993,7 @@ class flowModel extends Model
{
$this->flogmodel->update('valid=0', $this->mwhere.' '.$whe);
}
/**
* 说明追加
*/
......@@ -1986,7 +2004,7 @@ class flowModel extends Model
$sm.=$str;
return $sm;
}
/**
* 异常直接标识已完成
*/
......@@ -2006,11 +2024,11 @@ class flowModel extends Model
if($this->rs['status']==1)return '流程已处理完成,无需操作';
$arr = $this->getflow();
$flowinfor = $this->getflowinfor();
if($flowinfor['ischeck']==0 && $lx==0)return '当前是['.$arr['nowcheckname'].']处理';
$nowcourse = $this->nowcourse;
//异常的审核
if($lx==1){
if($arr['nowcourseid']!=0)return '当前有审核步骤ID是存在的不能直接标识已完成';
......@@ -2018,7 +2036,7 @@ class flowModel extends Model
if($to==0)return '该单据没有任何通过审核处理不能直接标识已完成或已审核';
$nowcourse = array('id'=>66666,'name'=>'异常处理','step'=>0);
}
$nextcourse = $this->nextcourse;
$zynameid = $this->rock->post('zynameid');
$zyname = $this->rock->post('zyname');
......@@ -2031,9 +2049,9 @@ class flowModel extends Model
$ischangenext = 1;//需要选下步处理人
}
if($zt!=2)$tuiid = 0;//只有2的状态才能退回
$istongyi = in_array($zt, $this->flowstatusarr); //是否审核本步骤同意
//判断是否转办
if($zynameid!='' && $istongyi){
if($zynameid==$this->adminid)return '不能转给自己';
......@@ -2042,13 +2060,13 @@ class flowModel extends Model
$this->rs['zb_name'] = $zyname;
$this->rs['zb_nameid'] = $zynameid;
}
if($nextnameid=='' && $ischangenext==1)return '请选择下一步处理人';
$ufied = array();
if($iszhuanyi == 0 && $zt!=2){
foreach($flowinfor['checkfields'] as $chef=>$chefv){
......@@ -2058,43 +2076,43 @@ class flowModel extends Model
if($_str!='')$this->echomsg($_str);
}
}
$this->checkiszhuanyi = $iszhuanyi;//是否为转移的
$barr = $this->flowcheckbefore($zt, $ufied, $sm);
$msg = '';
if(is_array($barr) && isset($barr['msg']))$msg = $barr['msg'];
//更新字段
if(is_array($barr) && isset($barr['update'])){
foreach($barr['update'] as $_k=>$_v)$ufied[$_k] = $_v;
}
if(is_string($barr))$msg = $barr;
if(!isempt($msg))return $msg;
if($ufied){
$bo = $this->update($ufied, $this->id);
if(!$bo)return 'dberr:'.$this->db->error();
}
$courseact = $flowinfor['courseact'];
$act = $courseact[$zt];
$statusname = $act[0];//状态名称
$statuscolor= $act[1];//状态颜色
$nzt = $act[2];//处理后对应状态
$courseid = $nowcourse['id'];
$this->checksmodel->update('`status`='.$zt.'', $this->mwhere.' and `checkid`='.$this->adminid.' and `courseid`='.$courseid.'');
if($iszhuanyi == 1){
$this->addcheckname($courseid, $zynameid, $zyname, false, 4);
$nowcourse['id'] = 0;
}
//指定下步审核
if($ischangenext==1){
$this->addcheckname($nextcourse['id'], $nextnameid, $nextname, true, 1);
}
//读取退回记录
$tuirs = array();
if($tuiid > 0)$tuirs = $this->flogmodel->getone($tuiid);
......@@ -2116,22 +2134,22 @@ class flowModel extends Model
'iszb' => $iszhuanyi,
'qmimg' => $qmimgstr
));
//退回处理
if($tuiid > 0){
$this->addcheckname($tuirs['courseid'], $tuirs['checkid'], $tuirs['checkname'], true, 3);
$this->updatelogvalid('and `courseid`>0 and `status`=1 and `step`>='.$tuirs['step'].'');
}
$lzt = $this->rock->repempt($nzt, $zt);//最后状态
$uparr = $nexttodoarr = $nexttodoarc = array();
$bsarr = $this->getflow();
$bsarr['tuiid'] = $tuiid;
$nextcheckid = $bsarr['nowcheckid']; //下一步审核人
if($istongyi){//同意
if($iszhuanyi==0){
$uparr['status']= $this->rock->repempt($nzt,'0');
......@@ -2147,22 +2165,22 @@ class flowModel extends Model
$uparr['status'] = $lzt;
}
$this->flowcheckafter($zt, $sm, $nowcourse);
$bsarr['nstatus'] = $lzt;
$bsarr['checksm'] = $sm;
//没有当前步骤就是结束完成了
if(!$this->nowcourse){
$uparr['status'] = $lzt;
$nexttodoarc = array($this->optid, 'finish', $sm, '');
}
//最后状态更新
if($uparr){
$this->update($uparr, $this->id);
}
//审核完成了调用对应函数接口
if(!$this->nowcourse){
$this->flowcheckfinsh($zt);
......@@ -2172,13 +2190,13 @@ class flowModel extends Model
}
$bsarr['status'] = $this->rs['status'];//状态
$this->getflowsave($bsarr, true);
//通知给相应人员
if($this->db->backsql()){
if($nexttodoarr)$this->nexttodo($nexttodoarr[0],$nexttodoarr[1],$nexttodoarr[2],$nexttodoarr[3]);
if($nexttodoarc)$this->nexttodo($nexttodoarc[0],$nexttodoarc[1],$nexttodoarc[2],$nexttodoarc[3]);
if($nexttodoarr)$this->nexttodo($nexttodoarr[0],$nexttodoarr[1],$nexttodoarr[2],$nexttodoarr[3]);
if($nexttodoarc)$this->nexttodo($nexttodoarc[0],$nexttodoarc[1],$nexttodoarc[2],$nexttodoarc[3]);
}
//通知发送的
if($iszhuanyi == 1){
$this->gettodosend('bozhuan','', $sm, 0, ''.$this->adminname.'将['.$nowcourse['name'].']转给:'.$zyname.'');
......@@ -2189,12 +2207,12 @@ class flowModel extends Model
}
return 'ok';
}
public function pushs($receid, $cont, $title='', $params=array())
{
return $this->push($receid,'', $cont, $title, 0, $params);
}
/**
* 详情的URL
*/
......@@ -2209,8 +2227,8 @@ class flowModel extends Model
return $url;
}
public function getxiangurlx($num='',$id=0){return $this->getxiangurl($num,$id,'x');}
/**
* 推送提醒
*/
......@@ -2223,7 +2241,7 @@ class flowModel extends Model
$modename = arrvalue($params, 'modename', $this->modename);
$id = (int)arrvalue($params, 'id', $this->id);
$moders = arrvalue($params, 'moders');
if(!is_array($moders))$moders = $this->moders;
if(!is_array($moders))$moders = $this->moders;
if($gname=='')$gname = $modename;
$reim = m('reim');
$url = $this->getxiangurl($modenum, $id, 'p');
......@@ -2235,7 +2253,8 @@ class flowModel extends Model
$url = arrvalue($params, 'url', $url); //PC上URL
$wxurl = arrvalue($params, 'wxurl', $wxurl); //移动端URL
$emurl = arrvalue($params, 'emurl', $emurl); //邮件上URL
$this->emurl = $emurl;
$slx = 0;
$pctx = $moders['pctx'];
$mctx = $moders['mctx'];
......@@ -2248,6 +2267,15 @@ class flowModel extends Model
$this->rs['now_adminname'] = $this->adminname;
$this->rs['now_modename'] = $modename;
$cont = $this->rock->reparr($cont, $this->rs);
$contt = strip_tags($cont);
if(strpos($contt,'北京广厦网络技术股份公司 GONN Network Technology Inc OA系统提示>,') !== false){
$contt=str_replace('北京广厦网络技术股份公司 GONN Network Technology Inc OA系统提示,','',$contt);
$contt=str_replace('链 接:>>> 更多信息请登录&nbsp;广厦网络OA办公系统&nbsp;进行查看,感谢您的使用和支持。 通过邮件或电话(010-62419724转829)联系我们,获得更多帮助。 OA办公系
统本邮件由系统自动发出,请勿直接回复 ','',$contt);
}
$receid = $this->adminmodel->gjoins($receid);
$uids = m('todo')->addtodo($receid, $modename, $cont, $modenum, $id);
if($uids!='' && $moders['type'] != '系统' && $id > 0)$this->todosmodel->addtotouids($uids, array(
......@@ -2258,20 +2286,20 @@ class flowModel extends Model
));
$reim->pushagent($uids, $gname, $cont, $title, $url, $wxurl, $slx, ''.$modenum.'|'.$id.'');
$this->flowchangetodo($uids, $gname);
if(isempt($title))$title = $modename;
$title = $this->rock->reparr($title, $this->rs);
//邮件提醒发送不发送全体人员的,太多了
if($emtx == 1 && $receid != 'all'){
$emcont = '您好:<br>'.$cont.'(邮件由系统自动发送)';
$emcont = ''.$cont.'';
if($emurl!=''){
$emcont.='<br><a href="'.$emurl.'" target="_blank" style="color:blue"><u>详情&gt;&gt;</u></a>';
$emcont.='<br><a href="'.$emurl.'" target="_blank" style="color:blue"><u></u></a>';
}
$msg = m('email')->sendmail($title, $emcont, $receid);
if($msg!='ok')m('log')->addlogs('邮件', $msg , 2);
}
//微信提醒发送
if($wxtx==1){
$wxarra = $this->flowweixinarr;
......@@ -2314,14 +2342,14 @@ class flowModel extends Model
$this->flowweixinarr=array();
return $receid;
}
public function getwxurl($num='')
{
if($num=='')$num = $this->modenum;
$str = ''.URL.'?m=ying&d=we&num='.$num.'';
return $str;
}
/**
* 删除单据
*/
......@@ -2332,7 +2360,7 @@ class flowModel extends Model
$is = $this->isdeleteqx();
if($is==0)return '无权删除';
}
//删除前判断
if(method_exists($this,'flowdeletebillbefore')){
$bstr = $this->flowdeletebillbefore($sm);
......@@ -2359,20 +2387,20 @@ class flowModel extends Model
$this->flowdeletebill($sm);
$this->flowzuofeibill($sm);
$this->gettodosend('bodel','', $sm);
$dels = '删除模块['.$this->modename.']id为'.$this->id.'的单据';
$ztss = arrvalue($this->rs,'base_summary');
if(!isempt($ztss))$dels.=',摘要['.$ztss.']';
if(!isempt($sm))$dels.=',说明:'.$sm.'';
m('log')->addlogs('删除单据', $dels, 3);
foreach($this->wherejoin as $num=>$fields){
$this->deletebilljoin($num, "`$fields`='$this->id'", $sm);
}
return 'ok';
}
/**
* 关联删除
*/
......@@ -2386,7 +2414,7 @@ class flowModel extends Model
$flow->deletebill($sm, false);
}
}
/**
* 关联作废
*/
......@@ -2400,7 +2428,7 @@ class flowModel extends Model
$flow->zuofeibill($sm);
}
}
/**
* 单据作废处理
*/
......@@ -2429,13 +2457,13 @@ class flowModel extends Model
}
$this->flowzuofeibill($sm);
$this->gettodosend('bozuofei','', $sm);
foreach($this->wherejoin as $num=>$fields){
$this->zuofeibilljoin($num, "`$fields`='$this->id'", $sm);
}
return 'ok';
}
/**
* 短信催办,需要有短信功能
*/
......@@ -2462,7 +2490,7 @@ class flowModel extends Model
}
return 'ok';
}
/**
* 加入日程提醒
*/
......@@ -2480,7 +2508,7 @@ class flowModel extends Model
m('schedule')->insert($barr);
return 'ok';
}
/*
* 获取操作菜单 $flx=0 从操作上点出来 1详情上展示的
*/
......@@ -2491,7 +2519,7 @@ class flowModel extends Model
$rows = $this->db->getrows('[Q]flow_menu',"`setid`='$this->modeid' ".$where." and `status`=1",'id,wherestr,name,statuscolor,statusvalue,num,islog,issm,type,upgcont','`sort`');
$arr = array();
$bfrom = $this->rock->post('bfrom');
foreach($rows as $k=>$rs){
$wherestr = $rs['wherestr'];
$bo = false;
......@@ -2521,31 +2549,31 @@ class flowModel extends Model
if($bo)$arr[] = $rs;
}
if($flx==1)return $arr;
$status = (int)arrvalue($this->rs,'status','0');
$isturn = (int)arrvalue($this->rs, 'isturn','0');
$ismy = ($this->uid == $this->adminid or $this->optid == $this->adminid);
$isreadbo = $this->isreadqx(1);
//菜单上参数说明lx 标识类型,nup是否不显示上传框,optmenuid菜单Id负数,issm是否需要说明
if($this->isflow>0 && $isturn==1){
//流程参与人都可以追加说明
if(!in_array($status, array(1,5)) && $isreadbo){
$arr[] = array('name'=>'追加说明...','lx'=>1,'issm'=>1,'optmenuid'=>-12);
}
$isjk = $this->isjiankongqx();//监控权限
if(!in_array($status, array(1,5)) && ($ismy || $isjk)){
$arr[] = array('name'=>'作废申请...','lx'=>16,'issm'=>1,'nup'=>1,'optmenuid'=>-16); //可直接作废
if($isjk){
$arr[] = array('name'=>'监控转办...','color'=>'blue','lx'=>3,'issm'=>1,'nup'=>1,'optmenuid'=>-18);
//$arr[] = array('name'=>'撤回上一步处理','color'=>'#ff6600','lx'=>1,'issm'=>1,'nup'=>1,'optmenuid'=>-19);
$arr[] = array('name'=>'监控转办...','color'=>'blue','lx'=>3,'issm'=>1,'nup'=>1,'optmenuid'=>-18);
//$arr[] = array('name'=>'撤回上一步处理','color'=>'#ff6600','lx'=>1,'issm'=>1,'nup'=>1,'optmenuid'=>-19);
}
}
if(!in_array($status, array(1,2,5)) && ($ismy || $isjk)){
$arr[] = array('name'=>'催办...','lx'=>13,'issm'=>1,'nup'=>1,'optmenuid'=>-13);
if($this->option->getval('sms_iscb')=='1')$arr[] = array('name'=>'短信催办...','lx'=>17,'issm'=>1,'nup'=>1,'optmenuid'=>-17);
......@@ -2562,11 +2590,11 @@ class flowModel extends Model
}
}
}
if($status != 5 && arrvalue($this->moders,'ispl','1')=='1' && $isreadbo){
$arr[] = array('name'=>'评论','lx'=>15,'nup'=>1,'issm'=>1,'optmenuid'=>-15);
}
//回执确认
if($ismy && arrvalue($this->moders,'ishz')=='1' && $status==1){
$smcont = $this->getsummary();
......@@ -2575,7 +2603,7 @@ class flowModel extends Model
if($mid>0)$namess = '回执确认编辑';
$arr[] = array('name'=>$namess,'djmid'=>$mid,'optnum'=>'receipt','lx'=>'18','optmenuid'=>-18,'modename'=>$this->modename,'smcont'=>$smcont);
}
//定时提醒设置
if($isreadbo && arrvalue($this->moders,'istxset','1')=='1' && $this->modenum != 'remind' && !in_array($status, array(2,5))){
$smcont = ''.$this->modename.':'.$this->getsummary();
......@@ -2584,20 +2612,20 @@ class flowModel extends Model
if($mid>0)$namess = '提醒设置编辑';
$arr[] = array('name'=>$namess,'djmid'=>$mid,'smcont'=>$smcont,'issm'=>1,'optnum'=>'tixing','lx'=>'14','optmenuid'=>-14);
}
if($this->iseditqx()==1 && $isreadbo){
$arr[] = array('name'=>'编辑','optnum'=>'edit','lx'=>'11','optmenuid'=>-11);
}
if($this->isdeleteqx()==1){
$arr[] = array('name'=>'删除','color'=>'red','optnum'=>'del','nup'=>1,'issm'=>0,'islog'=>0,'statusvalue'=>9,'lx'=>'9','optmenuid'=>-9);
}
return $arr;
}
/**
* 操作菜单操作
*/
......@@ -2623,7 +2651,7 @@ class flowModel extends Model
}else if($czid==-13){
$this->chuiban($sm);
}else if($czid==-14){
$msg = $this->addschedule($sm);
$msg = $this->addschedule($sm);
}else if($czid==-15){
$actname = $this->rock->post('name');
$this->addlog(array(
......@@ -2689,7 +2717,7 @@ class flowModel extends Model
if($msg=='')$msg='ok';
return $msg;
}
/**
* 监控人操作转办
*/
......@@ -2701,21 +2729,21 @@ class flowModel extends Model
$barr = $this->getflow();
$nowcourseid = arrvalue($barr, 'nowcourseid');
if(isempt($nowcourseid))return '此单据当前没审核步骤';
$sm = '将['.$this->nowcourse['name'].']转办给:'.$cname.'';
$this->addlog(array(
'explain' => $sm,
'name' => '监控转办',
));
$this->addcheckname($nowcourseid, $cnameid, $cname, true, 7);
$barr = $this->getflow();
$this->getflowsave($barr, true);
$this->nexttodo($barr['nowcheckid'], 'next', $sm);
return 'ok';
}
/**
* 单据展示条件搜索
*/
......@@ -2755,7 +2783,7 @@ class flowModel extends Model
$fwhere = $this->getflowwhere($uid, $lx);//流程模块上条件
$path = ''.P.'/flow/page/rock_page_'.$this->modenum.'.php';
$table = $arr['table'];
$temsao = 0;
if(!contain($table, ' ') && $this->isflow>0){
......@@ -2763,7 +2791,7 @@ class flowModel extends Model
if(!isempt($arr['tableleft']))$arr['table'].=' left join '.$arr['tableleft'].'';
$arr['asqom'] = 'a.';
$arr['fields']= 'a.*,b.`uname` as base_name,b.`udeptname` as base_deptname,b.`sericnum`,b.`nowcheckname`';
if(isset($arr['fieldsleft']) && $arr['fieldsleft'])$arr['fields'].=','.$arr['fieldsleft'].'';
if(isset($arr['fieldsleft']) && $arr['fieldsleft'])$arr['fields'].=','.$arr['fieldsleft'].'';
if($arr['order']=='')$arr['order'] = 'a.`optdt` desc'; //默认操作时间倒序
$temsao = 1;
if($this->defaultorder){
......@@ -2791,8 +2819,8 @@ class flowModel extends Model
$wherestr = $this->rock->covexec($wherestr);
$where .= ' and '.$wherestr;
}
if($fwhere!='')$where .= ' '.$fwhere;
if($fwhere!='')$where .= ' '.$fwhere;
if($_wehs!='')$where .= ' '.$_wehs;
$highwhere = $this->gethighwhere();//高级搜索
$allfields = array();
......@@ -2807,7 +2835,7 @@ class flowModel extends Model
$check = c('check');
$allfields = $this->db->getallfields('[Q]'.$this->mtable.'');
$_kearr = array();
//关键词是日期
if($check->isdate($key) || $check->ismonth($key)){
$skeay = array('date','datetime','month');
......@@ -2852,7 +2880,7 @@ class flowModel extends Model
$_kearr[] = "b.`sericnum` = '$key'";
$_kearr[] = "b.`nowcheckname` = '$key'"; //搜索当前处理人
}
//其他or字段条件格式:name@1,title
if(isset($nas['orlikefields'])){
$owhee = explode(',', $nas['orlikefields']);
......@@ -2883,8 +2911,8 @@ class flowModel extends Model
$where = str_replace('{asqom}', $arr['asqom'], $where);
$arr['order'] = str_replace('{asqom}', $arr['asqom'], $arr['order']);
$where = str_replace('[A]', $arr['asqom'], $where);
//字段显示
$fields = $arr['fields'];
......@@ -2933,7 +2961,7 @@ class flowModel extends Model
return $arr;
}
/**
* 获取高级搜索条件
*/
......@@ -2979,7 +3007,7 @@ class flowModel extends Model
}
return $s;
}
/**
* 根据编号获取对应条件flow_where
*/
......@@ -2991,7 +3019,7 @@ class flowModel extends Model
$where = $this->wheremodel->getwherestr($rs, $uid, $this->flowviewufieds);
return $where;
}
/**
* 根据流程模块条件读取记录和统计
*/
......@@ -3003,14 +3031,14 @@ class flowModel extends Model
if(isempt($nas['fields']))$nas['fields'] = '*';
$swher = str_replace('{asqom}',$nas['asqom'], $swher);
$where = '1=1 '.$nas['where'].' '.$swher.'';
if($limit==0)return $this->db->rows($table, $where );
if($limit==0)return $this->db->rows($table, $where );
$rows = $this->db->getrows($table, $where , $nas['fields'], $nas['order'], $limit);
foreach($rows as $k=>$rs){
$rows[$k] = $this->flowrsreplace($rs, 2);
}
return $rows;
}
/**
* 读取要提醒的单据
*/
......@@ -3029,9 +3057,9 @@ class flowModel extends Model
}
return $rows;
}
/**
* 打印导出
*/
......@@ -3042,21 +3070,21 @@ class flowModel extends Model
$cell = 1;
foreach($arr['fields'] as $k=>$v)$cell++;
$arr['cell'] = $cell;
$where = '1=1';
$str1 = $this->moders['where'];
if(!isempt($str1)){
$str1 = $this->rock->covexec($str1);
$where = $str1;
}
$vwhere = $this->viewmodel->viewwhere($this->moders, $this->adminid);
$rows = $this->getrows(''.$where.' '.$vwhere.'', '*', 'id desc', 100);
$arr['rows'] = $this->flowprintrows($rows);
$arr['count'] = $this->db->count;
return $arr;
}
/**
* 获取所有多行子表数据
* $lx=0编辑时读取,1展示时读取
......@@ -3089,8 +3117,8 @@ class flowModel extends Model
}
return $subdata;
}
/**
* 读取通知
* $act 当前动作有(boturn,boedit,bochang,bodel)
......@@ -3120,7 +3148,7 @@ class flowModel extends Model
}
return $garr;
}
/**
* 发送设置的通知
*/
......@@ -3134,12 +3162,12 @@ class flowModel extends Model
$cheo = c('check');
foreach($barr as $k=>$rs){
$receid = $rs['receid'];
if($act=='botong' || $act=='bobutong'){
$changewe = $rs['changecourse'];
if(!isempt($changewe) && !contain(','.$changewe.',',','.$courseid.','))continue;
}
if($rs['toturn']==1)$receid.=','.$this->uid.''; //通知给提交人
if(arrvalue($rs,'tosuper')=='1'){
$supar = $this->adminmodel->getsuperman($this->uid);
......@@ -3170,7 +3198,7 @@ class flowModel extends Model
$this->push($receid, '', $cont, $this->rock->repempt($rs['name']));
}
}
/**
* 根据编号发送通知
*/
......@@ -3180,8 +3208,8 @@ class flowModel extends Model
if(!$rows)return;
$this->gettodosend($rows, $actname, $sm);
}
/**
* 统计报表
*/
......@@ -3203,22 +3231,22 @@ class flowModel extends Model
if($type=='avg')$tofiels = 'avg([A]`'.$typefields.'`)';
$atype = $this->rock->post('atype');
$table = '[Q]'.$this->mtable.'';
$narr = $this->billwhere($this->adminid, $atype);
$where = $narr['where'];
$table = $narr['table'];
if(!contain($table,' '))$table = '[Q]'.$table.'';
$gwhere = $this->rock->post('where');
if(!isempt($gwhere)){
$gwhere = $this->rock->jm->uncrypt($this->rock->iconvsql($gwhere));
$where .= ' '.$gwhere.'';
}
$sql = 'select '.$fields.' as `name`,'.$tofiels.' as value from '.$table.' where 1=1 '.$where.' group by '.$fields.'';
$sql = str_replace('[A]', $narr['asqom'], $sql);
$rows = $this->db->getall($sql);
$total = 0;
if($rows){
......@@ -3232,9 +3260,9 @@ class flowModel extends Model
}
return $rows;
}
/**
* 回执确认
*/
......@@ -3247,36 +3275,36 @@ class flowModel extends Model
if(isempt($receids))$receids = '';
$uid = $this->adminid;
if(!contain(','.$receid.',', ','.$uid .','))return;
$reaa = explode(',', $receids);
if(!$reaa)$reaa = array();
if(!in_array($uid, $reaa)){
if($receids!='')$receids.=',';
$receids.=''.$uid.'';
}
$reaa = explode(',', $receids);
$ushuy = count($reaa);
$receids= join(',', $reaa);
m('receipt')->update(array(
'receids' => $receids,
'ushuy' => $ushuy,
), $hid);
$this->addlog(array(
'explain' => $sm,
'name' => '回执确认'
));
//通知给提交人
$this->rs = $hrs;
$this->nexttodo($hrs['uid'],'receipt', $sm, '回执确认');
return 'ok';
}
/**
* 获取简单列表数据,返回table表格
*/
......@@ -3297,7 +3325,7 @@ class flowModel extends Model
$cont = c('html')->createrows($rows, substr($headstr, 1),'#cccccc','noborder');
return $cont;
}
/**
* 禁看处理
*/
......@@ -3330,7 +3358,7 @@ class flowModel extends Model
foreach($jinrows as $k2=>$rs2)$jinrow[]=$rs2['id'];
$jinkfarr[$k1]['jinrows'] = $jinrow;
}
//隐藏字段设置
foreach($rows as $k=>$rs){
$id = $rs['id'];
......@@ -3351,7 +3379,7 @@ class flowModel extends Model
}
return $rows;
}
/**
* 判断是否导出子表处理
*/
......@@ -3361,7 +3389,7 @@ class flowModel extends Model
$excelsubtab = $this->rock->post('excelsubtab');
if(isempt($excelsubtab) || isempt($this->moders['tables']))return $rows;
$suba = explode(',', $excelsubtab);
foreach($rows as $k=>$rs){
if(!isset($rs['id']))return $rows;
$subdata = $this->getsuballdata(1, $rs['id']);
......@@ -3375,7 +3403,7 @@ class flowModel extends Model
}
}
}
return $rows;
}
......@@ -3396,8 +3424,10 @@ class flowModel extends Model
if(!empty($customer)) {
$url .= $customer['id'];
$link = '<a href="'.$url.'" target="_blank" style="color:#2fa4e7">'.$customer['name']?:$name.'</a>';
return $link;
} else {
$link = $name;
}
return $link;
}
public function getSupplierLink($name){
......@@ -3411,8 +3441,10 @@ class flowModel extends Model
if(!empty($supplier)) {
$url .= $supplier['id'];
$link = '<a href="'.$url.'" target="_blank" style="color:#2fa4e7">'.$supplier['name']?:$name.'</a>';
return $link;
} else {
$link = $name;
}
return $link;
}
/**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论