hardware.js
5.3 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'reservoir/hkws/hardware/index' + location.search,
add_url: 'reservoir/hkws/hardware/add',
edit_url: 'reservoir/hkws/hardware/edit',
del_url: 'reservoir/hkws/hardware/del',
multi_url: 'reservoir/hkws/hardware/multi',
import_url: 'reservoir/hkws/hardware/import',
table: 'reservoir_hkws_hardware',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
// {field: 'province_id', title: __('Province_id')},
// {field: 'state_id', title: __('State_id')},
// {field: 'county_id', title: __('County_id')},
// {field: 'reservoir_id', title: __('Reservoir_id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1')}, formatter: Table.api.formatter.normal},
{field: 'type_child_name', title: __('Type_child_name'), searchList: {"1":__('Type_child_name 1'),"2":__('Type_child_name 2')}, formatter: Table.api.formatter.normal},
// {field: 'rcode', title: __('Rcode'), operate: 'LIKE'},
// {field: 'vcode', title: __('Vcode'), operate: 'LIKE'},
{field: 'channel_no', title: __('Channel_no'), operate: 'LIKE'},
{field: 'scode', title: __('Scode'), operate: 'LIKE'},
{field: 'indexCode', title: __('indexCode'), operate: 'LIKE'},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'reservoirprovince.name', title: __('Reservoirprovince.name'), operate: 'LIKE'},
{field: 'reservoirstate.name', title: __('Reservoirstate.name'), operate: 'LIKE'},
{field: 'reservoircounty.name', title: __('Reservoircounty.name'), operate: 'LIKE'},
{field: 'longitude', title: __('设备经度'), operate: 'LIKE'},
{field: 'latitude', title: __('设备纬度'), operate: 'LIKE'},
{field: 'reservoirlist.name', title: __('Reservoirlist.name'), operate: 'LIKE'},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
$("#c-province_id").on("change",function(){
$("#c-state_id").selectPageClear();
});
$("#c-state_id").on("change",function(){
$("#c-county_id").selectPageClear();
});
$("#c-county_id").on("change",function(){
$("#c-reservoir_id").selectPageClear();
});
$("#c-state_id").data("params", function (obj) {
return {custom: {province_id: $("#c-province_id").val()}};
});
$("#c-county_id").data("params", function (obj) {
return {custom: {state_id: $("#c-state_id").val()}};
});
$("#c-reservoir_id").data("params", function (obj) {
return {custom: {county_id: $("#c-county_id").val()}};
});
Controller.api.bindevent();
},
edit: function () {
$("#c-province_id").on("change",function(){
$("#c-state_id").selectPageClear();
});
$("#c-state_id").on("change",function(){
$("#c-county_id").selectPageClear();
});
$("#c-county_id").on("change",function(){
$("#c-reservoir_id").selectPageClear();
});
$("#c-state_id").data("params", function (obj) {
return {custom: {province_id: $("#c-province_id").val()}};
});
$("#c-county_id").data("params", function (obj) {
return {custom: {state_id: $("#c-state_id").val()}};
});
$("#c-reservoir_id").data("params", function (obj) {
return {custom: {county_id: $("#c-county_id").val()}};
});
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});