Ver Fonte

内部设备列表的设备名称从内部设备名称表里获取
内部设备列表的规格型号,自填
创建内部设备名字列表的curd

ChenWuJie há 4 anos atrás
pai
commit
939f70ef78

+ 138 - 0
app/Http/Controllers/Admin/Inner/Device/NamesController.php

xqd
@@ -0,0 +1,138 @@
+<?php
+/**
+ *  内部设备名称
+ *  @author  system
+ *  @version    1.0
+ *  @date 2021-01-25 13:37:36
+ *
+ */
+namespace App\Http\Controllers\Admin\Inner\Device;
+use App\Http\Controllers\Admin\Controller;
+use Illuminate\Http\Request;
+use App\Repositories\Base\Criteria\OrderBy;
+use App\Repositories\Inner\Device\Criteria\MultiWhere;
+use App\Repositories\Inner\Device\NamesRepository;
+
+class NamesController extends Controller
+{
+    private $repository;
+
+    public function __construct(NamesRepository $repository) {
+        if(!$this->repository) $this->repository = $repository;
+    }
+
+    function index(Request $request) {
+        $search['keyword'] = $request->input('keyword');
+        $query = $this->repository->pushCriteria(new MultiWhere($search));
+
+        if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
+        $query = $query->pushCriteria(new OrderBy($request['sort_field'],$request['sort_field_by']));
+        }else{
+            $query = $query->pushCriteria(new OrderBy('updated_at','DESC'));
+        }
+        $list = $query->paginate();
+        return view('admin.inner.device.names.index',compact('list'));
+    }
+
+
+    function check(Request $request) {
+        $request = $request->all();
+        $search['keyword'] = $request->input('keyword');
+        $orderby = array();
+        if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
+            $orderby[$request['sort_field']] = $request['sort_field_by'];
+        }
+        $list = $this->repository->search($search,$orderby);
+        return view('admin.inner.device.names.check',compact('list'));
+    }
+
+
+    /**
+     * 添加
+     * 
+     */
+    public function create(Request $request)
+    {
+        if($request->method() == 'POST') {
+            return $this->_createSave();
+        }
+        return view('admin.inner.device.names.edit');
+    }
+
+    /**
+     * 保存修改
+     */
+    private function _createSave(){
+        $data = (array) request('data');
+        $id = $this->repository->create($data);
+        if($id) {
+            $url[] = array('url'=>U( 'Inner/Device/Names/index'),'title'=>'返回列表');
+            $url[] = array('url'=>U( 'Inner/Device/Names/create'),'title'=>'继续添加');
+            $this->showMessage('添加成功',$url);
+        }else{
+            $url[] = array('url'=>U( 'Inner/Device/Names/index'),'title'=>'返回列表');
+            return $this->showWarning('添加失败',$url);
+        }
+    }
+    
+    /**
+     * 
+     * 修改
+     * 
+     * 
+     */
+    public function update(Request $request) {
+        if($request->method() == 'POST') {
+            return $this->_updateSave();
+        }
+        $data = $this->repository->find($request->get('id'));
+        return view('admin.inner.device.names.edit',compact('data'));
+    }
+
+    /**
+     * 保存修改
+     */
+    private function _updateSave() {
+        $data = (array) request('data');
+        $ok = $this->repository->update(request('id'),$data);
+        if($ok) {
+            $url[] = array('url'=>U( 'Inner/Device/Names/index'),'title'=>'返回列表');
+            return $this->showMessage('操作成功',urldecode(request('_referer')));
+        }else{
+            $url[] = array('url'=>U( 'Inner/Device/Names/index'),'title'=>'返回列表');
+            return $this->showWarning('操作失败',$url);
+        }
+    }
+
+    public function view(Request $request) {
+        $data = $this->repository->find(request('id'));
+        return view('admin.inner.device.names.view',compact('data'));
+    }
+
+
+    /**
+     *
+     * 状态改变
+     *
+     */
+    public function status(Request $request) {
+        $ok = $this->repository->updateStatus(request('id'),request('status'));
+        if($ok) {
+            return $this->showMessage('操作成功');
+        }else{
+            return $this->showWarning('操作失败');
+        }
+    }
+    
+    /**
+     * 删除
+     */
+    public function destroy(Request $request) {
+        $bool = $this->repository->destroy($request->get('id'));
+        if($bool) {
+            return  $this->showMessage('操作成功');
+        }else{
+            return  $this->showWarning("操作失败");
+        }
+    }
+}

