123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
-
- var selectedRow;
- var refreshGirdData;
- var typnum = 1;
- var logbegin = '';
- var logend = '';
- var bootstrap = function ($, learun) {
- "use strict";
- var page = {
- init: function () {
- page.initGird();
- page.bind();
- },
- bind: function () {
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- // 调用后台查询
- // queryJson 查询条件
- queryJson["Btime"] = logbegin;
- queryJson["Etime"] = logend;
- console.log(queryJson);
- page.search({ queryJson: JSON.stringify(queryJson) });
- }, 250);
- // 条码类型
- $('#F_barType').DataItemNumSelect({
- code: 'EBarCodeType',
- parentId: 'EBarCodeType'
- });
- $('.datetime').each(function () {
- $(this).lrdatetime({
- dfdata: [
- { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- ],
- // 月
- mShow: false,
- premShow: false,
- // 季度
- jShow: false,
- prejShow: false,
- // 年
- ysShow: false,
- yxShow: false,
- preyShow: false,
- yShow: false,
- // 默认
- dfvalue: 'all',
- selectfn: function (begin, end) {
- logbegin = begin;
- logend = end;
- }
- });
- });
- // 查询
- $('#btn_Search').on('click', function () {
- var keyword = $('#txt_Keyword').val();
- page.search({ queryJson: JSON.stringify({ Btime: logbegin, Etime: logend, keyword: $('#txt_Keyword').val() }) });
- });
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- $('#lr_import').on('click', function () {
- learun.layerForm({
- id: 'ImportForm',
- title: '导入Excel数据',
- url: top.$.rootUrl + '/Utility/ImportForm?ordertype=' + typnum,
- width: 600,
- height: 300,
- maxmin: true,
- btn: null
- });
- });
- // 新增
- $('#lr_add').on('click', function () {
- selectedRow = null;
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/BaseManager/BaseBarCode/Form',
- width: 500,
- height: 280,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- $('#btn_Print').on('click', function () {
- //$("#printIframe").attr("src", "/DataFiles/test.pdf");
- //setTimeout(function () {
- // document.getElementById('printIframe').contentWindow.print();
- //}, 200);
- var postData = $('#gridtable').jfGridGet("rowdata");
- if (postData != "") {
- if (postData.length == 0) {
- learun.alert.error('未选择行项目!');
- return false;
- }
- var options = { format: "CODE128", displayValue: false, fontSize: 12, height: 60 };
- var htmls = "";
- var i = 0;
- $.each(postData, function (index, dbdata) {
- //htmls += "<div style='width: 100%;'>";
- //htmls += "<div style='text-align: center;font-size: 28px;'>" + warehouseName + " </div>";
- htmls += "<div id='DivbarCode" + i + "'style='margin:0 auto;width: 244px;white-space:nowrap ;'>";
- htmls += "<svg id='BarCode" + i + "'> </svg>";
- htmls += "<div id='showText" + i + "' style='margin-top:0; text-align: center;font-size:12px;'></div>";
- htmls += "</div>";
- //htmls += "</div>";
- htmls += "<div style='page-break-after: always;'></div>";
- i = i + 1;
- });
- $("#pringWarea").html(htmls);
- i = 0;
- $.each(postData, function (index, dbdata) {
- var barcode = document.getElementById('BarCode' + i);
- var barval = dbdata["F_barCode"];
- JsBarcode(barcode, barval, options);
- var widths = $("#BarCode" + i).width();
- $("#DivbarCode" + i).width(widths);
- $("#showText" + i).text(barval);
- i = i + 1;
- });
- doPrint();
- var frist = JSON.stringify(postData);
- var datas = {};
- datas["postData"] = frist;
- $.lrSaveForm(top.$.rootUrl + '/BaseManager/BaseBarCode/PrintBarCode', datas, function (data) {
- if (data.IsSucc == false) {
- learun.alert.error(data.info);
- return
- }
- // page.printPdf(data.data);
- //$("#printIframe").attr("src", data.data);
- //setTimeout(function () {
- // document.getElementById('printIframe').contentWindow.print();
- //}, 200);
- });
- }
- });
- },
- initGird: function () {
- $('#gridtable').jfGrid({
- url: top.$.rootUrl + '/BaseManager/BaseBarCode/GetPageList',
- headData: [
- { label: 'ID', name: 'F_no', width: 50, align: "left" },
- { label: '条码值', name: 'F_barCode', width: 120, align: "left" },
- {
- label: '条码类型', name: 'F_barType', width: 100, align: "left"
- , formatterAsync: function (callback, value, row) {
- learun.clientdata.getAsync('dataItem', {
- Rowkey: value,
- GrpCode: 'EBarCodeType',
- getType: 'Num',
- callback: function (item) {
- callback(item.F_NAME);
- }
- });
- }
- },
- { label: '打印时间', name: 'F_printTime', width: 120, align: "left" },
- { label: '打印人', name: 'F_printUserNo', width: 120, align: "left" },
- { label: '打印次数', name: 'F_printNumber', width: 120, align: "left" },
- { label: '创建人', name: 'F_addUserNo', width: 120, align: "left" },
- { label: '创建时间', name: 'F_addTime', width: 120, align: "left" }
- ],
- mainId: 'F_no',
- sidx: 'F_no',
- isPage: true,
- isMultiselect: true,
- });
- page.search({ queryJson: JSON.stringify({ Btime: logbegin, Etime: logend, keyword: $('#txt_Keyword').val() }) });
- },
- search: function (param) {
- param = param || {};
- $('#gridtable').jfGridSet('reload', param);
- },
- printPdf: function (pdf) {
- var iframe = document.createElement('iframe');
- iframe.style.display = "none";
- iframe.src = pdf;
- document.body.appendChild(iframe);
- //iframe.contentWindow.focus();
- iframe.contentWindow.print();
- }
- };
- refreshGirdData = function () {
- page.search();
- };
- page.init();
- }
|