作者 杨育虎

后台

正在显示 51 个修改的文件 包含 332 行增加49 行删除
@@ -37,4 +37,38 @@ class BatteryCode extends Backend @@ -37,4 +37,38 @@ class BatteryCode extends Backend
37 */ 37 */
38 38
39 39
  40 + /**
  41 + * 查看
  42 + */
  43 + public function index()
  44 + {
  45 + //当前是否为关联查询
  46 + $this->relationSearch = true;
  47 + //设置过滤方法
  48 + $this->request->filter(['strip_tags', 'trim']);
  49 + if ($this->request->isAjax()) {
  50 + //如果发送的来源是Selectpage,则转发到Selectpage
  51 + if ($this->request->request('keyField')) {
  52 + return $this->selectpage();
  53 + }
  54 + list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  55 +
  56 + $list = $this->model
  57 + ->with(['batterytype'])
  58 + ->where($where)
  59 + ->order($sort, $order)
  60 + ->paginate($limit);
  61 +
  62 + foreach ($list as $row) {
  63 +
  64 + $row->getRelation('batterytype')->visible(['type']);
  65 + }
  66 +
  67 + $result = array("total" => $list->total(), "rows" => $list->items());
  68 +
  69 + return json($result);
  70 + }
  71 + return $this->view->fetch();
  72 + }
  73 +
40 } 74 }
  1 +<?php
  2 +
  3 +namespace app\admin\controller;
  4 +
  5 +use app\common\controller\Backend;
  6 +
  7 +/**
  8 + * 总库表 型号管理
  9 + *
  10 + * @icon fa fa-circle-o
  11 + */
  12 +class BatteryType extends Backend
  13 +{
  14 +
  15 + /**
  16 + * BatteryType模型对象
  17 + * @var \app\admin\model\BatteryType
  18 + */
  19 + protected $model = null;
  20 +
  21 + public function _initialize()
  22 + {
  23 + parent::_initialize();
  24 + $this->model = new \app\admin\model\BatteryType;
  25 +
  26 + }
  27 +
  28 + public function import()
  29 + {
  30 + parent::import();
  31 + }
  32 +
  33 + /**
  34 + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  35 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  36 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  37 + */
  38 +
  39 +
  40 +}
@@ -54,14 +54,14 @@ class MoneyConfig extends Backend @@ -54,14 +54,14 @@ class MoneyConfig extends Backend
54 list($where, $sort, $order, $offset, $limit) = $this->buildparams(); 54 list($where, $sort, $order, $offset, $limit) = $this->buildparams();
55 55
56 $list = $this->model 56 $list = $this->model
57 - ->with(['batterycode']) 57 + ->with(['batterytype'])
58 ->where($where) 58 ->where($where)
59 ->order($sort, $order) 59 ->order($sort, $order)
60 ->paginate($limit); 60 ->paginate($limit);
61 61
62 foreach ($list as $row) { 62 foreach ($list as $row) {
63 63
64 - $row->getRelation('batterycode')->visible(['title']); 64 + $row->getRelation('batterytype')->visible(['type']);
65 } 65 }
66 66
67 $result = array("total" => $list->total(), "rows" => $list->items()); 67 $result = array("total" => $list->total(), "rows" => $list->items());
1 <?php 1 <?php
2 2
3 return [ 3 return [
4 - 'Id' => 'ID',  
5 - 'Title' => '电池类型名称',  
6 - 'Batterycode' => '电池编码',  
7 - 'Createtime' => '创建时间',  
8 - 'Updatetime' => '更改时间',  
9 - 'Avatar' => '设备头图',  
10 - 'Manufactor' => '厂家' 4 + 'Id' => 'ID',
  5 + 'Batter_type_id' => '电池类型',
  6 + 'Batterycode' => '电池编码',
  7 + 'Avatar' => '设备头图',
  8 + 'Mac' => 'Mac地址',
  9 + 'Manufactor' => '厂家',
  10 + 'Createtime' => '出场时间',
  11 + 'Batterytype.type' => '产品型号'
11 ]; 12 ];
  1 +<?php
  2 +
  3 +return [
  4 + 'Id' => 'ID',
  5 + 'Type' => '产品型号'
  6 +];
