|
@@ -76,8 +76,8 @@
|
|
|
<!-- 按钮 -->
|
|
|
<div class="btn-group clearfix">
|
|
|
<div class="fl">
|
|
|
- <el-button type="primary" size="mini" @click="toPrint" :disabled="tableSelection.length < 1">打印发货单
|
|
|
- </el-button>
|
|
|
+ <!-- <el-button type="primary" size="mini" @click="toPrint" :disabled="tableSelection.length < 1">打印发货单
|
|
|
+ </el-button> -->
|
|
|
</div>
|
|
|
<div class="fr">
|
|
|
|
|
@@ -199,17 +199,16 @@
|
|
|
|
|
|
<ReceiptPrint :listItem="queryItem" v-else-if="showDetail == 2" @backListFormDetail="backList" />
|
|
|
<ReceiptListDetail :detailId="detailId" v-else />
|
|
|
- <print-preview ref="preView" />
|
|
|
+ <!-- <print-preview ref="preView" /> -->
|
|
|
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { disAutoConnect, hiprint, defaultElementTypeProvider } from 'vue-plugin-hiprint'
|
|
|
-disAutoConnect();
|
|
|
-import panel from './components/design/panel'
|
|
|
-import { getDetail, detailArr } from './components/design/print-data'
|
|
|
-import printPreview from './components/design/preview.vue'
|
|
|
+
|
|
|
+// import panel from './components/design/panel'
|
|
|
+// import { getDetail, detailArr } from './components/design/print-data'
|
|
|
+// import printPreview from './components/design/preview.vue'
|
|
|
import { getCustomerList } from "@/api/finance/wallet";
|
|
|
import {
|
|
|
getK3ReceiptList,
|
|
@@ -223,7 +222,7 @@ export default {
|
|
|
components: {
|
|
|
ReceiptPrint,
|
|
|
ReceiptListDetail,
|
|
|
- printPreview
|
|
|
+
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -246,41 +245,6 @@ export default {
|
|
|
detailId: null,
|
|
|
queryItem: {},
|
|
|
tableSelection: [],
|
|
|
- curPaper: {
|
|
|
- type: 'A5',
|
|
|
- width: 500,
|
|
|
- height: 147.6
|
|
|
- },
|
|
|
- paperTypes: {
|
|
|
- 'A3': {
|
|
|
- width: 420,
|
|
|
- height: 296.6
|
|
|
- },
|
|
|
- 'A4': {
|
|
|
- width: 210,
|
|
|
- height: 296.6
|
|
|
- },
|
|
|
- 'A5': {
|
|
|
- width: 210,
|
|
|
- height: 147.6
|
|
|
- },
|
|
|
- 'B3': {
|
|
|
- width: 500,
|
|
|
- height: 352.6
|
|
|
- },
|
|
|
- 'B4': {
|
|
|
- width: 250,
|
|
|
- height: 352.6
|
|
|
- },
|
|
|
- 'B5': {
|
|
|
- width: 250,
|
|
|
- height: 175.6
|
|
|
- }
|
|
|
- },
|
|
|
- scaleValue: 1,
|
|
|
- scaleMax: 5,
|
|
|
- scaleMin: 0.5,
|
|
|
- hiprintTemplate: '',
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -288,18 +252,6 @@ export default {
|
|
|
return {
|
|
|
...this.searchForm,
|
|
|
};
|
|
|
- },
|
|
|
- curPaperType() {
|
|
|
- let type = 'other'
|
|
|
- let types = this.paperTypes
|
|
|
- for (const key in types) {
|
|
|
- let item = types[key]
|
|
|
- let { width, height } = this.curPaper
|
|
|
- if (item.width === width && item.height === height) {
|
|
|
- type = key
|
|
|
- }
|
|
|
- }
|
|
|
- return type
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -307,7 +259,10 @@ export default {
|
|
|
this.getCustomerDataList();
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.initPrint()
|
|
|
+ console.log(this.hiPrintPlugin,'888');
|
|
|
+ this.hiPrintPlugin.init()
|
|
|
+ var hiprintTemplate = new this.hiPrintPlugin.PrintTemplate();
|
|
|
+ var panel = hiprintTemplate.addPrintPanel({ width: 100, height: 130, paperFooter: 340, paperHeader: 10 });
|
|
|
},
|
|
|
methods: {
|
|
|
//获取经销商列表
|
|
@@ -318,40 +273,8 @@ export default {
|
|
|
});
|
|
|
this.customerList = res.data.records;
|
|
|
},
|
|
|
- initPrint() {
|
|
|
- hiprint.init({
|
|
|
- providers: [new defaultElementTypeProvider()]
|
|
|
- });
|
|
|
- // 还原配置
|
|
|
- hiprint.setConfig()
|
|
|
- // 替换配置
|
|
|
- hiprint.setConfig({
|
|
|
- movingDistance: 2.5,
|
|
|
- text: {
|
|
|
- supportOptions: [
|
|
|
- {
|
|
|
- name: 'styler',
|
|
|
- hidden: true
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'formatter',
|
|
|
- hidden: true
|
|
|
- },
|
|
|
- ]
|
|
|
- }
|
|
|
- })
|
|
|
- // eslint-disable-next-line no-undef
|
|
|
- hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'));
|
|
|
- this.hiprintTemplate = new hiprint.PrintTemplate({
|
|
|
- template: panel,
|
|
|
- settingContainer: '#PrintElementOptionSetting',
|
|
|
- paginationContainer: '.hiprint-printPagination'
|
|
|
- });
|
|
|
- this.hiprintTemplate.design('#hiprint-printTemplate');
|
|
|
- // 获取当前放大比例, 当zoom时传true 才会有
|
|
|
- // this.scaleValue = hiprintTemplate.editingPanel.scale || 1;
|
|
|
- }
|
|
|
- ,
|
|
|
+
|
|
|
+
|
|
|
//合计
|
|
|
getSummaries(param) {
|
|
|
const { columns, data } = param;
|
|
@@ -446,27 +369,11 @@ export default {
|
|
|
this.queryItem = {};
|
|
|
this.isShowPrint = false;
|
|
|
},
|
|
|
- /**
|
|
|
- * 设置纸张大小
|
|
|
- * @param type [A3, A4, A5, B3, B4, B5, other]
|
|
|
- * @param value {width,height} mm
|
|
|
- */
|
|
|
- setPaper(type, value) {
|
|
|
- try {
|
|
|
- if (Object.keys(this.paperTypes).includes(type)) {
|
|
|
- this.curPaper = { type: type, width: value.width, height: value.height }
|
|
|
- this.hiprintTemplate.setPaper(value.width, value.height)
|
|
|
- } else {
|
|
|
- this.curPaper = { type: 'other', width: value.width, height: value.height }
|
|
|
- this.hiprintTemplate.setPaper(value.width, value.height)
|
|
|
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- this.$message.error(`操作失败: ${error}`)
|
|
|
- }
|
|
|
- },
|
|
|
// 点击打印
|
|
|
toPrint(row, type) {
|
|
|
+
|
|
|
+ panel.addPrintText({ options: { width: 140, height: 15, top: 20, left: 20, title: 'hiprint插件手动添加text', textAlign: 'center' } });
|
|
|
// this.tableSelection = this.$refs.table.selection;
|
|
|
if (!type) {
|
|
|
getDetail(this.tableSelection)
|
|
@@ -474,7 +381,8 @@ export default {
|
|
|
this.queryItem = row;
|
|
|
getDetail(row.id)
|
|
|
}
|
|
|
- this.$refs.preView.show(this.hiprintTemplate, detailArr)
|
|
|
+ hiprintTemplate.print({});
|
|
|
+ // this.$refs.preView.show(this.hiprintTemplate, detailArr)
|
|
|
|
|
|
},
|
|
|
},
|