This commit is contained in:
xielue 2023-09-11 22:38:27 +08:00
parent 64856f846b
commit dc340bd144
2 changed files with 77 additions and 27 deletions

View File

@ -4,8 +4,8 @@
<div class="printcard-container"> <div class="printcard-container">
<div :class="item.isSelected ? 'printcard printcard-selected' : 'printcard'" v-for="(item, index) in InkjetPrinterData" <div :class="item.isSelected ? 'printcard printcard-selected' : 'printcard'"
:key="index" @click="toggleCard(item)"> v-for="(item, index) in InkjetPrinterData" :key="index" @click="toggleCard(item)">
<!-- 卡片内容 --> <!-- 卡片内容 -->
<div class="printcard-content"> <div class="printcard-content">
<div class="printcard-header"> <div class="printcard-header">
@ -15,10 +15,14 @@
<div class="printcard-buttons"> <div class="printcard-buttons">
<a-button type="primary" @click.stop="pageStart(item)">启动</a-button> <a-button type="primary" @click.stop="pageStart(item)">启动</a-button>
<a-button type="danger" @click.stop="pageStop(item)" style=" margin-left: 5px; ">停止</a-button> <a-button type="danger" @click.stop="pageStop(item)" style=" margin-left: 5px; ">停止</a-button>
</div> </div>
</div> </div>
<h3> {{ (item.ip || '') + (item.ip ? ":" : '') + (item.port || '') }}</h3> <h3> {{ (item.ip || '') + (item.ip ? ":" : '') + (item.port || '') }}</h3>
<div class="printcard-toolbar">
<a-icon key="setting" type="setting" @click.stop="pageSetting(item)"></a-icon>
</div>
@ -26,13 +30,15 @@
</div> </div>
</div> </div>
<div style="margin: 9px;width:300px;display: flex;">
<a-input v-model="addText" /> <a-button style="margin-left: 4px;" @click.stop="pageAdd()">增加条码</a-button>
</div>
<vxe-table border show-overflow keep-source ref="xTable" :height="table1Height" :data="detailsData" <vxe-table border show-overflow keep-source ref="xTable" :height="table1Height" :data="detailsData"
:row-config="{ height: 120 }" :column-config="{ resizable: true }"> :row-config="{ height: 120 }" :column-config="{ resizable: true }">
<vxe-column field="fileName" title="条码编号" width="160"></vxe-column> <vxe-column field="fileName" title="条码编号" width="160"></vxe-column>
<vxe-column field="times" title="打印次数" width="100"></vxe-column> <vxe-column field="print_statistics" title="打印次数" width="100"></vxe-column>
<vxe-column title="获取打印统计" width="150"> <vxe-column title="获取打印统计" width="150">
<template #default="{ row }"> <template #default="{ row }">
<a-button type="primary" @click.stop="pageGetPrintInfo(row)">获取打印统计</a-button> <a-button type="primary" @click.stop="pageGetPrintInfo(row)">获取打印统计</a-button>
@ -44,9 +50,9 @@
Y <a-input-number style="width:60px" v-model="row.y" /> Y <a-input-number style="width:60px" v-model="row.y" />
角度 <a-input-number style="width:60px" v-model="row.direction" /> 角度 <a-input-number style="width:60px" v-model="row.direction" />
字体 <a-select v-model="row.fontName" :options="fonts"></a-select> 字体 <a-select v-model="row.fontName" :options="fonts" style="width:80px;"></a-select>
字号 <a-input-number style="width:60px" v-model="row.fontSize" /> 字号 <a-input-number style="width:60px" v-model="row.fontSize" />
间距 <a-input-number style="width:60px" v-model="row.fontSpacing" /> 间距 <a-select v-model="row.fontSpacing" :options="fontSpacings" style="width:80px;"></a-select>
</template> </template>
</vxe-column> </vxe-column>
<vxe-column title="操作" width="150"> <vxe-column title="操作" width="150">
@ -56,11 +62,9 @@
</vxe-column> </vxe-column>
</vxe-table> </vxe-table>
<div style="margin: 9px;width:300px;display: flex;">
<a-input v-model="addText" /> <a-button style="margin-left: 4px;" @click.stop="pageAdd()">增加条码</a-button>
</div>
</div> </div>
</template> </template>
@ -87,16 +91,29 @@ export default {
currentPrint: null, currentPrint: null,
table1Height: 300, table1Height: 300,
addText:'', addText: '',
InkjetPrinterData: [ InkjetPrinterData: [
], ],
fonts: [ fonts: [
{ value: 'Arial', label: 'Arial' } { value: 'Arial', label: 'Arial' }
], ],
fontSpacings: [
{ value: 5, label: '5' },
{ value: 4, label: '4' },
{ value: 3, label: '3' },
{ value: 2, label: '2' },
{ value: 1, label: '1' },
{ value: 0, label: '0' },
{ value: -1, label: '-1' },
{ value: -2, label: '-2' },
{ value: -3, label: '-3' },
{ value: -4, label: '-4' },
{ value: -5, label: '-5' },
],
detailsData: [ detailsData: [
{ fileName: '080142-690844XAB', x: 0, y: 0, direction: 0, fontName: 'Arial', fontSize: 24, fontSpacing: 10 } { fileName: '080142-690844XAB', x: 0, y: 0, direction: 0, fontName: 'Arial', fontSize: 100, fontSpacing: 10 }
] ]
@ -115,7 +132,9 @@ export default {
}, },
// //
methods: { methods: {
pageSetting(row) {
this.$openPage("/InkjetPrinter/InkjetPrinterSetting/" + row.id); //
},
filesInit() { filesInit() {
this.$mk.post({ this.$mk.post({
url: this.actions.getFiles, url: this.actions.getFiles,
@ -129,17 +148,17 @@ export default {
let ds = []; let ds = [];
let textList = a.textList || a.data.textList || []; let textList = a.textList || a.data.textList || [];
textList.forEach(text => { textList.forEach(text => {
ds.push({ fileName: text, x: 0, y: 0, direction: 0, fontName: 'Arial', fontSize: 24, fontSpacing: 10 }) ds.push({ fileName: text, x: 0, y: 0, direction: 0, fontName: 'Arial', fontSize: 100, fontSpacing: 10 })
}); });
this.detailsData = ds; this.detailsData = ds;
} }
}); });
}, },
pageAdd(){ pageAdd() {
this.detailsData = [...this.detailsData, { fileName: this.addText || '', x: 0, y: 0, direction: 0, fontName: 'Arial', fontSize: 100, fontSpacing: 10 }]
this.detailsData = [...this.detailsData ,{ fileName: this.addText || '', x: 0, y: 0, direction: 0, fontName: 'Arial', fontSize: 24, fontSpacing: 10 }]
}, },
printInit() { printInit() {
@ -195,7 +214,7 @@ export default {
pageStart(item) { pageStart(item) {
var sendData = { var sendData = {
id: this.$mk.toBigInt(item.id) id: this.$mk.toBigInt(item.id)
}; };
this.$mk.post({ this.$mk.post({
url: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/start/machine`, url: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/start/machine`,
loading: "启动中...", loading: "启动中...",
@ -213,7 +232,7 @@ export default {
pageStop(item) { pageStop(item) {
var sendData = { var sendData = {
id: this.$mk.toBigInt(item.id) id: this.$mk.toBigInt(item.id)
}; };
this.$mk.post({ this.$mk.post({
url: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/stop/machine`, url: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/stop/machine`,
loading: "停止中...", loading: "停止中...",
@ -227,13 +246,13 @@ export default {
} }
}); });
}, },
pageGetPrintInfo() { pageGetPrintInfo(row) {
if (!this.currentPrint) { if (!this.currentPrint) {
this.$mk.error("请先选择机器"); this.$mk.error("请先选择机器");
return; return;
} }
var sendData = {}; var sendData = {};
sendData.id = this.$mk.toBigInt(this.currentPrint.id); sendData.id = this.$mk.toBigInt(this.currentPrint.id);
this.$mk.post({ this.$mk.post({
url: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/get/print/statistics`, url: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/get/print/statistics`,
loading: "获取中...", loading: "获取中...",
@ -243,7 +262,11 @@ export default {
if (a.code != 200) { if (a.code != 200) {
this.$mk.error(a.msg); this.$mk.error(a.msg);
} else { } else {
console.log(a) if (a.data && a.data.print_statistics) {
row.print_statistics = a.data.print_statistics;
this.$forceUpdate();
}
} }
}); });
}, },
@ -255,7 +278,7 @@ export default {
} }
var sendData = Object.assign({}, item); var sendData = Object.assign({}, item);
delete sendData._X_ROW_KEY; delete sendData._X_ROW_KEY;
delete sendData.times; delete sendData.print_statistics;
sendData.id = this.$mk.toBigInt(this.currentPrint.id); sendData.id = this.$mk.toBigInt(this.currentPrint.id);
sendData.contents = sendData.fileName; sendData.contents = sendData.fileName;
this.$mk.post({ this.$mk.post({
@ -293,7 +316,7 @@ export default {
width: calc(33.33% - 20px); width: calc(33.33% - 20px);
/* 调整卡片宽度,包括间距 */ /* 调整卡片宽度,包括间距 */
margin: 10px; margin: 10px;
padding: 20px; padding: 15px;
background-color: #fff; background-color: #fff;
border-radius: 8px; border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
@ -313,6 +336,8 @@ export default {
font-size: 16px; font-size: 16px;
color: #333; color: #333;
line-height: 1.5; line-height: 1.5;
position: relative;
padding-bottom: 20px;
} }
.printcard-content .ant-input { .printcard-content .ant-input {
@ -334,4 +359,14 @@ export default {
.printcard-selected { .printcard-selected {
background-color: #b2d9f1; background-color: #b2d9f1;
} }
.printcard-toolbar {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 10px;
display: flex;
justify-content: flex-end;
}
</style> </style>

View File

@ -53,8 +53,20 @@ export default {
{ title: '复位打印统计', url: "/InkjetPrinter/v1/reset/print/statistics" }, { title: '复位打印统计', url: "/InkjetPrinter/v1/reset/print/statistics" },
{ title: '取消报警闪烁', url: "/InkjetPrinter/v1/cancel/alarm/flash" }, { title: '取消报警闪烁', url: "/InkjetPrinter/v1/cancel/alarm/flash" },
{ title: '设置打印延迟', postField: 'delay', url: "/InkjetPrinter/v1/set/print/delay", type: 'integer', value: 1000 }, { title: '设置打印延迟', postField: 'delay', url: "/InkjetPrinter/v1/set/print/delay", type: 'integer', value: 1000 },
{ title: '设置字体大小', postField: 'fontSize', url: "/InkjetPrinter/v1/font/size", type: 'integer', value: 80 }, { title: '设置字体大小', postField: 'fontSize',isNumber:true, url: "/InkjetPrinter/v1/font/size", type: 'integer', value: 80 },
{ title: '设置字体间距', postField: 'fontSpacing', url: "/InkjetPrinter/v1/font/spacing", type: 'integer', value: 80 }, { title: '设置字体间距', postField: 'fontSpacing', url: "/InkjetPrinter/v1/font/spacing", type: 'select',options: [
{ value: 5, label: '5' },
{ value: 4, label: '4' },
{ value: 3, label: '3' },
{ value: 2, label: '2' },
{ value: 1, label: '1' },
{ value: 0, label: '0' },
{ value: -1, label: '-1' },
{ value: -2, label: '-2' },
{ value: -3, label: '-3' },
{ value: -4, label: '-4' },
{ value: -5, label: '-5' },
] , value: 0 },
{ {
title: '设置打印上下翻转', postField: 'direction', url: "/InkjetPrinter/v1/set/print/flip", type: 'select', value: 0, title: '设置打印上下翻转', postField: 'direction', url: "/InkjetPrinter/v1/set/print/flip", type: 'select', value: 0,
options: [{ value: 0, label: '上翻' }, { value: 1, label: '下翻' }] options: [{ value: 0, label: '上翻' }, { value: 1, label: '下翻' }]
@ -141,6 +153,9 @@ export default {
if (item.postField) { if (item.postField) {
sendData[item.postField] = item.value; sendData[item.postField] = item.value;
} }
if(item.isString){
sendData[item.postField] = item.value +"";
}
this.$mk.post({ this.$mk.post({
url: `${BASE_URL.BASE_URL}` + item.url, url: `${BASE_URL.BASE_URL}` + item.url,
loading: "发送指令中...", loading: "发送指令中...",