dyjh 6 年 前
コミット
d2fa46ffc2

+ 2 - 3
app/Http/Controllers/Admin/Album/ProductController.php

xqd xqd
@@ -113,7 +113,7 @@ class ProductController extends Controller
         if ($request->method() == 'POST') {
             return $this->_createSave();
         }
-        $cat = AlbumCatModel::where([['store_id',$this->getStoreId()],['parent_id',0]])->get();
+        $cat = AlbumCatModel::where([['store_id',$this->getStoreId()],['parent_id','!=',0]])->get();
 
         $data['cat_id'] = null;
         return view('admin.album.product.edit', compact('data', 'cat', 'style'));
@@ -178,9 +178,8 @@ class ProductController extends Controller
         if ($request->method() == 'POST') {
             return $this->_updateSave();
         }
-        $cat = AlbumCatModel::where([['store_id',$this->getStoreId()],['parent_id',0]])->get();
+        $cat = AlbumCatModel::where([['store_id',$this->getStoreId()],['parent_id','!=',0]])->get();
         $data = $this->repository->find($request->get('id'));
-        $parent = AlbumCatModel::where([['store_id',$this->getStoreId()],['parent_id',0],['id',$data->cat_id]])->get();
         $data['install_img'] = json_decode($data['install_img']);
         $data['specifications_img'] = json_decode($data['specifications_img']);
         $data['detail'] = json_decode($data['detail']);

+ 1 - 0
myb/we7_new_1_7

xqd
@@ -0,0 +1 @@
+Subproject commit 4fdeec9268ac03de0c46cb0371ddedab2518061b

+ 6 - 6
resources/views/admin/album/product/edit.blade.php

xqd xqd xqd
@@ -49,19 +49,19 @@
                  <label class="control-label col-sm-3">分类</label>
                                     
                    <div class="col-sm-3">
-                       <select id="data_parent_id" class="form-control" onchange="getLevelSecondCategory()">
+                       <select id="data_parent_id" class="form-control" name="data[cat_id]" >
                            @if(isset($cat))
                                @foreach($cat as $key=>$val)
-                                       <option value="{{$val->id}}"  @if($val['id'] == (isset($parent['id'])? $parent['id']:''))selected @endif>{{$val->name}}</option>
+                                       <option value="{{$val->id}}"  @if($val['id'] == (isset($data['cat_id'])? $data['cat_id']:''))selected @endif>{{$val->name}}</option>
                                @endforeach
                            @endif
                        </select>
                    </div>
-                    <div class="col-sm-3" id="app">
+                    {{--<div class="col-sm-3" id="app">
                         <select name="data[cat_id]" id="data_cat_id" class="form-control"  required="" aria-required="true">
                             <option v-for="item in list.data" :value="item.id">@{{ item.name }}</option>
                         </select>
-                    </div>
+                    </div>--}}
                 </div>
                                 <div class="form-group">
 
@@ -185,7 +185,7 @@
     toastr.options.positionClass = 'toast-bottom-center';
     toastr.options.timeOut = '4000';
 
-    var level = new Vue({
+  /*  var level = new Vue({
         el:"#app",
         data:{
             list:{
@@ -224,7 +224,7 @@
     }
 
 
-        getLevelSecondCategory();
+        getLevelSecondCategory();*/
 
 
     function checkLevel(){