Jelajahi Sumber

打印添加

loustwo 4 tahun lalu
induk
melakukan
2e8703c70a

+ 15 - 4
resources/views/store/receivingTasks/_clodop_print.blade.php

@@ -1,10 +1,21 @@
 <el-dialog
-    title="提示"
+    title="打印"
     :visible.sync="clodopPrintDialogVisible"
     width="45%"
     center>
+    <el-form ref="form" :model="print_setting" label-width="80px" class="demo-form-inline" size="small">
+        <el-form-item label="打印机" size="small">
+            <el-select v-model="print_setting.printer_index" placeholder="请选择打印机" @change="switchPrinter">
+                <el-option v-for="printer in printerList" :label="printer.name" :value="printer.value"></el-option>
+            </el-select>
+        </el-form-item>
+        <el-form-item label="打印纸张">
+            <select id="print-size-select"></select>
+        </el-form-item>
+    </el-form>
+
     <span slot="footer" class="dialog-footer">
-    <el-button @click="clodopPrintDialogVisible = false">取 消</el-button>
-    <el-button type="primary" @click="clodopPrintDialogVisible = false">确 定</el-button>
-  </span>
+        <el-button @click="dialogShowOrderWorkVisible = false">关 闭</el-button>
+        <el-button type="primary" @click="clodopPrint">打 印</el-button>
+    </span>
 </el-dialog>

+ 3 - 3
resources/views/store/receivingTasks/_receiving_task_print.blade.php

@@ -1,10 +1,10 @@
 <div id="print-receiving-task" class=" container print"
      style="min-height: 450px;min-width: 750px;max-height: 450px;max-width: 750px">
-    <div id="receiving-task-print" class="d-none print" style="min-height: 450px;min-width: 750px;max-height: 450px;max-width: 750px">
-        <table class="table table-sm table-bordered text-center print">
+    <div id="receiving-task-print" class="d-none print" style="min-height: 100mm;min-width: 170mm;max-height: 100mm;max-width: 170mm">
+        <table class="table table-sm table-bordered text-center print" style="min-height: 100mm;min-width: 170mm;max-height: 100mm;max-width: 170mm">
             <tr>
                 <td rowspan="2" colspan="4" class="">
-                    <div style="width: 700px;height:120px">
+                    <div style="min-width: 100mm;min-height: 25mm">
                         <svg id="receiving-task-print-code" style="width: 100%;height: 100%" preserveAspectRatio="none">
                         </svg>
                     </div>

+ 116 - 20
resources/views/store/receivingTasks/create.blade.php

@@ -439,10 +439,13 @@
                     owner: null,                // 货主
                     appointment_number: null, // 预约号
                 },
+                clodop:null,
                 clodopPrintDialogVisible: false,
                 printerList: [],
