Browse Source

保养类型

lizhen_gitee 1 year ago
parent
commit
8c43ed5ec6

+ 1 - 1
application/admin/controller/Servicetype.php

@@ -22,7 +22,7 @@ class Servicetype extends Backend
     {
         parent::_initialize();
         $this->model = new \app\admin\model\Servicetype;
-
+        $this->view->assign("isUpkeepList", $this->model->getIsUpkeepList());
     }
 
 

+ 9 - 5
application/admin/lang/zh-cn/servicetype.php

@@ -1,9 +1,13 @@
 <?php
 
 return [
-    'Id'         => '主键ID',
-    'Title'      => '标题',
-    'Weigh'      => '权重排序',
-    'Createtime' => '创建时间',
-    'Updatetime' => '更新时间'
+    'Id'               => '主键ID',
+    'Title'            => '标题',
+    'Weigh'            => '权重排序',
+    'Baoyang_switch'   => '弹出保养时间',
+    'Baoyang_switch 1' => '是',
+    'Baoyang_switch 0' => '否',
+    'Is_upkeep'        => '是否保养',
+    'Is_upkeep 1'      => '是',
+    'Is_upkeep 0'      => '否'
 ];

+ 14 - 5
application/admin/model/Servicetype.php

@@ -16,16 +16,16 @@ class Servicetype extends Model
     protected $name = 'servicetype';
     
     // 自动写入时间戳字段
-    protected $autoWriteTimestamp = 'integer';
+    protected $autoWriteTimestamp = false;
 
     // 定义时间戳字段名
-    protected $createTime = 'createtime';
-    protected $updateTime = 'updatetime';
+    protected $createTime = false;
+    protected $updateTime = false;
     protected $deleteTime = false;
 
     // 追加属性
     protected $append = [
-
+        'is_upkeep_text'
     ];
     
 
@@ -38,9 +38,18 @@ class Servicetype extends Model
     }
 
     
+    public function getIsUpkeepList()
+    {
+        return ['1' => __('Is_upkeep 1'), '0' => __('Is_upkeep 0')];
+    }
 
 
-
+    public function getIsUpkeepTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['is_upkeep']) ? $data['is_upkeep'] : '');
+        $list = $this->getIsUpkeepList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
 
 
 

+ 22 - 0
application/admin/view/servicetype/add.html

@@ -12,6 +12,28 @@
             <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="0">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Baoyang_switch')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <input  id="c-baoyang_switch" name="row[baoyang_switch]" type="hidden" value="0">
+            <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-baoyang_switch" data-yes="1" data-no="0" >
+                <i class="fa fa-toggle-on text-success fa-flip-horizontal text-gray fa-2x"></i>
+            </a>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Is_upkeep')}:</label>
+        <div class="col-xs-12 col-sm-8">
+                        
+            <select  id="c-is_upkeep" data-rule="required" class="form-control selectpicker" name="row[is_upkeep]">
+                {foreach name="isUpkeepList" item="vo"}
+                    <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </div>
+    </div>
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-8">

+ 22 - 0
application/admin/view/servicetype/edit.html

@@ -12,6 +12,28 @@
             <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Baoyang_switch')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <input  id="c-baoyang_switch" name="row[baoyang_switch]" type="hidden" value="{$row.baoyang_switch}">
+            <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-baoyang_switch" data-yes="1" data-no="0" >
+                <i class="fa fa-toggle-on text-success {eq name="$row.baoyang_switch" value="0"}fa-flip-horizontal text-gray{/eq} fa-2x"></i>
+            </a>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Is_upkeep')}:</label>
+        <div class="col-xs-12 col-sm-8">
+                        
+            <select  id="c-is_upkeep" data-rule="required" class="form-control selectpicker" name="row[is_upkeep]">
+                {foreach name="isUpkeepList" item="vo"}
+                    <option value="{$key}" {in name="key" value="$row.is_upkeep"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </div>
+    </div>
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-8">

+ 2 - 2
application/admin/view/servicetype/index.html

@@ -8,7 +8,7 @@
                     <div id="toolbar" class="toolbar">
                         <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
                         <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('servicetype/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
-                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('servicetype/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
+                        <!--<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('servicetype/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
                         <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('servicetype/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
                         
 
@@ -18,7 +18,7 @@
                                 <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
                                 <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
                             </ul>
-                        </div>
+                        </div>-->
 
                         
                     </div>

+ 5 - 1
public/assets/js/backend/servicetype.js

@@ -8,10 +8,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     index_url: 'servicetype/index' + location.search,
                     add_url: 'servicetype/add',
                     edit_url: 'servicetype/edit',
-                    del_url: 'servicetype/del',
+//                    del_url: 'servicetype/del',
                     multi_url: 'servicetype/multi',
                     import_url: 'servicetype/import',
                     table: 'servicetype',
+                    dragsort_url:false
                 }
             });
 
@@ -22,12 +23,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 url: $.fn.bootstrapTable.defaults.extend.index_url,
                 pk: 'id',
                 sortName: 'weigh',
+                search:false,
                 columns: [
                     [
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
                         {field: 'title', title: __('Title'), operate: 'LIKE'},
                         {field: 'weigh', title: __('Weigh'), operate: false},
+                        {field: 'baoyang_switch', title: __('Baoyang_switch'), searchList: {"1":__('Baoyang_switch 1'),"0":__('Baoyang_switch 0')}, table: table, formatter: Table.api.formatter.toggle},
+                        {field: 'is_upkeep', title: __('Is_upkeep'), searchList: {"1":__('Is_upkeep 1'),"0":__('Is_upkeep 0')}, formatter: Table.api.formatter.normal},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]