rev:载具打印添加配置

This commit is contained in:
zhangzq
2023-11-13 20:05:51 +08:00
parent 3f0cf6092a
commit 4354e961f4

View File

@@ -62,7 +62,7 @@
type="success" type="success"
icon="el-icon-printer" icon="el-icon-printer"
size="mini" size="mini"
@click="print" @click="printView"
> >
打印 打印
</el-button> </el-button>
@@ -124,7 +124,39 @@
<el-button type="primary" @click="pointMateriSubmit()">确认</el-button> <el-button type="primary" @click="pointMateriSubmit()">确认</el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog
:before-close="crud.cancelCU"
:close-on-click-modal="false"
title="打印配置"
:visible.sync="printVisible"
width="450px"
>
<el-form ref="form" :model="printForm" size="mini" label-width="150px">
<el-form-item label="纸张高度(mm)" prop="pageh">
<el-input-number v-model="printForm.pageh" :precision="0" style="width: 150px;" />
</el-form-item>
<el-form-item label="纸张宽度(mm)" prop="pagew">
<el-input-number v-model="printForm.pagew" :precision="0" style="width: 150px;" />
</el-form-item>
<el-form-item label="页边距top(mm)" prop="pagetop">
<el-input-number v-model="printForm.pagetop" :precision="0" style="width: 150px;" />
</el-form-item>
<el-form-item label="页边距right(mm)" prop="pageright">
<el-input-number v-model="printForm.pageright" :precision="0" style="width: 150px;" />
</el-form-item>
<el-form-item label="页边距down(mm)" prop="pagedown">
<el-input-number v-model="printForm.pagedown" :precision="0" style="width: 150px;" />
</el-form-item>
<el-form-item label="页边距left(mm)" prop="pageleft">
<el-input-number v-model="printForm.pageleft" :precision="0" style="width: 150px;" />
</el-form-item>
<br>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="info" @click="printClose">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="print">打印</el-button>
</div>
</el-dialog>
<el-dialog <el-dialog
:before-close="crud.cancelCU" :before-close="crud.cancelCU"
:close-on-click-modal="false" :close-on-click-modal="false"
@@ -301,7 +333,16 @@ export default {
} }
} }
return { return {
printVisible: false,
updateForm: {}, updateForm: {},
printForm : {
pageh:'40',
pagew:'60',
pagetop:'4.3',
pagedown:'50',
pageright:'30',
pageleft:'8',
},
pointMVisible: false, pointMVisible: false,
materType:'01', materType:'01',
materialShow: false, materialShow: false,
@@ -391,20 +432,45 @@ export default {
format_is_used(is_used) { format_is_used(is_used) {
return is_used === '1' return is_used === '1'
}, },
printView(){
this.printForm = {
pageh:'40',
pagew:'60',
pagetop:'4.3',
pagedown:'50',
pageright:'30',
pageleft:'8',
},
this.printVisible = true
},
printClose(){
this.printVisible = false
this.printForm = {
pageh:'40',
pagew:'60',
pagetop:'4.3',
pagedown:'50',
pageright:'30',
pageleft:'8',
}
},
print() { print() {
this.printVisible = false
const _selectData = this.$refs.table.selection const _selectData = this.$refs.table.selection
if (!_selectData || _selectData.length < 1) { if (!_selectData || _selectData.length < 1) {
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO) this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
return return
} }
console.log(_selectData.length)
console.log(this.printForm)
for (let i = 0; i < _selectData.length; i++) { for (let i = 0; i < _selectData.length; i++) {
const code = _selectData[i].storagevehicle_code const code = _selectData[i].storagevehicle_code
const LODOP = getLodop() const LODOP = getLodop()
LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮 LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮
// 打印纸张大小设置https://www.it610.com/article/2094844.html // 打印纸张大小设置https://www.it610.com/article/2094844.html
LODOP.SET_PRINT_PAGESIZE(1, '60mm', '40mm', '1') LODOP.SET_PRINT_PAGESIZE(1, printForm.pagew, printForm.pageh, '1')
// LODOP.ADD_PRINT_RECT('0mm', '0mm', '50mm', '30mm', 0, 1) // LODOP.ADD_PRINT_RECT('0mm', '0mm', '50mm', '30mm', 0, 1)
LODOP.ADD_PRINT_BARCODE('4.3mm', '8mm', '50mm', '30mm', '128Auto', code) LODOP.ADD_PRINT_BARCODE(printForm.pagetop, printForm.pageleft, printForm.pagedown, printForm.pageright, '128Auto', code)
// LODOP.PREVIEW()// 预览 // LODOP.PREVIEW()// 预览
LODOP.PRINT()// 打印 LODOP.PRINT()// 打印
this.crud.notify('打印成功', CRUD.NOTIFICATION_TYPE.SUCCESS) this.crud.notify('打印成功', CRUD.NOTIFICATION_TYPE.SUCCESS)