+ 9 - 7
app/Http/Controllers/Admin/InnerDeviceController.php

xqd xqd xqd xqd xqd
@@ -12,6 +12,7 @@ use App\Models\Project;
 use App\Models\WorkPoint;
 use Illuminate\Http\Request;
 use Maatwebsite\Excel\Facades\Excel;
+use phpDocumentor\Reflection\DocBlock;
 
 class InnerDeviceController extends BaseController
 {
@@ -49,7 +50,7 @@ class InnerDeviceController extends BaseController
 
     public function get(Request $request)
     {
-        $items = $this->model->where('id', '>', 0)->with(['device', 'spec', 'device_name']);
+        $items = $this->model->where('id', '>', 0)->with(['device', 'spec', 'device_name','inner_device_names']);
 
         $tmp_items = collect(['number']);
         foreach($tmp_items as $tmp_item) {
@@ -64,13 +65,13 @@ class InnerDeviceController extends BaseController
                 $items = $items->where($select_item, '=', $request->input($select_item));
             }
         }
-
+        //排序
         $items = $items->orderBy('updated_at', 'desc')->paginate();
-
+//        dd($items);
         foreach ($items as $item) {
             $item->device_type = $item->device ? $item->device->name : '';
-            $item->device_name_name = $item->device_name ? $item->device_name->name : '';
-            $item->spec_name = $item->spec ? $item->spec->name : '';
+            $item->device_name_name = $item->inner_device_names ? $item->inner_device_names->name : '';
+            $item->spec_name = $item->spec_name ? $item->spec_name : '';
             $item->status = $item->getStatusLabel();
             $item->work_point_name = $item->workPoint ? $item->workPoint->name : '';
             $item->project_name = $item->project ? $item->project->name : '';
@@ -102,7 +103,8 @@ class InnerDeviceController extends BaseController
             return back()->withErrors($validator)->withInput();
         }
         $data = $request->input('data');
-        $data = array_merge($data, $request->only(['device_id', 'device_name_id', 'spec_id', 'project_id', 'work_point_id']));
+//        dd($data);
+        $data = array_merge($data, $request->only(['device_id', 'device_name_id', 'spec_name', 'project_id', 'work_point_id']));
         $res = $this->model->create($data);
         if(empty($res)) return back()->withErrors(['sg_error_info' => '保存失败']);
         return redirect($this->pre_uri . 'create')->with(['sg_success_info' => '创建成功']);
@@ -134,7 +136,7 @@ class InnerDeviceController extends BaseController
             return back()->withErrors($validator)->withInput();
         }
         $data = $request->input('data');
-        $data = array_merge($data, $request->only(['device_id', 'device_name_id', 'spec_id', 'project_id', 'work_point_id']));
+        $data = array_merge($data, $request->only(['device_id', 'device_name_id', 'spec_name', 'project_id', 'work_point_id']));
         $res = $this->model->where('id', $request->input('id'))->update($data);
         if(!$res) return back()->withErrors(['sg_error_info' => '数据库保存失败!']);
         return back()->with(['sg_success_info' => '编辑成功']);

+ 12 - 5
app/Models/DeviceName.php

xqd
@@ -11,12 +11,19 @@ class DeviceName extends BaseModel
 
     public function getNameSpecOptions()
     {
-        $names = DeviceName::select('name as text', 'id as value')->get();
+//        $names = DeviceName::select('name as text', 'id as value')->get();
+//        $names = $names->prepend($this->transObject(['text' => '设备名称', 'value' => '']));
+//        foreach($names as $name) {
+//            $specs  = Spec::where('device_name_id', $name->value)->select('name as text', 'id as value')->get();
+//            $name->specs = $specs->prepend($this->transObject(['text' => '规格型号', 'value' => '']));
+//        }
+//        dd($names);
+        $names = InnerDeviceNamesModel::select('name as text', 'id as value')->get();
         $names = $names->prepend($this->transObject(['text' => '设备名称', 'value' => '']));
-        foreach($names as $name) {
-            $specs  = Spec::where('device_name_id', $name->value)->select('name as text', 'id as value')->get();
-            $name->specs = $specs->prepend($this->transObject(['text' => '规格型号', 'value' => '']));
-        }
+//        foreach($names as $name) {
+//            $specs  = Spec::where('device_name_id', $name->value)->select('name as text', 'id as value')->get();
+//            $name->specs = $specs->prepend($this->transObject(['text' => '规格型号', 'value' => '']));
+//        }
         return $names;
     }
 

