Esempio n. 1
0
 /**
  * @Title: lookupGenerals
  * @Description: todo(普通常用查找带回)
  * @author 杨东
  * @date 2013-7-9 下午6:04:06
  * @throws
  */
 public function lookupGenerals()
 {
     // add by nbmxkj at 20150129 2107 lookup 属性自动获取
     $lookupKey = $_REQUEST['lookupchoice'];
     $lookupObj = D('LookupObj');
     $lookupDetail = $lookupObj->GetLookupDetail($lookupKey);
     // model由lookup配置获取 分视图和正常情况
     $name = $lookupDetail['mode'];
     $viewname = $lookupDetail['viewname'];
     // 获取查找带回的字段
     $this->assign("field", $lookupDetail['fields']);
     $this->assign("fieldval", $lookupDetail['val']);
     $this->assign("fieldname", $lookupDetail['filed']);
     $_POST['dealLookupList'] = 1;
     // 强制查找带回重构数据列表
     $_POST['dealLookupType'] = 1;
     // 新版本lookup
     $this->assign("lookupchoice", $lookupKey);
     // 来源类型 type : dt[从数据表格中点击过来的]
     //
     $type = $_POST['type'];
     $this->assign("type", $type);
     /**
      * *************************************************
      */
     /*
      * 本段为快速新增记录功能,需要重新规划
      * /***************************************************
      */
     // 获取部门类型 ————快捷新增客户
     $deptid = $_REQUEST['deptid'];
     $this->assign("deptid", $deptid);
     if (strpos($name, '_')) {
         // 将表转换为model
         $nameArr = explode('_', $name);
         $names = "";
         foreach ($nameArr as $k => $v) {
             $names .= ucfirst($v);
         }
         if ($names) {
             $name = $names;
         }
     }
     if (substr($name, -4) == "View") {
         $qx_name = $name;
         $name = substr($name, 0, -4);
     }
     $this->assign("model", $name);
     // 单据号是否可写
     $table = D($name)->getTableName();
     $scnmodel = D('SystemConfigNumber');
     $writable = $scnmodel->GetWritable($table);
     $this->assign("writable", $writable);
     $ConfigListModel = D('SystemConfigList');
     $lookupGeneralList = $ConfigListModel->GetValue('lookupGeneralInclude');
     // 快速新增配置列表
     $include = $lookupGeneralList[$name];
     // 获取配置信息
     $layoutH = 110;
     // 默认高度
     if ($include) {
         $layoutH = $include['layoutH'];
         // 获取高度
         $this->assign("tplName", 'LookupGeneral:' . $include['tpl']);
         // 设置默认模版
         $this->assign("isauto", $include['isauto']);
         // 设置编号自动生成
     }
     $this->assign("layoutH", $layoutH);
     // 设置高度
     /**
      * ***********************************************************************
      */
     /**
      * ************************************************************************
      * 本段开始是普通查找带回查询效果
      * ***********************************************************************
      */
     // $name="MisHrPersonnelPersonInfoView";
     $scdmodel = D('SystemConfigDetail');
     if ($lookupDetail['viewname']) {
         // 读取当前模型下的视图配置文件
         $path = DConfig_PATH . "/Models/" . $lookupDetail['mode'] . "/" . $lookupDetail['viewname'] . ".inc.php";
         $detailList = (require $path);
         $this->assign("viewname", $lookupDetail['viewname']);
         $map = $this->_searchs($lookupDetail['viewname'], '', '', $detailList);
     } else {
         $detailList = $scdmodel->getDetail($name);
         $map = $this->_searchs($name);
     }
     $action = A("Common");
     // ////////////////////////////////////////////// 以前的条件 ////////////////////////////////////////////////
     $conditions = $_REQUEST['conditions'];
     // 检索条件
     if ($conditions) {
         $conditions = str_replace(array('&quot;', '&#39;', '&lt;', '&gt;', '=='), array('"', "'", '<', '>', '='), $conditions);
         $this->assign("conditions", $conditions);
         $cArr = explode(';', $conditions);
         // 分号分隔多个参数
         foreach ($cArr as $k => $v) {
             $wArr = explode(',', $v);
             // 逗号分隔字段、参数、修饰符
             if ($wArr[0] == "_string") {
                 // 判断是否传的为字符串条件
                 //替换掉用#代替的,
                 $wArr[1] = str_replace(array('#'), array(','), $wArr[1]);
                 $map['_string'] .= $wArr[1];
             } else {
                 if ($wArr[2]) {
                     // 存在修饰符的以修饰符形式进行检索
                     $map[$wArr[0]] = array($wArr[2], $wArr[1]);
                 } else {
                     // 普通检索
                     $map[$wArr[0]] = $wArr[1];
                 }
             }
         }
     }
     // //////////////////////////////////////////////////////////////////////////////////
     // add by nbmxkj at 20150129 2107 lookup 默认条件自动获取
     // /////////////////////////////////////// 附加条件 ///////////////////////////////////////////
     $appendCondition = $_REQUEST['newconditions'];
     //附加条件从页面获取 // $_POST['newconditions'];// lookup检索条件 为兼容条件选择器 by renling
     // 视图查询时,取出别名的真实字段名
     if ($lookupDetail['viewname']) {
         $conditionFieldResolveArr = '';
         $resolveCondition = explode('and', $appendCondition);
         foreach ($resolveCondition as $k => $v) {
             unset($temp);
             //$temp= explode('=', $v);
             $temp = preg_split('/( in )|( = )/', $v);
             $conditionFieldResolveArr[] = trim($temp[0]);
         }
         $searchAlias = "";
         if (is_array($conditionFieldResolveArr)) {
             $searchAlias = "'" . join("','", $conditionFieldResolveArr) . "'";
         }
         $sql = "SELECT * FROM mis_system_dataview_sub\nWHERE masid=(SELECT id FROM mis_system_dataview_mas WHERE NAME='{$lookupDetail['viewname']}')\nAND `otherfield` in({$searchAlias})\nAND STATUS=1";
         if ($searchAlias) {
             $aliasObj = M();
             $data = $aliasObj->query($sql);
             if ($data) {
                 $findArr = '';
                 $replaceArr = '';
                 foreach ($data as $k => $v) {
                     $findArr[] = $v['otherfield'];
                     $replaceArr[] = $v['field'];
                 }
                 if ($findArr && $replaceArr) {
                     $appendCondition = str_replace($findArr, $replaceArr, $appendCondition);
                 }
             }
         }
     }
     // 读取默认条件
     unset($newconditions);
     if ($lookupDetail['condition']) {
         /*
          * 1、判断是否存在条件sql语句,
          * 2、判断是否存在动态值,进行解析动态值,目前只支持   1 $uid 当前登录人,2 $time 当前时间
          */
         $newconditions = str_replace(array('$uid', '$time', '$admin'), array($_SESSION[C('USER_AUTH_KEY')], time(), $_SESSION['a']), $lookupDetail['condition']);
     }
     if ($appendCondition) {
         $newconditions .= ($newconditions ? ' and ' : '') . $appendCondition;
     }
     // 数据过滤条件 by nbmxkj@20150617 1555
     $filterSouce = getCurrentUserDataRight(1, D($lookupDetail['mode'])->getTableName(), $lookupDetail['val'], true);
     if ($filterSouce) {
         $dataFilterMaps = $filterSouce;
         // key($filterSouce)." in ('".join("','", reset($filterSouce))."')";
         // 在需要时可以在此处加上过滤条件格式验证,防止异常。
     }
     if (trim($newconditions)) {
         $newconditions = str_replace(array('&quot;', '&#39;', '&lt;', '&gt;', '=='), array('"', "'", '<', '>', '='), $newconditions);
         // 把条件加入map 中
         $map['_string'] .= $newconditions;
     }
     if ($dataFilterMaps) {
         $map['_string'] .= $map['_string'] ? ' and ' . $dataFilterMaps : $dataFilterMaps;
     }
     //////////////////////////////////////////////////////////////////////////////////////////////
     //					树菜单																									//
     //////////////////////////////////////////////////////////////////////////////////////////////
     if ($lookupDetail['tree']) {
         $this->assign('treecount', count($lookupDetail['tree']));
         $treeContentArr = '';
         $treeindex = $_REQUEST['treeindex'];
         $lookuptreeHidden = "";
         if (isset($treeindex)) {
             $treetext = $lookupDetail['tree'][$treeindex]['treetext'];
             $treetextArr = explode(',', $treetext);
             foreach ($treetextArr as $k => $v) {
                 if ($_REQUEST[$treetextArr[$k]]) {
                     $map[$treetextArr[$k]] = $_REQUEST[$treetextArr[$k]];
                     $lookuptreeHidden .= "<input type=\"hidden\" name=\"{$treetextArr[$k]}\" value=\"{$_REQUEST[$treetextArr[$k]]}\" />";
                 }
             }
             $lookuptreeHidden .= "<input type=\"hidden\" name=\"treeindex\" value=\"0\" />";
         }
         $this->assign('lookuptreeHidden', $lookuptreeHidden);
         foreach ($lookupDetail['tree'] as $key => $val) {
             $treeModel = $val['treemodel'];
             $treevalue = $val['treevalue'];
             $treeshow = $val['treeshow'];
             $treetext = $val['treetext'];
             $treetitle = $val['treetitle'];
             $treecondition = $val['treecondition'];
             $treelength = $val['treelength'] ? $val['treelength'] : 10;
             $treevalueArr = explode(',', $treevalue);
             $treetextArr = explode(',', $treetext);
             //构造左侧部门树结构
             $model = M($treeModel);
             $departmentmap['status'] = 1;
             if ($treecondition) {
                 $departmentmap['_string'] = $treecondition;
             }
             $ret = $model->where($departmentmap)->field("parentid")->find();
             if (false === $ret) {
                 $deptlist = $model->where($departmentmap)->field("{$treeshow} as name , id , 0 as parentid , {$treevalue}")->order("id asc")->limit($treelength)->select();
             } else {
                 $deptlist = $model->where($departmentmap)->field("{$treeshow} as name , id ,parentid , {$treevalue}")->order("id asc")->limit($treelength)->select();
             }
             $urlParame = '/treeindex/' . $key;
             foreach ($treevalueArr as $k => $v) {
                 // '.$v.'
                 $urlParame .= '/' . $treetextArr[$k] . '/#' . $v . '#';
             }
             $param['rel'] = "treelookupcontent";
             $param['url'] = "__URL__/lookupGenerals/jump/1{$urlParame}/lookupchoice/" . $lookupKey;
             $common = A('Common');
             $typeTree = $common->getTree($deptlist, $param);
             $treeContentArr[] = array('data' => $typeTree, 'title' => $treetitle);
         }
         $this->assign('treedata', $treeContentArr);
     }
     //////////////////////////////////////////////////////////////////////////////////////////////
     //					树菜单 end																							//
     //////////////////////////////////////////////////////////////////////////////////////////////
     // 以树形列表显示数据。
     if ($lookupDetail['mode'] && $lookupDetail['treelist'] && $lookupDetail['treelist']['show'] && $lookupDetail['treelist']['value'] && $lookupDetail['treelist']['parentid']) {
         $searchFields = $lookupDetail['fields'];
         $this->assign('searchFieldsArr', explode(',', $lookupDetail['listshowfields']));
         $model = D("MisSystemRecursion");
         $id = $lookupDetail['treelist']['value'];
         $name = $lookupDetail['treelist']['show'];
         $parentid = $lookupDetail['treelist']['parentid'];
         $isnextend = $lookupDetail['treelist']['isnextend'];
         $searchFieldsArr = explode(',', $searchFields);
         if (!in_array($id, $searchFieldsArr)) {
             array_push($searchFieldsArr, $id);
         }
         if (!in_array($name, $searchFieldsArr)) {
             array_push($searchFieldsArr, $name);
         }
         if (!in_array($parentid, $searchFieldsArr)) {
             array_push($searchFieldsArr, $parentid);
         }
         $searchFields = join(',', $searchFieldsArr);
         $this->assign('value', $id);
         $this->assign('show', $name);
         $this->assign('detailList', $detailList);
         $this->assign('isnextend', $isnextend);
         if ($lookupDetail['viewname']) {
             // 视图
             $data = D($lookupDetail['viewname'])->where($map)->select();
             $treeSelectselect6Data = $model->dataShow($data, array('key' => $id, 'pkey' => $parentid, 'conditions' => $newconditions, 'fields' => "{$searchFields}"), 0, 1);
             // print_r($data);
         } else {
             // 模型
             $table = D($lookupDetail['mode'])->getTableName();
             $data = M($table)->where($map)->select();
             $treeSelectselect6Data = $model->modelShow($table, array('key' => $id, 'pkey' => $parentid, 'conditions' => $newconditions, 'fields' => "{$searchFields}"), 0, 1);
         }
         //如果树形数据和原数据不一致(原因为父级缺失,补充父级记录)
         if (count($data) != count($treeSelectselect6Data) && count($data) > 0) {
             foreach ($data as $tk => $tv) {
                 $newTreeList[$tv[$id]] = $tv;
             }
             //获取无条件数据
             if ($lookupDetail['viewname']) {
                 $dataNoMap = D($lookupDetail['viewname'])->select();
             } else {
                 $table = D($lookupDetail['mode'])->getTableName();
                 $dataNoMap = M($table)->select();
             }
             //show_tree_node -> 判断该记录是否选择
             foreach ($dataNoMap as $tk2 => $tv2) {
                 if (empty($newTreeList[$tv2[$id]])) {
                     $dataNoMap[$tk2]['show_tree_node'] = 0;
                 } else {
                     $dataNoMap[$tk2]['show_tree_node'] = 1;
                 }
             }
             $temp2 = $this->sonParentLine($data, $dataNoMap, $id, $parentid);
             //重新实例化MisSystemRecursion,把$temp2排序
             $ddds = D("MisSystemRecursion");
             $ddds->__construct();
             $treeSelectselect6Data = $ddds->dataShow($temp2, array('key' => $id, 'pkey' => $parentid, 'conditions' => '', 'fields' => "{$searchFields}"), 0, 1);
         }
         $this->assign('vo', $treeSelectselect6Data);
         $this->display('Public:lookupTreeList');
         exit;
     }
     if ($lookupKey == '2ba96fc5ab7bef0ac9a4d3f5d72bb1f0') {
         $userid = $_SESSION[C('USER_AUTH_KEY')];
         $viewModel = D('MisHrPersonnelUserDeptView');
         $companyList = $viewModel->where('user.id=' . $userid)->field('companyid')->select();
         foreach ($companyList as $comk => $comv) {
             $companyArr[] = $comv['companyid'];
         }
         //构造左侧部门树结构
         $model = M('mis_system_department');
         $departmentmap['status'] = 1;
         if (!empty($companyList) && $userid != 1) {
             //$departmentmap['companyid']=array('in',$companyArr);
         }
         $deptlist = $model->where($departmentmap)->order("id asc")->select();
         $param['rel'] = "misrowaccessright1";
         $param['url'] = "__URL__/lookupGenerals/jump/1/deptid/#id#/parentid/#parentid#/companyid/#companyid#/lookupchoice/" . $lookupKey;
         $common = A('Common');
         $typeTree = $common->getTree($deptlist, $param);
         //获得树结构json值
         $this->assign('tree', $typeTree);
         if ($_REQUEST['companyid'] != null) {
             $map['companyid'] = $_REQUEST['companyid'];
         } else {
             $map['companyid'] = $deptlist[0]['companyid'];
         }
         $parentid = $_REQUEST['parentid'];
         //获得父类节点
         $companyid = $_REQUEST['companyid'];
         if ($deptid && $parentid) {
             $deptlist = array_unique(array_filter(explode(",", $this->downAllChildren($deptlist, $deptid))));
             $map['deptid'] = array(' in ', $deptlist);
         }
         $this->assign('parentid', $parentid);
         $this->assign('companyid', $companyid);
     }
     // ////////////////////////////////////// 附加条件end /////////////////////////////////////////
     $this->assign("newconditions", $newconditions);
     if (!$_REQUEST['viewname']) {
         if ($lookupKey == '2ba96fc5ab7bef0ac9a4d3f5d72bb1f0') {
             $map['user.status'] = 1;
         } else {
             if (!getFieldBy($lookupKey, "id", "viewname", "mis_system_lookupobj")) {
                 $map['status'] = 1;
             }
         }
     }
     $filterfield = "_lookupGeneralfilter";
     if ($_REQUEST['filtermethod']) {
         $filterfield = $_REQUEST['filtermethod'];
     }
     if (method_exists($this, $filterfield)) {
         call_user_func(array(&$this, $filterfield), &$map);
     }
     // if($_REQUEST['viewname']){
     // $name = $_REQUEST['viewname'];
     // }else
     // {
     // $name = $_POST['model'];
     // }
     if ($viewname) {
         $sortstr = $lookupDetail['datasort'] ? $lookupDetail['datasort'] : '';
         $action->_viewlist($viewname, $map, $sortBy = '', $asc = false, $group = '', '', $sortstr);
     } else {
         //$action->_list( $name, $map, $sortBy = '', $asc = false, $group = '' );
         //   $echoSql=1
         $sortstr = $lookupDetail['datasort'] ? $lookupDetail['datasort'] : '';
         //$sortstr = 'id asc';
         self::_list($name, $map, $sortBy = '', $asc = false, $group = '', '', $sortstr);
     }
     /*
      * 2ba96fc5ab7bef0ac9a4d3f5d72bb1f0
      * 代表用户视图形lookup参照。特殊处理。
      * a945d1a1f0487f8621c1d7797b894295
      * 
      * 
      */
     if ($lookupKey == '2ba96fc5ab7bef0ac9a4d3f5d72bb1f0' || $lookupKey == 'a945d1a1f0487f8621c1d7797b894295') {
         //2ba96fc5ab7bef0ac9a4d3f5d72bb1f0 b6fe179d38c8034cee79b5b09dd6b1e7
         if ($_REQUEST['jump']) {
             // lookupUserGenerals
             $this->display('Public:lookupUserGenerals');
         } else {
             $this->display('Public:lookupBackendUser');
         }
     } else {
         //$this->assign("detailList",$detailList);
         if ($lookupDetail['dt']) {
             // 内嵌表 页面 带回多条记录
             $dt = base64_encode(base64_encode(serialize($lookupDetail['dt'])));
             $this->assign('dt', $dt);
             $this->assign("samefield", $lookupDetail['fieldcom']);
             $this->display('Public:lookupfordatatable2');
         } elseif ($_REQUEST['viewtype'] == "checkfor") {
             $this->display('CheckFor:checkForNew');
         } elseif ($_POST["type"] == "dt" || $_REQUEST['ismuchchoice'] == 1) {
             //echo 2323;
             $check_list = html_entity_decode($_POST["check_list"]);
             $check_list_arr = json_decode($check_list, TRUE);
             $this->assign('check_list', $check_list);
             $this->assign('check_list_arr', $check_list_arr);
             $this->assign('type', $_POST["type"]);
             $this->assign('ismuchchoice', $_REQUEST['ismuchchoice']);
             // 数据表格中的lookup实现按配置生成树形导航功能。
             // modify by nbmxkj@20150818 1414
             if ($lookupDetail['tree']) {
                 //多选树形结构lookup带回
                 if ($_REQUEST['jump']) {
                     $this->display('Public:lookupGenerals');
                 } else {
                     $this->display('Public:lookupGeneralsTree');
                 }
             } else {
                 //多选非树形结构lookup带回
                 if ($_REQUEST['jump']) {
                     $this->display('Public:lookupBackendUserCenterRight');
                 } else {
                     $this->display('Public:lookupBackendUserCenter');
                 }
             }
         } else {
             if ($lookupDetail['tree']) {
                 if ($_REQUEST['jump']) {
                     $this->display('Public:lookupGenerals');
                 } else {
                     $this->display('Public:lookupGeneralsTree');
                 }
             } else {
                 $this->display('Public:lookupGenerals');
             }
         }
     }
 }