1 <?php 1 <?php
2 2
3 return [ 3 return [
4 - 'Id' => 'ID',  
5 - 'Battery_id' => '电池类型',  
6 - 'Upmoney' => '押金',  
7 - 'Monthmoney' => '月租金',  
8 - 'Batterycode.title' => '电池类型名称' 4 + 'Id' => 'ID',
  5 + 'Battery_type_id' => '电池类型',
  6 + 'Upmoney' => '押金',
  7 + 'Monthmoney' => '月租金',
  8 + 'Batterytype.type' => '产品型号'
9 ]; 9 ];
@@ -20,7 +20,7 @@ class BatteryCode extends Model @@ -20,7 +20,7 @@ class BatteryCode extends Model
20 20
21 // 定义时间戳字段名 21 // 定义时间戳字段名
22 protected $createTime = 'createtime'; 22 protected $createTime = 'createtime';
23 - protected $updateTime = 'updatetime'; 23 + protected $updateTime = false;
24 protected $deleteTime = false; 24 protected $deleteTime = false;
25 25
26 // 追加属性 26 // 追加属性
@@ -37,4 +37,8 @@ class BatteryCode extends Model @@ -37,4 +37,8 @@ class BatteryCode extends Model
37 37
38 38
39 39
  40 + public function batterytype()
  41 + {
  42 + return $this->belongsTo('BatteryType', 'batter_type_id', 'id', [], 'LEFT')->setEagerlyType(0);
  43 + }
40 } 44 }
  1 +<?php
  2 +
  3 +namespace app\admin\model;
  4 +
  5 +use think\Model;
  6 +
  7 +
  8 +class BatteryType extends Model
  9 +{
  10 +
  11 +
  12 +
  13 +
  14 +
  15 + // 表名
  16 + protected $name = 'battery_type';
  17 +
  18 + // 自动写入时间戳字段
  19 + protected $autoWriteTimestamp = false;
  20 +
  21 + // 定义时间戳字段名
  22 + protected $createTime = false;
  23 + protected $updateTime = false;
  24 + protected $deleteTime = false;
  25 +
  26 + // 追加属性
  27 + protected $append = [
  28 +
  29 + ];
  30 +
  31 +
  32 +
  33 +
  34 +
  35 +
  36 +
  37 +
  38 +
  39 +
  40 +}
@@ -37,8 +37,8 @@ class MoneyConfig extends Model @@ -37,8 +37,8 @@ class MoneyConfig extends Model
37 37
38 38
39 39
40 - public function batterycode() 40 + public function batterytype()
41 { 41 {
42 - return $this->belongsTo('BatteryCode', 'battery_id', 'id', [], 'LEFT')->setEagerlyType(0); 42 + return $this->belongsTo('BatteryType', 'battery_type_id', 'id', [], 'LEFT')->setEagerlyType(0);
43 } 43 }
44 } 44 }
  1 +<?php
  2 +
  3 +namespace app\admin\validate;
  4 +
  5 +use think\Validate;
  6 +
  7 +class BatteryType extends Validate
  8 +{
  9 + /**
  10 + * 验证规则
  11 + */
  12 + protected $rule = [
  13 + ];
  14 + /**
  15 + * 提示消息
  16 + */
  17 + protected $message = [
  18 + ];
  19 + /**
  20 + * 验证场景
  21 + */
  22 + protected $scene = [
  23 + 'add' => [],
  24 + 'edit' => [],
  25 + ];
  26 +
  27 +}
1 <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> 1 <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
2 2
3 <div class="form-group"> 3 <div class="form-group">
4 - <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> 4 + <label class="control-label col-xs-12 col-sm-2">{:__('Batter_type_id')}:</label>
5 <div class="col-xs-12 col-sm-8"> 5 <div class="col-xs-12 col-sm-8">
6 - <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text"> 6 + <input id="c-batter_type_id" data-rule="required" data-source="batter/type/index" class="form-control selectpage" name="row[batter_type_id]" type="text" value="">
7 </div> 7 </div>
8 </div> 8 </div>
9 <div class="form-group"> 9 <div class="form-group">
@@ -27,6 +27,12 @@ @@ -27,6 +27,12 @@
27 </div> 27 </div>
28 </div> 28 </div>
29 <div class="form-group"> 29 <div class="form-group">
  30 + <label class="control-label col-xs-12 col-sm-2">{:__('Mac')}:</label>
  31 + <div class="col-xs-12 col-sm-8">
  32 + <input id="c-Mac" data-rule="required" class="form-control" name="row[Mac]" type="text">
  33 + </div>
  34 + </div>
  35 + <div class="form-group">
