提交 b9366fb8 authored 作者: fengzy's avatar fengzy

Merge branch 'test' of ssh://39.155.253.71:33222/PHP/OA into test

//流程模块【emfk.电费付款】下录入页面自定义js页面,初始函数
function initbodys(){
}
\ No newline at end of file
<?php
/**
* 此文件是流程模块【emfk.电费付款】对应控制器接口文件。
*/
class mode_emfkClassAction extends inputAction{
/**
* 重写函数:保存前处理,主要用于判断是否可以保存
* $table String 对应表名
* $arr Array 表单参数
* $id Int 对应表上记录Id 0添加时,大于0修改时
* $addbo Boolean 是否添加时
* return array('msg'=>'错误提示内容','rows'=> array()) 可返回空字符串,或者数组 rows 是可同时保存到数据库上数组
*/
protected function savebefore($table, $arr, $id, $addbo){
}
/**
* 重写函数:保存后处理,主要保存其他表数据
* $table String 对应表名
* $arr Array 表单参数
* $id Int 对应表上记录Id
* $addbo Boolean 是否添加时
*/
protected function saveafter($table, $arr, $id, $addbo){
}
}
\ No newline at end of file
<table bordercolor="#000000" border="1"><tbody><tr><td class="ys1" style="text-align:center;background-color:#CCCCCC;"><span style="white-space:nowrap;">*单号<br /></span></td><td class="ys2" colspan="3"><span style="white-space:nowrap;">{docnum}<br /></span></td></tr><tr><td class="ys1" style="text-align:center;background-color:#CCCCCC;"><span style="white-space:nowrap;">*标题<br /></span></td><td class="ys2" colspan="3"><span style="white-space:nowrap;">{title}<br /></span></td></tr><tr><td height="34" align="right" class="ys1" style="height:34px;text-align:center;background-color:#CCCCCC;"><span style="white-space:nowrap;">*申请人</span></td><td class="ys2"><span style="white-space:nowrap;">{applicant}</span></td><td align="right" class="ys1" style="text-align:center;background-color:#CCCCCC;"><span style="white-space:nowrap;">*申请部门</span></td><td class="ys2"><span style="white-space:nowrap;">{dept}</span></td></tr><tr><td width="15%" height="34" align="right" class="ys1" style="width:124.4px;height:34px;text-align:center;background-color:#CCCCCC;"><span style="white-space:nowrap;">*申请日期</span></td><td width="35%" class="ys2"><span style="white-space:nowrap;">{date}</span></td><td width="15%" align="right" class="ys1" style="text-align:center;width:124.4px;background-color:#CCCCCC;"><style="text-align:center;text-indent:28px;white-space:normal;background-color:#cccccc;" style="white-space: nowrap;">*收款方<br /></style="text-align:center;text-indent:28px;white-space:normal;background-color:#cccccc;"></td><td width="35%" class="ys2" style="width:294.8px;"><span style="white-space:nowrap;">{payee}</span></td></tr><tr><td height="34" align="right" class="ys1" style="height:34px;text-align:center;background-color:#CCCCCC;"><span style="white-space:nowrap;">*付款方式</span></td><td class="ys2"><span style="white-space:nowrap;">{payway}</span></td><td align="right" class="ys1" style="text-align:center;background-color:#CCCCCC;"><span style="white-space:nowrap;">*付款金额()</span></td><td class="ys2"><span style="white-space:nowrap;">{amount}</span></td></tr><tr><td class="ys1" style="text-align:center;background-color:#CCCCCC;"><span style="white-space:nowrap;">*付款组织<br /></span></td><td class="ys2" colspan="3"><span style="white-space:nowrap;">{org}<br /></span></td></tr><tr><td class="ys2" colspan="4" style="background-color:#CCCCCC;vertical-align:middle;"><p><span style="white-space:nowrap;">款项明细</span></p></td></tr><tr><td colspan="4"><table class="tablesub ke-zeroborder" id="tablesub0" border="0" cellspacing="0" cellpadding="0" style="width:848px;"><tbody><tr><td width="10%" nowrap="nowrap">序号</td><td nowrap="nowrap">*款项类型</td><td nowrap="nowrap">*金额()</td><td nowrap="nowrap">*成本中心</td><td nowrap="nowrap">合同</td><td nowrap="nowrap">发票号</td><td width="5%" nowrap="nowrap">操作</td></tr><tr><td><span style="white-space:nowrap;">[xuhao0,0]</span></td><td><span style="white-space:nowrap;">[charge_type0,0]</span></td><td><span style="white-space:nowrap;">[amount0,0]</span></td><td><span style="white-space:nowrap;">[cbzxid0,0]</span></td><td><span style="white-space:nowrap;">[contract_num0,0]</span></td><td><span style="white-space:nowrap;">[receipt_num0,0]</span></td><td><span style="white-space:nowrap;">{删,0}</span></td></tr></tbody></table><div style="background-color:#F1F1F1;"><span style="white-space:nowrap;">{新增,0}</span></div><span style="white-space:nowrap;"><br /></span></td></tr><tr><td style="text-align:center;background-color:#CCCCCC;"><span style="white-space:nowrap;">*收款方信息<br /></span></td><td class="ys2" colspan="3"><span style="white-space:nowrap;">{info}<br /></span></td></tr><tr><td height="34" align="right" class="ys1" style="height:34px;text-align:center;background-color:#CCCCCC;"><span style="white-space:nowrap;">*付款事由</span></td><td class="ys2" colspan="3"><span style="white-space:nowrap;">{cause}</span></td></tr><tr><td height="34" align="right" class="ys1" style="height:34px;text-align:center;background-color:#CCCCCC;"><span style="white-space:nowrap;">*附件</span></td><td class="ys2" colspan="3"><span style="white-space:nowrap;">{receipt}</span></td></tr></tbody></table>
\ No newline at end of file
<?php
/**
* 模块:emfk.电费付款
* 说明:自定义区域内可写你想要的代码
* 来源:流程模块→表单元素管理→[模块.电费付款]→生成列表页
*/
defined('HOST') or die ('not access');
?>
<script>
$(document).ready(function(){
{params}
var modenum = 'emfk',modename='电费付款',isflow=0,modeid='124',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":"amount","name":"\u4ed8\u6b3e\u91d1\u989d","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"docnum","name":"\u5355\u636e\u7f16\u53f7","fieldstype":"num","ispx":"0","isalign":"0","islb":"1"},{"fields":"title","name":"\u6807\u9898","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"cause","name":"\u4ed8\u6b3e\u4e8b\u7531","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"payee","name":"\u6536\u6b3e\u65b9","fieldstype":"selectdatafalse","ispx":"0","isalign":"0","islb":"1"},{"fields":"payway","name":"\u4ed8\u6b3e\u65b9\u5f0f","fieldstype":"rockcombo","ispx":"0","isalign":"0","islb":"1"},{"fields":"info","name":"\u6536\u6b3e\u65b9\u4fe1\u606f","fieldstype":"textarea","ispx":"0","isalign":"0","islb":"1"},{"fields":"dept","name":"\u7533\u8bf7\u90e8\u95e8","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"receipt","name":"\u9644\u4ef6","fieldstype":"uploadfile","ispx":"0","isalign":"0","islb":"1"},{"fields":"applicant","name":"\u7533\u8bf7\u4eba","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"org","name":"\u4ed8\u6b3e\u7ec4\u7ec7","fieldstype":"rockcombo","ispx":"0","isalign":"0","islb":"1"},{"fields":"date","name":"\u7533\u8bf7\u65e5\u671f","fieldstype":"datetime","ispx":"0","isalign":"0","islb":"1"}],fieldsselarr= [];
var c = {
reload:function(){
a.reload();
},
clickwin:function(o1,lx){
var id=0;
if(lx==1)id=a.changeid;
openinput(modename,modenum,id,'opegs{rand}');
},
view:function(){
var d=a.changedata;
openxiangs(modename,modenum,d.id,'opegs{rand}');
},
searchbtn:function(){
this.search({});
},
search:function(cans){
var s=get('key_{rand}').value,zt='';
if(get('selstatus_{rand}'))zt=get('selstatus_{rand}').value;
var canss = js.apply({key:s,keystatus:zt,search_value:''}, cans);
a.setparams(canss,true);
},
searchhigh:function(){
new highsearchclass({
modenum:modenum,
oncallback:function(d){
c.searchhighb(d);
}
});
},
searchhighb:function(d){
d.key='';
d.search_value='';
get('key_{rand}').value='';
a.setparams(d,true);
},
searchuname:function(d){
js.getuser({
type:'deptusercheck',
title:'搜索'+d.name,
changevalue:this.search_value,
callback:function(sna,sid){
c.searchunames(d,sna,sid);
}
});
},
search_value:'',
searchunames:function(d,sna,sid){
get('key_{rand}').value=sna;
this.search_value = sid;
var cs = {key:'','search_fields':d.fields,'search_value':sid};
a.setparams(cs,true);
},
daochu:function(o1,lx,lx1,e){
publicdaochuobj({
'objtable':a,
'modename':modename,
'fieldsarr':fieldsarr,
'modenum':modenum,
'modenames':modenames,
'isflow':isflow,
'btnobj':o1
});
},
getacturl:function(act){
return js.getajaxurl(act,'mode_emfk|input','flow',{'modeid':modeid});
},
changatype:function(o1,lx){
$("button[id^='changatype{rand}']").removeClass('active');
$('#changatype{rand}_'+lx+'').addClass('active');
a.setparams({atype:lx},true);
var tit = $(o1).html();if(tit.indexOf(modename)<0)tit=modename+'('+tit+')';
nowtabssettext(tit);
},
init:function(){
$('#key_{rand}').keyup(function(e){
if(e.keyCode==13)c.searchbtn();
});
this.initpage();
},
initpage:function(){
},
loaddata:function(d){
this.setdownsodata(d.souarr);
if(!d.atypearr)return;
get('addbtn_{rand}').disabled=(d.isadd!=true);
get('daobtn_{rand}').disabled=(d.isdaochu!=true);
if(d.isdaochu)$('#daobtn_{rand}').show();
if(d.isdaoru)$('#daoruspan_{rand}').show();
var d1 = d.atypearr,len=d1.length,i,str='';
for(i=0;i<len;i++){
str+='<button class="btn btn-default" click="changatype,'+d1[i].num+'" id="changatype{rand}_'+d1[i].num+'" type="button">'+d1[i].name+'</button>';
}
$('#changatype{rand}').html(str);
$('#changatype{rand}_'+atype+'').addClass('active');
js.initbtn(c);
},
setdownsodata:function(darr){
var ddata = [{name:'高级搜索',lx:0}],dsd,i;
if(darr)for(i=0;i<darr.length;i++){
dsd = darr[i];
dsd.lx=3;
ddata.push(dsd);
}
if(admintype==1)ddata.push({name:'自定义列显示',lx:2});
ddata.push({name:'打印',lx:1});
this.soudownobj.setData(ddata);
},
setcolumns:function(fid, cnas){
var d = false,i,ad=bootparams.columns,len=ad.length,oi=-1;
for(i=0;i<len;i++){
if(ad[i].dataIndex==fid){
d = ad[i];
oi= i;
break;
}
}
if(d){
d = js.apply(d, cnas);
bootparams.columns[oi]=d;
}
},
daoru:function(){
window.managelistemfk = a;
addtabs({num:'daoruemfk',url:'flow,input,daoru,modenum=emfk',icons:'plus',name:'导入电费付款'});
},
initcolumns:function(bots){
var num = 'columns_'+modenum+'_'+pnum+'',d=[],d1,d2={},i,len=fieldsarr.length,bok;
var nstr= fieldsselarr[num];if(!nstr)nstr='';
if(nstr)nstr=','+nstr+',';
if(nstr=='' && isflow>0){
d.push({text:'申请人',dataIndex:'base_name',sortable:true});
d.push({text:'申请人部门',dataIndex:'base_deptname',sortable:true});
}
for(i=0;i<len;i++){
d1 = fieldsarr[i];
bok= false;
if(nstr==''){
if(d1['islb']=='1')bok=true;
}else{
if(nstr.indexOf(','+d1.fields+',')>=0)bok=true;
}
if(bok){
d2={text:d1.name,dataIndex:d1.fields};
if(d1.ispx=='1')d2.sortable=true;
if(d1.isalign=='1')d2.align='left';
if(d1.isalign=='2')d2.align='right';
d.push(d2);
}
}
if(isflow>0)d.push({text:'状态',dataIndex:'statustext'});
if(nstr=='' || nstr.indexOf(',caozuo,')>=0)d.push({text:'',dataIndex:'caozuo',callback:'opegs{rand}'});
if(!bots){
bootparams.columns=d;
}else{
a.setColumns(d);
}
},
setparams:function(cs){
var ds = js.apply({},cs);
a.setparams(ds);
},
storeurl:function(){
var url = this.getacturl('publicstore')+'&pnum='+pnum+'';
return url;
},
printlist:function(){
js.msg('success','可使用导出,然后打开在打印');
},
getbtnstr:function(txt, click, ys, ots){
if(!ys)ys='default';
if(!ots)ots='';
return '<button class="btn btn-'+ys+'" id="btn'+click+'_{rand}" click="'+click+'" '+ots+' type="button">'+txt+'</button>';
},
setfieldslist:function(){
new highsearchclass({
modenum:modenum,
modeid:modeid,
type:1,
isflow:isflow,
pnum:pnum,atype:atype,
fieldsarr:fieldsarr,
fieldsselarr:fieldsselarr,
oncallback:function(str){
fieldsselarr[this.columnsnum]=str;
c.initcolumns(true);
c.reload();
}
});
}
};
var bootparams = {
fanye:true,modenum:modenum,modename:modename,statuschange:false,tablename:jm.base64decode('Y19lbWZr'),
url:c.storeurl(),storeafteraction:'storeaftershow',storebeforeaction:'storebeforeshow',
params:{atype:atype},
columns:[{text:"付款金额",dataIndex:"amount"},{text:"单据编号",dataIndex:"docnum"},{text:"标题",dataIndex:"title"},{text:"付款事由",dataIndex:"cause"},{text:"收款方",dataIndex:"payee"},{text:"付款方式",dataIndex:"payway"},{text:"收款方信息",dataIndex:"info"},{text:"申请部门",dataIndex:"dept"},{text:"附件",dataIndex:"receipt"},{text:"申请人",dataIndex:"applicant"},{text:"付款组织",dataIndex:"org"},{text:"申请日期",dataIndex:"date"},{
text:'',dataIndex:'caozuo',callback:'opegs{rand}'
}],
itemdblclick:function(){
c.view();
},
load:function(d){
c.loaddata(d);
}
};
c.initcolumns(false);
opegs{rand}=function(){
c.reload();
}
//[自定义区域start]
//[自定义区域end]
js.initbtn(c);
var a = $('#viewemfk_{rand}').bootstable(bootparams);
c.init();
c.soudownobj = $('#downbtn_{rand}').rockmenu({
width:120,top:35,donghua:false,
data:[{name:'高级搜索',lx:0}],
itemsclick:function(d, i){
if(d.lx==0)c.searchhigh();
if(d.lx==1)c.printlist();
if(d.lx==2)c.setfieldslist();
if(d.lx==3)c.searchuname(d);
}
});
});
</script>
<!--SCRIPTend-->
<!--HTMLstart-->
<div>
<table width="100%">
<tr>
<td style="padding-right:10px;" id="tdleft_{rand}" nowrap><button id="addbtn_{rand}" class="btn btn-primary" click="clickwin,0" disabled type="button"><i class="icon-plus"></i> 新增</button></td>
<td>
<input class="form-control" style="width:160px" id="key_{rand}" placeholder="关键字">
</td>
<td style="padding-left:10px">
<div style="white-space:nowrap">
<button style="border-right:0;border-top-right-radius:0;border-bottom-right-radius:0" class="btn btn-default" click="searchbtn" type="button">搜索</button><button class="btn btn-default" id="downbtn_{rand}" type="button" style="padding-left:8px;padding-right:8px;border-top-left-radius:0;border-bottom-left-radius:0"><i class="icon-angle-down"></i></button>
</div>
</td>
<td width="90%" style="padding-left:10px"><div id="changatype{rand}" class="btn-group"></div></td>
<td align="right" id="tdright_{rand}" nowrap>
<button class="btn btn-default" style="display:none" id="daobtn_{rand}" disabled click="daochu" type="button">导出 <i class="icon-angle-down"></i></button>
</td>
</tr>
</table>
</div>
<div class="blank10"></div>
<div id="viewemfk_{rand}"></div>
<!--HTMLend-->
\ No newline at end of file
...@@ -297,7 +297,6 @@ class flow_supplierClassModel extends flowModel ...@@ -297,7 +297,6 @@ class flow_supplierClassModel extends flowModel
}else{ }else{
$log='供应商名称:'.$name.'保存接口失败 '.$array['Result']['ResponseStatus']['Errors'][0]['Message']; $log='供应商名称:'.$name.'保存接口失败 '.$array['Result']['ResponseStatus']['Errors'][0]['Message'];
$file_write = file_put_contents('supplier.txt',$log,FILE_APPEND); $file_write = file_put_contents('supplier.txt',$log,FILE_APPEND);
} }
......
<?php
/**
* Created by PhpStorm.
* User: chouchou
* Date: 2020-4-2
* Time: 0:17
*/
class openEmfkClassAction extends openapiAction
{
public $data = [];
public $subdata = [];
public $model = 'c_emfk';
public $per = 'OA-EM-FK-';
public $ext = 'oa';
public function initAction()
{
$data = json_decode($_POST['data'], true);
if (empty($data)) $this->showreturn([], $_POST['data'], '201');
if (!empty($data['docnum'])) $this->data['docnum'] = $data['docnum']; //如果是编辑则携带编码
$user = $this->getUser($data['uname']); //获取用户信息
if ($data['type'] == 1) {
$this->model = 'emfk';
$this->data['applicationdpt'] = $data['dept'];
};
//构建主表
$this->data[$this->model . 'name'] = $data['title'];
$this->data['payee'] = $data['payee'];
$this->data['paymentMethod'] = $data['payType'];
$this->data['applicant'] = $user['name'];
$this->data['fkorg'] = $data['payOrg'];
$this->data['paymentBy'] = $data['remarks'];
$this->data['fkinfo'] = $data['fkinfo'];
$this->data['applydt'] = $this->data['optdt'] = $this->data['applydate'] = $data['date'] ?: date('Y-m-d');
$this->data['uid'] = $this->data['optid'] = $user['id'];
$this->data['docnum'] = $this->data['docnum'] ?: $this->getDocNum();
$this->data['status'] = 0;
$this->subdata = $this->getSubData($data['details']);
$this->data['amountOfThisPayment'] = $this->AmountSum();
}
//返回不存在的接口方法
public function __call($name, $arguments)
{
$msg = $name . ' action not found';
$this->showreturn([], $msg, '201');
}
//创建预付款单
public function createAction()
{
$id = m($this->model)->insert($this->data);
if ($id) {
//插入子表数据
$smode = m($this->model . 'Detail');
foreach ($this->subdata as $sub) {
$sub['mid'] = $id;
$sub['comid'] = 1;
$smode->insert($sub);
}
//启动流程
$this->goflow($id);
$this->showreturn(['numb' => $this->data['docnum'], 'id' => $id], '插入数据成功', '200');
} else $this->showreturn([], '插入数据失败', '201');
}
public function updateAction()
{
$mid = $this->getIdByDocNum($this->data['docnum']);
if (!$mid) $this->showreturn([], '修改数据失败,不匹配的数据记录', '201');
$where = 'id=' . $mid;
unset($this->data['docnum']);
$res = m($this->model)->update($this->data, $where);
if (!$res) $this->showreturn([], '修改数据失败,数据字段异常或字段不匹配', '201');
$smode = m($this->model . 'Detail');
//1.获取子表数据,子表数据必须要携带子表id
//2.查询所有子表ID 如果子表ID存在于 记录中则是修改 否则是新增
$scount = 0;
foreach ($this->subdata as $k => $sub) {
if (empty($sub['id'])) { //插入操作
$sub['mid'] = $mid;
$sub['comid'] = 1;
$smode->insert($sub);
} else { //新增
//如果已经存在的子表数据则修改
if ($smode->getone('id=' . $sub['id'])) {
$smode->update($sub, 'id=' . $sub['id']);
} else {
$sub['mid'] = $mid;
$sub['comid'] = 1;
$smode->insert($sub);
}
}
$scount++;
}
$this->showreturn([], '修改数据成功,子表数据成功修改' . $scount . '条记录', '200');
}
public function getUser($username)
{
$where = "email='" . $username . "@gonn.com.cn'";
return $this->db->getone('oa_userinfo', $where);
}
public function getSubData($details = [])
{
$arr = [];
foreach ($details as $k => $d) {
if (!empty($d['id'])) $arr[$k]['id'] = $d['id'];
$arr[$k]['charge_type'] = $d['chargeType'];
$arr[$k]['charge_amount'] = $d['amount'];
$arr[$k]['cbzx_code'] = $d['projectNumber'];
$arr[$k]['contract_id'] = $d['contractNumber'];
$arr[$k]['receipt_id'] = $d['receipt'];
}
return $arr;
}
//子表金额求和
public function AmountSum()
{
$sum = 0;
foreach ($this->subdata as $v) {
$sum += $v['charge_amount'];
}
return $sum;
}
private function getDocNum()
{
$pre = 'OA-EM-FK-';
if ($this->model == 'yfk') $pre = 'OA-YFK-';
$cext = $pre . date("Ymd");
$where = "`docnum` like '%" . $cext . "%'";
$mode = m($this->model);
$data = $mode->getone($where, 'id,docnum', 'id desc');
$num = '001';
if ($data) {
$num = (int)substr($data['docnum'], strlen($cext)) + 1;
if (strlen($num) == 2) {
$num = '0' . $num;
} else if (strlen($num) == 1) {
$num = '00' . $num;
}
}
return $cext . $num;
}
private function getIdByDocNum($docnum)
{
$data = m($this->model)->getone("`docnum`='" . $docnum . "'", 'id,docnum');
return $data['id'] ?: 0;
}
private function goflow($id)
{
$num = $this->ext . $this->model;
$mode = m("flow:" . $num);
$mode->initdata($num);
$mode->loaddata($id);
$mode->submit();
}
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论