-                printArg: {
-                    printer_name: null,
+                print_size_list:[],
+                print_setting: {
+                    printer_index: 0,
+                    print_size:'',
                 }
             },
             mounted() {
@@ -705,52 +708,145 @@
                     };
                 },
                 printLodop() {
-                    let LODOP = null;
+                    this.clodop = null;
                     try {
-                        LODOP = getLodop();
-                        console.log(LODOP);
-                        if ((LODOP != null) && (typeof (LODOP.VERSION) != "undefined")) {
-                            this.printView(LODOP);
+                        this.clodop = getLodop();
+                        if ((this.clodop != null) && (typeof (this.clodop.VERSION) != "undefined")) {
+                            this.showPrintDialog();
                         } else {
-                            this.downloadLodopConfirm();
+                            this.downloadClodopConfirm();
                         }
                     } catch (err) {
                         this.errorTempTip('getLodop error');
                     }
                 },
-                downloadLodopConfirm() {
+                downloadClodopConfirm() {
                     this.$confirm('打印组件确实,是否下在?', '提示', {
                         confirmButtonText: '确定',
                         cancelButtonText: '取消',
                         type: 'warning'
                     }).then(() => {
+                        // 下载
                         this.downloadLodop();
                     }).catch(() => {
-                        this.getPrinterList(LODOP);
-                        this.clodopPrintDialogVisible = true;
+                        // 取消下载
                     });
                 },
                 downloadLodop() {
                     let url = "{{mix('/js/lodop/CLodop_Setup_for_Win32NT.exe')}}"
                     window.open(url, '_target');
                 },
-                printView(LODOP) {
-                    this.getPrinterList(LODOP);
-                    console.log(this.printerList);
-                    let strHTML = document.getElementById("print-receiving-task").innerHTML;
-
-
+                showPrintDialog() {
+                    this.getPrinterList();
+                    this.clodopPrintDialogVisible = true;
                 },
-                getPrinterList(LODOP) {
+                getPrinterList() {
                     this.printerList = [];
-                    let count = LODOP.GET_PRINTER_COUNT();
+                    let count = this.clodop.GET_PRINTER_COUNT();
                     for (let i = 0; i < count; i++) {
                         this.printerList.push({
-                            name: LODOP.GET_PRINTER_NAME(i),
+                            name: this.clodop.GET_PRINTER_NAME(i),
                             value: i,
                         });
                     }
                 },
+                switchPrinter(){
+                    let {printer_index} = this.print_setting;
+                    let print_size_select = document.getElementById('print-size-select');
+                    this.clodop.Create_PageSize_List(print_size_select,printer_index);
+                },
+                clodopPrint(){
+                    this.clodop.PRINT_INITA(0,0,490,285,"");
+                    this.clodop.ADD_PRINT_BARCODE(20,70,350,50,"Code39","123456789012");
+                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
+                    this.clodop.ADD_PRINT_TEXT(100,15,100,20,"收货任务号");
+                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
+                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
+                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
+                    this.clodop.ADD_PRINT_TEXT(130,15,100,20,"仓库");
+                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
+                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
+                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
+                    this.clodop.ADD_PRINT_TEXT(160,15,100,20,"司机姓名");
+                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
+                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
+                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
+                    this.clodop.ADD_PRINT_TEXT(190,15,100,20,"车牌号");
+                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
+                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
+                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
+                    this.clodop.ADD_PRINT_TEXT(220,15,100,20,"是否提供清单");
+                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
+                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
+                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
+                    this.clodop.ADD_PRINT_TEXT(250,15,100,20,"货主");
+                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
+                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
+                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
+                    this.clodop.ADD_PRINT_TEXT(130,245,100,20,"投单员");
+                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
+                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
+                    this.clodop.ADD_PRINT_TEXT(160,245,100,20,"司机电话");
+                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
+                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
+                    this.clodop.ADD_PRINT_TEXT(190,245,100,20,"驾驶证号");
+                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
+                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
+                    this.clodop.ADD_PRINT_TEXT(220,245,100,20,"收货类型");
+                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
+                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
+                    this.clodop.ADD_PRINT_TEXT(250,245,100,20,"预约号");
+                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
+                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
+                    this.clodop.ADD_PRINT_TEXT(100,115,250,20,"SH210211228001");
+                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
+                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
+                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
+                    this.clodop.ADD_PRINT_TEXT(130,115,130,20,"新加文本15");
+                    this.clodop.ADD_PRINT_TEXT(160,115,100,20,"新加文本16");
+                    this.clodop.ADD_PRINT_TEXT(190,115,130,20,"新加文本17");
+                    this.clodop.ADD_PRINT_TEXT(220,115,100,20,"新加文本18");
+                    this.clodop.ADD_PRINT_TEXT(250,115,130,20,"新加文本19");
+                    this.clodop.ADD_PRINT_TEXT(130,345,100,20,"新加文本20");
+                    this.clodop.ADD_PRINT_TEXT(160,345,140,20,"新加文本21");
+                    this.clodop.ADD_PRINT_TEXT(190,345,140,20,"123456789012345678");
+                    this.clodop.ADD_PRINT_TEXT(220,345,100,20,"新加文本23");
+                    this.clodop.ADD_PRINT_TEXT(250,345,140,20,"新加文本24");
+
+
+
+
+
+                    // this.clodop.SET_PRINT_MODE("PRINT_NOCOLLATE",1);
+                    // this.clodop.ADD_PRINT_BARCODE(15,70,350,55,"Code39","123456789012");
+                    // this.clodop.SET_PRINT_STYLEA(0,"GroundColor","#ffffff");
+                    // this.clodop.ADD_PRINT_TEXT(95,15,100,20,"收货任务号");
+                    // this.clodop.SET_PRINT_STYLEA(0,"SpacePatch",1);
+                    // this.clodop.ADD_PRINT_TEXT(95,116,150,20,"-收货任务号");
+                    // this.clodop.ADD_PRINT_TEXT(125,15,100,20,"仓库");
+                    // this.clodop.ADD_PRINT_TEXT(155,15,100,20,"司机姓名");
+                    // this.clodop.ADD_PRINT_TEXT(190,15,100,20,"车牌号");
+                    // this.clodop.ADD_PRINT_TEXT(225,15,100,20,"是否提供清单");
+                    // this.clodop.ADD_PRINT_TEXT(260,15,100,20,"货主");
+                    // this.clodop.ADD_PRINT_TEXT(125,260,100,20,"投单员");
+                    // this.clodop.ADD_PRINT_TEXT(155,260,100,20,"司机电话");
+                    // this.clodop.ADD_PRINT_TEXT(190,260,100,20,"驾驶证号");
+                    // this.clodop.ADD_PRINT_TEXT(225,260,100,20,"收货类型");
+                    // this.clodop.ADD_PRINT_TEXT(260,260,100,20,"预约号");
+                    // this.clodop.ADD_PRINT_TEXT(125,115,130,20,"-仓库");
+                    // this.clodop.ADD_PRINT_TEXT(155,115,130,20,"-司机姓名");
+                    // this.clodop.ADD_PRINT_TEXT(190,115,130,20,"-车牌号");
+                    // this.clodop.ADD_PRINT_TEXT(225,115,130,20,"-是否提供清单");
+                    // this.clodop.ADD_PRINT_TEXT(260,115,130,20,"-货主");
+                    // this.clodop.ADD_PRINT_TEXT(125,360,130,20,"-投单员");
+                    // this.clodop.ADD_PRINT_TEXT(155,360,130,20,"-司机电话");
+                    // this.clodop.ADD_PRINT_TEXT(190,361,130,20,"-驾驶证号");
+                    // this.clodop.ADD_PRINT_TEXT(225,360,130,20,"-收货类型");
+                    // this.clodop.ADD_PRINT_TEXT(260,360,130,20,"-预约号");
+                    // this.clodop.SET_PRINTER_INDEXA(document.getElementById("print-size-select").value);
+                    // this.clodop.SET_PRINT(document.getElementById("print-size-select").value);
+                    this.clodop.PREVIEW();
+                }
             }
         })
     </script>