|
@@ -3,13 +3,13 @@
|
|
|
<el-card>
|
|
<el-card>
|
|
|
<div style="display: flex;flex-direction: column">
|
|
<div style="display: flex;flex-direction: column">
|
|
|
<div style="margin-bottom: 10px">
|
|
<div style="margin-bottom: 10px">
|
|
|
- <el-button v-no-more-click-group>
|
|
|
|
|
|
|
+ <el-button-group >
|
|
|
<template v-for="(value,type) in paperTypes" >
|
|
<template v-for="(value,type) in paperTypes" >
|
|
|
<el-button v-no-more-click :type="curPaperType === type ? 'primary' : 'info'" @click="setPaper(type,value)" :key="type">
|
|
<el-button v-no-more-click :type="curPaperType === type ? 'primary' : 'info'" @click="setPaper(type,value)" :key="type">
|
|
|
{{ type }}
|
|
{{ type }}
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<el-popover v-model="paperPopVisible" title="设置纸张宽高(mm)" trigger="click">
|
|
<el-popover v-model="paperPopVisible" title="设置纸张宽高(mm)" trigger="click">
|
|
|
<div>
|
|
<div>
|
|
|
<el-input-number v-model="paperWidth" style=" width: 120px; text-align: center"
|
|
<el-input-number v-model="paperWidth" style=" width: 120px; text-align: center"
|
|
@@ -19,7 +19,7 @@
|
|
|
/>
|
|
/>
|
|
|
<el-input-number v-model="paperHeight" style="width: 120px; text-align: center; border-left: 0"
|
|
<el-input-number v-model="paperHeight" style="width: 120px; text-align: center; border-left: 0"
|
|
|
controls-position="right" placeholder="高(mm)"/>
|
|
controls-position="right" placeholder="高(mm)"/>
|
|
|
- </div>
|
|
|
|
|
|
|
+ </div>
|
|
|
<el-button v-no-more-click type="primary" style="width: 290px; margin-top: 10px;" @click="otherPaper">确定</el-button>
|
|
<el-button v-no-more-click type="primary" style="width: 290px; margin-top: 10px;" @click="otherPaper">确定</el-button>
|
|
|
<el-button v-no-more-click slot="reference" :type="'other'==curPaperType?'primary':''">自定义纸张</el-button>
|
|
<el-button v-no-more-click slot="reference" :type="'other'==curPaperType?'primary':''">自定义纸张</el-button>
|
|
|
</el-popover>
|
|
</el-popover>
|
|
@@ -36,7 +36,7 @@
|
|
|
<el-button v-no-more-click icon="el-icon-zoom-out" slot="prepend" @click="changeScale(false)"></el-button>
|
|
<el-button v-no-more-click icon="el-icon-zoom-out" slot="prepend" @click="changeScale(false)"></el-button>
|
|
|
<el-button v-no-more-click icon="el-icon-zoom-in" slot="append" @click="changeScale(true)"></el-button>
|
|
<el-button v-no-more-click icon="el-icon-zoom-in" slot="append" @click="changeScale(true)"></el-button>
|
|
|
</el-input>
|
|
</el-input>
|
|
|
- <el-button v-no-more-click-group style="margin-left: 10px;">
|
|
|
|
|
|
|
+ <el-button-group style="margin-left: 10px;">
|
|
|
<el-button v-no-more-click type="primary" icon="el-icon-refresh-left" @click="rotatePaper()">旋转</el-button>
|
|
<el-button v-no-more-click type="primary" icon="el-icon-refresh-left" @click="rotatePaper()">旋转</el-button>
|
|
|
<el-button v-no-more-click type="primary" icon="el-icon-view" @click="preView">
|
|
<el-button v-no-more-click type="primary" icon="el-icon-view" @click="preView">
|
|
|
预览
|
|
预览
|
|
@@ -294,7 +294,7 @@
|
|
|
<el-option label="请选择字典生成" value="" />
|
|
<el-option label="请选择字典生成" value="" />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
|
|
|
|
+ </el-col>
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
<el-form-item label="是否默认" prop="isDefault">
|
|
<el-form-item label="是否默认" prop="isDefault">
|
|
|
<el-input v-model="form.isDefault" placeholder="请输入是否默认" />
|
|
<el-input v-model="form.isDefault" placeholder="请输入是否默认" />
|
|
@@ -350,7 +350,7 @@ export default {
|
|
|
templateType: null,
|
|
templateType: null,
|
|
|
templateName: null,
|
|
templateName: null,
|
|
|
templateJson: null,
|
|
templateJson: null,
|
|
|
- paperType: this.$route.params.paperType,
|
|
|
|
|
|
|
+ paperType: this.$route.params.paperType,
|
|
|
templateWidth: null,
|
|
templateWidth: null,
|
|
|
templateHeight: null,
|
|
templateHeight: null,
|
|
|
templatePic: null,
|
|
templatePic: null,
|
|
@@ -362,7 +362,7 @@ export default {
|
|
|
{ required: true, message: "模板编号不能为空", trigger: "blur" }
|
|
{ required: true, message: "模板编号不能为空", trigger: "blur" }
|
|
|
], templateType: [
|
|
], templateType: [
|
|
|
{ required: true, message: "模板类型不能为空", trigger: "change" }
|
|
{ required: true, message: "模板类型不能为空", trigger: "change" }
|
|
|
- ],
|
|
|
|
|
|
|
+ ],
|
|
|
},
|
|
},
|
|
|
template: null,
|
|
template: null,
|
|
|
curPaper: {
|
|
curPaper: {
|
|
@@ -456,7 +456,7 @@ export default {
|
|
|
getTemplate(templateId).then(response => {
|
|
getTemplate(templateId).then(response => {
|
|
|
this.form = response.data;
|
|
this.form = response.data;
|
|
|
if (hiprintTemplate) {
|
|
if (hiprintTemplate) {
|
|
|
- try {
|
|
|
|
|
|
|
+ try {
|
|
|
this.setPaper(this.form.paperType);
|
|
this.setPaper(this.form.paperType);
|
|
|
hiprintTemplate.update(JSON.parse(this.form.templateJson));
|
|
hiprintTemplate.update(JSON.parse(this.form.templateJson));
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
@@ -633,7 +633,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
setPaper(type){
|
|
setPaper(type){
|
|
|
- if (Object.keys(this.paperTypes).includes(type)) {
|
|
|
|
|
|
|
+ if (Object.keys(this.paperTypes).includes(type)) {
|
|
|
this.curPaper = {type: type, width: this.paperTypes[type].width, height: this.paperTypes[type].height}
|
|
this.curPaper = {type: type, width: this.paperTypes[type].width, height: this.paperTypes[type].height}
|
|
|
hiprintTemplate.setPaper(this.paperTypes[type].width, this.paperTypes[type].height)
|
|
hiprintTemplate.setPaper(this.paperTypes[type].width, this.paperTypes[type].height)
|
|
|
}
|
|
}
|
|
@@ -711,7 +711,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
handleSave(){
|
|
handleSave(){
|
|
|
if(this.form.templateId !=null){
|
|
if(this.form.templateId !=null){
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
this.saveTemplate();
|
|
this.saveTemplate();
|
|
|
}else{
|
|
}else{
|
|
|
this.open = true;
|
|
this.open = true;
|
|
@@ -722,7 +722,7 @@ export default {
|
|
|
saveTemplate(){
|
|
saveTemplate(){
|
|
|
let that = this;
|
|
let that = this;
|
|
|
if (hiprintTemplate) {
|
|
if (hiprintTemplate) {
|
|
|
- this.form.templateJson = JSON.stringify(hiprintTemplate.getJson() || {});
|
|
|
|
|
|
|
+ this.form.templateJson = JSON.stringify(hiprintTemplate.getJson() || {});
|
|
|
}
|
|
}
|
|
|
//保存缩略图
|
|
//保存缩略图
|
|
|
html2canvas(document.getElementById("hiprint-printTemplate")).then(function(canvas){
|
|
html2canvas(document.getElementById("hiprint-printTemplate")).then(function(canvas){
|
|
@@ -733,7 +733,7 @@ export default {
|
|
|
// link.download = '测试图片.png';
|
|
// link.download = '测试图片.png';
|
|
|
// document.body.appendChild(link);
|
|
// document.body.appendChild(link);
|
|
|
// link.click();
|
|
// link.click();
|
|
|
- // document.body.removeChild(link);
|
|
|
|
|
|
|
+ // document.body.removeChild(link);
|
|
|
let fileName = `${new Date().getTime()}.jpg`;
|
|
let fileName = `${new Date().getTime()}.jpg`;
|
|
|
let file = new File([blob],fileName,{type: 'image/jpg'});
|
|
let file = new File([blob],fileName,{type: 'image/jpg'});
|
|
|
let formData = new FormData();
|
|
let formData = new FormData();
|
|
@@ -758,7 +758,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
//当前模板的打印测试
|
|
//当前模板的打印测试
|
|
|
printText(){
|
|
printText(){
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
onlyPrint2() {
|
|
onlyPrint2() {
|
|
|
let that = this;
|
|
let that = this;
|