wufeng hace 2 años
padre
commit
b3382fb337

+ 3 - 1
app/admin/controller/Action.php

@@ -219,12 +219,13 @@ class Action extends BaseController
      * }
      * **/
 
-    //11获取有菜单列表数据
+    //11获取有菜单列表数据
     public function index()
     {
         $post = $this->request->post();
         $data = Db::name("admin_menu")
             ->where(["pid" => 0, "status" => 1, "is_del" => 0])
+            ->order(['weight'=>'desc','id'=>'desc'])
             ->select()
             ->toArray();
         $result = [];
@@ -241,6 +242,7 @@ class Action extends BaseController
 
         $child = Db::name("admin_menu")
             ->where($child_where)
+            ->order(['weight'=>'desc','id'=>'desc'])
             ->select()
             ->toArray();
         foreach ($child as $k => $value) {

+ 8 - 0
app/admin/controller/AfterChild.php

@@ -486,6 +486,14 @@ class AfterChild extends Base
                                     ->dec('used_num', $value['can_sell_num'])//已用数量减少
                                     ->update(['updatetime' => $date]);
                             }
+
+                            //维护good_stock
+                            Db::name('good_stock')
+                                ->where(['is_del' => 0, 'id' => $stockids[$info[$value['id']]['return_wsm_code']]])
+                                ->inc('usable_stock', $value['can_sell_num'])
+                                ->inc('total_stock', $value['can_sell_num'])
+                                ->update(['updatetime' => $date]);
+
                         } else {
                             //新建good_stock和good_stock_info
                             $stockid = Db::name('good_stock')

+ 1 - 1
app/admin/controller/Base.php

@@ -165,7 +165,7 @@ class Base extends \app\BaseController
 
         if ($this->roleid == 1 || $this->roleid == 33) return [];// 超级管理员(roleid==1)和最高领导(roleid==33)能看到所有人的数据
 
-        $data = get_group_share_uid($this->uid);
+        $data = get_group_share_uid($this->uid,$this->level);
         /**
          * data[DataGroupModel::$type_全部] 0全部
          * data[DataGroupModel::$type_可编辑] 1可编辑

+ 2 - 0
app/admin/controller/Menu.php

@@ -189,6 +189,7 @@ class Menu extends Base
         if($pid!=0 && $route==""){
             return error_show(1002,"子级菜单路由不能为空");
         }
+        $menu_api = isset($post['menu_api'])?trim($post['menu_api']):'';
         $level = isset($post['level'])?intval($post['level']):'';
         if($level==='') return json_show(0,'菜单等级不能为空');//这里要用全等,有可能level传值0
         $data=[
@@ -204,6 +205,7 @@ class Menu extends Base
             'status'=>1,
             'level'=>$level,
             "weight"=>$weight,
+            "menu_api"=>$menu_api,
             "updatetime"=>date("Y-m-d H:i:s"),
         ];
         $message="新建";

+ 5 - 2
app/admin/controller/OrderOutChild.php

@@ -450,8 +450,11 @@ class OrderOutChild extends Base
 
                 //如果是库存品,只能由库管操作
                 //其他商品,若level2只能由供应商负责人操作,level3不限制
-                if (($sale[$child[$value['outChildCode']]['orderCode']]['is_stock'] == 1) && ($this->uid != $wsm_contactor[$child[$value['outChildCode']]['wsm_code']])) throw new Exception('库存品只能由仓库管理员操作');
-                elseif (($this->level == 2) && ($this->uid != $person[$child[$value['outChildCode']]['supplierNo']])) throw new Exception('非库存品和采返商品只能由供应商负责人操作');
+                if ($sale[$child[$value['outChildCode']]['orderCode']]['is_stock'] == 1) {
+                    if ($this->uid != $wsm_contactor[$child[$value['outChildCode']]['wsm_code']]) throw new Exception('库存品只能由仓库管理员操作');
+                } else {
+                    if (($this->level == 2) && ($this->uid != $person[$child[$value['outChildCode']]['supplierNo']])) throw new Exception('非库存品和采返商品只能由供应商负责人操作');
+                }
 
 //                if ($this->level == 2) {
 //                    if ($sale[$child[$value['outChildCode']]['orderCode']]['is_stock'] == 1) {

+ 2 - 2
app/common.php

@@ -1342,7 +1342,7 @@ if (!function_exists('checkHasAccountBySupplierNos')) {
 
 //获取当前用户可查看的其他用户id(新版的)
 if (!function_exists('get_group_share_uid')) {
-    function get_group_share_uid(int $uid = 0)
+    function get_group_share_uid(int $uid = 0,int $level=2)
     {
         //原始数据
         $data = [DataGroupModel::$type_可编辑 => [$uid], DataGroupModel::$type_只读 => [$uid], DataGroupModel::$type_不共享 => []];
@@ -1377,7 +1377,7 @@ if (!function_exists('get_group_share_uid')) {
         $api = app('http')->getName() . '/' . request()->pathinfo();
 
         $menu_id = Db::name('admin_menu')
-            ->where(['is_del' => 0, 'menu_api' => $api])
+            ->where(['is_del' => 0, 'menu_api' => $api,'level'=>$level])
             ->value('id', 0);
         if ($menu_id) {
             //共享规则