12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'product/index' + location.search,
- add_url: 'product/add',
- edit_url: 'product/edit',
- // del_url: 'product/del',
- multi_url: 'product/multi',
- import_url: 'product/import',
- table: 'product',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'weigh',
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'name', title: __('Name'), operate: 'LIKE'},
- // {field: 'title', title: __('Title'), operate: 'LIKE'},
- // {field: 'info', title: __('Info'), operate: 'LIKE'},
- {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
- {field: 'price', title: __('Price'), operate:'BETWEEN'},
- // {field: 'content', title: __('Content')},
- {field: 'is_show', title: __('Is_show'), searchList: {"1":__('Is_show 1'),"0":__('Is_show 0')}, formatter: Table.api.formatter.normal},
- // {field: 'weigh', title: __('Weigh'), operate: false},
- {field: 'view_number', title: __('View_number')},
- // {field: 'procate_id', title: __('Procate_id')},
- {field: 'procate.name', title: __('Procate.name'), operate: 'LIKE'},
- {field: 'is_recommend', title: __('Is_recommend'), searchList: {"1":__('Is_recommend 1'),"0":__('Is_recommend 0')}, formatter: Table.api.formatter.normal},
- {field: 'address', title: __('Address'), operate: 'LIKE'},
- {field: 'sell_number', title: __('Sell_number')},
- // {field: 'protag_id', title: __('Protag_id')},
- {field: 'protag.name', title: __('Protag.name'), operate: 'LIKE'},
- {field: 'jxtype', title: __('Jxtype'), searchList: {"0":__('Jxtype 0'),"1":__('Jxtype 1')}, formatter: Table.api.formatter.normal},
- {field: 'productxieyi.name', title: __('Productxieyi.name'), operate: 'LIKE'},
- {field: 'operate', title: __('Operate'),
- buttons:[
- {
- name:'jxqrcode',
- text:'经销商码',
- title:'经销商码',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-danger btn-dialog',
- url:'Product/jxqrcode/id/{ids}',
- target:'_self',
- refresh:true,
- hidden:function($row){
- if($row.jxtype == 1){
- return false;
- }
- return true;
- }
- }
- ],
- table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- jxqrcode: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|