integral_goods.js
4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'integral_goods/index' + location.search,
add_url: 'integral_goods/add',
edit_url: 'integral_goods/edit',
del_url: 'integral_goods/del',
multi_url: 'integral_goods/multi',
table: 'integral_goods',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'country_id', title: __('Country_id'),visible:false},
{field: 'depot_id', title: __('Depot_id'),visible:false},
{field: 'ch_name', title: __('Ch_name')},
{field: 'en_name', title: __('En_name')},
{field: 'image', title: __('Image'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate:false},
{field: 'images', title: __('Images'), events: Table.api.events.image, formatter: Table.api.formatter.images, operate:false},
{field: 'goods_no', title: __('Goods_no')},
{field: 'ch_specification', title: __('Ch_specification'),visible:false, operate:false},
{field: 'en_specification', title: __('En_specification'),visible:false, operate:false},
{field: 'ch_save_where', title: __('Ch_save_where'),visible:false, operate:false},
{field: 'en_save_where', title: __('En_save_where'),visible:false, operate:false},
{field: 'ch_period', title: __('Ch_period'),visible:false, operate:false},
{field: 'en_period', title: __('En_period'),visible:false, operate:false},
{field: 'stock_num', title: __('Stock_num'), operate:false},
{field: 'sales_initial', title: __('Sales_initial'), operate:false},
{field: 'sales_actual', title: __('Sales_actual'), operate:false},
{field: 'integral', title: __('Integral')},
{field: 'goods_price', title: __('Goods_price'), operate:false},
{field: 'original_price', title: __('Original_price'), operate:false},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.toggle,yes:1,no:2},
{field: 'weigh', title: __('Weigh')},
{field: 'createtime', title: __('Createtime'), operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'country.ch_name', title: __('Country.ch_name'), formatter: Table.api.formatter.label},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons: [
{
name: 'depot', title: '仓库信息', icon: 'fa fa-bars',
classname: 'btn btn-xs btn-warning btn-dialog',
url: 'depot/index/goods_id/{id}/type/2'
},
{
name: 'evaluate', title: '评价信息', icon: 'fa fa-bars',
classname: 'btn btn-xs btn-info btn-dialog',
url: 'evaluate/index/goods_id/{id}/type/2',
// extend: 'data-area=\'["1400px", "650px"]\''
}
]}
]
]
});
// 为表格绑定事件
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;
});