laiguoran 6 anos atrás
pai
commit
d0d9554f88

+ 3 - 0
213to214.sql

@@ -0,0 +1,3 @@
+ALTER TABLE `jl_auser` ADD `issuper` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '是否为超级管理员' AFTER `aemail`;
+
+ALTER TABLE `jl_auser` ADD `powerjson` VARCHAR(500) NOT NULL DEFAULT '{"itempower":1}' COMMENT '权限归类json';

+ 2 - 2
global/js/jl.js

@@ -9,8 +9,8 @@ function autoFlashHeight() {
     $(".jlTable").height($(window).height() - 101);
     $(".misTable").height($(window).height() - 228);
     $(".topBanner").height($(window).height() - 65);
-    $(".filesWrap").height($(window).height() - 170);
-    $(".filesList").height($(window).height() - 170);
+    //$(".filesWrap").height($(window).height() - 170);
+    //$(".filesList").height($(window).height() - 170);
     $(".sign-content").height($(window).height() - 112);
     $(".sign-content").width($(window).width() - signSide - 69);
     $(".sign-content-warp").height($(window).height() - 30);

+ 5 - 0
protected/class/actmeasure.php

@@ -41,6 +41,11 @@ class actMeasure
         return $this->__mmeasure->find(array('where' => 'uid=?', 'param' => array($uid), 'asArray' => TRUE));
     }
 
+    public function getRowUser2($uid)
+    {
+        return $this->__mmeasure->find(array('where' => 'uid=?', 'param' => array($uid), 'asc' => 'convert(pmname using gbk)', 'asArray' => TRUE));
+    }
+
     public function getGroupProject($uid)
     {
         return $this->__mmeasure->find(array('where' => 'uid=?', 'param' => array($uid), 'groupby' => 'pid', 'asArray' => TRUE));

+ 9 - 3
protected/class/change.php

@@ -152,9 +152,9 @@ class Changes
     public function getChangebyPnumPmid($pnum,$pmid,$cid = '')
     {
         if($cid != ''){
-            return $this->__change->getOne(array('where' => 'pnum=? and pmid=? and cid!=?', 'param' => array($pnum,$pmid,$cid), 'asArray' => TRUE));
+            return $this->__change->getOne(array('where' => 'pnum=? and pmid=? and cid!=? and status!="del"', 'param' => array($pnum,$pmid,$cid), 'asArray' => TRUE));
         }else{
-            return $this->__change->getOne(array('where' => 'pnum=? and pmid=?', 'param' => array($pnum,$pmid), 'asArray' => TRUE));
+            return $this->__change->getOne(array('where' => 'pnum=? and pmid=? and status!="del"', 'param' => array($pnum,$pmid), 'asArray' => TRUE));
         }
 
     }
@@ -220,7 +220,13 @@ class Changes
 
     public function getPmidGroup($uid)
     {
-        return $this->__changeaudit->find(array('where' => 'uid=? and cid in (SELECT `jl_change`.`cid` FROM `jl_change` WHERE `jl_change`.status!="uncheck")', 'param' => array($uid), 'groupby' => 'pmid', 'asArray' => TRUE));
+        // return $this->__changeaudit->find(array('where' => 'uid=? and cid in (SELECT `jl_change`.`cid` FROM `jl_change` WHERE `jl_change`.status!="uncheck")', 'param' => array($uid), 'groupby' => 'pmid', 'asArray' => TRUE));
+        $sql = 'SELECT a.* FROM `jl_change_audit` as a join `jl_project_measure` as b on a.pmid=b.pmid WHERE a.uid='.$uid.' and a.cid in (SELECT `jl_change`.`cid` FROM `jl_change` WHERE `jl_change`.status!="uncheck") GROUP BY a.pmid order by convert(b.pmname using gbk)';
+        $query = Doo::db ()->query ( $sql );
+
+        $result = $query->fetchAll ();
+
+        return $result;
     }
 
     public function getNumbyMydetail($pmid='',$uid)

+ 5 - 0
protected/config/routes.conf.php

@@ -207,6 +207,7 @@ $route['*']['/manage/user/list'] = array('[admin]AdminController', 'userList');
 $route['*']['/manage/user/repasswd/:uid/uid'] = array('[admin]AdminController', 'userRepasswd');
 $route['*']['/manage/option'] = array('[admin]AdminController', 'option');
 $route['get']['/manage/user/:uid/isstop'] = array('[admin]AdminController', 'userSwitch');
+$route['get']['/manage/user/check/mailExist'] = array('[admin]AdminController', 'userCheckExist');
 
 $route['*']['/manage/item/list'] = array('[admin]ItemController', 'itemList');
 $route['*']['/manage/item/list/:pid/project'] = array('[admin]ItemController', 'itemList');
@@ -220,6 +221,10 @@ $route['*']['/manage/sys/intermediate/switch'] = array('[admin]SysController', '
 $route['*']['/manage/item/index'] = array('[admin]ProController', 'index');
 $route['*']['/manage/item/:pid/section'] = array('[admin]ProController', 'section');
 $route['*']['/manage/item/:pmid/period'] = array('[admin]ProController', 'period');
+
+//power manage
+$route['*']['/manage/auser/add'] = array('[admin]LoginController', 'auserAdd');
+
 // upgrade
 $route['*']['/api/upgrade/v1/get/web/version'] = array('UpgradeController', 'getWebVersion');
 $route['*']['/api/upgrade/v1/get/software/version'] = array('UpgradeController', 'getSoftwareVersion');

+ 1 - 1
protected/config/ver.conf.php

@@ -1,5 +1,5 @@
 <?php
 
 // Version
-$config['ver'] = 'v2.1.3';
+$config['ver'] = 'v2.1.4';
 

+ 2 - 2
protected/controller/AppController.php

@@ -178,14 +178,14 @@ class AppController extends DooController {
                                 $numStatusArray['currstatus'] = 'uncheck';
                             }
                             $datatmp = $this->measureauditact->getMyAuditStatus2($numStatusArray['pmid'], $numStatusArray['numpname'], $numStatusArray['times'], $_POST['uid']);
-                            if ($datatmp && ($datatmp['mastatus'] == 'checked' || $datatmp['mastatus'] == 'checkno') ) {
+//                            if ($datatmp && ($datatmp['mastatus'] == 'checked' || $datatmp['mastatus'] == 'checkno') ) {
                                 $pmname = $this->actmeasure->getRowByPmid($value['pmid']);
                                 $sectioncheckedlistarray[$j]['pmname'] =  !empty($pmname) ? $pmname['pmname'] : '';
                                 $sectioncheckedlistarray[$j]['countNum'] = !empty($datatmp['numpname']) ? $datatmp['numpname'] : 0;
                                 $sectioncheckedlistarray[$j]['audittime'] = !empty($datatmp['audittime']) ? date('Y-m-d',$datatmp['audittime']) : '';
                                 $sectioncheckedlistarray[$j]['url'] = '/app/rproject/' . $this->params['pid'] . '/section/' . $value['pmid'] . '/detail';
                                 $j++;
-                            }
+//                            }
                         }
                     }
                     if(!empty($sectioncheckedlistarray)){

+ 1 - 1
protected/controller/ChangeController.php

@@ -119,7 +119,7 @@ class ChangeController extends DooController
         $hashArray = array();
 
         //先取原报人标段
-        $mpidArray = $this->actmeasure->getRowUser($this->auth->getUid());
+        $mpidArray = $this->actmeasure->getRowUser2($this->auth->getUid());
         if(!empty($mpidArray)){
             foreach($mpidArray as $k => $v){
                 $sectionlist[] = array('pid' => $v['pid'], 'stid' => $v['stid'], 'pmid' => $v['pmid']);

Diferenças do arquivo suprimidas por serem muito extensas
+ 30 - 16
protected/module/admin/controller/AdminController.php


+ 16 - 0
protected/module/admin/controller/LoginController.php

@@ -92,4 +92,20 @@ class LoginController extends DooController {
         return $_SESSION['csrf_hash'] === $hash;
     }
 
+    // 管理员添加接口
+    public function auserAdd() {
+        $auser = new AUser();
+        $auser->auname = $_POST['name'];
+        $auser->aupass = $this->__ph->HashPassword($_POST['pwd']);
+        $auser->issuper = intval($_POST['issuper']);
+        $auser->powerjson = $_POST['powerjson'];
+        $result = $auser->insert();
+        if($result) {
+            echo 'ok';
+        } else {
+            echo 'sorry';
+        }
+        die;
+    }
+
 }

+ 16 - 0
protected/module/admin/controller/ProController.php

@@ -59,6 +59,22 @@ class ProController extends DooController
         $this->itemmeasurenum = new ItemMeasureNumpofper();
         $this->change = new Changes();
         $this->data['rootUrl'] = Doo::conf()->APP_URL;
+
+        $power = $this->checkPower($_SESSION['auid']);
+        if($power['itempower'] != 1) {
+            echo 'No access is allowed for the current page.';
+            die;
+        }
+    }
+
+    function checkPower($auid) {
+        $auserinfo = $this->user->getRowByID($auid);
+        if($auserinfo['issuper'] == 0){
+            return $powerArray = json_decode($auserinfo['powerjson'], true);
+        } else {
+            return array('itempower' => 1);
+        }
+
     }
 
     public function index()

+ 7 - 1
protected/module/admin/model/auser.php

@@ -11,9 +11,11 @@ class AUser extends DooModel {
     public $auname;
     public $aupass;
     public $aemail;
+    public $issuper;
+    public $powerjson;
     public $_table = 'jl_auser';
     public $_primarykey = 'auid';
-    public $_fields = array('auid', 'auname', 'aupass', 'aemail');
+    public $_fields = array('auid', 'auname', 'aupass', 'aemail', 'issuper', 'powerjson');
 
     public function __construct() {
         parent::setupModel(__CLASS__);
@@ -24,6 +26,10 @@ class AUser extends DooModel {
         $this->update(array('where' => 'auid=?', 'param' => array($uid)));
     }
 
+    public function getRowByID($uid) {
+        return $this->getOne(array('where' => 'auid=?', 'param' => array($uid), 'asArray' => TRUE));
+    }
+
 }
 
 ?>

+ 37 - 2
protected/module/admin/view/admin-addUser.html

@@ -21,13 +21,16 @@
             <!-- include "menu" -->
             <div class="adminContent">
                 <div class="adminMain">
-                    <form class="form-horizontal" method="post">
+                    <form class="form-horizontal" method="post" onsubmit="return checkMail();">
                         <fieldset>
                             <legend>添加用户</legend>
                             <div class="form-group">
                                 <label class="col-sm-2 control-label">邮箱(登录使用)</label>
                                 <div class="col-sm-3">
-                                    <input class="form-control" type="text" name="email" placeholder="登录系统、找回密码和接收通知">
+                                    <input class="form-control" type="text" name="email" id="email" placeholder="登录系统、找回密码和接收通知">
+                                </div>
+                                <div class="col-sm-2">
+                                    <span style="color:red; vertical-align: middle;display: none" id="showmsg">已存在该邮箱账号!</span>
                                 </div>
                             </div>
                             <div class="form-group">
@@ -75,4 +78,36 @@
             </div>
         </div>
         <script type="text/javascript">autoFlashHeight();</script>
+        <script>
+            function checkMail() {
+                if($('#email').val() == '') {
+                    alert('请输入邮箱');
+                    return false;
+                } else {
+                    var flag = true;
+                    $.ajax({
+                        type: 'get',
+                        url: '/manage/user/check/mailExist?mail=' + $('#email').val(),
+                        async: false,
+                        timeout: 5000,
+                        dataType: 'json',
+                        success: function(result) {
+                            if (result.code == 200) {
+                                $('#showmsg').show();
+                                flag = false;
+                            }
+                        },
+                        error: function(){
+                            return true;
+                        }
+                    });
+                    return flag;
+                }
+            }
+            $(function(){
+                $('input[type="text"]').blur(function(){
+                    $('#showmsg').hide();
+                })
+            })
+        </script>
     </body>

+ 2 - 2
protected/view/biangeng-approval.html

@@ -285,8 +285,8 @@
 </div>
 <!--添加附件-->
 <script type="text/javascript">autoFlashHeight();</script>
-<link href="//cdn.bootcss.com/toastr.js/2.1.2/toastr.css" rel="stylesheet">
-<script src="//cdn.bootcss.com/toastr.js/2.1.2/toastr.min.js"></script>
+<link href="{{rootUrl}}global/css/toastr.css" rel="stylesheet">
+<script src="{{rootUrl}}global/js/toastr.min.js"></script>
 <script src="{{rootUrl}}global/js/SimpleAjaxUploader.min.js"></script>
 <script type="text/javascript" language="javascript" src="{{rootUrl}}global/js/jquery.dataTables.min.js"></script>
 <script type="text/javascript" language="javascript" src="{{rootUrl}}global/js/dataTables.bootstrap.min.js"></script>