+ 12 - 8
app/Models/InnerDevice.php

xqd xqd
@@ -44,14 +44,14 @@ class InnerDevice extends BaseModel
         ], [
             'number.required' => '固定资产编号'
         ]);
-        $validator->after(function ($validator) use($request) {
-            if (!$request->input('device_name_id')) {
-                $validator->errors()->add('device_name_id', '设备名称必填');
-            }
-            if (!$request->input('spec_id')) {
-                $validator->errors()->add('spec_id', '规格型号必填');
-            }
-        });
+//        $validator->after(function ($validator) use($request) {
+//            if (!$request->input('device_name_id')) {
+//                $validator->errors()->add('device_name_id', '设备名称必填');
+//            }
+//            if (!$request->input('spec_id')) {
+//                $validator->errors()->add('spec_id', '规格型号必填');
+//            }
+//        });
         return $validator;
     }
 
@@ -59,4 +59,8 @@ class InnerDevice extends BaseModel
     {
         return $this['option'] ? '<div style="color: ' . $this['option']['color'] . '">' . $this['option']['name'] . '</div>' : '';
     }
+
+    public function inner_device_names(){
+        return $this->hasOne(InnerDeviceNamesModel::class,'id','device_name_id');
+    }
 }

+ 39 - 0
app/Models/InnerDeviceNamesModel.php

xqd
@@ -0,0 +1,39 @@
+<?php
+namespace App\Models;
+use App\Models\BaseModel;
+/**
+ *  @description 内部设备名称
+ *  @author  system;
+ *  @version    1.0
+ *  @date 2021-01-25 13:37:36
+ *
+ */
+class InnerDeviceNamesModel extends BaseModel
+{
+    /**
+     * 数据表名
+     *
+     * @var string
+     *
+     */
+    protected $table = 'inner_device_names';
+    /**
+    主键
+     */
+    protected $primaryKey = 'id';
+
+    //分页
+    protected $perPage = PAGE_NUMS;
+
+    /**
+     * 可以被集体附值的表的字段
+     *
+     * @var string
+     */
+    protected $fillable = [
+                           'name',
+                           'sort',
+                           'status'
+                          ];
+
+}

+ 45 - 0
app/Repositories/Inner/Device/Criteria/MultiWhere.php

xqd
@@ -0,0 +1,45 @@
+<?php
+/**
+ * User: Mike
+ * Email: m@9026.com
+ * Date: 2017/1/12
+ * Time: 17:52
+ */
+
+namespace App\Repositories\Inner\Device\Criteria;
+
+
+
+
+use App\Repositories\Base\Criteria;
+use App\Repositories\Contracts\RepositoryInterface as Repository;
+
+class MultiWhere extends Criteria {
+
+    private $search = [];
+
+    /**
+     * MultiWhere constructor.
+     * @param array $search
+     *
+     */
+    public function __construct(array $search)
+    {
+        $this->search = $search;
+    }
+
+    /**
+    * @param $model
+    * @param RepositoryInterface $repository
+    * @return mixed
+    */
+    public function apply($model, Repository $repository)
+    {
+          if(isset($this->search['updated_at']) && $this->search['updated_at']) {
+                                    $model = $model->where('updated_at',$this->search['updated_at']);
+                                 }
+
+         return $model;
+    }
+
+}

+ 21 - 0
app/Repositories/Inner/Device/NamesRepository.php

xqd
@@ -0,0 +1,21 @@
+<?php
+/**
+ *   内部设备名称
+ *  @author  system
+ *  @version    1.0
+ *  @date 2021-01-25 13:37:36
+ *
+ */
+namespace App\Repositories\Inner\Device;
+
+use App\Repositories\Base\Repository;
+
+
+class NamesRepository extends Repository {
+
+    public function model() {
+        return \App\Models\InnerDeviceNamesModel::class;
+    }
+
+    
+}

+ 2 - 1
resources/views/admin/inner-devices/create.blade.php

xqd
@@ -20,7 +20,8 @@
                     <form class="layui-form" method="POST" action="{{ $pre_uri . 'store' }}">
 
                         {{ csrf_field() }}
