作者 王智

daima

@@ -43,22 +43,20 @@ class Renwu extends Backend @@ -43,22 +43,20 @@ class Renwu extends Backend
43 $this->relationSearch = true; 43 $this->relationSearch = true;
44 //设置过滤方法 44 //设置过滤方法
45 $this->request->filter(['strip_tags', 'trim']); 45 $this->request->filter(['strip_tags', 'trim']);
46 - if ($this->request->isAjax())  
47 - { 46 + if ($this->request->isAjax()) {
48 //如果发送的来源是Selectpage,则转发到Selectpage 47 //如果发送的来源是Selectpage,则转发到Selectpage
49 - if ($this->request->request('keyField'))  
50 - { 48 + if ($this->request->request('keyField')) {
51 return $this->selectpage(); 49 return $this->selectpage();
52 } 50 }
53 list($where, $sort, $order, $offset, $limit) = $this->buildparams(); 51 list($where, $sort, $order, $offset, $limit) = $this->buildparams();
54 $total = $this->model 52 $total = $this->model
55 - ->with(['user','vip']) 53 + ->with(['user', 'vip'])
56 ->where($where) 54 ->where($where)
57 ->order($sort, $order) 55 ->order($sort, $order)
58 ->count(); 56 ->count();
59 57
60 $list = $this->model 58 $list = $this->model
61 - ->with(['user','vip']) 59 + ->with(['user', 'vip'])
62 ->where($where) 60 ->where($where)
63 ->order($sort, $order) 61 ->order($sort, $order)
64 ->limit($offset, $limit) 62 ->limit($offset, $limit)
@@ -66,7 +64,7 @@ class Renwu extends Backend @@ -66,7 +64,7 @@ class Renwu extends Backend
66 64
67 foreach ($list as $row) { 65 foreach ($list as $row) {
68 66
69 - $row->getRelation('user')->visible(['nickname','mobile','address','address_con','car_num','color','car_type','vip']); 67 + $row->getRelation('user')->visible(['nickname', 'mobile', 'address', 'address_con', 'car_num', 'color', 'car_type', 'vip']);
70 $row->getRelation('vip')->visible(['title']); 68 $row->getRelation('vip')->visible(['title']);
71 } 69 }
72 $list = collection($list)->toArray(); 70 $list = collection($list)->toArray();
@@ -76,4 +74,11 @@ class Renwu extends Backend @@ -76,4 +74,11 @@ class Renwu extends Backend
76 } 74 }
77 return $this->view->fetch(); 75 return $this->view->fetch();
78 } 76 }
  77 +
  78 +
  79 + public function look()
  80 + {
  81 + $id = input('id');
  82 + dump($id);
  83 + }
79 } 84 }
  1 +<!DOCTYPE html>
  2 +<html lang="en">
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <title>Title</title>
  6 +</head>
  7 +<body>
  8 +
  9 +</body>
  10 +</html>
