增加打印 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" icon="delete" @click="pageDelete()">批量删除</a-button>
|
||||||
<a-button type="primary" style="margin-left: 5px;" icon="print" v-if="options.enabledPrint"
|
<a-button type="primary" style="margin-left: 5px;" icon="print" v-if="options.enabledPrint"
|
||||||
@click="pagePrint()">打印</a-button>
|
@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"
|
<a-button type="primary" style="margin-left: 5px;" icon="export" v-if="options.enabledExport"
|
||||||
@click="pageExport()">导出</a-button>
|
@click="pageExport()">导出</a-button>
|
||||||
|
|
@ -175,6 +177,11 @@ export default {
|
||||||
let tableData = JSON.parse(JSON.stringify(this.$refs.xGrid.getTableData().fullData));
|
let tableData = JSON.parse(JSON.stringify(this.$refs.xGrid.getTableData().fullData));
|
||||||
this.$emit("print", { tableData: tableData });
|
this.$emit("print", { tableData: tableData });
|
||||||
|
|
||||||
|
},
|
||||||
|
pagePrint2() {
|
||||||
|
let tableData = JSON.parse(JSON.stringify(this.$refs.xGrid.getTableData().fullData));
|
||||||
|
this.$emit("print2", { tableData: tableData });
|
||||||
|
|
||||||
},
|
},
|
||||||
pageExport() {
|
pageExport() {
|
||||||
let jsonRows = [];
|
let jsonRows = [];
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -40,6 +40,7 @@ export default {
|
||||||
keyName: 'id', // 主键字段名
|
keyName: 'id', // 主键字段名
|
||||||
listFieldName: 'BaseDepartment',
|
listFieldName: 'BaseDepartment',
|
||||||
enabledPrint: true,
|
enabledPrint: true,
|
||||||
|
enabledPrint2: true,
|
||||||
addPageUrl: "/BaseDepartment/BaseDepartmentAdd",
|
addPageUrl: "/BaseDepartment/BaseDepartmentAdd",
|
||||||
editPageUrl: "/BaseDepartment/BaseDepartmentUpdate/",
|
editPageUrl: "/BaseDepartment/BaseDepartmentUpdate/",
|
||||||
|
|
||||||
|
|
@ -113,8 +114,8 @@ export default {
|
||||||
tdata.table = JSON.parse(JSON.stringify(tableData));
|
tdata.table = JSON.parse(JSON.stringify(tableData));
|
||||||
tdata.table.forEach(item => {
|
tdata.table.forEach(item => {
|
||||||
item.qrcode = JSON.stringify({
|
item.qrcode = JSON.stringify({
|
||||||
id : item.id.toString(),
|
id: item.id.toString(),
|
||||||
types :"department"
|
types: "department"
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -126,6 +127,22 @@ export default {
|
||||||
hiprintTemplate.print(tdata, { printer: '', title: '部门' }); // 打印
|
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: {
|
watch: {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<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 }">
|
<template v-slot:column2="{ row }">
|
||||||
<vue-qr class="qr-code" :text="row.qr_code" :size="120" />
|
<vue-qr class="qr-code" :text="row.qr_code" :size="120" />
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -54,7 +54,9 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
pageOptions: {},
|
pageOptions: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
modelName: "",
|
modelName: "",
|
||||||
|
|
||||||
|
|
@ -137,6 +139,21 @@ export default {
|
||||||
});
|
});
|
||||||
hiprintTemplate.print(tdata, { printer: '', title: '工序' }); // 打印
|
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 }) {
|
pageImport({ data }) {
|
||||||
let rows = [];
|
let rows = [];
|
||||||
data.forEach(item => {
|
data.forEach(item => {
|
||||||
|
|
@ -185,6 +202,7 @@ export default {
|
||||||
enabledImport: true,
|
enabledImport: true,
|
||||||
enabledImportTemplate: true,
|
enabledImportTemplate: true,
|
||||||
enabledPrint: true,
|
enabledPrint: true,
|
||||||
|
enabledPrint2: true,
|
||||||
exportColumns: [
|
exportColumns: [
|
||||||
{ title: '编码', field: "code" },
|
{ title: '编码', field: "code" },
|
||||||
{ title: '工序名称', field: "name" },
|
{ title: '工序名称', field: "name" },
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue