模具 喷印界面调整1

This commit is contained in:
xielue 2023-09-21 23:33:37 +08:00
parent dc348d7fec
commit f4da0fcdee
3 changed files with 498 additions and 169 deletions

View File

@ -0,0 +1,121 @@
<template>
<div class="page-body router-edit-page">
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
</vxe-form>
<div class="footerbar-bottom">
<a-button type="primary" @click="pageSend">确定</a-button>
</div>
</div>
</template>
<script>
import BASE_URL from '@/services/base/api.js';
export default {
props: {
pageMode: {
type: String,
default: "edit"
},
pageOptions: {
type: Object
},
dataId: {
}
},
data() {
//
var pageData = {
actions: {
},
beid: 0,
parentName: '',
InkjetPrinterData:[],
formOptions: {
data: {
id:'',
x: 0,
y: 0,
direction: 0,
fontName: 'Arial',
fontSize: 100,
fontSpacing: 10
},
titleWidth: 100,
titleAlign: 'right',
rules: {
},
items: [
{ field: 'quantity', title: '本次完工数量', span: 24, itemRender: { name: '$input', props: { type: 'number' } } },
]
},
};
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
return pageData;
},
created() {
},
//
methods: {
pageSend() {
var sendData = JSON.parse(JSON.stringify( this.formOptions.data))
sendData.voucherId = this.pageOptions.voucherId;
sendData.inventoryId = this.pageOptions.inventoryId;
this.$mk.post({
url: `http://36.133.149.247:9112/api/tp/doneSqItem`,
loading: "操作中...",
data: sendData,
useBigInt: true
}).then(a => {
if (a.code != 200) {
this.$mk.error(a.msg);
} else {
this.$mk.success(a.msg || "操作成功");
}
});
},
cancel() {
this.$emit("callback", {});
},
},
//
watch: {
}
};
</script>
<style scoped lang="less">
.router-edit-page .vxe-pulldown {
width: 100%;
}
</style>

View File

@ -0,0 +1,190 @@
<template>
<div class="page-body router-edit-page">
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
</vxe-form>
<div class="footerbar-bottom">
<a-button type="primary" @click="pageSend">确定</a-button>
</div>
</div>
</template>
<script>
import BASE_URL from '@/services/base/api.js';
export default {
props: {
pageMode: {
type: String,
default: "edit"
},
pageOptions: {
type: Object
},
dataId: {
}
},
data() {
//
var pageData = {
actions: {
get: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/inkjet/printer/list`
},
beid: 0,
parentName: '',
InkjetPrinterData:[],
formOptions: {
data: {
id:'',
x: 0,
y: 0,
direction: 0,
fontName: 'Arial',
fontSize: 100,
fontSpacing: 10
},
titleWidth: 100,
titleAlign: 'right',
rules: {
},
items: [
{ field: 'id', title: '机器', span: 24, itemRender: { name: '$select', props: { options: [] } } },
{ field: 'x', title: 'X', span: 24, itemRender: { name: '$input', props: { type: 'number' } } },
{ field: 'y', title: 'Y', span: 24, itemRender: { name: '$input', props: { type: 'number' } } },
{ field: 'direction', title: '角度', span: 24, itemRender: { name: '$input', props: { type: 'number' } } },
{
field: 'fontName', title: '字体', span: 24, itemRender: {
name: '$select', props: {
options: [
{ value: 'Arial', label: 'Arial' }
]
}
}
},
{
field: 'fontSpacing', title: '间距', span: 24, itemRender: {
name: '$select', props: {
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' },
]
}
}
},
]
},
};
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
return pageData;
},
created() {
this.printInit();
},
//
methods: {
printInit() {
this.$mk.post({
url: this.actions.get,
loading: "加载中...",
data: {
"end_time": 0,
"page": 1,
"start_time": 0,
"limit": 999,
"order_bys": [
],
"search_rules": [
]
},
useBigInt: true
}).then(a => {
this.InkjetPrinterData = a.data.InkjetPrinter;
let options = [];
this.InkjetPrinterData.forEach(item=>{
options.push({
value :item.id.toString(),
label : item.name +"-" +( item.ip || '') + ":"+item.port
})
});
this.formOptions.data.id = options[0].value;
this.formOptions.items[0].itemRender.props.options = options;
}).catch((a) => {
this.$mk.error(a.data.msg);
});
},
pageSend() {
var sendData = JSON.parse(JSON.stringify( this.formOptions.data))
sendData.id = this.$mk.toBigInt(sendData.id);
sendData.contents = this.pageOptions.sequance;
sendData.fileName = "";
this.$mk.post({
url: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/send/print/file`,
loading: "发送文件中...",
data: sendData,
useBigInt: true
}).then(a => {
if (a.code != 200) {
this.$mk.error(a.msg);
} else {
this.$mk.success(a.msg || "发送成功");
}
});
},
cancel() {
this.$emit("callback", {});
},
},
//
watch: {
}
};
</script>
<style scoped lang="less">
.router-edit-page .vxe-pulldown {
width: 100%;
}
</style>

View File

@ -1,74 +1,40 @@
<template>
<div class="page-body">
<div style="margin: 10px;">
<vxe-form :data="searchFormData" :items="searchFormItems" titleColon @submit="onSearch">
<template #date="{ }">
<a-form-item label="单据时间" :style="{ display: 'inline-block', width: 120 }">
</a-form-item>
<a-form-item :style="{ display: 'inline-block', width: 'calc(100% - 120px )' }">
<a-range-picker @change="onDateChange" />
</a-form-item>
</template>
</vxe-form>
<vxe-table border show-overflow keep-source ref="xTable" :height="table1Height" :data="detailsData"
:row-config="{ height: 120 }" :column-config="{ resizable: true }">
<div class="printcard-container">
<div :class="item.isSelected ? 'printcard printcard-selected' : 'printcard'"
v-for="(item, index) in InkjetPrinterData" :key="index" @click="toggleCard(item)">
<!-- 卡片内容 -->
<div class="printcard-content">
<div class="printcard-header">
<div class="printcard-title">
<h4> {{ item.name }}</h4>
</div>
<div class="printcard-buttons">
<a-button type="primary" @click.stop="pageStart(item)">启动</a-button>
<a-button type="danger" @click.stop="pageStop(item)" style=" margin-left: 5px; ">停止</a-button>
</div>
</div>
<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>
<vxe-column title="操作" width="230">
<template #default="{ row }">
<a-button type="primary" @click.stop="pageShowSend(row)">开工</a-button>
<a-button type="primary" @click.stop="pagePrintTag(row)" style="margin-left: 2px;">打印</a-button>
<a-button type="primary" @click.stop="pageDone(row)" style="margin-left: 2px;">完工</a-button>
</template>
</vxe-column>
<vxe-column field="voucherdate" title="单据日期" width="110"></vxe-column>
<vxe-column field="vouchercode" title="单据号" width="140"></vxe-column>
<vxe-column field="departmentName" title="生产车间" width="120"></vxe-column>
<vxe-column field="inventoryName" title="存货名称" width="130"></vxe-column>
<vxe-column field="quantity" title="数量" width="80"></vxe-column>
<vxe-column field="sequance" title="批次号" width="170"></vxe-column>
</vxe-table>
</div>
</div>
</div>
<div style="margin: 9px;width:300px;display: flex;">
<a-input v-model="searchKey" /> <a-button style="margin-left: 4px;" @click.stop="pageSearch()">搜索</a-button>
<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"
:row-config="{ height: 120 }" :column-config="{ resizable: true }">
<vxe-column field="sequance" title="条码编号" width="180"></vxe-column>
<vxe-column field="voucherdate" title="单据日期" width="110"></vxe-column>
<vxe-column field="vouchercode" title="单据号" width="140"></vxe-column>
<vxe-column field="departmentName" title="生产车间" width="120"></vxe-column>
<vxe-column field="inventoryName" title="存货名称" width="130"></vxe-column>
<vxe-column field="quantity" title="数量" width="80"></vxe-column>
<vxe-column field="print_statistics" title="打印次数" width="100"></vxe-column>
<vxe-column title="获取打印统计" width="150">
<template #default="{ row }">
<a-button type="primary" @click.stop="pageGetPrintInfo(row)">获取打印统计</a-button>
</template>
</vxe-column>
<vxe-column title="设置" width="600">
<template #default="{ row }">
X <a-input-number style="width:60px" v-model="row.x" />
Y <a-input-number style="width:60px" v-model="row.y" />
角度 <a-input-number style="width:60px" v-model="row.direction" />
字体 <a-select v-model="row.fontName" :options="fonts" style="width:80px;"></a-select>
字号 <a-input-number style="width:60px" v-model="row.fontSize" />
间距 <a-select v-model="row.fontSpacing" :options="fontSpacings" style="width:80px;"></a-select>
</template>
</vxe-column>
<vxe-column title="操作" width="150">
<template #default="{ row }">
<a-button type="primary" @click.stop="pageSend(row)">发送打印文件</a-button>
</template>
</vxe-column>
</vxe-table>
</div>
@ -76,6 +42,7 @@
<script>
import BASE_URL from '@/services/base/api.js';
import { toDateString } from 'xe-utils'
export default {
@ -92,10 +59,56 @@ export default {
actions: {
get: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/inkjet/printer/list`,
sequanceData: `http://36.133.149.247:9112/api/tp/getSqList`
getSqDepartments: `http://36.133.149.247:9112/api/tp/getSqDepartments`,
sequanceData: `http://36.133.149.247:9112/api/tp/getSqList2`
},
start_time: 0, //
end_time: 0, //
//
searchFormData: {
vouchercode: '',
inventoryName: '',
departmentName:''
},
//
searchRules: [
{ key: "vouchercode", mode: "like" },
{ key: "inventoryName", mode: "like" },
{ key: "departmentName", mode: "equal" },
],
//
searchFormItems: [ //
{
span: 24, children: [
{ span: 6, slots: { default: 'date' } }, //
{ field: 'vouchercode', title: '单据编号', span: 6, itemRender: { name: '$input', props: { placeholder: '请输入单据编号' } } },
{ field: 'inventoryName', title: '存货名称', span: 6, itemRender: { name: '$input', props: { placeholder: '请输入存货名称' } } },
]
},
{
span: 24,
children: [
{ field: 'departmentName', title: '生产车间', span: 12, itemRender: { name: '$select', props: { placeholder: '请输入生产车间', options: [] } } },
{
align: 'right', span: 6, itemRender: { //
name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } }, //
{ props: { type: 'reset', content: '重置' } }]
}
}
]
}
],
searchKey: '',
currentPrint: null,
currentRow: null,
table1Height: 300,
addText: '',
InkjetPrinterData: [
@ -132,83 +145,138 @@ export default {
created() {
this.printInit();
this.sqDepartmentsInit();
this.sequanceDataInit();
this.heightInit();
},
//
methods: {
onDateChange(date) {
if (date && date.length) {
this.start_time = toDateString(date[0]._d, 'yyyy/MM/dd') + ' 00:00';
this.end_time = toDateString(date[1]._d, 'yyyy/MM/dd') + ' 23:59:59';
} else {
this.start_time = null;
this.end_time = null;
}
},
pageSetting(row) {
this.$openPage("/InkjetPrinter/InkjetPrinterSetting/" + row.id); //
},
getSearchParms() {
var rules = [];
let findMode = k => {
for (let i in this.searchRules) {
if (this.searchRules[i].key == k) return this.searchRules[i].mode;
}
return "equal";
};
for (let key in this.searchFormData) {
let value = this.searchFormData[key];
if (key == "inventory") {
if (value && value[0]) {
rules.push({
field: " id in (select manufactureOrderID from v_MP_ManufactureOrder_b where inventoryID = " + value[0] + ") ",
type: "sql"
});
}
} else {
if (value) {
let mode = findMode(key);
rules.push({
field: key,
op: mode,
value: value
});
}
}
}
if (this.start_time) {
rules.push({
field: 'voucherdate',
op: 'greaterorequal',
value: this.start_time
});
}
if (this.end_time) {
rules.push({
field: 'voucherdate',
op: 'lessorequal',
value: this.end_time
});
}
return {
op: 'and', groups: [], rules: rules
};
},
sequanceDataInit() {
this.$mk.post({
url: this.actions.sequanceData,
loading: "加载中...",
data: {
key: this.searchKey
}
}).then(a => {
if (a.code == 200) {
let ds = [];
let textList = a.textList || a.data.textList || [];
textList.forEach(item => {
let o = this.getDefaultData(item);
if(o.voucherdate){
o.voucherdate = o.voucherdate.substr(0,10)
filter: this.getSearchParms()
}
}).then(a => {
if (a.code == 200) {
let ds = [];
a.data.forEach(item => {
let o = item;
if (o.voucherdate) {
o.voucherdate = o.voucherdate.substr(0, 10)
}
ds.push(o)
});
ds= JSON.parse(JSON.stringify(ds))
});
ds = JSON.parse(JSON.stringify(ds))
this.detailsData = ds;
}
});
},
pageSearch() {
this.filesInit();
sqDepartmentsInit() {
this.$mk.post({
url: this.actions.getSqDepartments,
loading: "加载中...",
data: {
}
}).then(a => {
if (a.code == 200) {
let ds = [];
a.data.forEach(item => {
ds.push({value:item.name,label:item.name});
});
this.searchFormItems[1].children[0].itemRender.props.options = ds;
}
});
},
onSearch() {
this.sequanceDataInit();
},
getDefaultData(item){
return Object.assign(item, {x: 0, y: 0, direction: 0, fontName: 'Arial', fontSize: 100, fontSpacing: 10 });
getDefaultData(item) {
return Object.assign(item, { x: 0, y: 0, direction: 0, fontName: 'Arial', fontSize: 100, fontSpacing: 10 });
},
pageAdd() {
this.detailsData = [...this.detailsData, this.getDefaultData({sequance:this.searchKey})];
this.detailsData = [...this.detailsData, this.getDefaultData({ sequance: this.searchKey })];
},
printInit() {
this.$mk.post({
url: this.actions.get,
loading: "加载中...",
data: {
"end_time": 0,
"page": 1,
"start_time": 0,
"limit": 999,
"order_bys": [
],
"search_rules": [
]
},
useBigInt: true
}).then(a => {
this.InkjetPrinterData = a.data.InkjetPrinter;
}).catch((a) => {
this.$mk.error(a.data.msg);
});
},
heightInit() {
@ -236,7 +304,16 @@ export default {
this.$forceUpdate();
},
pageShowSend(row) {
this.currentRow = row
this.$mk.dialog.open({
page: () => import("./modal-send.vue"),
title: "开工",
pageOptions: row,
width: 500,
height: 400
});
},
pageStart(item) {
var sendData = {
id: this.$mk.toBigInt(item.id)
@ -265,7 +342,7 @@ export default {
data: sendData,
useBigInt: true
}).then(a => {
if (a.code == 200) {
if (a.code == 200) {
this.$mk.success(a.msg || "停止成功");
}
});
@ -338,66 +415,7 @@ export default {
</script>
<style>
.printcard-container {
display: flex;
flex-wrap: wrap;
}
.printcard {
width: calc(33.33% - 20px);
/* 调整卡片宽度,包括间距 */
margin: 10px;
padding: 15px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
/* 添加阴影效果 */
transition: box-shadow 0.3s ease;
/* 添加过渡效果 */
cursor: pointer;
}
.printcard:hover {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
/* 鼠标悬停时增加阴影效果 */
}
.printcard-content {
font-size: 16px;
color: #333;
line-height: 1.5;
position: relative;
padding-bottom: 20px;
}
.printcard-content .ant-input {
margin-bottom: 5px;
}
.printcard-header {
display: flex;
}
.printcard-title {
flex: 2;
}
.printcard-buttons {
flex: 1;
}
.printcard-selected {
background-color: #b2d9f1;
}
.printcard-toolbar {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 10px;
display: flex;
justify-content: flex-end;
.page-body {
background: white;
}
</style>