版本修改
This commit is contained in:
parent
0fcc8c5cbb
commit
8fc15b10cd
@ -6,11 +6,11 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta
|
||||
name="keywords"
|
||||
content="vue-next-admin,vue-prev-admin,vue-admin-wonderful,后台管理系统一站式平台模板,希望可以帮你完成快速开发。vue2.x,vue2.0,vue2,vue3,vue3.x,vue3.0,CompositionAPI,typescript,element plus,element,plus,admin,wonderful,wonderful-next,vue-next-admin,vite,vite-admin,快速,高效,后台模板,后台系统,管理系统"
|
||||
content="123"
|
||||
/>
|
||||
<meta
|
||||
name="description"
|
||||
content="vue-next-admin,基于 vue3 + CompositionAPI + typescript + vite + element plus,适配手机、平板、pc 的后台开源免费管理系统模板!vue-prev-admin,基于 vue2 + element ui,适配手机、平板、pc 的后台开源免费管理系统模板!"
|
||||
content="123"
|
||||
/>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<title>vue-next-admin</title>
|
||||
@ -18,7 +18,8 @@
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
<script type="module" src="/lodop.js"></script>
|
||||
<script src="https://cdn.staticfile.net/Sortable/1.10.0-rc2/Sortable.min.js"></script>
|
||||
<!-- <script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=wsijQt8sLXrCW71YesmispvYHitfG9gv&s=1"></script>-->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
189
lodop.js
Normal file
189
lodop.js
Normal file
@ -0,0 +1,189 @@
|
||||
//==本JS是加载Lodop插件或Web打印服务CLodop/Lodop7的综合示例,可直接使用,建议理解后融入自己程序==
|
||||
|
||||
//用双端口加载主JS文件Lodop.js(或CLodopfuncs.js兼容老版本)以防其中某端口被占:
|
||||
var MainJS ="CLodopfuncs.js",
|
||||
URL_WS1 = "ws://localhost:8000/"+MainJS, //ws用8000/18000
|
||||
URL_WS2 = "ws://localhost:18000/"+MainJS,
|
||||
URL_HTTP1 = "http://localhost:8000/"+MainJS, //http用8000/18000
|
||||
URL_HTTP2 = "http://localhost:18000/"+MainJS,
|
||||
URL_HTTP3 = "https://localhost.lodop.net:8443/"+MainJS; //https用8000/8443
|
||||
|
||||
var CreatedOKLodopObject, CLodopIsLocal, LoadJsState;
|
||||
|
||||
//==判断是否需要CLodop(那些不支持插件的浏览器):==
|
||||
function needCLodop() {
|
||||
try {
|
||||
var ua = navigator.userAgent;
|
||||
if (ua.match(/Windows\sPhone/i) ||
|
||||
ua.match(/iPhone|iPod|iPad/i) ||
|
||||
ua.match(/Android/i) ||
|
||||
ua.match(/Edge\D?\d+/i))
|
||||
return true;
|
||||
var verTrident = ua.match(/Trident\D?\d+/i);
|
||||
var verIE = ua.match(/MSIE\D?\d+/i);
|
||||
var verOPR = ua.match(/OPR\D?\d+/i);
|
||||
var verFF = ua.match(/Firefox\D?\d+/i);
|
||||
var x64 = ua.match(/x64/i);
|
||||
if ((!verTrident) && (!verIE) && (x64)) return true;
|
||||
else if (verFF) {
|
||||
verFF = verFF[0].match(/\d+/);
|
||||
if ((verFF[0] >= 41) || (x64)) return true;
|
||||
} else if (verOPR) {
|
||||
verOPR = verOPR[0].match(/\d+/);
|
||||
if (verOPR[0] >= 32) return true;
|
||||
} else if ((!verTrident) && (!verIE)) {
|
||||
var verChrome = ua.match(/Chrome\D?\d+/i);
|
||||
if (verChrome) {
|
||||
verChrome = verChrome[0].match(/\d+/);
|
||||
if (verChrome[0] >= 41) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (err) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//==检查加载成功与否,如没成功则用http(s)再试==
|
||||
//==低版本CLODOP6.561/Lodop7.043及前)用本方法==
|
||||
function checkOrTryHttp() {
|
||||
if (window.getCLodop) {
|
||||
LoadJsState = "complete";
|
||||
return true;
|
||||
}
|
||||
if (LoadJsState == "loadingB" || LoadJsState == "complete") return;
|
||||
LoadJsState = "loadingB";
|
||||
var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
|
||||
var JS1 = document.createElement("script")
|
||||
,JS2 = document.createElement("script")
|
||||
,JS3 = document.createElement("script");
|
||||
JS1.src = URL_HTTP1;
|
||||
JS2.src = URL_HTTP2;
|
||||
JS3.src = URL_HTTP3;
|
||||
JS1.onload = JS2.onload = JS3.onload = JS2.onerror = JS3.onerror=function(){LoadJsState = "complete";}
|
||||
JS1.onerror = function(e) {
|
||||
if (window.location.protocol !== 'https:')
|
||||
head.insertBefore(JS2, head.firstChild); else
|
||||
head.insertBefore(JS3, head.firstChild);
|
||||
}
|
||||
head.insertBefore(JS1,head.firstChild);
|
||||
}
|
||||
|
||||
//==加载Lodop对象的主过程:==
|
||||
(function loadCLodop(){
|
||||
if (!needCLodop()) return;
|
||||
CLodopIsLocal = !!((URL_WS1 + URL_WS2).match(/\/\/localho|\/\/127.0.0./i));
|
||||
LoadJsState = "loadingA";
|
||||
if (!window.WebSocket && window.MozWebSocket) window.WebSocket=window.MozWebSocket;
|
||||
//ws方式速度快(小于200ms)且可避免CORS错误,但要求Lodop版本足够新:
|
||||
try {
|
||||
var WSK1=new WebSocket(URL_WS1);
|
||||
WSK1.onopen = function(e) { setTimeout("checkOrTryHttp()",200); }
|
||||
WSK1.onmessage = function(e) {if (!window.getCLodop) eval(e.data);}
|
||||
WSK1.onerror = function(e) {
|
||||
var WSK2=new WebSocket(URL_WS2);
|
||||
WSK2.onopen = function(e) {setTimeout("checkOrTryHttp()",200);}
|
||||
WSK2.onmessage = function(e) {if (!window.getCLodop) eval(e.data);}
|
||||
WSK2.onerror= function(e) {checkOrTryHttp();}
|
||||
}
|
||||
} catch(e){
|
||||
checkOrTryHttp();
|
||||
}
|
||||
})();
|
||||
|
||||
//==获取LODOP对象主过程,判断是否安装、需否升级:==
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
function getLodop(oOBJECT, oEMBED) {
|
||||
var strFontTag = "<br><font color='#FF00FF'>打印控件";
|
||||
var strLodopInstall = strFontTag + "未安装!点击这里<a href='http://58.252.252.77:8085/CLodop_Setup_for_Win32NT.exe' target='_self'>执行安装</a>";
|
||||
var strLodopUpdate = strFontTag + "需要升级!点击这里<a href='http://58.252.252.77:8085/CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>";
|
||||
var strLodop64Install = strFontTag + "未安装!点击这里<a href='http://58.252.252.77:8085/CLodop_Setup_for_Win32NT.exe' target='_self'>执行安装</a>";
|
||||
var strLodop64Update = strFontTag + "需要升级!点击这里<a href='http://58.252.252.77:8085/CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>";
|
||||
var strCLodopInstallA = "<br><font color='#FF00FF'>Web打印服务CLodop未安装启动,点击这里<a href='http://58.252.252.77:8085/CLodop_Setup_for_Win32NT.exe' target='_self'>下载执行安装</a>";
|
||||
var strCLodopInstallB = "<br>(若此前已安装过,可<a href='CLodop.protocol:setup' target='_self'>点这里直接再次启动</a>)";
|
||||
var strCLodopUpdate = "<br><font color='#FF00FF'>Web打印服务CLodop需升级!点击这里<a href='http://58.252.252.77:8085/CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>";
|
||||
var strLodop7FontTag = "<br><font color='#FF00FF'>Web打印服务Lodop7";
|
||||
var strLodop7HrefX86 = "点击这里<a href='http://58.252.252.77:8085/CLodop_Setup_for_Win32NT.exe' target='_self'>下载安装</a>(下载后解压,点击lodop文件开始执行)";
|
||||
var strLodop7HrefARM = "点击这里<a href='http://58.252.252.77:8085/CLodop_Setup_for_Win32NT.exe' target='_self'>下载安装</a>(下载后解压,点击lodop文件开始执行)";
|
||||
var strLodop7Install_X86 = strLodop7FontTag + "未安装启动," + strLodop7HrefX86;
|
||||
var strLodop7Install_ARM = strLodop7FontTag + "未安装启动," + strLodop7HrefARM;
|
||||
var strLodop7Update_X86 = strLodop7FontTag + "需升级," + strLodop7HrefX86;
|
||||
var strLodop7Update_ARM = strLodop7FontTag + "需升级," + strLodop7HrefARM;
|
||||
var strInstallOK = ",成功后请刷新本页面或重启浏览器。</font>";
|
||||
var LODOP;
|
||||
try {
|
||||
var isWinIE = (/MSIE/i.test(navigator.userAgent)) || (/Trident/i.test(navigator.userAgent));
|
||||
var isWinIE64 = isWinIE && (/x64/i.test(navigator.userAgent));
|
||||
var isLinuxX86 = (/Linux/i.test(navigator.platform)) && (/x86/i.test(navigator.platform));
|
||||
var isLinuxARM = (/Linux/i.test(navigator.platform)) && (/aarch/i.test(navigator.platform));
|
||||
|
||||
if (needCLodop() || isLinuxX86 || isLinuxARM) {
|
||||
try {
|
||||
LODOP = window.getCLodop();
|
||||
} catch (err) { /* empty */ }
|
||||
if (!LODOP && LoadJsState !== "complete") {
|
||||
if (!LoadJsState)
|
||||
alert("未曾加载Lodop主JS文件,请先调用loadCLodop过程."); else
|
||||
alert("网页还没下载完毕,请稍等一下再操作.");
|
||||
return;
|
||||
}
|
||||
var strAlertMessage;
|
||||
if (!LODOP) {
|
||||
if (isLinuxX86)
|
||||
strAlertMessage = strLodop7Install_X86;
|
||||
else if (isLinuxARM)
|
||||
strAlertMessage = strLodop7Install_ARM;
|
||||
else
|
||||
strAlertMessage = strCLodopInstallA + (CLodopIsLocal ? strCLodopInstallB : "");
|
||||
document.body.innerHTML = strAlertMessage + strInstallOK + document.body.innerHTML;
|
||||
return;
|
||||
} else {
|
||||
if (isLinuxX86 && LODOP.CVERSION < "7.1.0.1")
|
||||
strAlertMessage = strLodop7Update_X86;
|
||||
else if (isLinuxARM && LODOP.CVERSION < "7.1.0.1")
|
||||
strAlertMessage = strLodop7Update_ARM;
|
||||
else if (CLODOP.CVERSION < "6.6.2.3")
|
||||
strAlertMessage = strCLodopUpdate;
|
||||
|
||||
if (strAlertMessage)
|
||||
document.body.innerHTML = strAlertMessage + strInstallOK + document.body.innerHTML;
|
||||
}
|
||||
} else {
|
||||
//==如果页面有Lodop插件就直接使用,否则新建:==
|
||||
if (oOBJECT || oEMBED) {
|
||||
if (isWinIE)
|
||||
LODOP = oOBJECT;
|
||||
else
|
||||
LODOP = oEMBED;
|
||||
} else if (!CreatedOKLodopObject) {
|
||||
LODOP = document.createElement("object");
|
||||
LODOP.setAttribute("width", 0);
|
||||
LODOP.setAttribute("height", 0);
|
||||
LODOP.setAttribute("style", "position:absolute;left:0px;top:-100px;width:0px;height:0px;");
|
||||
if (isWinIE)
|
||||
LODOP.setAttribute("classid", "clsid:2105C259-1E0C-4534-8141-A753534CB4CA");
|
||||
else
|
||||
LODOP.setAttribute("type", "application/x-print-lodop");
|
||||
document.documentElement.appendChild(LODOP);
|
||||
CreatedOKLodopObject = LODOP;
|
||||
} else
|
||||
LODOP = CreatedOKLodopObject;
|
||||
//==Lodop插件未安装时提示下载地址:==
|
||||
if ((!LODOP) || (!LODOP.VERSION)) {
|
||||
document.body.innerHTML = (isWinIE64 ? strLodop64Install : strLodopInstall) + strInstallOK + document.body.innerHTML;
|
||||
return LODOP;
|
||||
}
|
||||
if (LODOP.VERSION < "6.2.2.6") {
|
||||
document.body.innerHTML = (isWinIE64 ? strLodop64Update : strLodopUpdate) + strInstallOK + document.body.innerHTML;
|
||||
}
|
||||
}
|
||||
//===如下空白位置适合调用统一功能(如注册语句、语言选择等):=======================
|
||||
LODOP.SET_LICENSES("","EE0887D00FCC7D29375A695F728489A6","C94CEE276DB2187AE6B65D56B3FC2848","");
|
||||
|
||||
//===============================================================================
|
||||
return LODOP;
|
||||
} catch (err) {
|
||||
alert("getLodop出错:" + err);
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,6 @@ onMounted(() => {
|
||||
} else {
|
||||
Avue.locale.use(Local.get('langes') === 'zh-cn' ? zhLocale : enLocale)
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-mixed-spaces-and-tabs
|
||||
// 监听布局配'置弹窗点击打开
|
||||
mittBus.on('openSetingsDrawer', () => {
|
||||
|
@ -1,17 +1,10 @@
|
||||
<template>
|
||||
<el-dialog :model-value="props.showes" @close="closeFun" width="600">
|
||||
<div id="printTemplate" class="print-hide">
|
||||
<div class="typefaceBox" ref="typefaceBoxRef">
|
||||
<VueQr :text="props.data.tiaoMa" :size="200"></VueQr>
|
||||
<el-dialog :model-value="state.show" @close="closeFun" width="600">
|
||||
<div id="printTemplate" class="print-hide" ref="typefaceBoxRef">
|
||||
<div class="typefaceBox">
|
||||
<VueQr text="props.data.tiaoMa" :size="200"></VueQr>
|
||||
<div class="titleList">
|
||||
<div class="itemText">供应商:{{ props.data.supplierName }}</div>
|
||||
<div class="itemText">物料编码:{{ props.data.materialCode }}</div>
|
||||
<div class="itemText">包装数量:{{ props.data.qty }}</div>
|
||||
<div class="itemText">美塞斯批号:{{ props.data.mssSupplierLot }}</div>
|
||||
<div class="itemText">供应商批号:{{ props.data.fSupplierLot }}</div>
|
||||
<div class="itemText">采购订单号:</div>
|
||||
<div class="itemText">送货日期:{{ props.data.deliveryDate }}</div>
|
||||
<div class="itemText">收料通知单单号:{{ props.data.fBillNo }}</div>
|
||||
<div class="itemText">供应商:{{ state.data.supplierName }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -21,59 +14,56 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { defineProps, reactive, ref, defineEmits } from 'vue';
|
||||
import { reactive, ref, defineExpose } from 'vue';
|
||||
import VueQr from 'vue-qr/src/packages/vue-qr.vue';
|
||||
import printJS from 'print-js';
|
||||
import html2canvas from "html2canvas";
|
||||
import html2canvas from 'html2canvas';
|
||||
const LODOP = window.LODOP;
|
||||
const typefaceBoxRef = ref();
|
||||
const emits = defineEmits(['close']);
|
||||
const props = defineProps({
|
||||
showes: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const state = reactive({
|
||||
show: false,
|
||||
data: {},
|
||||
snapshotUrl: '',
|
||||
printWidth: 100,
|
||||
printHeight: 100,
|
||||
});
|
||||
const handlePrint = async () => {
|
||||
const canvas = await html2canvas(typefaceBoxRef.value, {
|
||||
allowTaint: true, // 允许跨域图片
|
||||
useCORS: true, // 使用 CORS 加载图片
|
||||
scale: 2, // 提高截图分辨率
|
||||
width: typefaceBoxRef.value.clientWidth,
|
||||
height: typefaceBoxRef.value.clientHeight,
|
||||
});
|
||||
state.snapshotUrl = canvas.toDataURL('image/png');
|
||||
// 获取打印模板的DOM元素
|
||||
const printElement = document.getElementById('printTemplate');
|
||||
if (printElement) {
|
||||
printJS({
|
||||
printable: state.snapshotUrl,
|
||||
type: 'image',
|
||||
style: `
|
||||
@page { size: 100mm 50mm landscapes; margin: 0; }
|
||||
`,
|
||||
});
|
||||
}
|
||||
|
||||
const openDataFun = (obj:object) => {
|
||||
state.data = obj
|
||||
state.show = true
|
||||
}
|
||||
|
||||
const handlePrintInitialization = () => {
|
||||
LODOP.PRINT_INITA(0,0,0,0,"L4");
|
||||
LODOP.SET_PRINT_PAGESIZE(0,state.printWidth * 10,state.printHeight * 10,"A4");
|
||||
// LODOP.PREVIEW();
|
||||
LODOP.PRINT();
|
||||
}
|
||||
|
||||
//打印配置
|
||||
const handlePrintZhuhai = async () => {
|
||||
LODOP.ADD_PRINT_BARCODE(125,25,150,150,"QRCode","1234567890版本7的最大值是122个字符123123");
|
||||
};
|
||||
|
||||
const handlePrintTaiguo = () => {
|
||||
|
||||
}
|
||||
|
||||
const closeFun = () => {
|
||||
emits('close');
|
||||
state.show = false
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
openDataFun
|
||||
})
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.typefaceBox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 64px 0;
|
||||
|
||||
.titleList {
|
||||
flex: 1;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog :model-value="state.show" @close="closeFun" width="90%">
|
||||
<el-dialog :model-value="state.show" @close="closeFun" width="95%">
|
||||
<avue-crud ref="crudRef" :data="state.data" :option="state.option">
|
||||
<template #packagingQuantity="{ row }">
|
||||
<div style="display: flex; align-items: center; justify-content: center; width: 100%">
|
||||
@ -8,16 +8,16 @@
|
||||
</template>
|
||||
<template #printBtn="{ row }">
|
||||
<el-button type="text">
|
||||
<div style="display: flex; align-items: center">{{ row.printBtn }}</div>
|
||||
<div style="display: flex; align-items: center" @click="printThisFun(row)">{{ row.printBtn }}</div>
|
||||
</el-button>
|
||||
<el-button type="text">打印样例</el-button>
|
||||
<el-button type="text" @click="printCheckCaseFun(row)">重新打印</el-button>
|
||||
</template>
|
||||
<template #expand="{ row }">
|
||||
<div class="expandListBox">
|
||||
<div class="expandItem" v-for="(item, index) of row.children" :key="index">
|
||||
<div class="expandItemCol" v-for="(itemCol,indexCol) in item" :key="indexCol">
|
||||
<div class="expandItemCol" v-for="(itemCol, indexCol) in item" :key="indexCol">
|
||||
<div v-if="itemCol != '打印此包装'">{{ itemCol }}</div>
|
||||
<el-button v-else type="text">
|
||||
<el-button v-else type="text" @click="printPackingFun(item)">
|
||||
<div style="display: flex; align-items: center">{{ itemCol }}</div>
|
||||
</el-button>
|
||||
</div>
|
||||
@ -37,27 +37,40 @@
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="selectItem">
|
||||
<el-select v-model="state.printSelection" clearable placeholder="请选择打印模板" size="default" style="width: 280px" >
|
||||
<el-input v-model="state.indexRow.fBillNo" style="width: 280px" size="default" disabled>
|
||||
<template #prepend>收料通知单</template>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="selectItem">
|
||||
<el-select v-model="state.printSelection" clearable placeholder="请选择打印模板" size="default" style="width: 150px">
|
||||
<el-option label="珠海" value="0" />
|
||||
<el-option label="泰国" value="1" />
|
||||
</el-select>
|
||||
</div>
|
||||
<el-button type="primary" size="default">整单打印</el-button>
|
||||
<el-button type="primary" size="default" @click="printCheckAllFun">整单打印</el-button>
|
||||
<el-button type="danger" size="default" v-if="state.timer !== null" @click="printCheckDangerFun">取消打印</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</avue-crud>
|
||||
<barCode ref="barCodeRef" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive, computed, defineExpose } from 'vue';
|
||||
import { computed, defineExpose, reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { listApi } from '/@/api/list';
|
||||
import barCode from './barCode.vue';
|
||||
import {ElMessage, ElMessageBox, ElNotification} from 'element-plus';
|
||||
import { Session } from '/@/utils/storage';
|
||||
const LODOP = window.LODOP;
|
||||
const barCodeRef = ref();
|
||||
const { t } = useI18n();
|
||||
const state: any = reactive({
|
||||
data: [],
|
||||
show: false,
|
||||
printSelection: '',
|
||||
printSelection: '0',
|
||||
printJQ: '',
|
||||
printState:'0',
|
||||
option: {
|
||||
expand: true,
|
||||
expandRowKeys: [1],
|
||||
@ -95,12 +108,159 @@ const state: any = reactive({
|
||||
fmrpCloseStatus: '',
|
||||
},
|
||||
indexRow: {},
|
||||
printerList: [],
|
||||
timer: null,
|
||||
});
|
||||
|
||||
const printCheckFun = () => {
|
||||
state.printSelectionShow = false;
|
||||
//打印校验
|
||||
const printVerification = () => {
|
||||
if (state.printSelection === '') {
|
||||
ElMessage.warning('请选择打印模板');
|
||||
return false;
|
||||
}
|
||||
if (state.timer !== null) {
|
||||
ElMessage.warning('打印机正在工作中');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
//取消打印
|
||||
const printCheckDangerFun = () => {
|
||||
LODOP.SET_PRINT_MODE(`CONTROL_PRINTER:${state.printJQ}`, "PURGE");
|
||||
clearInterval(state.timer);
|
||||
state.timer = null;
|
||||
}
|
||||
//全部打印
|
||||
const printCheckAllFun = () => {
|
||||
if (printVerification()) {
|
||||
ElMessageBox({
|
||||
closeOnClickModal: false,
|
||||
closeOnPressEscape: false,
|
||||
title: t('message.index.prompt'),
|
||||
message: '确定要打印整单吗?',
|
||||
confirmButtonText: t('message.index.confirm'),
|
||||
cancelButtonText: t('message.user.logOutCancel'),
|
||||
showCancelButton: true,
|
||||
buttonSize: 'default',
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
let arr:any = []
|
||||
state.data.forEach((item:any) => {
|
||||
if(item.children.length){
|
||||
arr = arr.concat(item.children)
|
||||
console.log(arr)
|
||||
} else {
|
||||
for (let i = 0; i < item.qty; i++){
|
||||
arr.push({...item,packagingQuantity:1,tiaoMa:item.tiaoMa})
|
||||
}
|
||||
}
|
||||
})
|
||||
dataExtractFun(arr);
|
||||
done()
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
//案例打印
|
||||
const printCheckCaseFun = (row: any) => {
|
||||
if (printVerification()) {
|
||||
dataExtractFun([{ ...row,packagingQuantity:row.packagingQuantity }]);
|
||||
}
|
||||
};
|
||||
//包装打印
|
||||
const printPackingFun = (row:any) => {
|
||||
if (printVerification()) {
|
||||
dataExtractFun([{ ...row }]);
|
||||
}
|
||||
}
|
||||
//此条打印
|
||||
const printThisFun = (row:any) => {
|
||||
if(row.children.length){
|
||||
dataExtractFun(row.children);
|
||||
} else {
|
||||
ElMessageBox({
|
||||
closeOnClickModal: false,
|
||||
closeOnPressEscape: false,
|
||||
title: t('message.index.prompt'),
|
||||
message: '确定要进行不分包装打印吗?',
|
||||
confirmButtonText: t('message.index.confirm'),
|
||||
cancelButtonText: t('message.user.logOutCancel'),
|
||||
showCancelButton: true,
|
||||
buttonSize: 'default',
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
instance.confirmButtonLoading = true;
|
||||
let arr = []
|
||||
for (let i = 0; i < row.qty; i++){
|
||||
arr.push({...row,packagingQuantity:1,tiaoMa:row.tiaoMa})
|
||||
}
|
||||
dataExtractFun(arr);
|
||||
done()
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
//数据提取/打印
|
||||
const dataExtractFun = (list: any = []) => {
|
||||
let stepCounter = 0;
|
||||
state.timer = setInterval(() => {
|
||||
if (state.printSelection === '0') {
|
||||
LODOP.PRINT_INITA(0, 0, 0, 0, 'L4');
|
||||
LODOP.SET_PRINT_PAGESIZE(1, 1000, 1000, '');
|
||||
AddPrintContentZhuhai(list[stepCounter]);
|
||||
// LODOP.PREVIEW();
|
||||
|
||||
LODOP.PRINT();
|
||||
} else {
|
||||
LODOP.PRINT_INITA(0, 0, 0, 0, 'L4');
|
||||
LODOP.SET_PRINT_PAGESIZE(1, 1000, 1000, '');
|
||||
AddPrintContentTaiguo(list[stepCounter]);
|
||||
LODOP.PRINT();
|
||||
}
|
||||
if (list.length - 1 == stepCounter) {
|
||||
clearInterval(state.timer);
|
||||
state.timer = null;
|
||||
state.printState = '0'
|
||||
}
|
||||
stepCounter++
|
||||
}, 2000);
|
||||
};
|
||||
const AddPrintContentZhuhai = (row: any) => {
|
||||
let obj = row
|
||||
state.data.forEach((item:any) => {
|
||||
if(item.purchaseOrderFBillNo === obj.purchaseOrderFBillNo){
|
||||
obj.tiaoMa = item.tiaoMa
|
||||
}
|
||||
})
|
||||
LODOP.ADD_PRINT_BARCODE(125, 25, 150, 150, 'QRCode', obj.tiaoMa);
|
||||
LODOP.ADD_PRINT_TEXT(125, 155, 300, 20, `供应商简称:${obj.supplierName}`);
|
||||
LODOP.ADD_PRINT_TEXT(145, 155, 300, 20, `物料编码:${obj.materialCode}`);
|
||||
LODOP.ADD_PRINT_TEXT(165, 155, 300, 20, `包装数量:${obj.packagingQuantity}`);
|
||||
LODOP.ADD_PRINT_TEXT(185, 155, 300, 20, `美塞斯批号:${obj.mssSupplierLot}`);
|
||||
LODOP.ADD_PRINT_TEXT(205, 155, 300, 20, `供应商批号:${obj.fSupplierLot}`);
|
||||
LODOP.ADD_PRINT_TEXT(225, 155, 300, 20, `采购订单号:${obj.purchaseOrderFBillNo}`);
|
||||
LODOP.ADD_PRINT_TEXT(245, 155, 300, 20, `送货日期:${state.indexRow.deliveryDate}`);
|
||||
LODOP.ADD_PRINT_TEXT(265, 155, 300, 20, `收料通知单单号:${state.indexRow.fBillNo}`);
|
||||
};
|
||||
const AddPrintContentTaiguo = (row: any) => {
|
||||
let obj = row
|
||||
state.data.forEach((item:any) => {
|
||||
if(item.purchaseOrderFBillNo === obj.purchaseOrderFBillNo){
|
||||
obj.tiaoMa = item.tiaoMa
|
||||
}
|
||||
})
|
||||
LODOP.ADD_PRINT_BARCODE(125, 25, 150, 150, 'QRCode', obj.tiaoMa);
|
||||
LODOP.ADD_PRINT_TEXT(125, 155, 300, 20, `物料编码:${obj.materialCode}`);
|
||||
LODOP.ADD_PRINT_TEXT(145, 155, 300, 20, `包装数量:${obj.packagingQuantity}`);
|
||||
LODOP.ADD_PRINT_TEXT(165, 155, 300, 20, `美塞斯批号:${obj.mssSupplierLot}`);
|
||||
LODOP.ADD_PRINT_TEXT(185, 155, 300, 20, `供应商批号:${obj.fSupplierLot}`);
|
||||
};
|
||||
//分包算法
|
||||
const inputNumberFun = (e: any, row: any) => {
|
||||
if (e <= 1 || e > row.packagingQuantity) {
|
||||
state.data = state.data.map((item: any) =>
|
||||
@ -126,8 +286,10 @@ const inputNumberFun = (e: any, row: any) => {
|
||||
},
|
||||
{} as Record<string, any>
|
||||
);
|
||||
|
||||
child.quantityPerPackage = i + 1;
|
||||
child.printBtn = '打印此包装';
|
||||
|
||||
if (i === packages - 1 && item.qty % e !== 0) {
|
||||
child.packagingQuantity = item.qty % e;
|
||||
} else {
|
||||
@ -138,28 +300,52 @@ const inputNumberFun = (e: any, row: any) => {
|
||||
return { ...item, children };
|
||||
});
|
||||
};
|
||||
|
||||
//获取数据
|
||||
const openShowDataFun = (row: any) => {
|
||||
if(LODOP === undefined){
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: '检测到无打印插件,正在下载',
|
||||
type: 'warning',
|
||||
duration: 0,
|
||||
position:'top-left'
|
||||
})
|
||||
const userAgent = window.navigator.userAgent.toLowerCase();
|
||||
if (userAgent.includes('windows')) {
|
||||
window.location.href ='http://58.252.252.77:8085/CLodop_Setup_for_Win64NT_6.623EN.exe'
|
||||
} else if (userAgent.includes('mac')) {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: 'MAC无打印配置',
|
||||
type: 'error',
|
||||
duration: 0,
|
||||
position:'top-left'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
state.indexRow = row;
|
||||
state.formData.sheet = row.sheet;
|
||||
listApi()
|
||||
.invoiceOrderGetPageList({ condition: state.formData, pageSize: 100000, page: 1 })
|
||||
.then((res: any) => {
|
||||
LODOP.SELECT_PRINTER();
|
||||
if (res.resultCode === 0) {
|
||||
state.data = res.data.dataList;
|
||||
state.data.forEach((item: any) => {
|
||||
item.packagingQuantity = 1;
|
||||
item.quantityPerPackage = item.qty;
|
||||
item.children = [];
|
||||
item.printBtn = '打印此条';
|
||||
item.printBtn = '打印条码';
|
||||
});
|
||||
state.show = true;
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
const closeFun = () => {
|
||||
state.show = false;
|
||||
state.data = [];
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
@ -167,6 +353,15 @@ defineExpose({
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
:deep(.avue-crud__right) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.el-table__cell) {
|
||||
width: calc(100% / 11) !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
|
||||
.expandListBox {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
@ -177,8 +372,6 @@ defineExpose({
|
||||
height: 30px;
|
||||
//background-color: #3eaadc;
|
||||
border-top: 1px solid #ebeef5;
|
||||
border-right: 8px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
|
||||
.expandItemCol {
|
||||
@ -194,7 +387,7 @@ defineExpose({
|
||||
}
|
||||
|
||||
:deep(.el-card) {
|
||||
padding: 0 !important;
|
||||
//padding: 0 !important;
|
||||
//height: 56px !important;
|
||||
}
|
||||
|
||||
@ -224,7 +417,7 @@ defineExpose({
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
padding: 4px;
|
||||
//padding: 4px;
|
||||
}
|
||||
|
||||
.system-user-container {
|
||||
@ -282,7 +475,7 @@ defineExpose({
|
||||
}
|
||||
|
||||
:deep(.el-card) {
|
||||
padding: 12px;
|
||||
//padding: 12px;
|
||||
}
|
||||
|
||||
:deep(.el-form) {
|
||||
@ -307,6 +500,6 @@ defineExpose({
|
||||
}
|
||||
|
||||
:deep(.cell) {
|
||||
padding: 0 !important;
|
||||
//padding: 0 !important;
|
||||
}
|
||||
</style>
|
||||
|
@ -15,7 +15,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<template #deliveryDate="{ row }">{{ row.ifHidden === 0 ? row.deliveryDate : '' }}</template>
|
||||
<!-- <template #purchaseOrderFBillNo="{ row }">{{ row.ifHidden === 0 ? row.purchaseOrderFBillNo : '' }}</template>-->
|
||||
<template #fBillNo="{ row }">{{ row.ifHidden === 0 ? row.fBillNo : '' }}</template>
|
||||
<template #sheet="{ row }">{{ row.ifHidden === 0 ? row.sheet : '' }}</template>
|
||||
<template #materialName="{ row }">
|
||||
<el-tooltip :content="row.materialName" placement="top">
|
||||
@ -26,7 +26,8 @@
|
||||
<el-tooltip :content="row.supplierName" placement="top">
|
||||
<div class="multi-line-omit">{{ row.supplierName }}</div>
|
||||
</el-tooltip>
|
||||
</template>43
|
||||
</template>
|
||||
43
|
||||
<template #menu-left>
|
||||
<div class="selectBoxes">
|
||||
<div class="selectItem">
|
||||
@ -49,18 +50,26 @@
|
||||
<el-button type="primary" size="default" @click="selectFun">{{ t('message.index.search') }}</el-button>
|
||||
<el-button size="default" @click="resetFun">{{ t('message.index.reset') }}</el-button>
|
||||
<el-button type="primary" size="default" @click="state.selectedDataShow = true">
|
||||
<span>{{ t('message.index.selected') }} {{ state.selectedData.length }} {{ t('message.index.items') }},{{ t('message.index.print') }}</span>
|
||||
<span
|
||||
>{{ t('message.index.selected') }} {{ state.selectedData.length }} {{ t('message.index.items') }},{{
|
||||
t('message.index.print')
|
||||
}}</span
|
||||
>
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<template #print="{ row }">
|
||||
<div class="btnList">
|
||||
<el-button v-if="row.ifHidden === 0" type="text" @click="componentPrintingFunDataRow(row)">{{ t('message.index.print') }}</el-button>
|
||||
<el-button v-if="row.ifHidden === 0" type="text" @click="componentPrintingFunDataRow(row)">
|
||||
{{ t('message.index.print') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<template #deleteText="{ row }">
|
||||
<div class="btnList">
|
||||
<el-button v-if="row.ifHidden === 0" type="text" @click="invoiceOrderDeleteOrderFun(row)">{{ t('message.index.deleteText') }}</el-button>
|
||||
<el-button v-if="row.ifHidden === 0" type="text" @click="invoiceOrderDeleteOrderFun(row)">
|
||||
{{ t('message.index.deleteText') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</avue-crud>
|
||||
@ -68,10 +77,13 @@
|
||||
<selectedData
|
||||
:listData="state.selectedData"
|
||||
:showes="state.selectedDataShow"
|
||||
@close="() => { state.selectedDataShow = false; }"
|
||||
@close="
|
||||
() => {
|
||||
state.selectedDataShow = false;
|
||||
}
|
||||
"
|
||||
/>
|
||||
<componentPrinting ref="componentPrintingRef"/>
|
||||
|
||||
<componentPrinting ref="componentPrintingRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -80,11 +92,13 @@ import { reactive, onMounted, computed, ref } from 'vue';
|
||||
import { listApi } from '/@/api/list';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import SelectedData from '/@/views/materialReceiptNotice/selectedData.vue';
|
||||
import componentPrinting from './componentPrinting.vue'
|
||||
import {ElMessage, ElMessageBox} from "element-plus";
|
||||
import componentPrinting from './componentPrinting.vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
const LODOP = window.LODOP;
|
||||
|
||||
const { t } = useI18n();
|
||||
const crudRef = ref();
|
||||
const componentPrintingRef = ref()
|
||||
const componentPrintingRef = ref();
|
||||
const state = reactive({
|
||||
page: {
|
||||
total: 0,
|
||||
@ -104,24 +118,25 @@ const state = reactive({
|
||||
selection: false,
|
||||
searchMenuSpan: 3,
|
||||
addBtn: false,
|
||||
menu:false,
|
||||
menu: false,
|
||||
column: [
|
||||
{ label: '', prop: 'checkboxBox', width: 35 },
|
||||
{ label: computed(()=> t('message.index.deliveryDate')), prop: 'deliveryDate' },
|
||||
{ label: computed(()=> t('message.index.deliveryNote')), prop: 'sheet', width: '135' },
|
||||
{ label: computed(()=> t('message.index.PO1')), prop: 'purchaseOrderFBillNo', width: '135' },
|
||||
{ label: computed(()=> t('message.index.maxcessLot')), prop: 'mssSupplierLot' },
|
||||
{ label: computed(()=> t('message.index.supplierLot')), prop: 'fSupplierLot' },
|
||||
{ label: computed(()=> t('message.index.partNumber')), prop: 'materialCode', width: '120' },
|
||||
{ label: computed(()=> t('message.index.materialName')), prop: 'materialName' },
|
||||
{ label: computed(() => t('message.index.deliveryDate')), prop: 'deliveryDate' },
|
||||
{ label: computed(() => t('message.index.deliveryNote')), prop: 'sheet', width: '135' },
|
||||
{ label: '收料通知单单号', prop: 'fBillNo', width: '135' },
|
||||
{ label: computed(() => t('message.index.PO1')), prop: 'purchaseOrderFBillNo', width: '135' },
|
||||
{ label: computed(() => t('message.index.maxcessLot')), prop: 'mssSupplierLot' },
|
||||
{ label: computed(() => t('message.index.supplierLot')), prop: 'fSupplierLot' },
|
||||
{ label: computed(() => t('message.index.partNumber')), prop: 'materialCode', width: '120' },
|
||||
{ label: computed(() => t('message.index.materialName')), prop: 'materialName' },
|
||||
{ label: computed(() => t('message.index.supplierCode')), prop: 'supplierId', width: '90' },
|
||||
{ label: computed(() => t('message.index.supplierName')), prop: 'supplierName', width: '120' },
|
||||
// { label: computed(() => t('message.index.receivedQTY')), prop: 'sendedQty', width: '110' },
|
||||
{ label: computed(() => t('message.index.shipmentQTY')), prop: 'qty' },
|
||||
{ label: computed(() => t('message.index.POQTY')), prop: 'purchaseQty' },
|
||||
{ label: computed(() => t('message.index.unit')), prop: 'unitName' },
|
||||
{ label: computed(() => t('message.index.print')), prop: 'print',width: 80 },
|
||||
{ label: computed(() => t('message.index.deleteText')), prop: 'deleteText',width: 80 },
|
||||
{ label: computed(() => t('message.index.print')), prop: 'print', width: 80 },
|
||||
{ label: computed(() => t('message.index.deleteText')), prop: 'deleteText', width: 80 },
|
||||
],
|
||||
},
|
||||
data: [],
|
||||
@ -140,7 +155,7 @@ const elDatePickerFun = (val: any) => {
|
||||
state.formData.fDateBegin = val[0];
|
||||
state.formData.fDateEmd = val[1];
|
||||
};
|
||||
const invoiceOrderDeleteOrderFun = (row:any) => {
|
||||
const invoiceOrderDeleteOrderFun = (row: any) => {
|
||||
ElMessageBox({
|
||||
closeOnClickModal: false,
|
||||
closeOnPressEscape: false,
|
||||
@ -153,20 +168,21 @@ const invoiceOrderDeleteOrderFun = (row:any) => {
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
instance.confirmButtonLoading = true;
|
||||
listApi().invoiceOrderDeleteOrder({id:row.id}).then((res:any) => {
|
||||
done()
|
||||
getList()
|
||||
if(res.resultCode === 0){
|
||||
ElMessage.success(t('message.index.success'))
|
||||
listApi()
|
||||
.invoiceOrderDeleteOrder({ id: row.id })
|
||||
.then((res: any) => {
|
||||
done();
|
||||
getList();
|
||||
if (res.resultCode === 0) {
|
||||
ElMessage.success(t('message.index.success'));
|
||||
}
|
||||
})
|
||||
});
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
const selectionChange = (row: any) => {
|
||||
if (row.checkboxBox == '1') {
|
||||
state.data.forEach((item: any) => {
|
||||
@ -195,9 +211,9 @@ const selectionChange = (row: any) => {
|
||||
state.selectedData = [];
|
||||
}
|
||||
};
|
||||
const componentPrintingFunDataRow = (row:any) => {
|
||||
componentPrintingRef.value.openShowDataFun(row)
|
||||
}
|
||||
const componentPrintingFunDataRow = (row: any) => {
|
||||
componentPrintingRef.value.openShowDataFun(row);
|
||||
};
|
||||
//接口数据处理
|
||||
const selectFun = () => {
|
||||
state.page.currentPage = 1;
|
||||
@ -241,30 +257,31 @@ const getList = () => {
|
||||
});
|
||||
};
|
||||
// 页面加载时
|
||||
onMounted(() => {});
|
||||
onMounted(() => {console.log( window.LODOP)});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-checkbox--default):nth-child(0) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
:deep(.el-checkbox) {
|
||||
height: 15px !important;
|
||||
}
|
||||
|
||||
:deep(.cell) {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
:deep(.avue-crud__left) {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
:deep(.el-button--text) {
|
||||
padding: 0 !important;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
:deep(.avue-crud__gridBtn) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.piliang {
|
||||
margin-left: 12px;
|
||||
border: 1px solid #d5d5d5;
|
||||
@ -275,9 +292,11 @@ onMounted(() => {});
|
||||
box-sizing: border-box;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.system-user-container {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.multi-line-omit {
|
||||
word-break: break-all; // 允许单词内自动换行,如果一个单词很长的话
|
||||
text-overflow: ellipsis; // 溢出用省略号显示
|
||||
@ -286,45 +305,56 @@ onMounted(() => {});
|
||||
-webkit-line-clamp: 1; // 显示的行
|
||||
-webkit-box-orient: vertical; // 设置伸缩盒子的子元素排列方式--从上到下垂直排列
|
||||
}
|
||||
|
||||
.selectBoxes {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
|
||||
.selectItem {
|
||||
margin-right: 16px;
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.avue-crud) {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.avue-crud--card) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
:deep(.avue-crud__body) {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
:deep(.el-table__header) {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
:deep(.el-card__body) {
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
overflow: hidden !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
:deep(.el-table__cell) {
|
||||
padding: 0 !important;
|
||||
//height: 56px !important;
|
||||
}
|
||||
|
||||
:deep(.el-card) {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
:deep(.el-form) {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.system-user-container {
|
||||
:deep(.el-card__body) {
|
||||
display: flex;
|
||||
@ -337,6 +367,7 @@ onMounted(() => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-col) {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
@ -65,6 +65,7 @@
|
||||
<span v-if="row.ifHidden === 0" @click="toPurchaseDetails(row)" style="cursor: pointer; color: #409eff">{{ row.fBillNo }}</span>
|
||||
</template>
|
||||
<template #fDate="{ row }">{{ row.ifHidden === 0 ? row.fDate : '' }}</template>
|
||||
<template #fPurchaseOrgName="{ row }">{{ row.ifHidden === 0 ? row.fPurchaseOrgName : '' }}</template>
|
||||
<template #fCancelStatus="{ row }">
|
||||
{{ row.ifHidden === 0 ? (row.fCancelStatus === 'A' ? t('message.index.closed') : t('message.index.unclosed')) : '' }}
|
||||
</template>
|
||||
|
Loading…
x
Reference in New Issue
Block a user