| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'product/synthesis/index' + location.search,
- add_url: 'product/synthesis/add',
- edit_url: 'product/synthesis/edit',
- del_url: 'product/synthesis/del',
- multi_url: 'product/synthesis/multi',
- import_url: 'product/synthesis/import',
- table: 'product_synthesis',
- }
- });
- 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: 'productlists.zh_name', title: __('Product_id')},
- {field: 'title', title: __('Title')},
- {field: 'announcement.title', title: __('导读信息'), operate: false}, //announcement, productLists'
- {field: 'to_lang', title: __('To_lang'), operate: false, searchList: {'zh':__('中文'), 'en':__('英文')}, formatter: Table.api.formatter.flag},
- {field: 'stock', title: __('发行数量'), operate: false},
- {field: 'num', title: __('流通数量'), operate: false},
- {field: 'weigh', title: __('Weigh'), operate: false},
- {field: 'status', title: __('Status'), searchList: {"1":__('上架'),"0":__('下架')}, formatter: Table.api.formatter.toggle},
- {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'operate', title: __('Operate'),
- buttons:[
- {
- classname: 'btn btn-xs btn-info btn-dialog',
- name: '合成记录',
- text: __('合成记录'),
- title: __('合成记录'),
- url: 'user/synthesis/index',
- extend:'data-area=["90%","85%"]',
- //refresh:true,
- },
- ],
- table: table, events: Table.api.events.operate,
- formatter: Table.api.formatter.operate
- }
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- $(".btn-add").data("area", ["80%", "80%"]);
- table.on('post-body.bs.table', function () {
- $('.btn-editone').data("area", ["80%", "80%"]);
- });
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|