| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'product/buying/index' + location.search,
- table: 'product_buying',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- //users,productlists'
- {field: 'users.address', title: __('User_id')},
- {field: 'productlists.zh_name', title: __('Product_id')},
- {field: 'min_price', title: __('Min_price'), operate: false},
- {field: 'stock', title: __('Stock')},
- {field: 'num', title: __('Num'), operate: false},
- {field: 'total_price', title: __('Total_price'), operate:false},
- {field: 'status', title: __('Status'), searchList: {0:__('关闭'),1 :__('正常'), 2:__('已出售')}, formatter: Table.api.formatter.status},
- {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/buying/index',
- extend:'data-area=["90%","85%"]',
- //refresh: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();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|