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; });