예제 #1
0
 public function index()
 {
     $model = M('Task')->alias('T')->join(" LEFT JOIN user as U ON u.id = T.user_id ");
     $field = 'T.id, T.title, T.sub_title, T.content, T.sub_content, T.user_id, T.parent_id, T.root_id, T.sort,  T.status, U.realname, U.avatar';
     $_list = $model->where(['T.status' => 1])->order('T.sort asc, T.id asc')->field($field)->select();
     $_list = listToTree($_list, $pk = 'id', $pid = 'parent_id', $child = '_child', $root = 0);
     $html = '';
     foreach ($_list as $key => $value) {
         $value['_child'] = isset($value['_child']) && !empty($value['_child']) ? $value['_child'] : [];
         $lastClass = isset($value['_child']) && !empty($value['_child']) ? '' : 'last-child';
         $html .= '<div class="father father-' . $key . ' ' . $lastClass . '">';
         $this->assign('value', $value);
         $html .= $this->fetch('content');
         $html .= $this->getChild($value['_child']);
         $html .= '</div>';
     }
     unset($_list);
     Cookie('__forward__', $_SERVER['REQUEST_URI']);
     $this->assign('html', $html);
     $this->display();
 }
예제 #2
0
 /**
  * @Title: lookupSelectXyzPerson
  * @Description: todo(选人)
  * @author xyz
  * @date 2014-3-7 下午3:42:37
  * @throws
  * 		缺失功能:查询用户指定字段数据。@屈强
  */
 public function lookupSelectXyzPerson()
 {
     $map = array();
     $map['user.id'] = array('NEQ', 1);
     $map['mis_hr_personnel_person_info.working'] = 1;
     // 在职状态判断
     if (method_exists($this, '_filterLookupSelectPerson')) {
         $this->_filterLookupSelectPerson($map);
     }
     /*$model = D("MisHrPersonnelAppraisalInfoView");
     		$list = $model->field("id,name,deptid,userid,pinyin,dutylevelname,deptname")->where($map)->select();
     
     		$this->assign("num",$num);// 总人数
     		$returnarr = array();
     		$dptmodel = D("MisSystemDepartment");//部门表
     		$deptlist = $dptmodel->where("status=1")->order("id asc")->field('id,name,parentid')->select();
     		
     		foreach ($deptlist as $k=>$v){
     			foreach($list as $k1=>$v1){
     				if($v['id']==$v1['deptid']){
     					$deptlist[$k]['uname'][]=$v1['name'];
     					$deptlist[$k]['dutylevelname'][]=$v1['dutylevelname'];
     					$deptlist[$k]['userid'][]=$v1['userid'];
     				}
     			}
     		}
     		$newlist = $this->getArrTree($deptlist,0, 'id', 'parentid', 'child');
     		*/
     // 获取用户需要查询的字段
     $userfindfiel = '';
     $userfindfieljson = '';
     foreach (explode(';', $_POST["data"]) as $k => $v) {
         $v = explode(',', $v);
         $userfindfieljson[] = $v;
         $userfindfiel[] = next($v);
     }
     $this->assign('userfindfiel', $userfindfiel);
     // 人员信息
     $this->assign('userfindfieljson', json_encode($userfindfieljson));
     // 人员信息
     // 系统默认查询的字段
     $defaultField = array('id', 'name', 'deptid', 'userid', 'pinyin', 'dutylevelname', 'deptname');
     $findfield = array_merge($defaultField, $userfindfiel);
     $mode = D("MisHrPersonnelAppraisalInfoView");
     $userdata = $mode->field(join(',', $findfield))->where($map)->select();
     $dptmodel = D("MisSystemDepartment");
     //部门表
     $deptlist = $dptmodel->where("status=1")->order("id asc")->field('id,name,parentid')->select();
     $this->assign('departmentnarmol', $deptlist);
     // 部门树形数据
     $deptlist = listToTree($deptlist, 'id', 'parentid');
     $tempData = array();
     foreach ($userdata as $k => $v) {
         $tempData[$v['deptid']][] = $v;
     }
     $this->assign('personnel', $tempData);
     // 人员信息
     $this->assign('department', $deptlist);
     // 部门树形数据
     $this->assign('data', $_POST["data"]);
     $this->assign('ulid', $_POST["ulid"]);
     if ($_POST["ulid"]) {
         $this->display("SelectUser:multiple");
         // 选多个用户
     } else {
         $this->display("SelectUser:singleUser");
         // 选单个用户
     }
 }