|
|
@ -48,6 +48,49 @@ |
|
|
<el-button @click="printDialogVisible = false">取消</el-button> |
|
|
<el-button @click="printDialogVisible = false">取消</el-button> |
|
|
</div> |
|
|
</div> |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 打印机选择对话框 --> |
|
|
|
|
|
<el-dialog |
|
|
|
|
|
title="服务器打印设置" |
|
|
|
|
|
:visible.sync="printerSelectionVisible" |
|
|
|
|
|
width="350px" |
|
|
|
|
|
:close-on-click-modal="false" |
|
|
|
|
|
class="printer-selection-dialog" |
|
|
|
|
|
> |
|
|
|
|
|
<div class="printer-selection-content"> |
|
|
|
|
|
<div class="form-item"> |
|
|
|
|
|
<label class="form-label">选择打印机:</label> |
|
|
|
|
|
<el-select |
|
|
|
|
|
v-model="selectedPrinter" |
|
|
|
|
|
placeholder="请选择打印机" |
|
|
|
|
|
style="width: 100%;" |
|
|
|
|
|
> |
|
|
|
|
|
<el-option |
|
|
|
|
|
v-for="printer in availablePrinters" |
|
|
|
|
|
:key="printer.printerName" |
|
|
|
|
|
:label="`${printer.printerName} (${printer.ipAddress})`" |
|
|
|
|
|
:value="printer.printerName" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="form-item"> |
|
|
|
|
|
<label class="form-label">打印份数:</label> |
|
|
|
|
|
<el-input |
|
|
|
|
|
v-model.number="printCopies" |
|
|
|
|
|
:min="1" |
|
|
|
|
|
:max="1" |
|
|
|
|
|
size="mini" |
|
|
|
|
|
style="width: 100%;" |
|
|
|
|
|
/> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
|
|
<el-button @click="printerSelectionVisible = false">取消</el-button> |
|
|
|
|
|
<el-button type="primary" @click="confirmPrint" :disabled="!selectedPrinter">开始打印</el-button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</el-dialog> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
@ -90,7 +133,11 @@ export default { |
|
|
}, |
|
|
}, |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
printLoading: false |
|
|
|
|
|
|
|
|
printLoading: false, |
|
|
|
|
|
printerSelectionVisible: false, |
|
|
|
|
|
availablePrinters: [], |
|
|
|
|
|
selectedPrinter: '', |
|
|
|
|
|
printCopies: 1 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
|
@ -174,64 +221,23 @@ export default { |
|
|
* 显示打印机选择对话框 |
|
|
* 显示打印机选择对话框 |
|
|
*/ |
|
|
*/ |
|
|
showPrinterSelectionDialog(printers) { |
|
|
showPrinterSelectionDialog(printers) { |
|
|
const h = this.$createElement |
|
|
|
|
|
let selectedPrinter = printers.length > 0 ? printers[0].printerName : '' |
|
|
|
|
|
let copies = 1 |
|
|
|
|
|
|
|
|
|
|
|
this.$msgbox({ |
|
|
|
|
|
title: '服务器打印设置', |
|
|
|
|
|
message: h('div', [ |
|
|
|
|
|
h('div', { style: 'margin-bottom: 15px;' }, [ |
|
|
|
|
|
h('label', { style: 'display: block; margin-bottom: 5px; font-weight: bold;' }, '选择打印机:'), |
|
|
|
|
|
h('el-select', { |
|
|
|
|
|
props: { |
|
|
|
|
|
value: selectedPrinter, |
|
|
|
|
|
placeholder: '请选择打印机', |
|
|
|
|
|
style: 'width: 100%;' |
|
|
|
|
|
}, |
|
|
|
|
|
on: { |
|
|
|
|
|
input: (val) => { selectedPrinter = val } |
|
|
|
|
|
} |
|
|
|
|
|
}, printers.map(printer => |
|
|
|
|
|
h('el-option', { |
|
|
|
|
|
props: { |
|
|
|
|
|
key: printer.printerName, |
|
|
|
|
|
label: `${printer.printerName} (${printer.ipAddress})`, |
|
|
|
|
|
value: printer.printerName |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
)) |
|
|
|
|
|
]), |
|
|
|
|
|
h('div', { style: 'margin-bottom: 15px;' }, [ |
|
|
|
|
|
h('label', { style: 'display: block; margin-bottom: 5px; font-weight: bold;' }, '打印份数:'), |
|
|
|
|
|
h('el-input-number', { |
|
|
|
|
|
props: { |
|
|
|
|
|
value: copies, |
|
|
|
|
|
min: 1, |
|
|
|
|
|
max: 1, |
|
|
|
|
|
size: 'mini', |
|
|
|
|
|
style: 'width: 100%;', |
|
|
|
|
|
disabled: true |
|
|
|
|
|
}, |
|
|
|
|
|
on: { |
|
|
|
|
|
input: (val) => { copies = val } |
|
|
|
|
|
} |
|
|
|
|
|
}), |
|
|
|
|
|
h('div', { |
|
|
|
|
|
style: 'margin-top: 5px; font-size: 12px; color: #909399;' |
|
|
|
|
|
}, 'RFID标签只能打印1份,每张标签需要独立的TID读取和EPC写入过程') |
|
|
|
|
|
]) |
|
|
|
|
|
]), |
|
|
|
|
|
showCancelButton: true, |
|
|
|
|
|
confirmButtonText: '开始打印', |
|
|
|
|
|
cancelButtonText: '取消' |
|
|
|
|
|
}).then(() => { |
|
|
|
|
|
if (!selectedPrinter) { |
|
|
|
|
|
this.$message.warning('请选择打印机') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.printViaServer(selectedPrinter, copies) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
this.availablePrinters = printers |
|
|
|
|
|
this.selectedPrinter = printers.length > 0 ? printers[0].printerName : '' |
|
|
|
|
|
this.printCopies = 1 |
|
|
|
|
|
this.printerSelectionVisible = true |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 确认打印 |
|
|
|
|
|
*/ |
|
|
|
|
|
confirmPrint() { |
|
|
|
|
|
if (!this.selectedPrinter) { |
|
|
|
|
|
this.$message.warning('请选择打印机') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.printerSelectionVisible = false |
|
|
|
|
|
this.printViaServer(this.selectedPrinter, this.printCopies) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -481,6 +487,30 @@ export default { |
|
|
padding-top: 10px; |
|
|
padding-top: 10px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* 打印机选择对话框样式 */ |
|
|
|
|
|
.printer-selection-content { |
|
|
|
|
|
padding: 10px 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.form-item { |
|
|
|
|
|
margin-bottom: 20px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.form-label { |
|
|
|
|
|
display: block; |
|
|
|
|
|
margin-bottom: 8px; |
|
|
|
|
|
font-weight: 600; |
|
|
|
|
|
color: #303133; |
|
|
|
|
|
font-size: 14px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.form-hint { |
|
|
|
|
|
margin-top: 6px; |
|
|
|
|
|
font-size: 12px; |
|
|
|
|
|
color: #909399; |
|
|
|
|
|
line-height: 1.4; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/* 响应式设计 */ |
|
|
/* 响应式设计 */ |
|
|
@media (max-width: 600px) { |
|
|
@media (max-width: 600px) { |
|
|
.print-method { |
|
|
.print-method { |
|
|
@ -501,5 +531,13 @@ export default { |
|
|
.method-content p { |
|
|
.method-content p { |
|
|
font-size: 12px; |
|
|
font-size: 12px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.printer-selection-content { |
|
|
|
|
|
padding: 5px 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.form-label { |
|
|
|
|
|
font-size: 13px; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |