modified 完善表单信息

This commit is contained in:
zhaoxiang 2016-11-10 18:46:25 +08:00
parent 5a5d158aec
commit e712577b65
3 changed files with 14 additions and 9 deletions

View File

@ -6,7 +6,8 @@
*/
namespace app\admin\controller;
use app\admin\model\User;
use app\admin\model\Menu;
use think\Controller;
class Base extends Controller {
@ -14,6 +15,9 @@ class Base extends Controller {
public $primaryKey;
public $uid;
public $userInfo;
public $url;
public $menuInfo;
private $superUrl = [
'User/login'
];
@ -43,13 +47,12 @@ class Base extends Controller {
* 系统初始化函数(登陆状态检测,权限检测,初始化菜单)
*/
private function iniSystem(){
$url = $this->request->controller().'/'.$this->request->action();
if( !in_array($url, $this->superUrl) ){
// $this->allMenu = D('Menu')->order('sort asc')->select();
// $this->menuInfo = D('Menu')->where(['url' => $this->url])->find();
// if( empty($this->menuInfo) ){
// $this->error( 'Menu'.L('_SELECT_NOT_EXIST_') );
// }
$this->url = $this->request->controller().'/'.$this->request->action();
if( !in_array($this->url, $this->superUrl) ){
$this->menuInfo = Menu::where(['url' => $this->url])->find()->toArray();
if( empty($this->menuInfo) ){
$this->error( '目录:'.$this->url.'不存在!' );
}
$this->checkLogin();
// $this->checkRule();
}

View File

@ -217,6 +217,7 @@ class Menu extends Base {
$data = array_column($data, 'name', $this->primaryKey);
$defaultFather = $this->request->get($this->primaryKey);
$form = [
'formTitle' => $this->menuInfo['name'],
'tempType' => 'add',
'formAttr' => [
'target' => url('Menu/add'),
@ -365,6 +366,7 @@ class Menu extends Base {
$data = array_column($data, 'name', $this->primaryKey);
$detail = \app\admin\model\Menu::get($this->request->get($this->primaryKey))->toArray();
$form = [
'formTitle' => $this->menuInfo['name'],
'tempType' => 'edit',
'formAttr' => [
'target' => url('Menu/edit'),

View File

@ -29,7 +29,7 @@
*/
function buildForm( formObj, boxType, method ) {
var formHtml = '<div class="box '+ boxType +'" id="formBox"><div class="box-body">';
formHtml += '<div class="box-header with-border"><h3 class="box-title">新增菜单</h3></div>';
formHtml += '<div class="box-header with-border"><h3 class="box-title">'+formObj.formTitle+'</h3></div>';
formHtml += '<form id="'+ formObj.formAttr.formId +'" action="'+ formObj.formAttr.target +'"><div class="box-body">';
$.each(formObj.formList, function (index, value) {
switch (value.module){