javascript.stub
4.01 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
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'fastflow-base'], function ($, undefined, Backend, Table, Form, FastflowBase) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: '{%controllerUrl%}/index' + location.search,
add_url: '{%controllerUrl%}/add',
edit_url: '{%controllerUrl%}/edit',
del_url: '{%controllerUrl%}/del',
multi_url: '{%controllerUrl%}/multi',
import_url: '{%controllerUrl%}/import',
table: '{%table%}',
}
});
var table = $("#table");
table.on('post-common-search.bs.table', function (event, table) {
var form = $("form", table.$commonsearch);
$("input[name='initiator_id']", form).addClass("selectpage").data("source", "fastflow/flow/flow/getSelectpageWorkers?scope=1").data("primaryKey", "id").data("field", "initiator").data("orderBy", "id asc");
Form.events.selectpage(form);
});
table.on('post-body.bs.table', function (e, data) {
$('#table').bootstrapTable('expandAllRows');
$('#table').bootstrapTable('collapseAllRows');
});
table.on('load-success.bs.table', function (e, data) {
FastflowBase.api.renderbadge();
});
$(window).resize( function () {
table.bootstrapTable('resetView');
});
var fixedColumnsEnable = true;
if ($(window).width() < 600){
fixedColumnsEnable = false;
}
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: '{%pk%}',
sortName: '{%order%}',
detailView: true,
detailFormatter: FastflowBase.api.formatter.detail,
fixedColumns: fixedColumnsEnable,
fixedRightNumber: 1,
rowStyle: function (row, index) {
return {
css: {
border: '1px solid #eaeaea'
}
};
},
columns: [
[
{%javascriptList%},
{field: 'initiator_id', title: __('Initiator_id'), visible: false},
{field: 'initiator', title: __('流程发起人'), operate: false},
{field: 'status', title: __('状态'), searchList: {"0": __('Status 0'),"1": __('Status 1'),"2": __('Status 2'),"3": __('Status 3')}, formatter: Table.api.formatter.status, custom: {'0': 'warning', '1': 'success', '2': 'info', '3': 'danger'}},
{field: 'flow_progress', title: __('流程进度'), operate: false, formatter: FastflowBase.api.formatter.progress},
{field: '', title: __('流程控制'), width:"250", operate: false, table: table, events: FastflowBase.api.events.flowinfo, formatter: FastflowBase.api.formatter.flowinfo},
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
FastflowBase.api.bindevent(table);
},{%recyclebinJs%}
add: function () {
Controller.api.bindevent();
},
edit: function () {
if (Config.billFileds){
Config.billFileds.forEach(function (item) {
if ($.inArray(item, Config.canEditFields) === -1) {
$('[name="row[' + item + ']"]').attr('disabled','disabled');
}
});
}
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
},
}
};
return Controller;
});