30 <label class="control-label col-xs-12 col-sm-2">{:__('Manufactor')}:</label> 36 <label class="control-label col-xs-12 col-sm-2">{:__('Manufactor')}:</label>
31 <div class="col-xs-12 col-sm-8"> 37 <div class="col-xs-12 col-sm-8">
32 <input id="c-manufactor" data-rule="required" class="form-control" name="row[manufactor]" type="text"> 38 <input id="c-manufactor" data-rule="required" class="form-control" name="row[manufactor]" type="text">
1 <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> 1 <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
2 2
3 <div class="form-group"> 3 <div class="form-group">
4 - <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> 4 + <label class="control-label col-xs-12 col-sm-2">{:__('Batter_type_id')}:</label>
5 <div class="col-xs-12 col-sm-8"> 5 <div class="col-xs-12 col-sm-8">
6 - <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}"> 6 + <input id="c-batter_type_id" data-rule="required" data-source="batter/type/index" class="form-control selectpage" name="row[batter_type_id]" type="text" value="{$row.batter_type_id|htmlentities}">
7 </div> 7 </div>
8 </div> 8 </div>
9 <div class="form-group"> 9 <div class="form-group">
@@ -27,6 +27,12 @@ @@ -27,6 +27,12 @@
27 </div> 27 </div>
28 </div> 28 </div>
29 <div class="form-group"> 29 <div class="form-group">
  30 + <label class="control-label col-xs-12 col-sm-2">{:__('Mac')}:</label>
  31 + <div class="col-xs-12 col-sm-8">
  32 + <input id="c-Mac" data-rule="required" class="form-control" name="row[Mac]" type="text" value="{$row.Mac|htmlentities}">
  33 + </div>
  34 + </div>
  35 + <div class="form-group">
