123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index : function () {
- // 初始化表格参数配置
- Table.api.init({
- extend : {
- index_url : 'qingdongams/finance/account/index',
- add_url: 'qingdongams/finance/account/add',
- edit_url: 'qingdongams/finance/account/edit',
- del_url: 'qingdongams/finance/account/del',
- table : 'account',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url : $.fn.bootstrapTable.defaults.extend.index_url,
- pk : 'id',
- sortName : 'id',
- fixedColumns : true,
- fixedNumber : 2,
- search:false,
- searchFormVisible:true,
- columns : [
- [
- {checkbox : true},
- {field : 'deposit', title : '开户行', fixedColumns : true,operate:'like'},
- {field : 'name', title : '收款账号名称',operate:'like'},
- {field : 'account', title : '收款账号',operate:false},
- {field : 'status', title : '状态', formatter : Table.api.formatter.status,
- searchList : {0 : '禁用', 1 : '正常'}},
- {field : 'type', title : '账户类型', formatter : Table.api.formatter.status,
- searchList : {'public' : '公账', 'private' : '私账'}},
- {field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime, operate: false, addclass: 'datetimerange', sortable: true},
- {
- field : 'operate',
- title : __('Operate'),
- table : table,
- events : Table.api.events.operate,
- formatter : Table.api.formatter.operate,
- buttons : [
- {
- name: 'edit',
- text: __('编辑'),
- title: __('编辑'),
- classname: 'records btn-dialog',
- url: 'qingdongams/finance/account/edit',
- visible: function (row) {
- //返回true时按钮显示,返回false隐藏
- return true;
- }
- },
- {
- name: 'del',
- text: __('删除'),
- title: __('删除'),
- classname: 'records btn-ajax',
- url: 'qingdongams/finance/account/del',
- confirm: '确定要删除吗?',
- refresh:true,
- error: function (data, ret) {
- console.log(data, ret);
- Layer.alert(ret.msg);
- return false;
- },
- visible: function (row) {
- //返回true时按钮显示,返回false隐藏
- return true;
- }
- },
- ]
- }
- ]
- ]
- });
- $('.y_submit').on('click',function(){
- $("form[role=form]").submit();
- })
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add : function () {
- Controller.api.bindevent();
- },
- edit : function () {
- Controller.api.bindevent();
- },
- api : {
- bindevent : function () {
- Form.api.bindevent($("form[role=form]"), function(data, ret){
- //这里是表单提交处理成功后的回调函数,接收来自php的返回数据
- Fast.api.close(data);//这里是重点
- });
- }
- }
- };
- return Controller;
- });
|