在通达OA2009中,“数据选择控件”目前只有自带的三种类型数据。
现增加第三方的数据来源,以增强其功能。
一、
MYOA\webroot\general\system\workflow\flow_form\cool_form\data\config.php在Config.php 增加
'TX_USERS' => array("NAME" => "同享系统用户" , "CONTENT" => array("EMP_NAME" => "工号姓名",
"DEPT_NAME" => "部门","ZHIWEI" => "职位","ZHIWU" => "职务","ZHIJI" => "职级"))
二、
MYOA\webroot\general\workflow\list\input_form
增加连接MSSQL-SERVER的输出
if ($dataSrc == 'TX_USERS') {
if($act=="count")
$query = "select count(*) from OA_Employee_View where 1=1";
else
$query = "select top 10 $dataField from OA_Employee_View where 1=1";
if(strstr($dataQuery,"1,"))
{
$array1 = explode(",",$dataQuery);
$array2 = explode(",",$dataField);
$array3 = explode(",",$dataFieldName);
foreach($array1 as $k => $v)
{
if($v==1)
{
$name = $array2[$k];
$value = $$name;
if($value!="")
$query .= " and $name like '%$value%'";
}
}
}
$txconn=mssql_connect($MSSQL_TX_SERVER,$MSSQL_TX_USER,$MSSQL_TX_PASS);
mssql_select_db($MSSQL_TX_DB,$txconn);
if($act=="count")
{
$cursor = mssql_query($query);
if($ROW=mssql_fetch_array($cursor))
$COUNT=$ROW[0];
echo $COUNT;
exit;
}
$cursor = mssql_query($query);
$COUNT=0;
$dataField_arr = explode(",",$dataField);
$dataFieldName_arr = explode(",",$dataFieldName);
while($ROW=mssql_fetch_array($cursor))
{
$COUNT++;
if($COUNT%2==1)
$TableLine="TableLine1";
else
$TableLine="TableLine2";
foreach($dataField_arr as $k=> $v)
{
if($v=="") continue;
if($COUNT==1)
{
if($k==0)
$thead.='<table class="TableList" align="center" width="90%"><tr class="TableHeader">';
$thead.='<td nowrap align="center">'.$dataFieldName_arr[$k].'</td>';
}
if($k==0)
$tbody.='<tr class="'.$TableLine.'">';
$tbody.='<td nowrap align="center">'.$ROW[$v].'</td>';
}
if($COUNT==1) $thead.='<td nowrap align="center">操作</td></tr>';
$tbody.='<td nowrap align="center"> <a href="#" class="orgAdd" onclick="addData(this)">添加</a></td></tr>';
}
$tbody.="</table>";
echo $thead.$tbody;