| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 | define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {    var Controller = {        index: function () {            // 初始化表格参数配置            Table.api.init({                extend: {                    index_url: 'risk_live_question/index' + location.search,                    // add_url: 'risk_live_question/add',                    // edit_url: 'risk_live_question/edit',                    // del_url: 'risk_live_question/del',                    // multi_url: 'risk_live_question/multi',                    // import_url: 'risk_live_question/import',                    table: 'risk_live_question',                }            });            var table = $("#table");            // 初始化表格            table.bootstrapTable({                url: $.fn.bootstrapTable.defaults.extend.index_url,                pk: 'id',                sortName: 'id',                columns: [                    [                        {checkbox: true},                        {field: 'order_number', title: __('Id')},                        //{field: 'risk_live_id', title: __('Risk_live_id')},                        {field: 'question', title: __('问题')},						{field: 'plan', title: __('措施')},                        //{field: 'status', title: __('Status'), searchList: {"未完成":__('未完成'),"已完成":__('已完成')}, formatter: Table.api.formatter.status},                        // {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},                        // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},                        //{field: 'file', title: __('File'), formatter: Controller.api.formatter.thumb, operate: false},						{field: 'picture', title: __('图片'), formatter: Controller.api.formatter.thumb, operate: false},                        {field: 'file_name', title: __('文件'), operate: 'LIKE',formatter: Controller.api.formatter.link},                         {field: 'time_limit', title: __('整改时限')},                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,buttons: [							{								name: '审批',								text: '审批',								title: '审批',								classname: 'btn btn-xs btn-info btn-view btn-dialog ',								icon: 'fa fa-search',								url: 'risk_live_question/examine',								extend: 'data-area=\'["450px","70%"]\'',								visible: function (row) {									if (row['state'] == 0) {										return true;									} else {										return false;									}								},								refresh: true							},							{								name: '审批已通过',								text: '审批已通过',								title: '审批已通过',								classname: 'btn btn-xs btn-info btn-view',								icon: 'fa',								//url: 'risk_live_question/examine',								//extend: 'data-area=\'["1000px","80%"]\'',								visible: function (row) {									if (row['state'] == 1) {										return true;									} else {										return false;									}								},								refresh: true							},							{								name: '审批不通过',								text: '审批不通过',								title: '审批不通过',								classname: 'btn btn-xs btn-info btn-view',								icon: 'fa',								//url: 'risk_live_question/examine',								//extend: 'data-area=\'["1000px","80%"]\'',								visible: function (row) {									if (row['state'] == 2) {										return true;									} else {										return false;									}								},								refresh: true							},{								name: '重新整改',								text: '重新整改',								title: '重新整改',								classname: 'btn btn-xs btn-info btn-dialog',								icon: 'fa',								//url: 'risk_live_question/examine1',								url:function(row){									return 'risk_live_question/examine1?ids='+row['id'];								},								//extend: 'data-area=\'["1000px","80%"]\'',								visible: function (row) {									if (row['state'] == 2) {										return true;									} else {										return false;									}								},								refresh: true							}						], formatter: Table.api.formatter.operate}                    ]                ]            });            // 为表格绑定事件            Table.api.bindevent(table);        },        add: function () {            Controller.api.bindevent();        },        edit: function () {            Controller.api.bindevent();        },		examine: function () {		    Controller.api.bindevent();		},        api: {            bindevent: function () {                Form.api.bindevent($("form[role=form]"));            },            formatter: {                thumb: function (value, row, index) {                    return '<a href="' + value + '" class="btn-dialog"><img src="' + value + '" alt="" style="max-height:90px;max-width:120px"></a>';                },                url: function (value, row, index) {                    return '<a href="' + row.fullurl + '" target="_blank" class="label bg-green">' + row.url + '</a>';                },                link: function (value, row, index) {                    return '<a href="' + row.file + '" target="_blank" class="label bg-green">' + row.file_name + '</a>';                },                filename: function (value, row, index) {                    return '<div style="width:180px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + Table.api.formatter.search.call(this, value, row, index) + '</div>';                },            }        }    };    return Controller;});
 |