/*
//2023年10月16日
功能:根据flow_id,或run_id,获取该流程的全部表名及描述,和字段及描述
返回值:$returnData=array(
'sortAndDesc'=>array(
'main'=>'表单名称',
'detail_828'=>'列表控件名称'
),
'bpmTbAllInfo'=>array(
'main'=>array(
'tableNameArr'=>array(
'bpm_data_537',
'bpm_data_537_child'//如果表单中有多行文本框时,则有子表
),
'tableColumArr'=>array(
'data_m18951'=>'申请日期',
'data_m18954'=>'报销人'
)
),
'detail_828'=>array(
'tableNameArr'=>array(
'bpm_data_537_list_828',//如果存在列表控件
'bpm_data_537_list_828_child'//如果列表控件中有多行文本框时,则有子表
),
'tableColumArr'=>array(
'data_m18984'=>'派车单号',
'data_m18985'=>'报告编号'
)
),
'detail_829'=>array(
'tableNameArr'=>array(
'bpm_data_537_list_829',//如果存在列表控件
'bpm_data_537_list_829_child'//如果列表控件中有多行文本框时,则有子表
),
'tableColumArr'=>array(
'data_m19004'=>'派车单号',
'data_m19005'=>'报告编号'
)
)
)
)
*/
function getBpmTbAllInfoCy($run_id='',$flow_id=''){
//流程表名前缀
$tbNamePre='bpm_data_';
$RUN_ID=$run_id;
$FLOW_ID=$flow_id;
//返回数据
$returnData=array();
//根据表名描述获取sort
$returnData['sortAndDesc']=array();
$returnData['bpmTbAllInfo']=array();
//根据RUN_ID获取FlOW_ID
if(empty($flow_id)){
$sql='select * from bpm_run where RUN_ID='.$RUN_ID.' limit 1';
$res=exequery(TD::conn(),$sql);
$row=mysqli_fetch_assoc($res);
$FLOW_ID = $row['FLOW_ID'];
}
$tbNamePre=$tbNamePre.$FLOW_ID;
$sortAndDesc=array();
$bpmTbAllInfo=array();
$sql='select * from bpm_variable_sort where FLOW_ID='.$FLOW_ID;
$res=exequery(TD::conn(),$sql);
while ($row=mysqli_fetch_assoc($res)) {
$tableName='';
$tableNameArr=array();
$tableColumArr=array();
if($row['TYPE']=='main'){
$type='main';
$tableName=$tbNamePre;
}else{
$type=$row['TYPE'].'_'.$row['ID'];
$tableName=$tbNamePre.'_list_'.$row['ID'];
}
array_push($tableNameArr,$tableName);
$sortAndDesc[$type]=$row['DESC'];
$sql2='select * from bpm_variable where SORT_ID ='.$row['ID'];
$res2=exequery(TD::conn(),$sql2);
$i=0;
while ($row2=mysqli_fetch_assoc($res2)) {
$tableColumArr[$row2['NAME']]=$row2['DESC'];
if($i===0&&$row2['TYPE']=='text'){ //如果有一个控件类型为text,则存在xx_child子表
$tableName=$tableName.'_child';
array_push($tableNameArr,$tableName);
$i++;
}
}
sort($tableNameArr);
asort($tableColumArr);
$bpmTbAllInfo[$type]=array(
'tableNameArr'=>$tableNameArr,
'tableColumArr'=>$tableColumArr
);
}
$returnData['sortAndDesc']=$sortAndDesc;
$returnData['bpmTbAllInfo']=$bpmTbAllInfo;
return $returnData;
}
# 前端
## 表单常用js
```javascript
//拼接当前地址
var pro = window.location.protocol;
var host = window.location.host;
var url = pro + "//" + host;
//向html中的head元素,追加标签
var headadd = document.getElementsByTagName("head")[0];
//追加link标签,引入css样式
var links = document.createElement('link');
links.href = '/static/layui/css/layui.css';
links.rel = 'stylesheet';
links.type = 'text/css';
//追加script标签,引入js
var scripts = document.createElement("script");
scripts.src = "/static/layui/layui.js";
scripts.type = "text/javascript";
headadd.appendChild(scripts);
//自定义 解析地址栏的数据 的函数
function getWindonHref() {
var sHref = window.location.href;//获取url
var args = sHref.split('?');//从中间的?隔开存成数组
if (args[0] === sHref) {
return '';//?后面没有参数直接返回
}
var hrefarr = args[1].split('#')[0].split('&');//截取?和#之间的url,再根据&隔开每个参数存成数组待处理
var obj = {};
var tmp_str = "";
for (var i = 0; i < hrefarr.length; i++) {
hrefarr[i] = hrefarr[i].split('=');
tmp_str = hrefarr[i][0].toLowerCase();
obj[tmp_str] = hrefarr[i][1];
}
return obj;
}
内容绝对原创,希望对您有帮助。您的打赏,是让我持续更新的牛奶和面包