30 <label class="control-label col-xs-12 col-sm-2">{:__('Manufactor')}:</label> 36 <label class="control-label col-xs-12 col-sm-2">{:__('Manufactor')}:</label>
31 <div class="col-xs-12 col-sm-8"> 37 <div class="col-xs-12 col-sm-8">
32 <input id="c-manufactor" data-rule="required" class="form-control" name="row[manufactor]" type="text" value="{$row.manufactor|htmlentities}"> 38 <input id="c-manufactor" data-rule="required" class="form-control" name="row[manufactor]" type="text" value="{$row.manufactor|htmlentities}">
@@ -10,16 +10,16 @@ @@ -10,16 +10,16 @@
10 <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('battery_code/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> 10 <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('battery_code/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
11 <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('battery_code/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> 11 <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('battery_code/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
12 <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('battery_code/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> 12 <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('battery_code/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
13 - <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('battery_code/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->  
14 -<!---->  
15 - <!--<div class="dropdown btn-group {:$auth->check('battery_code/multi')?'':'hide'}">-->  
16 - <!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->  
17 - <!--<ul class="dropdown-menu text-left" role="menu">-->  
18 - <!--<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>-->  
19 - <!--<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>-->  
20 - <!--</ul>-->  
21 - <!--</div>-->  
22 -<!----> 13 + <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('battery_code/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
  14 +
  15 + <div class="dropdown btn-group {:$auth->check('battery_code/multi')?'':'hide'}">
  16 + <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
  17 + <ul class="dropdown-menu text-left" role="menu">
  18 + <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>
  19 + <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>
  20 + </ul>
  21 + </div>
  22 +
23 23
24 </div> 24 </div>
25 <table id="table" class="table table-striped table-bordered table-hover table-nowrap" 25 <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
  1 +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
  2 +
  3 + <div class="form-group">
  4 + <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
  5 + <div class="col-xs-12 col-sm-8">
  6 + <input id="c-type" data-rule="required" class="form-control" name="row[type]" type="text">
  7 + </div>
  8 + </div>
  9 + <div class="form-group layer-footer">
  10 + <label class="control-label col-xs-12 col-sm-2"></label>
  11 + <div class="col-xs-12 col-sm-8">
  12 + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
  13 + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  14 + </div>
  15 + </div>
  16 +</form>
  1 +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
  2 +
  3 + <div class="form-group">
  4 + <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
  5 + <div class="col-xs-12 col-sm-8">
  6 + <input id="c-type" data-rule="required" class="form-control" name="row[type]" type="text" value="{$row.type|htmlentities}">
  7 + </div>
  8 + </div>
  9 + <div class="form-group layer-footer">
  10 + <label class="control-label col-xs-12 col-sm-2"></label>
  11 + <div class="col-xs-12 col-sm-8">
  12 + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
  13 + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  14 + </div>
  15 + </div>
  16 +</form>
  1 +<div class="panel panel-default panel-intro">
  2 + {:build_heading()}
  3 +
  4 + <div class="panel-body">
  5 + <div id="myTabContent" class="tab-content">
  6 + <div class="tab-pane fade active in" id="one">
  7 + <div class="widget-body no-padding">
  8 + <div id="toolbar" class="toolbar">
  9 + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
  10 + <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('battery_type/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
  11 + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('battery_type/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
  12 + <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('battery_type/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
  13 + <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('battery_type/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
  14 +
  15 + <div class="dropdown btn-group {:$auth->check('battery_type/multi')?'':'hide'}">
  16 + <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
  17 + <ul class="dropdown-menu text-left" role="menu">
  18 + <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>
  19 + <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>
  20 + </ul>
  21 + </div>
  22 +
  23 +
  24 + </div>
  25 + <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
  26 + data-operate-edit="{:$auth->check('battery_type/edit')}"
  27 + data-operate-del="{:$auth->check('battery_type/del')}"
  28 + width="100%">
  29 + </table>
  30 + </div>
  31 + </div>
  32 +
  33 + </div>
  34 + </div>
  35 +</div>
1 <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> 1 <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
2 2
3 <div class="form-group"> 3 <div class="form-group">
4 - <label class="control-label col-xs-12 col-sm-2">{:__('Battery_id')}:</label> 4 + <label class="control-label col-xs-12 col-sm-2">{:__('Battery_type_id')}:</label>
5 <div class="col-xs-12 col-sm-8"> 5 <div class="col-xs-12 col-sm-8">
6 - <input id="c-battery_id" data-rule="required" data-source="battery_code/index" data-field="title" class="form-control selectpage" name="row[battery_id]" type="text" value=""> 6 + <input id="c-battery_type_id" data-rule="required" data-source="battery/type/index" class="form-control selectpage" name="row[battery_type_id]" type="text" value="">
7 </div> 7 </div>
8 </div> 8 </div>
9 <div class="form-group"> 9 <div class="form-group">
1 <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> 1 <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
2 2
3 <div class="form-group"> 3 <div class="form-group">
4 - <label class="control-label col-xs-12 col-sm-2">{:__('Battery_id')}:</label> 4 + <label class="control-label col-xs-12 col-sm-2">{:__('Battery_type_id')}:</label>
5 <div class="col-xs-12 col-sm-8"> 5 <div class="col-xs-12 col-sm-8">
6 - <input id="c-battery_id" data-rule="required" data-source="battery_code/index" data-field="title" class="form-control selectpage" name="row[battery_id]" type="text" value="{$row.battery_id|htmlentities}"> 6 + <input id="c-battery_type_id" data-rule="required" data-source="battery/type/index" class="form-control selectpage" name="row[battery_type_id]" type="text" value="{$row.battery_type_id|htmlentities}">
7 </div> 7 </div>
8 </div> 8 </div>
9 <div class="form-group"> 9 <div class="form-group">
@@ -10,15 +10,15 @@ @@ -10,15 +10,15 @@
10 <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('money_config/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> 10 <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('money_config/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
11 <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('money_config/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> 11 <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('money_config/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
12 <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('money_config/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> 12 <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('money_config/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
13 - <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('money_config/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->  
14 -<!---->  
15 - <!--<div class="dropdown btn-group {:$auth->check('money_config/multi')?'':'hide'}">-->  
16 - <!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->  
17 - <!--<ul class="dropdown-menu text-left" role="menu">-->  
18 - <!--<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>-->  
19 - <!--<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>-->  
20 - <!--</ul>-->  
21 - <!--</div>--> 13 + <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('money_config/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
  14 +
  15 + <div class="dropdown btn-group {:$auth->check('money_config/multi')?'':'hide'}">
  16 + <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
  17 + <ul class="dropdown-menu text-left" role="menu">
  18 + <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>
  19 + <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>
  20 + </ul>
  21 + </div>
22 22
23 23
24 </div> 24 </div>
@@ -26,12 +26,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -26,12 +26,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
26 [ 26 [
27 {checkbox: true}, 27 {checkbox: true},
28 {field: 'id', title: __('Id')}, 28 {field: 'id', title: __('Id')},
29 - {field: 'title', title: __('Title'), operate: 'LIKE'}, 29 + {field: 'batter_type_id', title: __('Batter_type_id')},
  30 + {field: 'BatteryCode', title: __('Batterycode'), operate: 'LIKE'},
30 {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image}, 31 {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
  32 + {field: 'Mac', title: __('Mac'), operate: 'LIKE'},
31 {field: 'manufactor', title: __('Manufactor'), operate: 'LIKE'}, 33 {field: 'manufactor', title: __('Manufactor'), operate: 'LIKE'},
32 - {field: 'BatteryCode', title: __('Batterycode'), operate: 'LIKE'},  
33 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, 34 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
34 - {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, 35 + {field: 'batterytype.type', title: __('Batterytype.type'), operate: 'LIKE'},
35 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 36 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
36 ] 37 ]
37 ] 38 ]
  1 +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2 +
  3 + var Controller = {
  4 + index: function () {
  5 + // 初始化表格参数配置
  6 + Table.api.init({
  7 + extend: {
  8 + index_url: 'battery_type/index' + location.search,
  9 + add_url: 'battery_type/add',
  10 + edit_url: 'battery_type/edit',
  11 + del_url: 'battery_type/del',
  12 + multi_url: 'battery_type/multi',
  13 + import_url: 'battery_type/import',
  14 + table: 'battery_type',
  15 + }
  16 + });
  17 +
  18 + var table = $("#table");
  19 +
  20 + // 初始化表格
  21 + table.bootstrapTable({
  22 + url: $.fn.bootstrapTable.defaults.extend.index_url,
  23 + pk: 'id',
  24 + sortName: 'id',
  25 + columns: [
  26 + [
  27 + {checkbox: true},
  28 + {field: 'id', title: __('Id')},
  29 + {field: 'type', title: __('Type'), operate: 'LIKE'},
  30 + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  31 + ]
  32 + ]
  33 + });
  34 +
  35 + // 为表格绑定事件
  36 + Table.api.bindevent(table);
  37 + },
  38 + add: function () {
  39 + Controller.api.bindevent();
  40 + },
  41 + edit: function () {
  42 + Controller.api.bindevent();
  43 + },
  44 + api: {
  45 + bindevent: function () {
  46 + Form.api.bindevent($("form[role=form]"));
  47 + }
  48 + }
  49 + };
  50 + return Controller;
  51 +});
@@ -26,10 +26,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -26,10 +26,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
26 [ 26 [
27 {checkbox: true}, 27 {checkbox: true},
28 {field: 'id', title: __('Id')}, 28 {field: 'id', title: __('Id')},
29 - // {field: 'battery_id', title: __('Battery_id')},  
30 - {field: 'batterycode.title', title: __('Batterycode.title'), operate: 'LIKE'}, 29 + {field: 'battery_type_id', title: __('Battery_type_id')},
31 {field: 'UpMoney', title: __('Upmoney'), operate:'BETWEEN'}, 30 {field: 'UpMoney', title: __('Upmoney'), operate:'BETWEEN'},
32 {field: 'MonthMoney', title: __('Monthmoney'), operate:'BETWEEN'}, 31 {field: 'MonthMoney', title: __('Monthmoney'), operate:'BETWEEN'},
  32 + {field: 'batterytype.type', title: __('Batterytype.type'), operate: 'LIKE'},
33 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 33 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
34 ] 34 ]
35 ] 35 ]