|
|
|
|
@ -153,7 +153,7 @@ const handleClose = (done) => {
|
|
|
|
|
};
|
|
|
|
|
const drawer = ref(false);
|
|
|
|
|
const loading = ref(false);
|
|
|
|
|
const drawerRef = ref()
|
|
|
|
|
const drawerRef = ref();
|
|
|
|
|
const printTemplateList = ref([]);
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const printType = ref(0);
|
|
|
|
|
@ -188,8 +188,20 @@ const messageFun = (event) => {
|
|
|
|
|
// let data = JSON.parse(event.data);
|
|
|
|
|
let data = event.data;
|
|
|
|
|
if (data.type === 'print') {
|
|
|
|
|
window.chrome?.webview?.postMessage(JSON.stringify({ value: pageDatas.value, type: 'print' }));
|
|
|
|
|
printFun();
|
|
|
|
|
let zoomEl = zoom.value
|
|
|
|
|
zoom.value = 5
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
printFun()
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
zoom.value = zoomEl
|
|
|
|
|
},200)
|
|
|
|
|
},500)
|
|
|
|
|
})
|
|
|
|
|
// printFun();
|
|
|
|
|
}
|
|
|
|
|
if (data.type === 'return') {
|
|
|
|
|
window.chrome?.webview?.postMessage(JSON.stringify({ value: pageDatas.value, type: 'return' }));
|
|
|
|
|
}
|
|
|
|
|
if (data.type === 'JSONDATA') {
|
|
|
|
|
if (typeof data.message === 'object' && data.message !== null && !Array.isArray(data.message)) {
|
|
|
|
|
@ -202,6 +214,23 @@ const messageFun = (event) => {
|
|
|
|
|
// window.chrome?.webview?.postMessage('setDataFail');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (data.type === 'updateData') {
|
|
|
|
|
let data = [];
|
|
|
|
|
if (typeof data.message === 'object' && data.message !== null && !Array.isArray(data.message)) {
|
|
|
|
|
data = [data.message];
|
|
|
|
|
// window.chrome?.webview?.postMessage('setDataFinally');
|
|
|
|
|
} else if (Array.isArray(data.message)) {
|
|
|
|
|
data = data.message;
|
|
|
|
|
// window.chrome?.webview?.postMessage('setDataFinally');
|
|
|
|
|
} else {
|
|
|
|
|
// window.chrome?.webview?.postMessage('setDataFail');
|
|
|
|
|
}
|
|
|
|
|
data.forEach((item, index) => {
|
|
|
|
|
Object.keys(item).forEach(key => {
|
|
|
|
|
pageDatas.value[index][key] = item[key];
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
};
|
|
|
|
|
const setNodes = (data) => {
|
|
|
|
|
@ -232,7 +261,7 @@ const setNodes = (data) => {
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
zoom.value = ((printRef.value.offsetWidth) / 793);
|
|
|
|
|
});
|
|
|
|
|
drawer.value = false
|
|
|
|
|
drawer.value = false;
|
|
|
|
|
loading.value = false;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
@ -240,7 +269,49 @@ const setNodes = (data) => {
|
|
|
|
|
const setValue = (value, field, index) => {
|
|
|
|
|
pageDatas.value[index][field] = value;
|
|
|
|
|
};
|
|
|
|
|
const test = () =>{
|
|
|
|
|
let json1 = {
|
|
|
|
|
'PlanCode': '20260112100528PL0001',
|
|
|
|
|
'CardRecordCode': '20260112NC001010001',
|
|
|
|
|
'ClassesName': '\u65E9',
|
|
|
|
|
'TeamName': '\u7532\u73ED',
|
|
|
|
|
'MaterialSpec': 'NL821/832/833/840/841/844/848/849/106',
|
|
|
|
|
'MachineName': '\u5185\u5B58\u5C421#',
|
|
|
|
|
'UserList': ['\u674E\u5185\u886C\u5C42', '\u738B\u5185\u886C\u5C42', '\u5F20\u5185\u886C\u5C42'],
|
|
|
|
|
'UserListSel': null,
|
|
|
|
|
'ResultList': ['\u5408\u683C', '\u4E0D\u5408\u683C'],
|
|
|
|
|
'ResultListSel': null,
|
|
|
|
|
'ValidDate': '30',
|
|
|
|
|
'ToolingCode': '',
|
|
|
|
|
'Width': '1000',
|
|
|
|
|
'RealBeginTime': '2026-01-12 10:54:35',
|
|
|
|
|
'RealEndTime': '2026-01-12 14:34:12',
|
|
|
|
|
'CompleteAmount': '0',
|
|
|
|
|
'UnitList': ['\u7C73'],
|
|
|
|
|
'UnitListSel': null,
|
|
|
|
|
'Batch': '0',
|
|
|
|
|
'ContinueTime': '0',
|
|
|
|
|
'Remark': '',
|
|
|
|
|
'StationList': ['\u5185\u5B58\u5C421#\u4EA7\u51FA\u5DE5\u4F4D1', '\u5185\u5B58\u5C421#\u4EA7\u51FA\u5DE5\u4F4D2'],
|
|
|
|
|
'StationListSel': '\u5185\u5B58\u5C421#',
|
|
|
|
|
'BarCode': null
|
|
|
|
|
};
|
|
|
|
|
pageDatas.value = [json1];
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
console.log(123);
|
|
|
|
|
let data = [{ Batch: '123' }];
|
|
|
|
|
data.forEach((item, index) => {
|
|
|
|
|
Object.keys(item).forEach(key => {
|
|
|
|
|
pageDatas.value[index][key] = item[key];
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}, 1000 * 5);
|
|
|
|
|
}
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
// test()
|
|
|
|
|
window.addEventListener('afterprint', () => {
|
|
|
|
|
isPrint.value = false;
|
|
|
|
|
});
|
|
|
|
|
window.chrome?.webview?.addEventListener('message', messageFun);
|
|
|
|
|
window.chrome?.webview?.postMessage('onMounted');
|
|
|
|
|
const param = route.query.data;
|
|
|
|
|
@ -305,6 +376,7 @@ const printFun = (e) => {
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
Promise.all(pros).then((values) => {
|
|
|
|
|
|
|
|
|
|
window.print();
|
|
|
|
|
// window.chrome?.webview?.postMessage('completed');
|
|
|
|
|
isPrint.value = false;
|
|
|
|
|
@ -348,10 +420,11 @@ defineExpose({
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
|
|
.content {
|
|
|
|
|
position: relative;
|
|
|
|
|
width: 100%;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
//overflow: hidden;
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
background-size: 100% 100%;
|
|
|
|
|
border-top: 1px solid #ccc;
|
|
|
|
|
@ -397,6 +470,7 @@ defineExpose({
|
|
|
|
|
right: 0;
|
|
|
|
|
top: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.printTemplateList {
|
|
|
|
|
width: 150px;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|