| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- Table.api.init({
- extend: {
- index_url: 'procuremenexport/index' + location.search,
- table: 'purchase_month_export_log',
- }
- });
- var table = $("#table");
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- sortOrder: 'desc',
- columns: [
- [
- {field: 'id', title: __('Id')},
- {field: 'ym', title: '月份', operate: 'LIKE'},
- {field: 'admin_name', title: '导出人', operate: 'LIKE'},
- {field: 'row_count', title: '明细行数', operate: false},
- {field: 'total_amount_text', title: '金额合计', operate: false},
- {field: 'createtime_text', title: '导出时间', operate: false}
- ]
- ]
- });
- Table.api.bindevent(table);
- $(document).off('click.procuremenExportMonth', '#btn-export-month-outward').on('click.procuremenExportMonth', '#btn-export-month-outward', function () {
- var d = new Date();
- var ymDefault = d.getFullYear() + '-' + ('0' + (d.getMonth() + 1)).slice(-2);
- var escYm = String(ymDefault).replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
- var html = ''
- + '<div style="padding:14px 18px 6px;">'
- + '<div class="form-group" style="margin-bottom:0;">'
- + '<input type="month" id="export-outward-ym-input" class="form-control" value="' + escYm + '" style="max-width:220px;" />'
- + '</div>'
- + '</div>';
- Layer.open({
- type: 1,
- title: '月份外发明细导出',
- area: ['370px', 'auto'],
- shadeClose: true,
- content: html,
- btn: ['导出 Excel'],
- yes: function (index, layero) {
- var v = (layero.find('#export-outward-ym-input').val() || '').trim();
- if (!/^\d{4}-\d{2}$/.test(v)) {
- Toastr.warning('请选择有效月份');
- return;
- }
- Layer.close(index);
- var url = Fast.api.fixurl('procuremen/export_month_outward?ym=' + encodeURIComponent(v));
- setTimeout(function () {
- window.open(url, '_blank');
- }, 100);
- setTimeout(function () {
- table.bootstrapTable('refresh');
- }, 1500);
- }
- });
- });
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|