define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'LodopFuncs'], function ($, undefined, Backend, Table, Form, LodopFuncs) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init(); this.table.first(); this.table.second(); //绑定 // $('#bind').click(function (e) { // var ids = $('#table1').bootstrapTable('getSelections')[0]['id']; // // $.get('qcode_bach/bind',{'ids':ids},function (data) { // if(data.code==1){ // Toastr.success(data.msg) // $('#table2').bootstrapTable('refresh'); // }else{ // Toastr.error(data.msg) // } // },'json'); // layer.confirm('确定提交选中的 1 项?!', { // btn: ['确定', '取消'], // cancel: function(index, layero) { // } // },function (index) { // $.get('qcode_bach/bind',{'ids':ids},function (data) { // if(data.code==1){ // Toastr.success(data.msg) // table2.bootstrapTable('refresh'); // }else{ // Toastr.error(data.msg) // } // },'json'); // Layer.close(index); // // },function (){}) // }) //绑定 // $('#unbind').click(function (e) { // layer.confirm('确定提交选中的 1 项?!', { // btn: ['确定', '取消'], // cancel: function(index, layero) { // } // },function (index) { // var ids = $('#table2').bootstrapTable('getSelections')[0]['id']; // // $.get('qcode_bach/unbind',{'ids':ids},function (data) { // if(data.code==1){ // Toastr.success(data.msg) // $('#table2').bootstrapTable('refresh'); // }else{ // Toastr.error(data.msg) // } // },'json'); // Layer.close(index); // // },function (){}) // // }) }, table: { first: function () { // 表格1 var table1 = $("#table1"); table1.bootstrapTable({ url: 'qcode_bach/table1', extend: { index_url: 'qcode_bach/table1' + location.search, add_url: 'qcode_bach/add', edit_url: 'qcode_bach/edit', del_url: 'qcode_bach/del', table: 'qcode_bach', }, onClickRow:function(row, $element, field) { console.log(JSON.stringify(row)); }, toolbar: '#toolbar1', pk: 'id', sortName: 'id', pageSize: 8, pageList: [8, 20, 50, 'All'], search: false, singleSelect: true, columns: [ [ {checkbox: true}, {field: 'matter_name', title: __('Matter_name'), operate: 'LIKE'}, {field: 'l_flow', title: __('L_flow'), operate: 'LIKE'}, {field: 'large_endnum', title: __('Large_endnum'), operate: 'LIKE'}, {field: 'bach_num', title: __('Bach_num'), operate: 'LIKE'}, {field: 'larger_num', title: __('Larger_num'), operate: 'LIKE'}, {field: 'print_date', title: __('Print_date'), operate: 'LIKE'}, {field: 'company_name', title: __('Company_name'), operate: 'LIKE'}, {field: 'matter_no', title: __('Matter_no'), operate: 'LIKE'}, // {field: 'notes', title: __('Notes')}, {field: 'operate', title: __('Operate'), table: table1, events: Table.api.events.operate, formatter: Table.api.formatter.operate} ] ] }); // 为表格1绑定事件 Table.api.bindevent(table1); }, second: function () { // 表格2 var table2 = $("#table2"); table2.bootstrapTable({ url: 'qcode_bach/table2', extend: { index_url: '', add_url: '', edit_url: '', del_url: '', multi_url: '', table: '', }, toolbar: '#toolbar2', pk: 'id', sortName: 'id', pageSize: 8, pageList: [8, 20, 50, 'All'], search: false, singleSelect: true, columns: [ [ {checkbox: true}, {field: 'l_flow', title: __('当前托盘'), operate: 'LIKE'}, {field: 'code', title: __('Code'), operate: 'LIKE'}, {field: 'print_date', title: __('Print_date'), operate: 'LIKE'}, {field: 'p_nums', title: __('P_nums'), operate: 'LIKE'}, {field: 'small_num', title: __('Small_num'), operate: 'LIKE'}, {field: 'l_weight', title: __('L_weight'), operate: 'LIKE'}, {field: 'l_print', title: __('L_print'), operate: 'LIKE'}, {field: 'l_status', title: __('L_status'), operate: 'LIKE'}, // {field: 'notes', title: __('Notes')}, // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} ] ] }); // 为表格2绑定事件 Table.api.bindevent(table2); } }, /*recyclebin: function () { // 初始化表格参数配置 Table.api.init({ extend: { 'dragsort_url': '' } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: 'qcode_bach/recyclebin' + location.search, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'name', title: __('Name'), align: 'left'}, { field: 'deletetime', title: __('Deletetime'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime }, { field: 'operate', width: '140px', title: __('Operate'), table: table, events: Table.api.events.operate, buttons: [ { name: 'Restore', text: __('Restore'), classname: 'btn btn-xs btn-info btn-ajax btn-restoreit', icon: 'fa fa-rotate-left', url: 'qcode_bach/restore', refresh: true }, { name: 'Destroy', text: __('Destroy'), classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit', icon: 'fa fa-times', url: 'qcode_bach/destroy', refresh: true } ], formatter: Table.api.formatter.operate } ] ] }); // 为表格绑定事件 Table.api.bindevent(table); },*/ add: function () { Controller.api.bindevent(); }, edit: function () { Controller.api.bindevent(); }, reprint: function () { $("#sel-n").data("params", function (obj) { //obj为SelectPage对象 return {custom: {name: $("#sel-n").val()}}; }); $("#sel-p").data("params", function (obj) { //obj为SelectPage对象 return {custom: {name: $("#sel-p").val()}}; }); $("#sel-c").data("params", function (obj) { //obj为SelectPage对象 return {custom: {name: $("#sel-c").val()}}; }); $("#btn").click(function (e) { e.preventDefault(); var data = $("form").serialize(); $.post('qcode_bach/reprint',{data},function (res) { if (res.code==1){ //打印二维码 var html = '\n' + '
\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '
'+res.data.company_name+'
规格:'+res.data.product_name+'
配盘数:'+res.data.sqrcd+'辅单位:'+res.data.sec_unit+'
数量:'+res.data.num+'主单位:'+res.data.main_unit+'
生产日期:'+res.data.date+'
生产批号:'+res.data.batch+'
'+res.data.qrcode+'
\n' + '
\n' + ' \n' + '
\n' + '
大件号'+res.data.l_flow+'
\n' + '
'; var printPdf = (html,qrcode) => { let LODOP=getLodop(); LODOP.SET_LICENSES("","152A06E8F6CBD6AC1F213ABFCB0D8604","C94CEE276DB2187AE6B65D56B3FC2848",""); LODOP.PRINT_INIT("河南中烟大件二维码打码"); LODOP.SET_PRINT_STYLE("FontSize",16); LODOP.SET_PRINT_STYLE("Bold",1); LODOP.SET_PRINT_PAGESIZE(1, 1000, 1500, "CreateCustomPage"); LODOP.ADD_PRINT_HTM(15,20,350,545,html); // LODOP.SET_PRINT_STYLEA(0,"QRCodeVersion",14); // LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M"); // LODOP.ADD_PRINT_BARCODE(18,715,'27mm','27mm',"QRCode",qrcode); // LODOP.PRINT() // 直接打印 // LODOP.PRINT_DESIGN() // 设计模式 LODOP.PREVIEW() //打印预览 } printPdf(html) }else{ Toastr.error(res.msg); } }) }) Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });