增加打印 2
This commit is contained in:
parent
c072e15a20
commit
e83c4ff0cf
|
|
@ -24,6 +24,8 @@
|
|||
<a-button type="primary" icon="delete" @click="pageDelete()">批量删除</a-button>
|
||||
<a-button type="primary" style="margin-left: 5px;" icon="print" v-if="options.enabledPrint"
|
||||
@click="pagePrint()">打印</a-button>
|
||||
<a-button type="primary" style="margin-left: 5px;" icon="print" v-if="options.enabledPrint2"
|
||||
@click="pagePrint2()">打印2</a-button>
|
||||
|
||||
<a-button type="primary" style="margin-left: 5px;" icon="export" v-if="options.enabledExport"
|
||||
@click="pageExport()">导出</a-button>
|
||||
|
|
@ -175,6 +177,11 @@ export default {
|
|||
let tableData = JSON.parse(JSON.stringify(this.$refs.xGrid.getTableData().fullData));
|
||||
this.$emit("print", { tableData: tableData });
|
||||
|
||||
},
|
||||
pagePrint2() {
|
||||
let tableData = JSON.parse(JSON.stringify(this.$refs.xGrid.getTableData().fullData));
|
||||
this.$emit("print2", { tableData: tableData });
|
||||
|
||||
},
|
||||
pageExport() {
|
||||
let jsonRows = [];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<basic-page-list :desc="desc" :options="pageOptions" @print="pagePrint"></basic-page-list>
|
||||
<basic-page-list :desc="desc" :options="pageOptions" @print="pagePrint" @print2="pagePrint2"></basic-page-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -40,6 +40,7 @@ export default {
|
|||
keyName: 'id', // 主键字段名
|
||||
listFieldName: 'BaseDepartment',
|
||||
enabledPrint: true,
|
||||
enabledPrint2: true,
|
||||
addPageUrl: "/BaseDepartment/BaseDepartmentAdd",
|
||||
editPageUrl: "/BaseDepartment/BaseDepartmentUpdate/",
|
||||
|
||||
|
|
@ -113,10 +114,10 @@ export default {
|
|||
tdata.table = JSON.parse(JSON.stringify(tableData));
|
||||
tdata.table.forEach(item => {
|
||||
item.qrcode = JSON.stringify({
|
||||
id : item.id.toString(),
|
||||
types :"department"
|
||||
id: item.id.toString(),
|
||||
types: "department"
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
console.log(tdata.table)
|
||||
hiprint.init(); // 初始化打印组件
|
||||
|
|
@ -126,6 +127,22 @@ export default {
|
|||
hiprintTemplate.print(tdata, { printer: '', title: '部门' }); // 打印
|
||||
},
|
||||
|
||||
pagePrint2({ tableData }) {
|
||||
|
||||
let hiprint = this.$hiPrint; // 获取打印组件
|
||||
let tdata = {};
|
||||
tdata.table = JSON.parse(JSON.stringify(tableData));
|
||||
tdata.table.forEach(item => {
|
||||
item.qrcode = '1#'+item.code;
|
||||
})
|
||||
|
||||
console.log(tdata.table)
|
||||
hiprint.init(); // 初始化打印组件
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ // 创建打印模板
|
||||
template: settings.printTemplate_department // 模板内容
|
||||
});
|
||||
hiprintTemplate.print(tdata, { printer: '', title: '部门' }); // 打印
|
||||
},
|
||||
|
||||
},
|
||||
watch: {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
</div>
|
||||
<div class="right">
|
||||
|
||||
<basic-page-list ref="listPage" :desc="desc" @importData="pageImport" @print="pagePrint" :options="pageOptions">
|
||||
<basic-page-list ref="listPage" :desc="desc" @importData="pageImport" @print="pagePrint" @print2="pagePrint2" :options="pageOptions">
|
||||
<template v-slot:column2="{ row }">
|
||||
<vue-qr class="qr-code" :text="row.qr_code" :size="120" />
|
||||
</template>
|
||||
|
|
@ -54,7 +54,9 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
pageOptions: {},
|
||||
pageOptions: {
|
||||
|
||||
},
|
||||
|
||||
modelName: "",
|
||||
|
||||
|
|
@ -137,6 +139,21 @@ export default {
|
|||
});
|
||||
hiprintTemplate.print(tdata, { printer: '', title: '工序' }); // 打印
|
||||
},
|
||||
pagePrint2({ tableData }) {
|
||||
|
||||
let hiprint = this.$hiPrint; // 获取打印组件
|
||||
let tdata = {};
|
||||
tdata.table = JSON.parse(JSON.stringify(tableData));
|
||||
tdata.table.forEach(item => {
|
||||
item.qrcode = '2#' + item.code;
|
||||
})
|
||||
console.log(tdata);
|
||||
hiprint.init(); // 初始化打印组件
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ // 创建打印模板
|
||||
template: settings.printTemplate_processes // 模板内容
|
||||
});
|
||||
hiprintTemplate.print(tdata, { printer: '', title: '工序' }); // 打印
|
||||
},
|
||||
pageImport({ data }) {
|
||||
let rows = [];
|
||||
data.forEach(item => {
|
||||
|
|
@ -185,6 +202,7 @@ export default {
|
|||
enabledImport: true,
|
||||
enabledImportTemplate: true,
|
||||
enabledPrint: true,
|
||||
enabledPrint2: true,
|
||||
exportColumns: [
|
||||
{ title: '编码', field: "code" },
|
||||
{ title: '工序名称', field: "name" },
|
||||
|
|
|
|||
Loading…
Reference in New Issue