Esempio n. 2
0
    /**
     * (non-PHPdoc)
     * @see Widget::render()
     * @param Array $data	参数集合
     * 		$data[0]	当前显示数据,修改时使用
     * 		$data[1]	用户参数集合
     * $data[1]=>array(
     * 		[0]=>'样式参数'
     * 		[1]=>'组件配置参数'
     * );
     * $param[0] = 'col require '; 	// 样式参数
     * $param[1] = array( 		// 组件配置参数
     * 		'type'=>'table|selectlist',数据来源方式:table|selectlist
     * 		$parame
     * );
     *
     *
     * 公用的属性
     * $parame['readonly']		组件是否只读
     * $parame['targevent']		绑定的事件
     * $parame['names']			组件name属性
     * $parame['defaultcheckitem']		默认选中项的值,只有在add时有效
     * $parame['defaultval']			外部传入首选项的值
     * $parame['defaulttext']			外部传入首选项的显示文本
     *
     * // 表查询私有属性
     *   $parame['table']			查询表名
     *   $parame['id']			真实值字段名
     *   $parame['name']			显示值字段名
     *   $parame['conditions']	过滤条件
     *
     *   	//当数据为树形查找的需要的参数
     *   $parame['parentid']		上一级ID,当这个有值时表示下拉框为树形下拉。
     *   $parame['mulit']          是否多选 true false   false:单选 , true:多选
     *   $parame['isnextend']		是否只能操作最下一级数据 true|false。
     *
     *   // selectlist 查询私有属性
     *   $parame['key']			数据key值
     *
     * {W:ShowSelect(array('1' , $param ))}
     */
    public function render($data)
    {
        $param = $data[1];
        $conf = $param[1];
        $parame = $conf[0];
        if (!is_array($param) || !is_array($conf)) {
            return "<error>组件配置信息缺失!</error>";
        }
        $datatype = $conf['type'];
        $datatypeArr = array('table' => 'table', 'selectlist' => 'selectlist');
        $type = $datatypeArr[$datatype];
        if (!$type) {
            return "<error>未知数据来源:{$datatype},当前允许类型:" . join(',', $datatypeArr) . "</error>";
        }
        //样式
        $classStyle = $param[0];
        //组件name属性
        $fieldName = $parame['names'];
        //组件事件
        $targevent = $parame['targevent'];
        //action名称
        $actionName = $parame['actionName'];
        //默认选中项的值,只有在add时有效
        $defaultcheckitem = $parame['defaultcheckitem'];
        //外部传入首选项的值
        $defaultval = $parame['defaultval'];
        //外部传入首选项的显示文本
        $defaulttext = $parame['defaulttext'];
        //查询表名
        $table = $parame['table'];
        //真实值字段名
        $id = $parame['id'];
        //显示值字段名
        $name = $parame['name'];
        //过滤条件
        $conditions = $parame['conditions'];
        $conditions = html_entity_decode($conditions);
        //父级id
        $parentid = $parame['parentid'];
        //是否多选 true false
        $mulit = $parame['mulit'];
        //是否末级操作
        $isnextend = $parame['isnextend'];
        //数据key值
        $key = $parame['key'];
        //是否编辑
        $isedit = $parame['isedit'];
        //	树形-下拉高度
        $treeheight = $parame['treeheight'];
        // 树形-是否对话框模式
        $treedialog = $parame['treedialog'] ? 1 : 0;
        // 下拉框的返写标识
        $dropbackkey = $parame['dropbackkey'] ? $parame['dropbackkey'] : $name;
        // 下拉框组件的默认选中项
        $defaultcheckitem = $parame['defaultcheckitem'];
        // 将默认选中项设置到选中值中去,只对新增无漫游时有效。
        $data[0] = $data[0] == '' && $defaultcheckitem ? $defaultcheckitem : $data[0];
        $dropbackkeyStr = "dropbackkey=\"{$dropbackkey}\"";
        // 是否在子级勾取时自动勾取其父级 bynbmxkj@20150831 2338
        // 其默认值最好为true,表示子级勾取后其父级也会被勾中,
        // 注意:在树的配置属性上默认子级勾取后父级勾中时其值一定要为 true 这个字符。不是php可认识的1。
        $checkedSelfParent = "false";
        if (empty($treeheight) || $treeheight == 0) {
            $treeheight = 150;
        }
        // 树形-下拉宽度
        $treewidth = $parame['treewidth'];
        // 		if(empty($treewidth) || $treewidth==0){
        // 			$treewidth = false;
        // 		}
        $nodeCheckFunc = "S_NodeCheck";
        $nodeClickFunc = "S_NodeClick";
        if ($mulit) {
            $nodeCheckFunc = "S_NodesCheck";
        }
        $treewidthParame = '';
        if (!empty($treewidth) || $treewidth != 0) {
            $treewidthParame = 'data-width="' . $treewidth . '"';
        }
        // 是否为直接转出只读内容
        $showtype = $parame['showtype'];
        if ($targevent) {
            //$tagEventSytr = 'on'.ucwords($targevent).'="'.$actionName.'_'.$fieldName.'_'.$targevent.'(this)"';
        }
        if (!$isedit) {
            $readonlyStr = 'readonly="readonly"';
            $classStyle .= " readonly ";
        }
        if ($mulit == 1) {
            $mulitType = 'checkbox';
        } else {
            $mulitType = 'radio';
        }
        if ($defaulttext) {
            $optionStr = '<option value="' . $defaultval . '">' . $defaulttext . '</option>';
        }
        $ztreeId = "ztree_{$actionName}_{$fieldName}";
        if ($isedit) {
            $ztreeId = "ztree_{$actionName}_{$fieldName}_edit";
        }
        if ($showtype) {
            if ($conf['type'] == 'selectlist') {
                $html = '<span class="input_new">' . getControllbyHtml('selectlist', array('type' => 'select', 'key' => $key, 'conditions' => $conditions, 'selected' => $data[0], 'showtype' => $showtype)) . '</span>';
            } else {
                $html = '<span class="input_new">' . getControllbyHtml('table', array('type' => 'select', 'table' => $table, 'id' => $id, 'name' => $name, 'conditions' => $conditions, 'selected' => $data[0], 'showtype' => $showtype)) . '</span>';
            }
            return $html;
        }
        if ($conf['type'] == 'selectlist') {
            if ($key) {
                $html = <<<EOF
\t\t\t<select {$tagEventSytr} {$readonlyStr}  name="{$fieldName}" {$dropbackkeyStr} class="   {$classStyle} select2 select_elm ">
\t\t\t{$optionStr}
EOF;
                $html .= getControllbyHtml('selectlist', array('type' => 'select', 'key' => $key, 'conditions' => $conditions, 'selected' => $data[0]));
                $html .= <<<EOF

\t\t\t</select>
EOF;
            }
        } else {
            if ($parentid) {
                //添加-只能选择下拉框最后一级的特殊数据获取方式 @date:15-01-17 16:38:41
                $model = D("MisSystemRecursion");
                $model->__construct();
                $treeDataCondition = ' status=1 ';
                if ($conditions) {
                    $treeDataCondition .= ' and ' . $conditions;
                }
                $filterSouce = getCurrentUserDataRight(1, $table, $id, true);
                if ($filterSouce) {
                    $dataFilterMaps = $filterSouce;
                    // key($filterSouce)." in ('".join("','", reset($filterSouce))."')";
                    // 在需要时可以在此处加上过滤条件格式验证,防止异常。
                    $treeDataCondition .= ' and ' . $dataFilterMaps;
                }
                $treeDataCondition = str_replace('&#39;', "'", $treeDataCondition);
                $treeSelectselect6Data = $model->modelShow($table, array('key' => 'id', 'pkey' => $parentid, 'conditions' => $treeDataCondition, 'fields' => "{$id},{$name}"), 0, 1);
                $treeSelectselect6DataTemp = '';
                if ($defaulttext) {
                    array_unshift($treeSelectselect6Data, array($id => $defaultval, $name => $defaulttext, $parentid => 0, 'nextEnd' => 1));
                }
                $nameArr = '';
                if ($data[0]) {
                    $dataArr = explode(',', $data[0]);
                    //查询显示数据
                    $ztreeModel = M($table);
                    $ztreemap[$id] = array('in', $dataArr);
                    $ztreeList = $ztreeModel->where($ztreemap)->select();
                    $ztreeName = array();
                    foreach ($ztreeList as $zk => $zval) {
                        $ztreeName[] = $zval[$name];
                    }
                    $nameArr = implode(',', $ztreeName);
                }
                foreach ($treeSelectselect6Data as $key => $value) {
                    // id":1, "pId":0, "name":"基本元素"
                    $tem = '';
                    $tem['id'] = $value['id'];
                    $tem['key'] = $value[$id];
                    $tem['pId'] = $value[$parentid];
                    $tem['name'] = $value[$name];
                    if ($isnextend == '1' && $value['nextEnd'] == 0) {
                        $tem['chkDisabled'] = true;
                    }
                    if ($isedit) {
                        $dataArr = explode(',', $data[0]);
                        if (in_array($value[$id], $dataArr)) {
                            $tem['checked'] = true;
                        }
                    }
                    $treeSelectselect6DataTemp[] = $tem;
                }
                //print_r($treeSelectselect6DataTemp);
                // 当前没得传显示数据,有首项显示数据
                if ($isedit == '' && $defaulttext) {
                    $nameVal = $defaulttext;
                    $IdVal = $defaultval;
                } else {
                    if ($data[0] == $defaultval) {
                        $nameVal = $defaulttext;
                        $IdVal = $defaultval;
                    } else {
                        $nameVal = $nameArr;
                        $IdVal = $data[0];
                    }
                }
                $conboxtreeCls = 'comboxtree';
                if (!$isedit) {
                    $conboxtreeCls = '';
                } else {
                    $conboxtreeCls = 'comboxtree notreadonly';
                }
                $ret = preg_match('/required/', $classStyle);
                $hiddenRequired = '';
                if ($ret) {
                    $hiddenRequired = 'required';
                }
                $treeData = json_encode($treeSelectselect6DataTemp);
                $html = <<<EOF
              <input type="text" readonly="readonly" class="{$conboxtreeCls} {$classStyle} input_new" size="18" value="{$nameVal}" data-names="{$fieldName}" data-height="{$treeheight}" data-dialog="{$treedialog}" {$treewidthParame} data-tree="#{$ztreeId}" data-search="true" />
              <input type="hidden" name="{$fieldName}" {$dropbackkeyStr} class="{$hiddenRequired}" value="{$IdVal}"/>
              <ul id="{$ztreeId}" class="ztree hide" attrs = '{"expandAll":false, "checkEnable":true, "chkStyle":"{$mulitType}", "radioType":"all", "onClick":"{$nodeClickFunc}", "onCheck":"{$nodeCheckFunc}","chkboxType":"{$checkedSelfParent}"}' nodes='{$treeData}'></ul>
EOF;
            } else {
                $html = <<<EOF
\t\t\t<select  {$tagEventSytr} {$readonlyStr}  name="{$fieldName}"  {$dropbackkeyStr}  class="{$classStyle} select2 select_elm">
\t\t\t\t{$optionStr}
EOF;
                $html .= getControllbyHtml('table', array('type' => 'select', 'table' => $table, 'id' => $id, 'name' => $name, 'conditions' => $conditions, 'selected' => $data[0]));
                $html .= <<<EOF

\t\t\t</select>
EOF;
            }
        }
        return $html;
    }