text: define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  
      var Controller = {
          index: function () {
              // 初始化表格参数配置
              Table.api.init({
                  extend: {
                      index_url: 'general/replacedsource/index',
                      add_url: 'general/replacedsource/add',
                      edit_url: 'general/replacedsource/edit',
                      del_url: 'general/replacedsource/del',
                      multi_url: 'general/replacedsource/multi',
                      table: 'image_class',
                  }
              });
  
              var table = $("#table");
  
              // 初始化表格
              table.bootstrapTable({
                  url: $.fn.bootstrapTable.defaults.extend.index_url,
                  pk: 'id',
                  sortName: 'weigh',
                  columns: [
                      [
                          {checkbox: true},
                          {field: 'id', title: __('Id'), operate:false},
                          {field: 'status', title: __('Status'), formatter: Controller.api.formatter.status, operate:false},
                          {field: 'weigh', title: __('Weigh'), operate:false},
                          {field: 'name', title: __('Name')},
                          {field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime, operate:false},
                          {field: 'updatetime', title: __('Updatetime'), formatter: Table.api.formatter.datetime, operate:false},
                          {field: 'operate', title: __('Operate'), 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]"));
              },
              formatter : {
                  status: function (value, row, index) {
                      //颜色状态数组,可使用red/yellow/aqua/blue/navy/teal/olive/lime/fuchsia/purple/maroon
                      var colorArr = {"1": 'success', "0": 'grey', "-1": 'danger'};
                      var color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
                      switch(value){
                          case '1':
                              value = '正常';
                              break;
                          case '0':
                              value = '隐藏';
                              break;
                          case '-1':
                              value = "已删除";
                              break;
                      }
                      //渲染状态
                      var html = '<span class="text-' + color + '"><i class="fa fa-circle"></i> '+ value+ '</span>';
                      return html;
                  }
              }
          }
      };
      return Controller;
  });