diff --git a/application/admin/controller/user4s/User.php b/application/admin/controller/user4s/User.php index 2d86f3d..b46928b 100644 --- a/application/admin/controller/user4s/User.php +++ b/application/admin/controller/user4s/User.php @@ -124,9 +124,14 @@ class User extends Backend $this->model->validateFailException(true)->validate($validate); } $result = $this->model->allowField(true)->save($params); + var_dump($params['need_visit']); //新加用户期初等级 if($result && $this->model->id){ - $log_res = $this->model->afterlog($this->auth->id,$this->model,$this->model->id); + if($params['need_visit'] == 1){ + $log_res = $this->model->afterlog($this->auth->id,$this->model,$this->model->id,'',true); + }else{ + $log_res = $this->model->afterlog($this->auth->id,$this->model,$this->model->id,'',false); + } if(!$log_res){ $this->model->rollback(); $this->error('新增失败'); @@ -317,69 +322,42 @@ class User extends Backend $this->error(__('You have no permission')); } } - $all_level = $this->level_model->where('status', 1)->column('id,name'); + //$all_level = $this->level_model->where('status', 1)->column('id,name'); if ($this->request->isPost()) { $params = $this->request->post("row/a"); - //var_dump($params); - $user_data = array( - 'id' => $row->id - ); - //记录用户充值、积分、等级记录 - $log_data = array( - 'user4s_id' => $row->id, - 'admin_id'=>$this->auth->id - ); - //余额充值 - if ($params['balance'] > 0) { - $now = round($params['balance'], 2); - $end = round($row->balance + $now, 2); - - $log_data['start'] = $row->balance; - $log_data['end'] = $end; - $log_data['state'] = 0; - $log_data['description'] = $params['description']; - $this->log_model->isUpdate(false)->save($log_data); - $user_data['balance'] = $end; - } - //积分记录 - if ($params['integral'] > 0) { - $now = intval($params['integral']); - $end = intval($row->integral + $now); - - $log_data['start'] = $row->integral; - $log_data['end'] = $end; - $log_data['state'] = 1; - if($now > 0){ - $log_data['description'] = $params['description'].' 赠送积分:'.$now; - }else{ - $log_data['description'] = $params['description'].' 系统后台扣除积分'.$now; - } - $this->log_model = new \app\common\model\user4s\Log(); - $this->log_model->isUpdate(false)->save($log_data); - $user_data['integral'] = $end; - //var_dump($log_data, $user_data); - } - //等级记录 - if ($params['level_id'] != $row->level_id && $params['level_id'] > 0) { - $end = intval($params['level_id']); - $log_data['start'] = $row->level_id; - $log_data['end'] = $end; - - $log_data['description'] = '会员等级变动,由 '.$all_level[$row->level_id].' 更改为:'.$all_level[$end]; - //var_dump($log_data); - $this->levellog_model->isUpdate(false)->save($log_data); - $user_data['level_id'] = $end; - } - if(isset($user_data['balance']) || isset($user_data['integral']) || isset($user_data['level_id'])){ - //var_dump($user_data); - //$this->model->get($row->id); + //记录用户续保记录 + if (!empty($params['inscom']) && !empty($params['insdate'])) { + $log_data = array( + 'user4s_id' => $row->id, + 'admin_id'=>$this->auth->id, + 'inscom'=>$params['inscom'], + 'insdate'=>$params['insdate'], + 'star'=>$params['star'], + 'description'=>$params['description'] + ); + $this->Inslog_model = new \app\common\model\user4s\Inslog(); + $this->Inslog_model->isUpdate(false)->save($log_data); + $user_data = array( + 'inscom'=>$params['inscom'], + 'insdate'=>$params['insdate'], + ); $this->model->save($user_data, ['id' => $row->id]); + }else{ + $this->error('请填写续保信息',url('user4s/user/expireins',['user4s_id'=>$row->id])); } - $this->success(); + $this->success('续保成功!',url('user4s/user/expireins',['user4s_id'=>$row->id])); } //var_dump($col); - $this->view->assign("all_level", $all_level); + $all_star = array( + 1=>'★', + 2=>'★★', + 3=>'★★★', + 4=>'★★★★', + 5=>'★★★★★', + ); + $this->view->assign("now", date('Y-m-d')); + $this->view->assign("all_star", $all_star); $this->view->assign('row', $row); return $this->view->fetch(); } diff --git a/application/admin/controller/user4s/Visit.php b/application/admin/controller/user4s/Visit.php new file mode 100644 index 0000000..f847445 --- /dev/null +++ b/application/admin/controller/user4s/Visit.php @@ -0,0 +1,71 @@ +model = new \app\common\model\user4s\Visit; + + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['visittype','user','admin']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/admin/controller/user4s/Visittype.php b/application/admin/controller/user4s/Visittype.php new file mode 100644 index 0000000..c0c1210 --- /dev/null +++ b/application/admin/controller/user4s/Visittype.php @@ -0,0 +1,37 @@ +model = new \app\common\model\user4s\Visittype; + + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + +} diff --git a/application/admin/lang/zh-cn/user4s/visit.php b/application/admin/lang/zh-cn/user4s/visit.php new file mode 100644 index 0000000..32004a7 --- /dev/null +++ b/application/admin/lang/zh-cn/user4s/visit.php @@ -0,0 +1,58 @@ + 'ID', + 'User4s_id' => '会员', + 'Admin_id' => '操作员', + 'Type_id' => '回访类型', + 'Visittime' => '回访时间', + 'Description' => '备注', + 'Createtime' => '创建时间', + 'Deletetime' => '删除时间', + 'Visittype.id' => 'ID', + 'Visittype.name' => '名称', + 'Visittype.tip_time' => '提醒时间', + 'Visittype.description' => '备注', + 'Visittype.createtime' => '创建时间', + 'Visittype.deletetime' => '删除时间', + 'User.id' => 'ID', + 'User.category_id' => '用户分组', + 'User.level_id' => '用户等级', + 'User.name' => '姓名', + 'User.tel' => '联系方式', + 'User.balance' => '余额', + 'User.integral' => '积分', + 'User.genderdata' => '性别', + 'User.genderdata male' => '男', + 'User.genderdata female' => '女', + 'User.city' => '省市', + 'User.buydate' => '购车日期', + 'User.carno' => '车牌号码', + 'User.model' => '车型', + 'User.color' => '颜色', + 'User.inscom' => '保险类型', + 'User.insdate' => '保险日期', + 'User.tags' => '标签', + 'User.description' => '备注', + 'User.admin_id' => '销售顾问', + 'User.createtime' => '创建时间', + 'User.updatetime' => '更新时间', + 'User.deletetime' => '删除时间', + 'User.status' => '状态值', + 'User.status 0' => '禁用', + 'User.status 1' => '正常', + 'Admin.id' => 'ID', + 'Admin.username' => '用户名', + 'Admin.nickname' => '昵称', + 'Admin.password' => '密码', + 'Admin.salt' => '密码盐', + 'Admin.avatar' => '头像', + 'Admin.email' => '电子邮箱', + 'Admin.loginfailure' => '失败次数', + 'Admin.logintime' => '登录时间', + 'Admin.loginip' => '登录IP', + 'Admin.createtime' => '创建时间', + 'Admin.updatetime' => '更新时间', + 'Admin.token' => 'Session标识', + 'Admin.status' => '状态' +]; diff --git a/application/admin/lang/zh-cn/user4s/visittype.php b/application/admin/lang/zh-cn/user4s/visittype.php new file mode 100644 index 0000000..4ebc16b --- /dev/null +++ b/application/admin/lang/zh-cn/user4s/visittype.php @@ -0,0 +1,10 @@ + 'ID', + 'Name' => '名称', + 'Tip_time' => '提醒时间', + 'Description' => '备注', + 'Createtime' => '创建时间', + 'Deletetime' => '删除时间' +]; diff --git a/application/admin/view/user4s/user/add.html b/application/admin/view/user4s/user/add.html index 06b93d7..9f2767b 100644 --- a/application/admin/view/user4s/user/add.html +++ b/application/admin/view/user4s/user/add.html @@ -92,7 +92,18 @@ +
+ +
+ + + + + 新用户开启后可以直接创建回访单。 +
+
+
diff --git a/application/admin/view/user4s/user/renewal.html b/application/admin/view/user4s/user/renewal.html index 50af781..3149620 100644 --- a/application/admin/view/user4s/user/renewal.html +++ b/application/admin/view/user4s/user/renewal.html @@ -1,4 +1,4 @@ -
+ {:token()}
用户保险信息
@@ -20,7 +20,6 @@
-
@@ -36,8 +35,8 @@
- + {foreach name="all_star" item="vo"} {/foreach} @@ -45,36 +44,30 @@
- +
- - - +
- +
- - 如果需要更改用户会员等级请选择此处,如果不需要更改可以不选择。 + + 本次续保的保险开始时间,方便下次提醒。
- 建议输入备注信息,方便后期对账查询。 + 建议输入备注信息,方便后期查询。
diff --git a/application/admin/view/user4s/visit/add.html b/application/admin/view/user4s/visit/add.html new file mode 100644 index 0000000..23d4c22 --- /dev/null +++ b/application/admin/view/user4s/visit/add.html @@ -0,0 +1,34 @@ + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + diff --git a/application/admin/view/user4s/visit/edit.html b/application/admin/view/user4s/visit/edit.html new file mode 100644 index 0000000..c9a3999 --- /dev/null +++ b/application/admin/view/user4s/visit/edit.html @@ -0,0 +1,34 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/application/admin/view/user4s/visit/index.html b/application/admin/view/user4s/visit/index.html new file mode 100644 index 0000000..c929f64 --- /dev/null +++ b/application/admin/view/user4s/visit/index.html @@ -0,0 +1,35 @@ +
+ {:build_heading()} + +
+
+
+
+
+ + {:__('Add')} + {:__('Edit')} + + + + + + +
+ +
+
+
+ +
+
+
diff --git a/application/admin/view/user4s/visit/recyclebin.html b/application/admin/view/user4s/visit/recyclebin.html new file mode 100644 index 0000000..39ca70c --- /dev/null +++ b/application/admin/view/user4s/visit/recyclebin.html @@ -0,0 +1,25 @@ +
+ {:build_heading()} + +
+
+
+ +
+ +
+
+
diff --git a/application/admin/view/user4s/visittype/add.html b/application/admin/view/user4s/visittype/add.html new file mode 100644 index 0000000..e2fa8e2 --- /dev/null +++ b/application/admin/view/user4s/visittype/add.html @@ -0,0 +1,28 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/application/admin/view/user4s/visittype/edit.html b/application/admin/view/user4s/visittype/edit.html new file mode 100644 index 0000000..d245a05 --- /dev/null +++ b/application/admin/view/user4s/visittype/edit.html @@ -0,0 +1,28 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/application/admin/view/user4s/visittype/index.html b/application/admin/view/user4s/visittype/index.html new file mode 100644 index 0000000..5ac4ffe --- /dev/null +++ b/application/admin/view/user4s/visittype/index.html @@ -0,0 +1,27 @@ +
+ {:build_heading()} + + +
diff --git a/application/admin/view/user4s/visittype/recyclebin.html b/application/admin/view/user4s/visittype/recyclebin.html new file mode 100644 index 0000000..2794d70 --- /dev/null +++ b/application/admin/view/user4s/visittype/recyclebin.html @@ -0,0 +1,25 @@ +
+ {:build_heading()} + +
+
+
+ +
+ +
+
+
diff --git a/application/common/model/user4s/User.php b/application/common/model/user4s/User.php index 2e60020..c43d500 100644 --- a/application/common/model/user4s/User.php +++ b/application/common/model/user4s/User.php @@ -41,7 +41,7 @@ class User extends Model // }); } //新建用户事件 加入会员余额、积分、等级等期初 - public function afterlog($admin_id,$model=null,$id=null,$description='') + public function afterlog($admin_id,$model=null,$id=null,$description='',$need_visit=false) { if(isset($model)){ @@ -96,6 +96,22 @@ class User extends Model $this->levellog_model = new \app\common\model\user4s\Levellog(); $this->levellog_model->isUpdate(false)->save($log_data); } + //新加入用户添加回访单 + if ($need_visit) { + $visit_type = new \app\common\model\user4s\Visittype(); + $all_type = $visit_type->get(1); + //var_dump($all_type); + $visit_data = array( + 'user4s_id' => $row->id, + 'admin_id'=>$admin_id, + 'type_id'=>1, + 'visittime'=>strtotime('+'.$all_type->tip_time.' days'), + 'description'=>'新用户回访' + ); + //var_dump($visit_data); + $visit = new \app\common\model\user4s\Visit(); + $visit->isUpdate(false)->save($visit_data); + } return true; }else{ // if($del_error){ diff --git a/application/common/model/user4s/Visit.php b/application/common/model/user4s/Visit.php new file mode 100644 index 0000000..b3ad7d0 --- /dev/null +++ b/application/common/model/user4s/Visit.php @@ -0,0 +1,64 @@ +belongsTo('Visittype', 'type_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function user() + { + return $this->belongsTo('User', 'user4s_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function admin() + { + return $this->belongsTo('app\common\model\Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/common/model/user4s/Visittype.php b/application/common/model/user4s/Visittype.php new file mode 100644 index 0000000..ab2d1c3 --- /dev/null +++ b/application/common/model/user4s/Visittype.php @@ -0,0 +1,32 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/common/validate/user4s/Visittype.php b/application/common/validate/user4s/Visittype.php new file mode 100644 index 0000000..87b0fc4 --- /dev/null +++ b/application/common/validate/user4s/Visittype.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/public/assets/js/backend/user4s/inslog.js b/public/assets/js/backend/user4s/inslog.js index bc61bc7..ccedbcd 100644 --- a/public/assets/js/backend/user4s/inslog.js +++ b/public/assets/js/backend/user4s/inslog.js @@ -53,6 +53,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin //这里可以动态赋值,比如从URL中获取admin_id的值,filter.admin_id=Fast.api.query('admin_id'); filter.user4s_id = Fast.api.query('user4s_id'); op.user4s_id = "="; + if (filter.user4s_id == null || filter.user4s_id == "") { + delete filter.user4s_id; + delete op.user4s_id; + } + params.filter = JSON.stringify(filter); params.op = JSON.stringify(op); console.log(params); diff --git a/public/assets/js/backend/user4s/user.js b/public/assets/js/backend/user4s/user.js index ddc1912..b11f3a8 100644 --- a/public/assets/js/backend/user4s/user.js +++ b/public/assets/js/backend/user4s/user.js @@ -322,7 +322,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, buttons: [ { - name: 'push', + name: 'renewal', text: __('续保'), title: __('续保'), classname: 'btn btn-xs btn-danger btn-dialog', @@ -338,7 +338,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin } }, { - name: 'push', + name: 'inslog', text: __('续保记录'), title: __('续保记录'), classname: 'btn btn-xs btn-warning btn-dialog', @@ -356,6 +356,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin // 为表格绑定事件 Table.api.bindevent(table); }, + renewal: function () { + Controller.api.bindevent(); + }, api: { bindevent: function (table) { Form.api.bindevent($("form[role=form]")); diff --git a/public/assets/js/backend/user4s/visit.js b/public/assets/js/backend/user4s/visit.js new file mode 100644 index 0000000..aee7517 --- /dev/null +++ b/public/assets/js/backend/user4s/visit.js @@ -0,0 +1,130 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'user4s/visit/index' + location.search, + add_url: 'user4s/visit/add', + edit_url: 'user4s/visit/edit', + del_url: 'user4s/visit/del', + multi_url: 'user4s/visit/multi', + import_url: 'user4s/visit/import', + table: 'user4s_visit', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + fixedColumns: true, + fixedRightNumber: 1, + showToggle: false, + maintainSelected: true, + columns: [ + [ + {checkbox: true}, + //{ field: 'id', title: __('Id') }, + //{ field: 'type_id', title: __('Type_id') }, + {field: 'visittype.name', title: __('Type_id'), operate: 'LIKE'}, + //{ field: 'user4s_id', title: __('User4s_id') }, + { field: 'user.name', title: __('会员姓名'), operate: 'LIKE' }, + {field: 'user.carno', title: __('User.carno'), operate: 'LIKE'}, + //{ field: 'user.buydate', title: __('User.buydate'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false }, + {field: 'user.model', title: __('User.model'), operate: false}, + //{field: 'user.color', title: __('User.color'), operate: 'LIKE'}, + //{field: 'user.inscom', title: __('User.inscom'), operate: 'LIKE'}, + //{ field: 'user.insdate', title: __('User.insdate'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false }, + //{ field: 'user.description', title: __('User.description'), operate: 'LIKE' }, + + {field: 'visittime', title: __('Visittime'), operate:'BETWEEN', addclass:'datetimepicker',data:'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete:false, formatter: Table.api.formatter.datetime}, + //{field: 'admin.nickname', title: __('操作员'), operate: 'LIKE'}, + { field: 'createtime', title: __('Createtime'), operate: 'BETWEEN', addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false, formatter: Table.api.formatter.datetime }, + {field: 'description', title: __('Description'), operate: 'LIKE'}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + recyclebin: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + 'dragsort_url': '' + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: 'user4s/visit/recyclebin' + location.search, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + { + field: 'deletetime', + title: __('Deletetime'), + operate: 'RANGE', + addclass: 'datetimerange', + formatter: Table.api.formatter.datetime + }, + { + field: 'operate', + width: '130px', + title: __('Operate'), + table: table, + events: Table.api.events.operate, + buttons: [ + { + name: 'Restore', + text: __('Restore'), + classname: 'btn btn-xs btn-info btn-ajax btn-restoreit', + icon: 'fa fa-rotate-left', + url: 'user4s/visit/restore', + refresh: true + }, + { + name: 'Destroy', + text: __('Destroy'), + classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit', + icon: 'fa fa-times', + url: 'user4s/visit/destroy', + refresh: true + } + ], + formatter: Table.api.formatter.operate + } + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); diff --git a/public/assets/js/backend/user4s/visittype.js b/public/assets/js/backend/user4s/visittype.js new file mode 100644 index 0000000..d6e25ea --- /dev/null +++ b/public/assets/js/backend/user4s/visittype.js @@ -0,0 +1,119 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'user4s/visittype/index' + location.search, + add_url: 'user4s/visittype/add', + edit_url: 'user4s/visittype/edit', + del_url: 'user4s/visittype/del', + multi_url: 'user4s/visittype/multi', + import_url: 'user4s/visittype/import', + table: 'user4s_visittype', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + fixedColumns: true, + fixedRightNumber: 1, + showToggle: false, + maintainSelected: true, + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id'),operate:false}, + {field: 'name', title: __('Name'), operate: 'LIKE'}, + {field: 'tip_time', title: __('Tip_time'), operate:'RANGE', autocomplete:false}, + {field: 'description', title: __('Description'), operate: 'LIKE'}, + {field: 'createtime', title: __('Createtime'), operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + recyclebin: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + 'dragsort_url': '' + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: 'user4s/visittype/recyclebin' + location.search, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'name', title: __('Name'), align: 'left'}, + { + field: 'deletetime', + title: __('Deletetime'), + operate: 'RANGE', + addclass: 'datetimerange', + formatter: Table.api.formatter.datetime + }, + { + field: 'operate', + width: '130px', + title: __('Operate'), + table: table, + events: Table.api.events.operate, + buttons: [ + { + name: 'Restore', + text: __('Restore'), + classname: 'btn btn-xs btn-info btn-ajax btn-restoreit', + icon: 'fa fa-rotate-left', + url: 'user4s/visittype/restore', + refresh: true + }, + { + name: 'Destroy', + text: __('Destroy'), + classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit', + icon: 'fa fa-times', + url: 'user4s/visittype/destroy', + refresh: true + } + ], + formatter: Table.api.formatter.operate + } + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +});