瀏覽代碼

页面修改

ajun 4 年之前
父節點
當前提交
210fc6a00d

+ 27 - 0
resources/views/maintenance/expressPrinting/image/_table.blade.php

@@ -0,0 +1,27 @@
+<table class="table table-striped table-sm table-hover" id="table">
+    <thead>
+    <tr>
+        <td>序号</td>
+        <td>名称</td>
+        <td>图片</td>
+        <td>操作</td>
+    </tr>
+    </thead>
+    <tbody>
+    <template v-for="(item,i) in images">
+        <tr @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
+            <td>@{{ i+1 }}</td>
+            <td>@{{ item.name }}</td>
+            <td>
+                <img :src="imgPrefix+item.file.url+'.'+item.file.type" :alt="item.name" :id="'img'+item.id"  :onload="setImageStyle(item)" >
+            </td>
+            <td>
+                <button class="btn btn-sm btn-primary" @click="edit(item,i)">编辑</button>
+                <button class="btn btn-sm btn-danger " style="opacity: 0.9" @click="destroy(item.id,i)">删除</button>
+            </td>
+        </tr>
+    </template>
+
+    </tbody>
+</table>
+{{ $printPartImages->links() }}

+ 16 - 7
resources/views/maintenance/expressPrinting/part/image/index.blade.php → resources/views/maintenance/expressPrinting/image/index.blade.php

@@ -4,15 +4,14 @@
 @section("content")
     <div class="container-fluid d-noe" id="list">
         <div class="card">
-
-            @include('maintenance.expressPrinting.print.image._create')
+            @include('maintenance.expressPrinting.image._create')
             <div class="card-body">
                 <div class="row pull-left m-1">
                     <button class="btn btn-outline-info mb-1 mr-3" @click="showCreatedModel"><span
                             class="fa fa-plus"></span>&nbsp;新&nbsp;&nbsp;增
                     </button>
                 </div>
-                @include('maintenance.expressPrinting.print.image._table')
+                @include('maintenance.expressPrinting.image._table')
             </div>
         </div>
     </div>
@@ -21,9 +20,11 @@
 @section('lastScript')
     <script>
         let list = new Vue({
-            el:'list',
+            el:'#list',
             data:{
                 images:{!! $printPartImages->toJson() !!}['data'],
+                notFindImgUrl:'{!! url('/icon/img404-thumbnail.jpg') !!}',
+                imgPrefix:"{{asset("/storage")}}",
                 selectTr:null,
                 isCreated:null,
                 editItem:{},
@@ -37,8 +38,9 @@
                     this.isCreated = true;
                     $("#imageModal").modal("show");
                 },
-                edit(){
+                edit(item){
                     this.isCreated = false;
+                    this.editItem = JSON.parse(JSON.stringify(item))
                     $("#imageModal").modal("show");
                 },
                 save(){
@@ -49,7 +51,7 @@
                     data.set("file",file);
                     if (!this.isCreated)  {
                         url = '{{url("apiLocal/maintenance/expressPrinting/part/image/update")}}'
-                        data.set("id",this.);
+                        data.set("id",this.index);
                     };
 
                     window.tempTip.setIndex(2000);
@@ -61,7 +63,8 @@
                             if (this.isCreated){
                                 this.images.unshift(res.data.data);
                             } else {
-                                this.$set(this.images,index,res.data.data);
+                                this.$set(this.images,this.index,res.data.data);
+                                document.getElementById('img'+this.editItem.id).setAttribute('src',this.imgPrefix+res.data.data.file.url+'.'+res.data.data.file.type);
                             }
                             this.$forceUpdate();
                             $('#imageModal').modal('hide');
@@ -85,6 +88,12 @@
                     }).catch(err=>{
                         window.tempTip.show(err)
                     });
+                },
+                setImageStyle(image){
+                    console.log('img'+image.id);
+                    let img =  document.getElementById('img'+image.id);
+                    // let height = img.getAttribute('height');
+                    // img.setAttribute('height',int(height)  * (120 / int(height)));
                 }
             }
         })

+ 0 - 24
resources/views/maintenance/expressPrinting/part/image/_table.blade.php

@@ -1,24 +0,0 @@
-<table class="table table-striped table-sm table-hover" id="table">
-    <thead>
-    <tr>
-        <td>序号</td>
-        <td>名称</td>
-        <td>图片</td>
-        <td>操作</td>
-    </tr>
-    </thead>
-    <tbody>
-    <tr v-for="(item,i) in  images" @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
-        <td>@{{ i+1 }}</td>
-        <td></td>
-        <td></td>
-        <td></td>
-        <td></td>
-        <td>
-            <button class="btn btn-sm btn-primary" @click="edit(printer,i)">编辑</button>
-            <button class="btn btn-sm btn-danger " style="opacity: 0.9" @click="destroy(printer,i)">删除</button>
-        </td>
-    </tr>
-    </tbody>
-</table>
-{{ $printPartImages->links()}}

+ 51 - 57
resources/views/maintenance/expressPrinting/print/template.blade.php

@@ -7,14 +7,14 @@
         <div class="card">
             <div class="card-header">
                 <label>
-                    <input type="text" name="printStr" class="form-control">
+                    <input type="text" name="printStr" class="form-control" ref="printStr">
                 </label>
             </div>
             <div class="card-body">
-                <button @click="getPrintRequest">获取</button>
-                <button @click="pushGoPrintData">打印</button>
-                <button @click="resetGoWebsocket">recon</button>
-                <button @click="uploadPrintData">上传</button>
+                <button @click="getPrintItems">获取</button>
+{{--                <button @click="pushGoPrintData">打印</button>--}}
+{{--                <button @click="resetGoWebsocket">recon</button>--}}
+{{--                <button @click="uploadPrintData">上传</button>--}}
             </div>
             <div class="alert-success" v-if="goWebSocketStatus">
                 链接成功