-                        @include('share.name-select-form', ['device_name_id' => '', 'spec_id' => '', 'options' => $options])
+                        @include('share.name-select-form', ['device_name_id' => '', 'options' => $options])
+                        @include('share.layui-form-item', ['type' => 'input', 'name' => 'spec_name', 'label' => '规格型号', 'required' => true, 'value' => (old('data') ? old('data')['spec_id'] : '')])
                         @include('share.layui-form-item', ['type' => 'radio', 'name' => 'status', 'label' => '状态', 'selected_id' => (old('data') ? old('data')['status'] : ''), 'options' => $status_options])
                         @include('share.project-work-point-select-form', ['project_id' => '', 'work_point_id' => '', 'options' => $project_work_point_options])
                         @include('share.layui-form-item', ['type' => 'input', 'name' => 'number', 'label' => '固定资产编号', 'required' => true, 'value' => (old('data') ? old('data')['number'] : '')])

+ 2 - 1
resources/views/admin/inner-devices/edit.blade.php

xqd
@@ -21,7 +21,8 @@
 
                         {{ csrf_field() }}
                         <input type="hidden" name="id" value="{{ $item->id }}">
-                        @include('share.name-select-form', ['device_name_id' => $item->device_name_id, 'spec_id' => $item->spec_id, 'options' => $options])
+                        @include('share.name-select-form', ['device_name_id' => $item->device_name_id,'options' => $options])
+                        @include('share.layui-form-item', ['type' => 'input', 'name' => 'spec_name', 'label' => '规格型号', 'required' => true, 'value' => $item->spec_name])
                         @include('share.layui-form-item', ['type' => 'radio', 'name' => 'status', 'label' => '状态', 'selected_id' => $item->status, 'options' => $status_options])
                         @include('share.project-work-point-select-form', ['project_id' => $item->project_id, 'work_point_id' => $item->work_point_id, 'options' => $project_work_point_options])
                         @include('share.layui-form-item', ['type' => 'input', 'name' => 'number', 'label' => '固定资产编号', 'required' => true, 'value' => $item->number])

+ 88 - 0
resources/views/admin/inner/device/names/check.blade.php

xqd
@@ -0,0 +1,88 @@
+@extends('admin.layout')
+
+@section('content')
+		<div class="row">
+			<div class="col-sm-12">
+				<div class="ibox float-e-margins">
+					<div class="ibox-title">
+						<h5>内部设备名称</h5>
+						<div class="ibox-tools">
+							<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+							</a>
+						</div>
+					</div>
+					<div class="ibox-content">
+						<div class="row">
+							<form method="GET" action="" accept-charset="UTF-8">
+
+								<div class="col-sm-4">
+									<div class="input-group">
+										<input type="text" value="{{Request::get('keyword')}}"	placeholder="请输入关键词" name="keyword"class="input-sm form-control">
+								<span class="input-group-btn">
+									<button type="submit" class="btn btn-sm btn-primary">搜索</button>
+								</span>
+									</div>
+								</div>
+							</form>
+							@if(role('Inner/Device/Names/create'))
+								<div class="col-sm-3 pull-right">
+									<a href="{{ U('Inner/Device/Names/create')}}" class="btn btn-sm btn-primary pull-right">添加</a>
+								</div>
+							@endif
+						</div>
+
+						<table class="table table-striped table-bordered table-hover dataTables-example dataTable dataCheckTable">
+							<thead>
+							<tr>
+								<th><input class="btSelectAll" name="btSelectAll" type="checkbox"></th>
+								
+            <th class="sorting" data-sort="created_at"> 创建时间 </th>
+            <th class="sorting" data-sort="id"> ID </th>
+            <th class="sorting" data-sort="name"> 设备名 </th>
+            <th class="sorting" data-sort="sort"> 排序 </th>
+            <th class="sorting" data-sort="status"> 状态 0禁用 1启用   </th>
+            <th class="sorting" data-sort="updated_at"> 更新时间 </th>
+								<th width="22%">相关操作</th>
+							</tr>
+							</thead>
+							<tbody>
+							@if(isset($list))
+								@foreach($list as $key => $item)
+									<tr>
+									<td><input data-json='{!! json_encode($item) !!}'  name="btSelectItem" class="data_key" type="checkbox" value="{{ $item->id or 0 }}" /></td>
+									
+            <td>{{ $item->created_at }}</td>
+            <td>{{ $item->id }}</td>
+            <td>{{ $item->name }}</td>
+            <td>{{ $item->sort }}</td>
+            <td>{{ $item->status }}</td>
+            <td>{{ $item->updated_at }}</td>
+									<td>
+										@if(role('Inner/Device/Names/view'))
+											<button onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('Inner/Device/Names/view',['id'=>$item->id])}}'});"  class="btn btn-primary ">查看</button>
+										@endif
+									</td>
+								</tr>
+								@endforeach
+							@endif
+
+							</tbody>
+						</table>
+						<div class="row">
+							<div class="col-sm-6">
+								<div class="dataTables_info" id="DataTables_Table_0_info"
+									 role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。</div>
+							</div>
+							<div class="col-sm-6">
+								<div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
+									{!! $list->setPath('')->appends(Request::all())->render() !!}
+								</div>
+							</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	@include('admin.tools.check_script');
+
+@endsection

