define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'manystore/index/index', add_url: 'manystore/index/add', edit_url: 'manystore/index/edit', del_url: 'manystore/index/del', multi_url: 'manystore/index/multi', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', fixedColumns: true, fixedRightNumber: 1, columns: [ [ {checkbox: true}, {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} , {field: 'id', title: 'ID'}, {field: 'username', title: __('Username')}, {field: 'nickname', title: __('Nickname')}, {field: 'email', title: __('Email')}, {field: 'status', title: __("Status"), formatter: Table.api.formatter.status}, {field: 'shop.status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status}, {field: 'user_id', title: __('User_id'),visible:false}, {field: 'shop.type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal}, {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'}, {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'}, {field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'shop.name', title: __('申请姓名|机构名'), operate: 'LIKE'}, {field: 'shop.logo', title: __('Logo'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'shop.image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'shop.address_city', title: __('Address_city'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'shop.province', title: __('Province'),visible:false}, {field: 'shop.city', title: __('City'),visible:false}, {field: 'shop.district', title: __('District'),visible:false}, {field: 'shop.address', title: __('Address'), operate: 'LIKE',visible:false}, {field: 'shop.address_detail', title: __('Address_detail'), operate: 'LIKE',visible:false}, {field: 'shop.yyzz_images', title: __('Yyzz_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images}, {field: 'shop.front_idcard_image', title: __('身份证正面'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'shop.reverse_idcard_image', title: __('身份证反面'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'shop.tel', title: __('Tel'), operate: 'LIKE'}, {field: 'logintime', title: __('Login time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, ] ] }); // 为表格绑定事件 Table.api.bindevent(table); }, add: function () { $("#c-address_city").on("cp:updated", function() { var citypicker = $(this).data("citypicker"); var province = citypicker.getCode("province"); var city = citypicker.getCode("city"); var district = citypicker.getCode("district"); if(province){ $("#province").val(province); } if(city){ $("#city").val(city); } if(district){ $("#district").val(district); } $(this).blur(); }); Form.api.bindevent($("form[role=form]")); }, edit: function () { $("#c-address_city").on("cp:updated", function() { var citypicker = $(this).data("citypicker"); var province = citypicker.getCode("province"); var city = citypicker.getCode("city"); var district = citypicker.getCode("district"); if(province){ $("#province").val(province); } if(city){ $("#city").val(city); } if(district){ $("#district").val(district); } }); Form.api.bindevent($("form[role=form]")); } }; return Controller; });