| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'user/user/index',
- add_url: 'user/user/add',
- edit_url: 'user/user/edit',
- del_url: 'user/user/del',
- multi_url: 'user/user/multi',
- table: 'user',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'user.id',
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: '_id.$oid', title: __('Id'), sortable: true},
- {field: 'order_ddbh', title: __('销售订单号')},
- {field: 'gdbh', title: __('工单编号'), operate: 'LIKE'},
- {field: 'cpmc', title: __('产品名称'), operate: 'LIKE'},
- {field: 'total_ru_quantity', title: __('入库数量'), operate:false},
- {field: 'total_chu_quantity', title: __('出库数量'), operate: false},
- {field: 'remaining_quantity', title: __('剩余数量'), operate: false},
- // {field: 'email', title: __('Email'), operate: 'LIKE'},
- // {field: 'gender', title: __('Gender'), visible: false, searchList: {1: __('Male'), 0: __('Female')}},
- // {field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true},
- // {field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true},
- // {field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true},
- // {field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
- // {field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
- // {field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
- // {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
- // {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
- // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- {field: 'operate',
- title: __('Operate'),
- table: table,
- events: {
- 'click .btn-detail-out': function (e, value, row, index) {
- let url = 'user/user/chuku?order_ddbh=' + encodeURIComponent(row.order_ddbh)
- + '&gdbh=' + encodeURIComponent(row.gdbh)
- + '&cpmc=' + encodeURIComponent(row.cpmc);
- Fast.api.open(url, '出库明细', {
- area: ['80%', '80%'] // 设置弹窗大小
- });
- },
- 'click .btn-detail-in': function (e, value, row, index) {
- let url = 'user/user/ruku?order_ddbh=' + encodeURIComponent(row.order_ddbh)
- + '&gdbh=' + encodeURIComponent(row.gdbh)
- + '&cpmc=' + encodeURIComponent(row.cpmc);
- Fast.api.open(url, '入库明细', {
- area: ['80%', '80%']
- });
- },
- },
- formatter: function (value, row, index) {
- var buttons = [];
- buttons.push('<a href="javascript:;" class="btn btn-xs btn-info btn-detail-in"><i class="fa fa-sign-in"></i> 入库明细</a>');
- buttons.push('<a href="javascript:;" class="btn btn-xs btn-info btn-detail-out"><i class="fa fa-sign-out"></i> 出库明细</a>');
- return buttons.join(' ');
- }
- }
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- //切换栏目显示隐藏
- $(document).on("click", "a.btn-channel", function () {
- $("#archivespanel").toggleClass("col-md-10", $("#channelbar").hasClass("hidden"));
- $("#archivespanel").toggleClass("col-full-width", !$("#channelbar").hasClass("hidden"));
- $("#channelbar").toggleClass("hidden");
- });
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|