@@ -25,33 +25,92 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -25,33 +25,92 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
25 [ 25 [
26 {checkbox: true}, 26 {checkbox: true},
27 {field: 'id', title: __('Id')}, 27 {field: 'id', title: __('Id')},
28 - {field: 'order_sn', title: __('Order_sn'),operate:'LIKE'}, 28 + {field: 'order_sn', title: __('Order_sn'), operate: 'LIKE'},
29 // {field: 'user_id', title: __('User_id')}, 29 // {field: 'user_id', title: __('User_id')},
30 // {field: 'vip_id', title: __('Vip_id')}, 30 // {field: 'vip_id', title: __('Vip_id')},
31 - {field: 'user.nickname', title: __('User.nickname'),operate:'LIKE'},  
32 - {field: 'user.mobile', title: __('User.mobile'),operate:'LIKE'},  
33 - {field: 'user.address', title: __('User.address'),operate:'LIKE'},  
34 - {field: 'user.address_con', title: __('User.address_con'),operate:'LIKE'},  
35 - {field: 'user.car_num', title: __('User.car_num'),operate:'LIKE'},  
36 - {field: 'user.color', title: __('User.color'),operate:'LIKE'},  
37 - {field: 'user.car_type', title: __('User.car_type'),operate:'LIKE'}, 31 + {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  32 + {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  33 + {field: 'user.address', title: __('User.address'), operate: 'LIKE'},
  34 + {field: 'user.address_con', title: __('User.address_con'), operate: 'LIKE'},
  35 + {field: 'user.car_num', title: __('User.car_num'), operate: 'LIKE'},
  36 + {field: 'user.color', title: __('User.color'), operate: 'LIKE'},
  37 + {field: 'user.car_type', title: __('User.car_type'), operate: 'LIKE'},
38 // {field: 'user.vip', title: __('User.vip')}, 38 // {field: 'user.vip', title: __('User.vip')},
39 - {field: 'vip.title', title: __('Vip.title'),operate:false},  
40 - {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"0":__('Type 0'),"2":__('Type 2')}, formatter: Table.api.formatter.normal}, 39 + {field: 'vip.title', title: __('Vip.title'), operate: false},
  40 + {
  41 + field: 'type',
  42 + title: __('Type'),
  43 + searchList: {"1": __('Type 1'), "0": __('Type 0'), "2": __('Type 2')},
  44 + formatter: Table.api.formatter.normal
  45 + },
41 // {field: 'xi_id', title: __('Xi_id')}, 46 // {field: 'xi_id', title: __('Xi_id')},
42 - {field: 'xi_type', title: __('Xi_type'), searchList: {"1":__('Xi_type 1'),"0":__('Xi_type 0'),"2":__('Xi_type 2')}, formatter: Table.api.formatter.normal}, 47 + {
  48 + field: 'xi_type',
  49 + title: __('Xi_type'),
  50 + searchList: {"1": __('Xi_type 1'), "0": __('Xi_type 0'), "2": __('Xi_type 2')},
  51 + formatter: Table.api.formatter.normal
  52 + },
43 // {field: 'xi_images', title: __('Xi_images'), events: Table.api.events.image, formatter: Table.api.formatter.images}, 53 // {field: 'xi_images', title: __('Xi_images'), events: Table.api.events.image, formatter: Table.api.formatter.images},
44 // {field: 'zhao_id', title: __('Zhao_id')}, 54 // {field: 'zhao_id', title: __('Zhao_id')},
45 - {field: 'zhao_type', title: __('Zhao_type'), searchList: {"1":__('Zhao_type 1'),"0":__('Zhao_type 0'),"2":__('Zhao_type 2')}, formatter: Table.api.formatter.normal}, 55 + {
  56 + field: 'zhao_type',
  57 + title: __('Zhao_type'),
  58 + searchList: {"1": __('Zhao_type 1'), "0": __('Zhao_type 0'), "2": __('Zhao_type 2')},
  59 + formatter: Table.api.formatter.normal
  60 + },
46 // {field: 'zhao_images', title: __('Zhao_images'), events: Table.api.events.image, formatter: Table.api.formatter.images}, 61 // {field: 'zhao_images', title: __('Zhao_images'), events: Table.api.events.image, formatter: Table.api.formatter.images},
47 - {field: 'car_address', title: __('Car_address'),operate:'LIKE'}, 62 + {field: 'car_address', title: __('Car_address'), operate: 'LIKE'},
48 // {field: 'lat', title: __('Lat')}, 63 // {field: 'lat', title: __('Lat')},
49 // {field: 'lng', title: __('Lng')}, 64 // {field: 'lng', title: __('Lng')},
50 - {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},  
51 - {field: 'startime', title: __('Startime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},  
52 - {field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},  
53 - {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},  
54 - {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 65 + {
  66 + field: 'createtime',
  67 + title: __('Createtime'),
  68 + operate: 'RANGE',
  69 + addclass: 'datetimerange',
  70 + formatter: Table.api.formatter.datetime
  71 + },
  72 + {
  73 + field: 'startime',
  74 + title: __('Startime'),
  75 + operate: 'RANGE',
  76 + addclass: 'datetimerange',
  77 + formatter: Table.api.formatter.datetime
  78 + },
  79 + {
  80 + field: 'endtime',
  81 + title: __('Endtime'),
  82 + operate: 'RANGE',
  83 + addclass: 'datetimerange',
  84 + formatter: Table.api.formatter.datetime
  85 + },
  86 + {
  87 + field: 'updatetime',
  88 + title: __('Updatetime'),
  89 + operate: 'RANGE',
  90 + addclass: 'datetimerange',
  91 + formatter: Table.api.formatter.datetime
  92 + },
  93 + {
  94 + field: 'operate',
  95 + title: __('Operate'),
  96 + table: table,
  97 + events: Table.api.events.operate,
  98 + formatter: Table.api.formatter.operate,
  99 + buttons: [
  100 + {
  101 + name: 'yuangong',
  102 + text: __('查看员工'),
  103 + title: __('查看员工'),
  104 + classname: 'btn btn-xs btn-primary btn-dialog',
  105 + icon: 'fa fa-send',
  106 + url: 'renwu/look?id={id}',
  107 + visible: function (row) {
  108 + //返回true时按钮显示,返回false隐藏
  109 + return true;
  110 + }
  111 + }
  112 + ]
  113 + },
55 ] 114 ]
56 ] 115 ]
57 }); 116 });