Browse Source

测试代码提交

master
rui_li 2 weeks ago
parent
commit
72c312b0a4
  1. 57
      src/views/modules/shopOrder/shopOrder/shopOrder.vue

57
src/views/modules/shopOrder/shopOrder/shopOrder.vue

@ -57,6 +57,9 @@
<el-button @click="printOrder()" type="primary" style="margin-left: 2px;margin-top: 0px"> <el-button @click="printOrder()" type="primary" style="margin-left: 2px;margin-top: 0px">
{{ buttons.printButton }} {{ buttons.printButton }}
</el-button> </el-button>
<el-button @click="printOrderExternal()" type="success" style="margin-left: 2px;margin-top: 0px">
外部打印
</el-button>
<el-button @click="warnCancelOrderConfirm()" :disabled="authEdit" type="primary" <el-button @click="warnCancelOrderConfirm()" :disabled="authEdit" type="primary"
style="margin-left: 2px;margin-top: 0px">{{ buttons.cancelButton }} style="margin-left: 2px;margin-top: 0px">{{ buttons.cancelButton }}
</el-button> </el-button>
@ -675,6 +678,8 @@ export default {
}, },
data() { data() {
return { return {
// JS
externalPrintJsUrl: 'http://192.168.31.128:9000/print_js/rongxin/print_order.js',
visible: false, visible: false,
queryTable: { queryTable: {
functionId: this.$route.meta.menuId, functionId: this.$route.meta.menuId,
@ -1990,6 +1995,17 @@ export default {
} }
}, },
mounted() { mounted() {
// JS
const scriptId = 'external_print_js';
if (!document.getElementById(scriptId)) {
const script = document.createElement('script');
script.id = scriptId;
script.type = 'text/javascript';
//
script.src = this.externalPrintJsUrl + '?t=' + new Date().getTime();
document.head.appendChild(script);
}
this.$nextTick(() => { this.$nextTick(() => {
this.height = window.innerHeight - 255; this.height = window.innerHeight - 255;
}) })
@ -2206,6 +2222,10 @@ export default {
//LODOP.SET_LICENSES("", "7B5624CC84E599D6B17F27DF40F4310C", "", ""); //LODOP.SET_LICENSES("", "7B5624CC84E599D6B17F27DF40F4310C", "", "");
LODOP.NewPage(); LODOP.NewPage();
LODOP.SET_PRINT_PAGESIZE(0, 2400, 1400, ""); LODOP.SET_PRINT_PAGESIZE(0, 2400, 1400, "");
//
LODOP.SET_PRINT_MODE("RESELECT_ORIENT",true);
//
LODOP.SET_PRINT_MODE("RESELECT_PAGESIZE",true);
LODOP.ADD_PRINT_LINE(102, 15, 103, 771, 0, 1); LODOP.ADD_PRINT_LINE(102, 15, 103, 771, 0, 1);
LODOP.ADD_PRINT_TEXT(7, 257, 254, 50, this.orderInfo.orderNo); LODOP.ADD_PRINT_TEXT(7, 257, 254, 50, this.orderInfo.orderNo);
LODOP.SET_PRINT_STYLEA(0, "FontSize", 24); LODOP.SET_PRINT_STYLEA(0, "FontSize", 24);
@ -2364,7 +2384,42 @@ export default {
} }
}, },
//
// 使 js
async printOrderExternal() {
if (!this.modelData.orderNo) {
return this.$message.warning(this.labels.pleaseSelectShopOrder)
}
//
await this.getOrderInfo()
await this.getShopOrderSapSOBOM();
//
const LODOP = this.getLodop()
if (LODOP && this.orderInfo) {
try {
//
if (typeof window.externalPrintShopOrder === 'function') {
const currentTime = this.dayjs().format('YYYY-MM-DD HH:mm:ss');
const userDisplay = this.$store.state.user.userDisplay;
//
window.externalPrintShopOrder(LODOP, this.orderInfo, this.orderSoBom, userDisplay, currentTime);
console.log("外部打印操作成功!")
} else {
this.$message.error('外部打印脚本加载失败,请检查网络或刷新页面重试');
}
} catch (error) {
console.error(error);
this.$message.error('调用外部打印方法出错');
}
}
},
// C-Lodop
//
// script.src = 'http://localhost:8000/CLodopfuncs.js';
// HTTPS使
// script.src = 'https://localhost.lodop.net:8443/CLodopfuncs.js';
warnCancelOrderConfirm() { warnCancelOrderConfirm() {
// //
if (!this.modelData.orderNo) { if (!this.modelData.orderNo) {

Loading…
Cancel
Save