信呼OA版本v2.3.8

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

View File

@@ -0,0 +1,217 @@
<?php
/**
* 可视化模块设计
* 开发者:雨中磐石
* 官网www.rockoa.com
* 禁止乱修改头部信息,请保留尊重开发者
* 修改时间2021-10-14
*/
class flowviewClassAction extends Action
{
public function defaultAction()
{
$ybarr = $this->option->authercheck();
if(is_string($ybarr))return $ybarr;
$this->title = '可视化模块设计';
$this->assign('modearr', m('mode')->getmodearr("and (`type`<>'系统' or `num`='demo')"));
}
//加载字段信息
public function getziduanAction()
{
$num = $this->get('num');
$fid = $this->get('fid');
$moders = m('flow_set')->getone("`num`='$num'");
$tables = $moders['table'];
$ziduan = m('flow_element')->getone('mid='.$moders['id'].' and `iszb`=0 and `fields`=\''.$fid.'\'','*','`iszb` asc,`sort` asc');
$fiedar = $this->db->gettablefields('[Q]'.$tables.'','',"and `COLUMN_NAME`='$fid'");
if($fiedar){
$fieda = $fiedar[0];
if($fieda['type']=='decimal'){
$ziduan['lens'] = $fieda['xslen1'];
$ziduan['xiaoshu'] = $fieda['xslen2'];
}
}
return array(
'ziduan' => $ziduan,
'fiedar' => $fiedar,
'typedata' => $this->option->getdata('flowinputtype'),
);
}
//加载字段信息
public function getziduansAction()
{
$num = $this->get('num');
$name = $this->rock->xssrepstr($this->post('name'));
$fields = c('pingyin')->get($name,1);
if(!$fields || strlen($fields)<4)$fields = 'a'.$this->db->ranknum('flow_element','fields');
if(strlen($fields)>20)$fields = 'a'.substr($fields,0,19);
$ziduan['name'] = $name;
$ziduan['fields'] = $fields;
$ziduan['fieldstype'] = 'text';
$ziduan['id'] = '0';
$ziduan['dev'] = '';
$ziduan['lens'] = '0';
$ziduan['islu'] = '1';
$ziduan['issou'] = '1';
$ziduan['xiaoshu'] = '0';
return array(
'ziduan' => $ziduan,
'typedata' => $this->option->getdata('flowinputtype'),
);
}
//保存字段
public function saveziduanAction()
{
$id = (int)$this->post('id','0');
$num = $this->post('modenum');
$moders = m('flow_set')->getone("`num`='$num'");
$mid = $moders['id'];
$sarr['name'] = $this->post('name');
$sarr['fieldstype'] = $this->post('fieldstype');
$sarr['dev'] = $this->post('dev');
$sarr['placeholder'] = $this->post('placeholder');
$sarr['data'] = $this->post('data');
$sarr['lens'] = (int)$this->post('lens','0');
$sarr['isbt'] = (int)$this->post('isbt','0');
$sarr['islu'] = (int)$this->post('islu','0');
$sarr['issou'] = (int)$this->post('issou','0');
$sarr['fields'] = $this->post('fields');
$sarr['attr'] = $this->post('attr');
$sarr['xiaoshu']= (int)$this->post('xiaoshu','0'); //小数点
$sarr['mid'] = $mid;
$sarr['iszb'] = 0;
if(substr($sarr['fieldstype'],0,6)=='change' && isempt($sarr['data'])){
$sarr['data'] = ''.$sarr['fields'].'id';
}
include_once('webmain/main/flow/flowAction.php');
$obj = new flowClassAction();
$strs= $obj->elemensavefieldsbefore('flow_element', $sarr, $id);
if($strs)return returnerror($strs);
$where = '`id`='.$id.'';
if($id==0)$where = '';
$bo = m('flow_element')->record($sarr, $where);
if($bo)$obj->elemensavefields('', $sarr);
//一键布局PC录入
$path = 'webmain/flow/page/input_'.$num.'.html';
$isscl = false;
$xgwj = 0;
$base = 0;
if(!file_exists($path)){
$isscl = true;
}else{
$ofile = file_get_contents($path);
if(contain($ofile,'{file_content}'))$xgwj = 1;
if(contain($ofile,'{base_name}'))$base = 1;
if(contain($ofile,'autoyijianview'))$isscl = true;
}
if($isscl){
$obj->yinruonearr = array(
'modeid' => $mid,
'xgwj' => $xgwj,
'base' => $base,
);
$str = $obj->yinruoneAjax();
$this->rock->createtxt($path, $str);
}
return returnsuccess();
}
//删除字段
public function delziduanAction()
{
$id = (int)$this->get('id','0');
m('flow_element')->delete($id);
return returnsuccess();
}
//创建模块
public function createmodeAction()
{
$name = $this->rock->xssrepstr($this->post('name'));
$fields = c('pingyin')->get($name,1);
if(!$fields || strlen($fields)<4)$fields = $this->db->ranknum('flow_set','num');
if(strlen($fields)>20)$fields = substr($fields,0,18);
$num = 'zz'.$fields.'';
if(m('flow_set')->rows("`num`='$num'")>0){
$fields = $this->db->ranknum('flow_set','num');
$num = 'zz'.$fields.'';
}
$id = 0;
$uarr['name'] = $name;
$uarr['num'] = $num;
$uarr['table'] = $num;
$uarr['isflow'] = 0;
$uarr['tables'] = '';
$uarr['names'] = '';
$uarr['sort'] = '0';
$uarr['type'] = '新增';
$uarr['receid'] = 'all';
$uarr['recename'] = '全体人员';
$uarr['optdt'] = $this->now;
$uarr['isup'] = 0;
$uarr['isscl'] = 1;
$uarr['pctx'] = 1;
$uarr['status'] = 1;
$uarr['istxset'] = 0;
$uarr['ispl'] = 0;
$id = m('flow_set')->insert($uarr);
include_once('webmain/main/flow/flowAction.php');
$obj = new flowClassAction();
$obj->flowsetsaveafter('flow_set', $uarr);
$obj->setinputid = $id;
$obj->inputAction();
$wherestr = $this->jm->base64encode('`optid`={uid}');
m('flow_where')->insert(array(
'setid' => $id,
'num' => 'my',
'name' => '我添加数据',
'wheresstr' => $wherestr,
'sort' => 0,
'islb' => 1,
'status' => 1,
));
m('flow_where')->insert(array(
'setid' => $id,
'num' => 'all',
'pnum' => 'all',
'name' => '所有数据',
'wheresstr' => $this->jm->base64encode('1=1'),
'sort' => 0,
'islb' => 1,
'status' => 1,
));
$uarr = array(
'recename' => '全体人员',
'receid' => 'all',
'modeid' => $id,
'type' => 2,
'wherestr' => $wherestr,
);
m('flow_extent')->insert($uarr);
$uarr['type'] = 3;
m('flow_extent')->insert($uarr);
m('mode')->createlistpage($id); //生成列表页
return returnsuccess(array(
'name' => ''.$id.'.'.$name.'('.$num.')',
'id' => $id,
'num' => $num
));
}
}

View File

@@ -0,0 +1,18 @@
var iview= {
init:function(){
$('.lumtr').click(function(){
iview.clickvew(this)
});
},
clickvew:function(o1){
if(this.noobk)this.noobk.css('background','');
this.noobk = $(o1);
this.noobk.css('background',maincolor);
var fid = this.noobk.find('[name]')[0];
if(fid){
fid = fid.name.replace('[]','');
parent.ke.showzdxing(fid);
}
}
}
iview.init();

View File

@@ -0,0 +1,322 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=$da['title']?></title>
<link rel="stylesheet" type="text/css" href="webmain/css/webmain.css"/>
<link rel="stylesheet" type="text/css" href="web/res/fontawesome/css/font-awesome.min.css">
<script src="js/jquery.js"></script>
<script src="js/js.js"></script>
<link rel="shortcut icon" href="favicon.ico" />
<script type="text/javascript" src="mode/plugin/jquery-rockmodels.js"></script>
<style>
<?php
$maincolor = getconfig('apptheme','#1389D3');
$maincolora= c('image')->colorTorgb($maincolor);
$maincolors= ''.$maincolora[0].','.$maincolora[1].','.$maincolora[2].'';
echo 'body{--main-color:'.$maincolor.';--main-border:rgba('.$maincolors.',0.2)}';
?>
.tools{height:40px;padding:0px 10px;overflow:hidden;text-align:center;line-height:40px;cursor:pointer;font-size:14px;float:left}
.tools:hover{background-color:#f1f1f1}
.typedata{margin:8px 10px;padding:8px;border:1px #dddddd solid;font-size:12px;border-radius:5px}
.listdata{padding:10px;border-bottom:1px #eeeeee solid;cursor:pointer}
.listdata:hover,.aactive{ background:#f1f1f1;color:<?=$maincolor?>}
</style>
<script>
maincolor='<?=$maincolor?>';
modenum = '';
modeid = 0;
var ke = {
init:function(){
this.geihes();
$(window).resize(this.geihes);
this.getzidudn();
},
geihes:function(){
var hei = winHb()-2;
$('#leftmain').css('height',''+hei+'px');
$('#centerdiv').css('height',''+(hei-40)+'px');
$('#shuxinglist').css('height',''+(hei-40)+'px');
$('#centerdivs').css('height',''+(hei-110)+'px');
},
addmode:function(){
js.prompt('新增模块','请输入模块名称(模块编号随机生成)', function(jg,txt){
if(jg=='yes' && txt){
ke.addmodes(txt);
}
});
},
addmodes:function(na){
js.loading('模块创建中...');
js.ajax('?d=main&m=flowview&a=createmode',{name:na},function(ret){
if(ret.success){
js.msgok('创建成功');
var ds = ret.data;
$('#modelist').prepend('<div class="listdata" onclick="ke.viewmode(\''+ds.num+'\',\''+ds.id+'\', this)">'+ds.name+'</div>');
}else{
js.msgerror(ret.msg);
}
},'post,json');
},
viewmode:function(bh,sid,o1){
if(this.modevsse)this.modevsse.removeClass('aactive');
this.modevsse = $(o1);
this.modevsse.addClass('aactive');
modenum = bh;
modeid = sid;
this.getzidudn();
},
getzidudn:function(){
if(!modenum)return;
var url = '?a=lum&m=input&d=flow&num='+modenum+'&showtype=view';
showIframe.location.href=url;
},
showshuxing:function(d){
var str = '<form name="myform" autocomplete="off">';
str+='<input type="hidden" name="id" value="'+d.id+'">';
//str+='<input type="hidden" name="isss" value="'+d.isss+'">';
str+='<table width="100%">';
str+='<tr>';
str+='<td align="right" nowrap><font color=red>*</font>名称&nbsp;</td>';
str+='<td><input type="text" value="'+d.name+'" name="name" style="width:100%" class="input"></td>';
str+='</tr>';
str+='<tr><td height="10"></td></tr>';
str+='<tr>';
str+='<td align="right" nowrap><font color=red>*</font>对应字段&nbsp;</td>';
str+='<td><input type="text" value="'+d.fields+'" placeholder="不能数字/中文" name="fields" style="width:100%" class="input"></td>';
str+='</tr>';
if(!d.xiaoshu)d.xiaoshu='0';
str+='<tr><td height="10"></td></tr>';
str+='<tr>';
str+='<td align="right" nowrap><font color=red>*</font>字段类型&nbsp;</td>';
str+='<td><select onchange="ke.changetype()" name="fieldstype" style="width:100%" class="input"></select><div id="div_number" style="display:none">小数点位数:<input type="text" onfocus="js.focusval=this.value" onblur="js.number(this)" min="0" max="6" name="xiaoshu" class="input" style="width:60px" value="'+d.xiaoshu+'"></div></td>';
str+='</tr>';
if(!d.lens)d.lens='';
str+='<tr><td height="10"></td></tr>';
str+='<tr>';
str+='<td align="right" nowrap>长度&nbsp;</td>';
str+='<td><input type="text" onfocus="js.focusval=this.value" onblur="js.number(this)" value="'+d.lens+'" name="lens" style="width:100%" class="input"></td>';
str+='</tr>';
if(!d.dev)d.dev='';
str+='<tr><td height="10"></td></tr>';
str+='<tr>';
str+='<td align="right" nowrap>默认值&nbsp;</td>';
str+='<td><input type="text" value="'+d.dev+'" placeholder="录入时显示的默认值" name="dev" style="width:100%" class="input"></td>';
str+='</tr>';
if(!d.placeholder)d.placeholder='';
str+='<tr><td height="10"></td></tr>';
str+='<tr>';
str+='<td align="right" nowrap>提示内容&nbsp;</td>';
str+='<td><input type="text" value="'+d.placeholder+'" name="placeholder" style="width:100%" class="input"></td>';
str+='</tr>';
str+='<tr><td height="10"></td></tr>';
str+='<tr>';
str+='<td align="right" nowrap>是否必填&nbsp;</td>';
str+='<td><label><input type="checkbox" value="1" name="isbt">录入必须填写</label></td>';
str+='</tr>';
str+='<tr><td height="10"></td></tr>';
str+='<tr>';
str+='<td align="right" nowrap>是否录入&nbsp;</td>';
str+='<td><label><input type="checkbox" value="1" name="islu">在录入页显示</label></td>';
str+='</tr>';
str+='<tr><td height="10"></td></tr>';
str+='<tr>';
str+='<td align="right" nowrap>是否搜索&nbsp;</td>';
str+='<td><label><input type="checkbox" value="1" name="issou">列表页上搜索</label></td>';
str+='</tr>';
if(!d.attr)d.attr='';
str+='<tr><td height="10"></td></tr>';
str+='<tr>';
str+='<td align="right" nowrap>属性&nbsp;</td>';
str+='<td><input type="text" value="'+d.attr+'" placeholder="如果只读填写readonly" name="attr" style="width:100%" class="input"></td>';
str+='</tr>';
if(!d.data)d.data='';
str+='<tr id="div_data">';
str+='<td align="right" nowrap>数据源&nbsp;</td>';
str+='<td><textarea name="data" style="width:100%;height:100px;margin-top:10px" class="input">'+d.data+'</textarea><a class="blue" href="http://www.rockoa.com/view_element.html" target="_blank">数据源帮助</a></td>';
str+='</tr>';
str+='<tr><td height="10"></td></tr>';
str+='<tr>';
str+='<td align="right" nowrap></td>';
str+='<td><button type="button" onclick="ke.saveshuxing(this)" class="webbtn">'+d.btnname+'保存</button>&nbsp;<span id="msgview">';
if(d.id>0){
str+='<button type="button" onclick="ke.delfields(this,'+d.id+')" class="webbtn webbtn-red">删</button>';
}
str+='</span></td>';
str+='</tr>';
str+='</table></form>';
str='<div style="margin:10px;">'+str+'</div>';
$('#shuxinglist').html(str);
js.setselectdata(form('fieldstype'),this.typedata,'value');
form('fieldstype').value = d.fieldstype;
if(d.isbt==1)form('isbt').checked=true;
if(d.islu==1)form('islu').checked=true;
if(d.issou==1)form('issou').checked=true;
this.changetype();
},
changetype:function(){
var val = form('fieldstype').value;
if(val=='number'){
$('#div_number').show();
}else{
$('#div_number').hide();
}
},
saveshuxing:function(o1){
var da = js.getformdata();
o1.disabled=true;
if(!da.name){js.setmsg('名称不能为空');return;}
if(!da.fields){js.setmsg('对应字段不能为空');return;}
js.setmsg('保存中...');
da.modenum = modenum;
js.ajax('?d=main&m=flowview&a=saveziduan',da,function(ret){
if(ret.success){
js.setmsg('保存成功','green');
ke.getzidudn();
}else{
js.setmsg(ret.msg,'red');
o1.disabled=false;
}
},'post,json');
},
iframeshow:function(){
},
showzdxing:function(fid){
js.loading('加载字段信息...');
js.ajax('?d=main&m=flowview&a=getziduan',{num:modenum,fid:fid},function(ret){
ke.typedata = ret.typedata;
var das = ret.ziduan;
if(das){
das.btnname = '编辑';
ke.showshuxing(das);
js.unloading();
}else{
js.msgerror('读取不到字段信息');
}
},'get,json');
},
addfields:function(){
if(modenum==''){
js.msgerror('请先选择模块');return;
}
js.prompt('新增字段','请输入字段名称', function(jg,txt){
if(jg=='yes' && txt){
ke.addfieldss(txt);
}
});
},
addfieldss:function(jx){
js.loading('加载字段信息...');
js.ajax('?d=main&m=flowview&a=getziduans',{num:modenum,name:jx},function(ret){
ke.typedata = ret.typedata;
var das = ret.ziduan;
das.btnname = '新增';
ke.showshuxing(das);
js.unloading();
},'post,json');
},
lubuju:function(){
if(modenum==''){
js.msgerror('请先选择模块');return;
}
var url='?m=flow&d=main&a=input&setid='+modeid+'&atype=0';
js.open(url,980,530);
}
,
lubujus:function(){
if(modenum==''){
js.msgerror('请先选择模块');return;
}
var url = js.getajaxurl('@lu','input','flow',{num:modenum});
js.open(url, 800,450);
},
delfields:function(o1,ids){
js.confirm('确定要删除此字段吗?', function(jg){
if(jg=='yes'){
js.ajax('?d=main&m=flowview&a=delziduan',{id:ids},function(ret){
js.msgok('删除成功');
ke.getzidudn();
},'get,json');
}
});
}
}
function initbody(){
ke.init();
}
</script>
</head>
<body style="background:#f5f5f5;padding:0;margin:0;overflow:hidden">
<div align="center">
<div align="left" style="max-width:1200px">
<table width="100%">
<tr valign="top">
<td >
<div id="leftmain" style="width:230px;background-color:white;border:1px #dddddd solid;overflow:auto">
<div style="padding:10px" align="center">
<button type="button" onclick="ke.addmode()" class="webbtn"><i class="icon-plus"></i> 新增模块</button>
</div>
<div id="modelist">
<?php
$type = '';
foreach($modearr as $k=>$rs){
if($type!=$rs['type']){
echo '<div style="line-height:30px;border-bottom:1px #eeeeee solid">&nbsp;<b>'.$rs['type'].'</b></div>';
}
$type = $rs['type'];
echo '<div class="listdata" onclick="ke.viewmode(\''.$rs['num'].'\',\''.$rs['id'].'\', this)">'.$rs['name'].'</div>';
}
?>
</div>
</div>
</td>
<td width="100%" style="padding:0px 10px">
<div style="border:1px #dddddd solid;">
<div style="height:40px;overflow:hidden;background:#fefefe;border-bottom:0px #f1f1f1 solid">
<div class="tools" onclick="ke.addfields()"><i class="icon-plus"></i>增加字段</div>
<div class="tools" onclick="ke.lubuju()"><i class="icon-laptop"></i>PC端录入布局</div>
<div class="tools" onclick="ke.lubujus()"><i class="icon-desktop"></i>PC录入页</div>
</div>
<div id="centerdiv" style="height:40px;background:#ededed" align="center">
<div style="padding:15px 0px">
<div style="height:40px;line-height:40px;font-size:12px;color:gray">更多完整的设置,请到【流程模块→表单元素管理】下操作</div>
<div id="centerdivs" style="width:350px;overflow:hidden;background:white;border:1px #cccccc solid;border-radius:2px" id="ziduanlist" align="left">
<iframe src="" onload="ke.iframeshow()" name="showIframe" width="100%" height="100%" frameborder="0"></iframe>
</div>
</div>
</div>
</div>
</td>
<td >
<div id="rightmain" style="width:300px;background-color:white;border:1px #dddddd solid">
<div style="height:40px;overflow:hidden;background:#fefefe;border-bottom:1px #f1f1f1 solid;line-height:40px">
&nbsp;字段属性
</div>
<div id="shuxinglist" style="height:120px;overflow:auto"></div>
</div>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>