@@ -38,7 +38,7 @@
         let vue = new Vue({
             el: '#list',
             data: {
-                data: [],
+                printItems: [],
                 goWebSocketPath: "ws://127.0.0.1:11101/print",
                 goWebSocket: null,
                 goWebSocketStatus: false,
@@ -49,10 +49,10 @@
 
             },
             mounted() {
-                this.getGoWebSocket();
+                this.initGoWebSocket();
             },
             methods: {
-                getGoWebSocket() {
+                initGoWebSocket() {
                     if (this.goWebSocket) return this.goWebSocket;
                     this.goWebSocket = new window.WebSocket(this.goWebSocketPath);
                     this.goWebSocket.onmessage = this.receiveGoWebSocketMessage;
@@ -61,10 +61,15 @@
                 closeGoWebSocket() {
                     this.goWebSocket.close();
                 },
-                getPrintRequest() {
-                    let self = this;
+                getPrintItems() {
                     let url = '{{url('apiLocal/maintenance/print/getData')}}'
-                    window.axios.get(url).then(res => {
+
+                    let data = {
+                        printStr:this.$refs.printStr,
+                    };
+
+                    window.axios.post(url,data).then(res => {
+                        console.log(res.data)
                         this.printData = res.data.data
                         this.$forceUpdate();
                         console.log(this.printData);
@@ -72,65 +77,54 @@
                         console.log(err);
                     });
                 },
-                pushGoPrintData() {
-                    let self = this;
-                    this.printData.forEach(function (item) {
-                        let json = JSON.stringify(item);
-                        self.getGoWebSocket().send(json);
-                    })
-                },
+
+
+                // TODO GoWs 返回信息
                 receiveGoWebSocketMessage(meg) {
                     console.log("receiveGoWebSocketMessage");
-                    let params = JSON.parse(meg.data)
-                    if(params.success ==="false"){
-                        alert(params.message)
-                    }else if (params.success ==="true"){
-                        let imgBase64 = params.data;
-                        let base64String = "data:image/gif;base64," + imgBase64;
-                        document.getElementById("img").setAttribute("src",base64String)
-                        // js/base64图片 base64String
-                        this.uploadData.push({
-                            'base64':base64String
-                        })
-                        console.log(this.uploadData);
-                        this.$forceUpdate()
-                    }
-                },
-                getPreviewRequest(item, taskId) {
-                    return {
-                        cmd: "print",
-                        requestID: "123458976",
-                        letsion: '1.0',
-                        firstDocumentNumber: 0,
-                        totalDocumentCount: 1,
-                        task: {
-                            taskID: '123458976123',
-                            preview: true,
-                            printer: '',
-                            notifyMode: 'allInOne',
-                            previewType: 'image',
-                            documents: [{
-                                documentID: "123123123",
-                                contents: [{
-                                    encryptedData: item['encryptedData'],
-                                    signature: item['encryptedData'],
-                                    templateURL: item['templateURL'],
-                                    ver: item['ver']
-                                }],
-                            }],
+                    let res = JSON.parse(meg.data)
+                    if (res.operation === 'print'){
+                        if(res.status === true){
+
                         }
-                    };
+                    } else if(res.operation === 'preview'){
+                        if (res.status === true){
+
+                        }
+                    }
                 },
+                // TODO 重置GoWs链接
                 resetGoWebsocket() {
                     this.goWebSocket = new window.WebSocket(this.goWebSocketPath);
                     this.goWebSocket.onmessage = this.receiveGoWebSocketMessage;
                 },
+                // TODO 发送到后台进行加工
                 uploadPrintData(){
                     let url = "{{url("apiLocal/maintenance/print/uploadPrintData")}}";
-                    let data = {printData:this.uploadData}
+                    let data = {printData:this.printItems}
                     window.axios.post(url,data).then(res=>{
+
                     }).then(err=>{
+
                     })
+                },
+                // TODO 推动到GoWs 获取打印图片
+                wsGetImage(){
+                    let self = this;
+                    this.initGoWebSocket();
+                    this.printItems.each(function(item){
+                        item['operation'] = 'preview';
+                        self.goWebSocket.send(JSON.stringify(item))
+                    });
+                },
+                // TODO 推动到GoWs 进行打印
+                wsPrintImage(){
+                    this.initGoWebSocket();
+                    let self = this;
+                    this.printItems.each(function(item){
+                        item['operation'] = 'print';
+                        self.goWebSocket.send(JSON.stringify(item));
+                    });
                 }
             }
         });

+ 96 - 62
resources/views/maintenance/expressPrinting/template/create.blade.php

@@ -1,5 +1,5 @@
 @extends('layouts.app')
-@section('title')模板@endsection
+@section('title')模板-创建@endsection
 
 @section('content')
     <div class="container-fluid d-none row m-1" id="print-template">
@@ -27,13 +27,28 @@
         let vue = new Vue({
             el: "#print-template",
             data: {
-                printParts:{!! $printParts !!},
+                printParts: [
+                        @foreach($printParts as $items)
+                    {
+                        name: '{{ $items['name'] }}', value: {
+                            @foreach($items['value'] as $key=>$value)
+                            '{{$key}}': '{{$value}}',
+                            @endforeach
+                        }
+                    },
+                    @endforeach
+                ],
+                imgPrefix:"{{asset("/storage")}}",
+                images:{!! $printPartImages ?? [] !!},
                 filterPrintParts: [],
                 producePanel: {},              // 背景版
                 selectProducePanel: false,              // 是否选中背景版
                 productionParts: {
+                    bg: null,
                     printParts: [],                  // 组件
-                    editPart: null,                    // 编辑中的组件
+                    editPart: {
+                        id:null
+                    },                  // 编辑中的组件
                     editIndex: {},                   // 编辑中组件的下标
                     addPart: {},                     // 添加模板
                 },
@@ -46,7 +61,6 @@
                 z_index: 10,
             },
             mounted() {
-                this.initProductionParts();
                 $('.navbar,.nav1,.nav2').hide();
                 $('.nav3').on('mouseenter', function () {
                     $('.navbar,.nav1,.nav2').show();
@@ -60,22 +74,41 @@
                 // 添加组件至面板上
                 _addPartToProductionPanel(printPart) {
                     let _clone = JSON.parse(JSON.stringify(printPart));
-                    let print_part = JSON.parse(_clone.value);
-                    print_part.left = 0;
-                    print_part.top = 0;
+                    let print_part = _clone.value
+                    if (!this.productionParts.bg && print_part.type !== 'bg') {
+                        window.tempTip.show('先添加背景组件在进行其他组件的添加');
+                        return
+                    } else if (this.productionParts.bg && print_part.type === 'bg') {
+                        window.tempTip.show('背景组件请勿重复添加');
+                        return
+                    }
+                    if (print_part.type === 'bg') {
+                        this.productionParts.bg = print_part;
+                        return;
+                    }
                     print_part.index = this.productionParts.printParts.length;
-                    print_part.z_index = this.z_index++;
+                    this.z_index+=1
+                    print_part.z_index = this.z_index;
                     print_part.id = "id" + this.z_index;
                     print_part.text = null;
-                    this.productionParts.printParts.push(print_part);
-                    if (print_part.type === "StripeCode") {
+                    this.productionParts.printParts.push(print_part);  // 添加入组件列表中
+                    if (print_part.type === "stripeCode") {
                         setTimeout(function () {
-                            window.setBarcode("0123456789", "#" + print_part.id, 2, 50, true)
+                            window.setBarcode("0123456789", "#svg" + print_part.id, 2, 50, true)
                         }, 100);
-                    } else if (print_part.type === "QrCode"){
-                        setTimeout(function(){
-                            QRCode.toCanvas(document.getElementById("#"+print_part.id),"占位二维码",function(err){});
-                        },100)
+                    } else if (print_part.type === "qRCode") {
+                        setTimeout(function () {
+                            new QRCode(document.getElementById(print_part.id), {
+                                text: "0123456789",
+                                width: print_part.width,
+                                height: print_part.height,
+                                colorDark : "#000000",
+                                colorLight : "#ffffff",
+                                correctLevel : QRCode.CorrectLevel.H
+                            });
+                        }, 1000)
+                    } else if (print_part.type === "image") {
+
                     }
                 },
                 // 从面板删除组件
@@ -89,14 +122,6 @@
                     this.productionParts.printParts.splice(this.productionParts.editIndex, 1);
                     this.$forceUpdate();
                 },
-                // 查询组件
-                _searchPrintPart(event) {
-                    let value = $(event.target).val();
-                    this.filterPrintParts = this.printParts.filter(function (printPart) {
-                        return printPart.name.includes(value);
-                    });
-                    if (value === null || value === '') this.filterPrintParts = JSON.parse(JSON.stringify(this.printParts));
-                },
                 // 打开保存modal
                 showSaveModal() {
                     $('#saveModal').modal('show');
@@ -106,12 +131,7 @@
                     tempTip.setDuration(3000);
                     tempTip.setIndex(1999);
                     let printTemplate = JSON.parse(JSON.stringify(this.productionParts.printParts));
-                    let bg = {
-                        type: 'bg',
-                        'width': this.producePanel.width,
-                        'height': this.producePanel.height,
-                    }
-                    printTemplate.push(bg);
+                    printTemplate.push(this.productionParts.bg);
                     let data = {
                         name: this.productionParts.addPart.name,
                         value: printTemplate
@@ -127,57 +147,71 @@
                         tempTip.show(err);
                     });
                 },
-                // 初始化编辑面板
-                initProductionParts() {
-                    this.productionParts = {printParts: [], editPart: null, addPart: {}};
-                    this.filterPrintParts = JSON.parse(JSON.stringify(this.printParts));
-                    let height = (window.innerHeight - 120) + 'px';
-                    $("#production_panel,#part_panel,#compile_panel,#select-panel,#produce-panel").css({height: height});
-                    let produce_panel = $("#produce-panel");
-                    produce_panel.css({height: height});
-                },
-                //
-                getPrintPartStyle(item) {
-                    let style = JSON.parse(JSON.stringify(item));
-                    style['border-style'] = style.borderStyle;
-                    style['border-width'] = style.borderWidth + 'px';
-                    if (style.borderStyle === 'none') {
-                        style['border-style'] = 'dotted';
-                        style['border-width'] = '1px';
-                    }
-                    style.display = 'flex';
-                    style['font-size'] = style.fontSize + 'px';
-                    style['font-weight'] = style.fontWeight;
-                    style['justify-content'] = style.justifyContent;
-                    style['align-items'] = style.alignItems;
-                    style.width += 'px';
-                    style.height += 'px';
-                    style.left += 'px';
-                    style.top += 'px';
-                    style['white-space'] = 'pre';              // 字体换行
-                    return style;
-                },
                 // 开始拖动元素时触发
                 _dragstart(item, $event) {
+                    console.log(item)
                     this.selectPrintPartPoint = {x: parseInt(item.left), y: parseInt(item.top)};
                     this.mousePointStart = {x: $event.offsetX, y: $event.offsetY};
                 },
                 // 结束拖动元素时触发
                 _dragend(item, $event) {
+                    console.log(item)
                     this.mousePointEnd = {x: $event.offsetX, y: $event.offsetY};
                     let left = item.left - (this.mousePointStart.x - this.mousePointEnd.x);
                     let top = item.top - (this.mousePointStart.y - this.mousePointEnd.y);
                     item.left = left > 0 ? left : 0;
                     item.top = top > 0 ? top : 0;
                 },
-                editProducePanel() {
-                    this.selectProducePanel = !this.selectProducePanel;
-                },
                 getProducePanelStyle() {
                     return {
                         width: this.producePanel.width + 'px',
                         height: this.producePanel.height + 'px',
                     }
+                },
+                getStyle(item) {
+                    let style =  {
+                        width: item.width + 'px',
+                        height: item.height + 'px',
+                        left: item.left + 'px',
+                        top: item.top + 'px',
+                        'z-index' : item['z_index'],
+                    };
+                    if (item.type === 'textBox'){
+                        style['font-size'] = item['font-size'];
+                        style['border-width'] = item['border-width']+'px';
+                        style['border-color'] = '#000';
+                        style['border-style'] = 'solid';
+                        style['display'] = 'flex'
+                        style['justify-content'] = item['justify-content']
+                        style['align-items'] = item['align-items']
+                        style['text-align'] = 'center'
+                    } else if (item.type === 'qRCode'){
+                        style.heigth = style.width;
+                        let scale = item.scale;
+                        style.transform =  `scale(${scale},${scale})`;
+                    } else if (item.type === 'stripeCode'){
+                        let scale = item.scale;
+                        style.transform =  `scale(${scale},${scale})`;
+                    }
+                    return style;
+                },
+                getImageSrc(image){
+                    return this.imgPrefix+image.file.url+'.'+image.file.type
+                },
+                setImageBg(image){
+                    let src =  this.getImageSrc(image);
+                    this.productionParts.editPart.text = image.name;
+                    document.getElementById(this.productionParts.editPart.id).setAttribute('src',src) ;
+                },
+                changeStripeCodeWidth(){
+                    let default_width = 404;
+                    if (this.productionParts.editPart.type === 'qRCode')default_width = 100;
+                    this.productionParts.editPart.scale = this.productionParts.editPart.width / default_width;
+                },
+                changeStripeCodeScale(){
+                    let default_width = 404;
+                    if (this.productionParts.editPart.type === 'qRCode')default_width = 100;
+                    this.productionParts.editPart.width = default_width * this.productionParts.editPart.scale;
                 }
             }
         });

+ 200 - 0
resources/views/maintenance/expressPrinting/template/edit.blade.php

@@ -0,0 +1,200 @@
+@extends('layouts.app')
+@section('title')模板-编辑@endsection
+
+@section('content')
+    <div class="container-fluid d-none row m-1" id="print-template">
+        <div class="col-lg-2 col-sm-3 p-0" id="part_panel">
+            {{--  组件选择面板 --}}
+            @include('maintenance.expressPrinting.template._select')
+        </div>
+        <div class="col-lg-8 col-sm-6 p-0" id="production_panel">
+            {{--  模板制作面板 --}}
+            @include('maintenance.expressPrinting.template._produce')
+        </div>
+        <div class="col-lg-2 col-sm-3 p-0" id="compile_panel">
+            {{-- 模板编辑页面 --}}
+            @include('maintenance.expressPrinting.template._compile')
+        </div>
+    </div>
+@endsection
+
+
+@section('lastScript')
+    <script type="text/javascript" src="{{mix('js/utilities/barcode.js')}}"></script>
+    <script type="text/javascript" src="{{mix('/js/utilities/qrcode.js')}}"></script>
+    <script>
+
+        let vue = new Vue({
+            el: "#print-template",
+            data: {
+                printParts: [
+                        @foreach($printParts as $items)
+                    {
+                        name: '{{ $items['name'] }}', value: {
+                            @foreach($items['value'] as $key=>$value)
+                            '{{$key}}': '{{$value}}',
+                            @endforeach
+                        }
+                    },
+                    @endforeach
+                ],
+                imgPrefix:"{{asset("/storage")}}",
+                images:{!! $printPartImages ?? [] !!},
+                filterPrintParts: [],
+                producePanel: {},              // 背景版
+                selectProducePanel: false,              // 是否选中背景版
+                productionParts: {
+                    bg: null,
+                    printParts: [],                  // 组件
+                    editPart: null,                  // 编辑中的组件
+                    editIndex: {},                   // 编辑中组件的下标
+                    addPart: {},                     // 添加模板
+                },
+                partIsSelected: false,               // 表示模块被选中
+                selectPrintPart: {},                 // 选中模块
+                selectPrintPartPoint: {x: '', y: ''},   // 选中模块时模块 point
+                mousePointStart: {x: '', y: ''},        // 开始拖动时的 point
+                mousePointEnd: {x: '', y: ''},          // 结束拖动时的 point
+                selectPrintPartOffset: {left: '', top: ''},     // 选中时的left 和 top
+                z_index: 10,
+            },
+            mounted() {
+                $('.navbar,.nav1,.nav2').hide();
+                $('.nav3').on('mouseenter', function () {
+                    $('.navbar,.nav1,.nav2').show();
+                });
+                $('.body').on('mouseenter', function () {
+                    $('.navbar,.nav1,.nav2').hide();
+                });
+                $("#print-template").removeClass('d-none');
+            },
+            methods: {
+                // 添加组件至面板上
+                _addPartToProductionPanel(printPart) {
+                    let _clone = JSON.parse(JSON.stringify(printPart));
+                    let print_part = _clone.value
+                    if (!this.productionParts.bg && print_part.type !== 'bg') {
+                        window.tempTip.show('先添加背景组件在进行其他组件的添加');
+                        return
+                    } else if (this.productionParts.bg && print_part.type === 'bg') {
+                        window.tempTip.show('背景组件请勿重复添加');
+                        return
+                    }
+                    if (print_part.type === 'bg') {
+                        this.productionParts.bg = print_part;
+                        return;
+                    }
+                    print_part.index = this.productionParts.printParts.length;
+                    this.z_index+=1
+                    print_part.z_index = this.z_index;
+                    print_part.id = "id" + this.z_index;
+                    print_part.text = null;
+                    this.productionParts.printParts.push(print_part);  // 添加入组件列表中
+                    console.log(print_part.type);
+                    if (print_part.type === "stripeCode") {
+                        setTimeout(function () {
+                            console.log(123);
+                            window.setBarcode("0123456789", "#" + print_part.id, 2, 50, true)
+                        }, 100);
+                    } else if (print_part.type === "qRCode") {
+                        setTimeout(function () {
+                            new QRCode(document.getElementById(print_part.id), {
+                                text: "占位二维码",
+                                width: print_part.width,
+                                height: print_part.height,
+                                colorDark : "#000000",
+                                colorLight : "#ffffff",
+                                correctLevel : QRCode.CorrectLevel.H
+                            });
+                        }, 1000)
+                    } else if (print_part.type === "image") {
+                        // TODO 修改为图片
+                    }
+                },
+                // 从面板删除组件
+                _removePartToProductionPanel(editPart) {
+                    this.productionParts.editPart = null;
+                    let index = this.productionParts.printParts.indexOf(editPart);
+                    this.productionParts.printParts.splice(index, 1);
+                },
+                //
+                _alignContentToProductionPanel() {
+                    this.productionParts.printParts.splice(this.productionParts.editIndex, 1);
+                    this.$forceUpdate();
+                },
+
+                // 打开保存modal
+                showSaveModal() {
+                    $('#saveModal').modal('show');
+                },
+                // 保存modal
+                _savePrintTemplate() {
+                    tempTip.setDuration(3000);
+                    tempTip.setIndex(1999);
+                    let printTemplate = JSON.parse(JSON.stringify(this.productionParts.printParts));
+                    printTemplate.push(this.productionParts.bg);
+                    let data = {
+                        name: this.productionParts.addPart.name,
+                        value: printTemplate
+                    };
+                    window.axios.post("{{url('apiLocal/maintenance/expressPrinting/template/create')}}", data).then(res => {
+                        if (res.data.success) {
+                            tempTip.showSuccess('保存成功!');
+                            $('#saveModal').modal('hide');
+                            return;
+                        }
+                        tempTip.show(res.data.message);
+                    }).catch(err => {
+                        tempTip.show(err);
+                    });
+                },
+                // 开始拖动元素时触发
+                _dragstart(item, $event) {
+                    this.selectPrintPartPoint = {x: parseInt(item.left), y: parseInt(item.top)};
+                    this.mousePointStart = {x: $event.offsetX, y: $event.offsetY};
+                },
+                // 结束拖动元素时触发
+                _dragend(item, $event) {
+                    this.mousePointEnd = {x: $event.offsetX, y: $event.offsetY};
+                    let left = item.left - (this.mousePointStart.x - this.mousePointEnd.x);
+                    let top = item.top - (this.mousePointStart.y - this.mousePointEnd.y);
+                    item.left = left > 0 ? left : 0;
+                    item.top = top > 0 ? top : 0;
+                },
+                getProducePanelStyle() {
+                    return {
+                        width: this.producePanel.width + 'px',
+                        height: this.producePanel.height + 'px',
+                    }
+                },
+                getStyle(item) {
+                    let style =  {
+                        width: item.width + 'px',
+                        height: item.height + 'px',
+                        left: item.left + 'px',
+                        top: item.top + 'px',
+
+                        'white-space': 'pre',
+                        'z-index' : item['z_index'],
+                    };
+                    if (item['border-width']) {
+                        style['border-width'] = item['border-width']+'px';
+                        style['border-color'] = '#000';
+                        style['border-style'] = 'solid';
+                    }
+                    if (item['font-size']) style['font-size'] = item['font-size'];
+                    return style;
+                },
+                getImageSrc(image){
+                    return this.imgPrefix+image.file.url+'.'+image.file.type
+                },
+                setImageBg(image){
+                    let src =  this.getImageSrc(image);
+                    this.productionParts.editPart.value = image.name;
+                    document.getElementById(this.productionParts.editPart.id).setAttribute('src',src) ;
+                }
+            }
+        });
+    </script>
+@endsection
+