+ 86 - 0
resources/views/admin/inner/device/names/edit.blade.php

xqd
@@ -0,0 +1,86 @@
+@extends('admin.layout')
+
+@section('content')
+
+<?php
+    if(!isset($data)) $data = array();
+    if(!$data && session("data")){
+        $data = session("data");
+    }
+    if(!$data && session('_old_input')){
+        $data = session("_old_input");
+    }
+?>
+	<div class="row">
+		<div class="col-sm-12">
+			<div class="ibox float-e-margins">
+				<div class="ibox-title">
+					<h5>内部设备名称</h5>
+					<div class="ibox-tools">
+						<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+						</a>
+					</div>
+				</div>
+				<div class="ibox-content">
+                    @if(role('Inner/Device/Names/index'))
+				    <div class="row">
+    					<div class="col-sm-3 pull-right">
+    					   <a href="{{ U('Inner/Device/Names/index')}}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+    					</div>
+					</div>
+                    @endif
+
+		            <div class="row">
+                        <div class="col-lg-10">
+                            <form name="form_product" id="form-validation" action="" class="form-horizontal form-validation" accept-charset="UTF-8" method="post">
+
+                                    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">设备名</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_name" name="data[name]" class="form-control" value="{{ $data['name'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">排序</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_sort" name="data[sort]" class="form-control" value="{{ $data['sort'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">状态 0禁用 1启用  </label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_status" name="data[status]" class="form-control" value="{{ $data['status'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>
+                                
+                                <div class="form-group">
+                                    <label class="control-label col-sm-3">&nbsp;</label>
+                                    <div class="col-sm-9">
+                                        <input type="hidden" name="_referer" value="<?php echo urlencode(request()->server('HTTP_REFERER'));?>"/>
+                                        <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"/>
+                                        <input type="submit" class="btn btn-success" style="margin-right:20px;">
+                                        <input type="reset" class="btn btn-default" >
+                                    </div>
+                                </div>
+        
+                            </form>
+                        </div>
+                        <!-- /.col-lg-10 -->
+                    </div>
+                    <!-- /.row -->
+				</div>
+			</div>
+		</div>
+	</div>
+
+@endsection

+ 105 - 0
resources/views/admin/inner/device/names/index.blade.php

xqd
@@ -0,0 +1,105 @@
+@extends('admin.layout') 
+
+@section('content')
+	<div class="row">
+		<div class="col-sm-12">
+			<div class="ibox float-e-margins">
+				<div class="ibox-title">
+					<h5>内部设备名称</h5>
+					<div class="ibox-tools">
+						<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+						</a>
+					</div>
+				</div>
+				<div class="ibox-content">
+				    <div class="row">
+				        <form method="GET" action="" accept-charset="UTF-8">
+
+				        <div class="col-sm-4">
+				            <div class="input-group">
+								<input type="text" value="{{Request::get('keyword')}}"	placeholder="请输入关键词" name="keyword"class="input-sm form-control"> 
+								<span class="input-group-btn">
+									<button type="submit" class="btn btn-sm btn-primary">搜索</button>
+								</span>
+    						</div>
+				        </div>
+				        </form>
+						@if(role('Inner/Device/Names/create'))
+    					<div class="col-sm-3 pull-right">
+    					   <a href="{{ U('Inner/Device/Names/create')}}" class="btn btn-sm btn-primary pull-right">添加</a>
+    					</div>
+						@endif
+					</div>
+					
+					<table class="table table-striped table-bordered table-hover dataTables-example dataTable">
+						<thead>
+    						<tr>
+								
+            <th class="sorting" data-sort="id"> ID </th>
+            <th class="sorting" data-sort="name"> 设备名 </th>
+            <th class="sorting" data-sort="sort"> 排序 </th>
+            <th class="sorting" data-sort="status"> 状态 0禁用 1启用   </th>
+								<th class="sorting" data-sort="created_at"> 创建时间 </th>
+
+								<th class="sorting" data-sort="updated_at"> 更新时间 </th>
+        						<th width="22%">相关操作</th>
+        					</tr>
+						</thead>
+						<tbody>
+						@if(isset($list))
+							@foreach($list as $key => $item)							<tr>
+								
+            <td>{{ $item->id }}</td>
+            <td>{{ $item->name }}</td>
+            <td>{{ $item->sort }}</td>
+            <td>{{ $item->status }}</td>
+								<td>{{ $item->created_at }}</td>
+
+								<td>{{ $item->updated_at }}</td>
+								<td>
+									<div class="btn-group">
+										<button data-toggle="dropdown"
+											class="btn btn-warning btn-sm dropdown-toggle"
+											aria-expanded="false">
+											操作 <span class="caret"></span>
+										</button>
+										<ul class="dropdown-menu">
+
+
+											@if(role('Inner/Device/Names/update'))
+											<li><a href="{{ U('Inner/Device/Names/update',['id'=>$item->id])}}" class="font-bold">修改</a></li>
+											@endif
+
+											@if(role('Inner/Device/Names/destroy'))
+											<li class="divider"></li>
+											<li><a href="{{ U('Inner/Device/Names/destroy',['id'=>$item->id])}}" onclick="return confirm('你确定执行删除操作?');">删除</a></li>
+											@endif
+
+										</ul>
+									</div>
+								@if(role('Inner/Device/Names/view'))
+										<button onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('Inner/Device/Names/view',['id'=>$item->id])}}'});"  class="btn btn-primary ">查看</button>
+									@endif
+								</td>
+							</tr>
+							@endforeach
+							@endif
+
+						</tbody>
+					</table>
+					<div class="row">
+						<div class="col-sm-6">
+							<div class="dataTables_info" id="DataTables_Table_0_info"
+								role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。</div>
+						</div>
+						<div class="col-sm-6">
+						<div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
+						{!! $list->setPath('')->appends(Request::all())->render() !!}
+						</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+@endsection

+ 32 - 0
resources/views/admin/inner/device/names/view.blade.php

xqd
@@ -0,0 +1,32 @@
+@extends('admin.layout')
+
+@section('content')
+<div class="row">
+    <div class="ibox-content">
+        <div class="list-group">
+                                 
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">设备名</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['name'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">排序</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['sort'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">状态 0禁用 1启用  </h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['status'] or ''}}</p>
+                                                 
+               </div>
+        </div>
+    </div>
+</div>
+@endsection

+ 15 - 14
resources/views/share/name-select-form.blade.php

xqd xqd
@@ -20,18 +20,19 @@
     @endif
 </div>
 
-@if(!isset($hide_spec))
-<div class="layui-form-item {{ $errors->has('spec_id') ? 'has-error' : '' }}">
-    <label class="layui-form-label" style="padding: 0px;">规格型号</label>
-    <div class="layui-input-block">
-        <select name="spec_id" lay-filter="spec_id">
-        </select>
-        @if($errors->has('spec_id'))
-            <span class="help-block">{{ $errors->first('spec_id') }}</span>
-        @endif
-    </div>
-</div>
-@endif
+{{--@if(!isset($hide_spec))--}}
+{{--<div class="layui-form-item {{ $errors->has('spec_id') ? 'has-error' : '' }}">--}}
+    {{--<label class="layui-form-label" style="padding: 0px;">规格型号</label>--}}
+    {{--<div class="layui-input-block">--}}
+        {{--<select name="spec_id" lay-filter="spec_id">--}}
+        {{--</select>--}}
+        {{--<text name="spec_id" lay-filter="spec_id"></text>--}}
+        {{--@if($errors->has('spec_id'))--}}
+            {{--<span class="help-block">{{ $errors->first('spec_id') }}</span>--}}
+        {{--@endif--}}
+    {{--</div>--}}
+{{--</div>--}}
+{{--@endif--}}
 <script>
     $(function() {
         layui.use(['form'], function() {
@@ -39,8 +40,8 @@
             let device_names = JSON.parse('{!! $options !!}');
             let specs = [];
             let device_name_id = '{{ $device_name_id }}';
-            let spec_id = '{{ $spec_id }}';
-            let hide_spec = '{{ isset($hide_spec) ? "yes" : "no" }}';
+            {{--let spec_id = '{{ $spec_id }}';--}}
+            {{--let hide_spec = '{{ isset($hide_spec) ? "yes" : "no" }}';--}}
             // console.log(hide_spec)
 
             form.on('select(device_name_id)', function(data) {