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

添加推荐专家

... ... @@ -11,6 +11,7 @@
namespace app\portal\controller;
use app\admin\model\RouteModel;
use app\user\model\UserModel;
use cmf\controller\AdminBaseController;
use app\portal\model\PortalCategoryModel;
use think\Db;
... ... @@ -126,7 +127,13 @@ class AdminCategoryController extends AdminBaseController
$portalCategoryModel = new PortalCategoryModel();
$categoriesTree = $portalCategoryModel->adminCategoryTree($category['parent_id'], $id);
$User=new UserModel();
$expert_info = $User->getExpert($category['expert']);
if (!empty($expert_info->toArray())){
$expert=$expert_info->toArray()['0'];
}else{
$expert='';
}
$themeModel = new ThemeModel();
$listThemeFiles = $themeModel->getActionThemeFiles('portal/List/index');
$articleThemeFiles = $themeModel->getActionThemeFiles('portal/Article/index');
... ... @@ -136,6 +143,7 @@ class AdminCategoryController extends AdminBaseController
$category['alias'] = $alias;
$this->assign($category);
$this->assign('expert_info',$expert);
$this->assign('list_theme_files', $listThemeFiles);
$this->assign('article_theme_files', $articleThemeFiles);
$this->assign('categories_tree', $categoriesTree);
... ...
... ... @@ -375,6 +375,22 @@ class UserModel extends Model
return $user;
}
public function getExpert($user_id){
$map['u.id']=$user_id;
$user=$this->alias('u')
->field('u.id,h.name as hospital,o.name as office,u.user_login,j.name as job,u.describe,u.avatar,u.mobile')
->join('hospital h','h.id=u.hospital',"LEFT")
->join('office o','u.office=o.id',"LEFT")
->join('job j','u.job=j.id',"LEFT")
->where($map)
->select();
return $user;
}
public function getMyself($user_id=''){
if (empty($user_id)){
$user_id=cmf_get_current_user_id();
... ...
... ... @@ -35,6 +35,15 @@
</div>
</div>
<div class="form-group">
<label for="input-name"><span class="form-required">*</span>推荐专家</label>
<div>
<td>
<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">
<input class="form-control" type="hidden" name="expert" value="{$expert|default=''}" id="js-users-id-input">
</td>
</div>
</div>
<div class="form-group">
<label for="input-name">分类别名</label>
<div>
<input type="text" class="form-control" id="input-alias" name="alias"
... ... @@ -133,5 +142,28 @@
$('#input-list_tpl').val("{$list_tpl|default=''}");
$('#input-one_tpl').val("{$one_tpl|default=''}");
</script>
<script type="application/javascript">
function doSelectUsers() {
var selectedUsersId = $('#js-users-id-input').val();
openIframeLayer("{:url('Common/selectExport')}?ids=" + selectedUsersId, '请选择分类', {
area: ['1200px', '800px'],
btn: ['确定', '取消'],
yes: function (index, layero) {
//do something
var iframeWin = window[layero.find('iframe')[0]['name']];
var selectedUsers = iframeWin.confirm();
if (selectedUsers.selectedUsersId.length == 0) {
layer.msg('请选择专家');
return;
}
$('#js-users-id-input').val(selectedUsers.selectedUsersId.join(','));
$('#js-users-name-input').val(selectedUsers.selectedUsersName.join(' '));
//console.log(layer.getFrameIndex(index));
layer.close(index); //如果设定了yes回调,需进行手工关闭
}
});
}
</script>
</body>
</html>
\ No newline at end of file
... ...