|
|
@@ -35,7 +35,7 @@ import {withResolvers} from '@/tools/object';
|
|
|
* @returns {Promise<sf_express_instance>}
|
|
|
*/
|
|
|
let sf_express = async function (options = {}) {
|
|
|
- const module = await import('@/libs/print/SCPPrint-2.7.js');
|
|
|
+ const module = await import('@/libs/print/SCPPrint-2.7.1.js');
|
|
|
|
|
|
const {promise: load, resolve, reject} = withResolvers();
|
|
|
|
|
|
@@ -52,6 +52,7 @@ let sf_express = async function (options = {}) {
|
|
|
try {
|
|
|
const instance = await load;
|
|
|
sf_express = () => Promise.resolve(instance);
|
|
|
+ return instance;
|
|
|
} catch (e) {}
|
|
|
return instance;
|
|
|
};
|
|
|
@@ -76,7 +77,12 @@ export async function sf_express_print(data, options = {}) {
|
|
|
const device = devices.find(device => device.name.startsWith(process.env.VUE_APP_SF_EXPRESS_APPNAME));
|
|
|
|
|
|
if (device) instance['setPrinter'](device.index);
|
|
|
- await instance.print(data);
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ instance.print(data, ({code, msg}) => {
|
|
|
+ if (code === 1) resolve()
|
|
|
+ else reject({code, message: msg});
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
let c_lodop = async function (options = {}) {
|