作者 sgj
1 个管道 的构建 通过 耗费 1 秒

添加推荐专家

@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 namespace app\portal\controller; 11 namespace app\portal\controller;
12 12
13 use app\admin\model\RouteModel; 13 use app\admin\model\RouteModel;
  14 +use app\user\model\UserModel;
14 use cmf\controller\AdminBaseController; 15 use cmf\controller\AdminBaseController;
15 use app\portal\model\PortalCategoryModel; 16 use app\portal\model\PortalCategoryModel;
16 use think\Db; 17 use think\Db;
@@ -126,7 +127,13 @@ class AdminCategoryController extends AdminBaseController @@ -126,7 +127,13 @@ class AdminCategoryController extends AdminBaseController
126 127
127 $portalCategoryModel = new PortalCategoryModel(); 128 $portalCategoryModel = new PortalCategoryModel();
128 $categoriesTree = $portalCategoryModel->adminCategoryTree($category['parent_id'], $id); 129 $categoriesTree = $portalCategoryModel->adminCategoryTree($category['parent_id'], $id);
129 - 130 + $User=new UserModel();
  131 + $expert_info = $User->getExpert($category['expert']);
  132 + if (!empty($expert_info->toArray())){
  133 + $expert=$expert_info->toArray()['0'];
  134 + }else{
  135 + $expert='';
  136 + }
130 $themeModel = new ThemeModel(); 137 $themeModel = new ThemeModel();
131 $listThemeFiles = $themeModel->getActionThemeFiles('portal/List/index'); 138 $listThemeFiles = $themeModel->getActionThemeFiles('portal/List/index');
132 $articleThemeFiles = $themeModel->getActionThemeFiles('portal/Article/index'); 139 $articleThemeFiles = $themeModel->getActionThemeFiles('portal/Article/index');
@@ -136,6 +143,7 @@ class AdminCategoryController extends AdminBaseController @@ -136,6 +143,7 @@ class AdminCategoryController extends AdminBaseController
136 143
137 $category['alias'] = $alias; 144 $category['alias'] = $alias;
138 $this->assign($category); 145 $this->assign($category);
  146 + $this->assign('expert_info',$expert);
139 $this->assign('list_theme_files', $listThemeFiles); 147 $this->assign('list_theme_files', $listThemeFiles);
140 $this->assign('article_theme_files', $articleThemeFiles); 148 $this->assign('article_theme_files', $articleThemeFiles);
141 $this->assign('categories_tree', $categoriesTree); 149 $this->assign('categories_tree', $categoriesTree);
@@ -375,6 +375,22 @@ class UserModel extends Model @@ -375,6 +375,22 @@ class UserModel extends Model
375 return $user; 375 return $user;
376 } 376 }
377 377
  378 +
  379 + public function getExpert($user_id){
  380 + $map['u.id']=$user_id;
  381 + $user=$this->alias('u')
  382 + ->field('u.id,h.name as hospital,o.name as office,u.user_login,j.name as job,u.describe,u.avatar,u.mobile')
  383 + ->join('hospital h','h.id=u.hospital',"LEFT")
  384 + ->join('office o','u.office=o.id',"LEFT")
  385 + ->join('job j','u.job=j.id',"LEFT")
  386 + ->where($map)
  387 + ->select();
  388 + return $user;
  389 + }
  390 +
  391 +
  392 +
  393 +
378 public function getMyself($user_id=''){ 394 public function getMyself($user_id=''){
379 if (empty($user_id)){ 395 if (empty($user_id)){
380 $user_id=cmf_get_current_user_id(); 396 $user_id=cmf_get_current_user_id();
@@ -35,6 +35,15 @@ @@ -35,6 +35,15 @@
35 </div> 35 </div>
36 </div> 36 </div>
37 <div class="form-group"> 37 <div class="form-group">
  38 + <label for="input-name"><span class="form-required">*</span>推荐专家</label>
  39 + <div>
  40 + <td>
  41 + <input class="form-control valid" type="text" required="" placeholder="请选择专家" onclick="doSelectUsers();" id="js-users-name-input" readonly="" value="{$expert_info['user_login']|default=''}" aria-required="true" aria-invalid="false">
  42 + <input class="form-control" type="hidden" name="expert" value="{$expert|default=''}" id="js-users-id-input">
  43 + </td>
  44 + </div>
  45 + </div>
  46 + <div class="form-group">
38 <label for="input-name">分类别名</label> 47 <label for="input-name">分类别名</label>
39 <div> 48 <div>
40 <input type="text" class="form-control" id="input-alias" name="alias" 49 <input type="text" class="form-control" id="input-alias" name="alias"
@@ -133,5 +142,28 @@ @@ -133,5 +142,28 @@
133 $('#input-list_tpl').val("{$list_tpl|default=''}"); 142 $('#input-list_tpl').val("{$list_tpl|default=''}");
134 $('#input-one_tpl').val("{$one_tpl|default=''}"); 143 $('#input-one_tpl').val("{$one_tpl|default=''}");
135 </script> 144 </script>
  145 +<script type="application/javascript">
  146 + function doSelectUsers() {
  147 + var selectedUsersId = $('#js-users-id-input').val();
  148 + openIframeLayer("{:url('Common/selectExport')}?ids=" + selectedUsersId, '请选择分类', {
  149 + area: ['1200px', '800px'],
  150 + btn: ['确定', '取消'],
  151 + yes: function (index, layero) {
  152 + //do something
  153 +
  154 + var iframeWin = window[layero.find('iframe')[0]['name']];
  155 + var selectedUsers = iframeWin.confirm();
  156 + if (selectedUsers.selectedUsersId.length == 0) {
  157 + layer.msg('请选择专家');
  158 + return;
  159 + }
  160 + $('#js-users-id-input').val(selectedUsers.selectedUsersId.join(','));
  161 + $('#js-users-name-input').val(selectedUsers.selectedUsersName.join(' '));
  162 + //console.log(layer.getFrameIndex(index));
  163 + layer.close(index); //如果设定了yes回调,需进行手工关闭
  164 + }
  165 + });
  166 + }
  167 +</script>
136 </body> 168 </body>
137 </html> 169 </html>