Commit 77af1dff by linjinhong

新增驱动

parent c2b510b7
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"@vue/composition-api": "^0.3.4", "@vue/composition-api": "^0.3.4",
"axios": "^0.19.2", "axios": "^0.19.2",
"bignumber.js": "^9.2.1", "bignumber.js": "^9.2.1",
"canvas": "^2.11.2",
"compressing": "^1.10.1", "compressing": "^1.10.1",
"core-js": "^3.6.4", "core-js": "^3.6.4",
"electron-builder": "^24.13.3", "electron-builder": "^24.13.3",
...@@ -39,6 +40,7 @@ ...@@ -39,6 +40,7 @@
"multiparty": "^4.2.3", "multiparty": "^4.2.3",
"nodemon": "^3.1.4", "nodemon": "^3.1.4",
"normalize.css": "^8.0.1", "normalize.css": "^8.0.1",
"rebuild": "^0.1.2",
"sharp": "0.28.0", "sharp": "0.28.0",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-draggable-resizable": "^2.0.0", "vue-draggable-resizable": "^2.0.0",
......
// preload.js
const { contextBridge, ipcRenderer } = require("electron");
// 暴露安全的 IPC 方法给渲染进程
contextBridge.exposeInMainWorld("electronAPI", {
sendToMain: (channel, data) => ipcRenderer.send(channel, data),
receiveFromMain: (channel, callback) => {
ipcRenderer.on(channel, (event, ...args) => callback(...args));
},
});
GTXproCMD.exe print -X "Profile\CO12.xml" -I "Input\sample.png" -A "Output\pO12.arxp" -S 01000200 -L 02540254
echo %errorlevel%
\ No newline at end of file
GTXproCMD.exe print -X "Profile\CO12.xml" -I "Input\sample.png" -A "Output\pO12.arxp" -S 01000200 -L 02540254
echo %errorlevel%
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bMultiple>1</bMultiple>
<byResolution>1</byResolution>
<byInk>1</byInk>
<byInkVolume>1</byInkVolume>
<byDoublePrint>1</byDoublePrint>
<bySaturation>1</bySaturation>
<byBrightness>1</byBrightness>
<byContrast>1</byContrast>
<iCyanBalance>1</iCyanBalance>
<iMagentaBalance>1</iMagentaBalance>
<iYellowBalance>1</iYellowBalance>
<iBlackBalance>1</iBlackBalance>
<bUniPrint>1</bUniPrint>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<byHighlight>1</byHighlight>
<byMask>1</byMask>
<bDivide>1</bDivide>
<bTransColor>1</bTransColor>
<bySaturation>1</bySaturation>
<byBrightness>1</byBrightness>
<byContrast>1</byContrast>
<bUniPrint>1</bUniPrint>
<byResolution>1</byResolution>
<byInk>1</byInk>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>5</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>1</bEcoMode>
<byInk>1</byInk>
<bMaterialBlack>1</bMaterialBlack>
<bMultiple>1</bMultiple>
<byHighlight>1</byHighlight>
<byMask>1</byMask>
<bFastMode>1</bFastMode>
<bDivide>1</bDivide>
<bPause>1</bPause>
<bTransColor>1</bTransColor>
<byChoke>1</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>1</bySaturation>
<byBrightness>1</byBrightness>
<byContrast>1</byContrast>
<iCyanBalance>1</iCyanBalance>
<bUniPrint>1</bUniPrint>
<iMagentaBalance>1</iMagentaBalance>
<iYellowBalance>1</iYellowBalance>
<iBlackBalance>1</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<byResolution>1</byResolution>
<byInk>1</byInk>
<bMultiple>1</bMultiple>
<byInkVolume>1</byInkVolume>
<byDoublePrint>1</byDoublePrint>
<bySaturation>1</bySaturation>
<byBrightness>1</byBrightness>
<byContrast>1</byContrast>
<iBlackBalance>1</iBlackBalance>
<bUniPrint>1</bUniPrint>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>5</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>5</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>5</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
GTXproCMD.exe print -X "Profile\CO12.xml" -I "Input\sample.png" -A "Output\pO12.arxp" -S 01000200 -L 02540254
echo %errorlevel%
\ No newline at end of file
GTXproCMD.exe send -A "D:\sample\Output\pO12.arxp" -P "Brother GTX pro" -D 1
echo %errorlevel%
\ No newline at end of file
...@@ -27,6 +27,8 @@ const winURL = ...@@ -27,6 +27,8 @@ const winURL =
: `file://${__dirname}/index.html`; : `file://${__dirname}/index.html`;
async function createWindow() { async function createWindow() {
let latestVersion = "print"; // 默认值
win = new BrowserWindow({ win = new BrowserWindow({
width: 1500, width: 1500,
height: 1000, height: 1000,
...@@ -34,6 +36,9 @@ async function createWindow() { ...@@ -34,6 +36,9 @@ async function createWindow() {
webPreferences: { webPreferences: {
webSecurity: false, webSecurity: false,
nodeIntegration: true, nodeIntegration: true,
//p.s.路径为绝对路径
preload: path.join(__dirname, "./preloadOther.js"),
}, },
}); });
...@@ -80,6 +85,9 @@ async function createWindow() { ...@@ -80,6 +85,9 @@ async function createWindow() {
win.webContents.send("sendWebsockt", obj); win.webContents.send("sendWebsockt", obj);
}); });
ipcMain.on("sync-version", (_, version) => {
latestVersion = version; // 更新全局变量
});
win.on("closed", () => { win.on("closed", () => {
// win && win.removeAllListeners(); // win && win.removeAllListeners();
// win = null; // win = null;
......
...@@ -22,6 +22,13 @@ let fileEnv, env, visionUrl; ...@@ -22,6 +22,13 @@ let fileEnv, env, visionUrl;
axios.defaults.timeout = 12600000; axios.defaults.timeout = 12600000;
const multiparty = require("multiparty"); const multiparty = require("multiparty");
// import store from "@/store/index.js";
let version;
function getCurrentVersion() {
return version;
}
function readEnv() { function readEnv() {
let exePath, configPath; let exePath, configPath;
if (process.env.NODE_ENV === "development") { if (process.env.NODE_ENV === "development") {
...@@ -52,7 +59,10 @@ export default { ...@@ -52,7 +59,10 @@ export default {
responseType: "stream", responseType: "stream",
}); });
let fileName = uuid.v4() + ".png"; let fileName = uuid.v4() + ".png";
const filePath = path.join(process.cwd(), "./print/Input/" + fileName); const filePath = path.join(
process.cwd(),
`./${getCurrentVersion()}/Input/` + fileName
);
const writer = fs.createWriteStream(filePath); const writer = fs.createWriteStream(filePath);
response.data.pipe(writer); response.data.pipe(writer);
...@@ -215,7 +225,7 @@ export default { ...@@ -215,7 +225,7 @@ export default {
for (let k in q.imgList) { for (let k in q.imgList) {
const p = path.join( const p = path.join(
process.cwd(), process.cwd(),
"./print/Input/" + q.imgList[k].fileName `./${getCurrentVersion()}/Input/` + q.imgList[k].fileName
); );
zipStream.addEntry(p); zipStream.addEntry(p);
} }
...@@ -254,7 +264,7 @@ export default { ...@@ -254,7 +264,7 @@ export default {
}, },
uploadImage: async (req, res) => { uploadImage: async (req, res) => {
try { try {
const p = path.join(process.cwd(), "./print/Input/"); const p = path.join(process.cwd(), `./${getCurrentVersion()}/Input/`);
let fileName = uuid.v4() + ".png"; let fileName = uuid.v4() + ".png";
console.log(fileName); console.log(fileName);
...@@ -269,7 +279,10 @@ export default { ...@@ -269,7 +279,10 @@ export default {
code: 200, code: 200,
data: { data: {
fileName, fileName,
url: path.join(process.cwd(), "./print/Input/" + fileName), url: path.join(
process.cwd(),
`./${getCurrentVersion()}/Input/` + fileName
),
}, },
}); });
} }
...@@ -283,7 +296,7 @@ export default { ...@@ -283,7 +296,7 @@ export default {
try { try {
const filePath = path.join( const filePath = path.join(
process.cwd(), process.cwd(),
`./print/Input/${req.body.fileName}` `./${getCurrentVersion()}/Input/${req.body.fileName}`
); );
console.log(filePath); console.log(filePath);
// 给客户端返回一个文件流 type类型 // 给客户端返回一个文件流 type类型
...@@ -318,7 +331,7 @@ export default { ...@@ -318,7 +331,7 @@ export default {
toPrint: (req, res) => { toPrint: (req, res) => {
let body = req.body; let body = req.body;
writeProfileXml(body); // 写入xml文件 writeProfileXml(body); // 写入xml文件
// GTXproCMD.exe print -X "Profile\\CO12.xml" -I "Input\\sample.png" -A "Output\\pO12.arxp" -S 03000400 -L 02540254 // GTX6CMD.exe print -X "Profile\\CO12.xml" -I "Input\\sample.png" -A "Output\\pO12.arxp" -S 03000400 -L 02540254
console.log(249, body); console.log(249, body);
toSend(body) toSend(body)
...@@ -410,7 +423,7 @@ export default { ...@@ -410,7 +423,7 @@ export default {
}, },
//删除图片 //删除图片
cleanDirectorySync: async (req, res) => { cleanDirectorySync: async (req, res) => {
let dirPath = path.join(process.cwd(), `./print/Input`); let dirPath = path.join(process.cwd(), `./${getCurrentVersion()}/Input`);
if (!fs.existsSync(dirPath)) { if (!fs.existsSync(dirPath)) {
console.log(`目录不存在: ${dirPath}`); console.log(`目录不存在: ${dirPath}`);
res.json({ code: 500, msg: `目录不存在: ${dirPath}` }); res.json({ code: 500, msg: `目录不存在: ${dirPath}` });
...@@ -442,7 +455,7 @@ export default { ...@@ -442,7 +455,7 @@ export default {
}, },
saveToPng: async (req, res) => { saveToPng: async (req, res) => {
try { try {
const p = path.join(process.cwd(), "./print/Input/"); const p = path.join(process.cwd(), `./${getCurrentVersion()}/Input/`);
const form = new multiparty.Form({ uploadDir: p }); const form = new multiparty.Form({ uploadDir: p });
form.parse(req, function(err, fields, files) { form.parse(req, function(err, fields, files) {
console.log(367, fields, files, err); console.log(367, fields, files, err);
...@@ -455,7 +468,10 @@ export default { ...@@ -455,7 +468,10 @@ export default {
fs.renameSync(file.path, path.join(p, fileName)); fs.renameSync(file.path, path.join(p, fileName));
list.push({ list.push({
fileName, fileName,
url: path.join(process.cwd(), "./print/Input/" + fileName), url: path.join(
process.cwd(),
`./${getCurrentVersion()}/Input/` + fileName
),
}); });
}); });
res.json({ res.json({
......
...@@ -6,6 +6,13 @@ var request = require("request"); ...@@ -6,6 +6,13 @@ var request = require("request");
var uuid = require("uuid"); var uuid = require("uuid");
const compressing = require("compressing"); const compressing = require("compressing");
// import store from "@/store/index.js";
let version;
function getCurrentVersion() {
return version;
}
function zip(from, to) { function zip(from, to) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let dirName = path.join(to, uuid.v4()); let dirName = path.join(to, uuid.v4());
...@@ -49,7 +56,7 @@ export const downloadImage = (list) => { ...@@ -49,7 +56,7 @@ export const downloadImage = (list) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
// console.log("Formatted Folder Name:", folderName); // 检查替换结果 // console.log("Formatted Folder Name:", folderName); // 检查替换结果
let dirPath = path.join(process.cwd(), `./print/Input/`); let dirPath = path.join(process.cwd(), `./${getCurrentVersion()}/Input/`);
if (!fs.existsSync(dirPath)) { if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath); fs.mkdirSync(dirPath);
...@@ -80,7 +87,10 @@ export const downloadImage = (list) => { ...@@ -80,7 +87,10 @@ export const downloadImage = (list) => {
fileName = uuid.v4() + ".png"; fileName = uuid.v4() + ".png";
type = 2; type = 2;
} }
let p = path.join(process.cwd(), "./print/Input/" + fileName); let p = path.join(
process.cwd(),
`./${getCurrentVersion()}/Input/` + fileName
);
let stream = fs.createWriteStream(p); let stream = fs.createWriteStream(p);
request(list[i].url) request(list[i].url)
.pipe(stream) .pipe(stream)
...@@ -141,7 +151,7 @@ export function downloadOtherImage(list) { ...@@ -141,7 +151,7 @@ export function downloadOtherImage(list) {
.split(".")[0]; .split(".")[0];
let otherTypePath = path.join( let otherTypePath = path.join(
process.cwd(), process.cwd(),
`./print/Input/${folderName}` `./${getCurrentVersion()}/Input/${folderName}`
); );
if (!fs.existsSync(otherTypePath)) { if (!fs.existsSync(otherTypePath)) {
fs.mkdirSync(otherTypePath); fs.mkdirSync(otherTypePath);
...@@ -210,7 +220,10 @@ export function downloadOtherImage(list) { ...@@ -210,7 +220,10 @@ export function downloadOtherImage(list) {
// 传递素材给前端 // 传递素材给前端
export const sendImg = (filename = "sample.png") => { export const sendImg = (filename = "sample.png") => {
let filePath = path.join(process.cwd(), "./print/Input/" + filename); let filePath = path.join(
process.cwd(),
`./${getCurrentVersion()}/Input/` + filename
);
if (!fs.existsSync(filePath)) { if (!fs.existsSync(filePath)) {
return false; return false;
} }
...@@ -220,18 +233,21 @@ export const sendImg = (filename = "sample.png") => { ...@@ -220,18 +233,21 @@ export const sendImg = (filename = "sample.png") => {
}; };
export const toSend = (body) => { export const toSend = (body) => {
console.log("999999999", path.join(process.cwd(), getCurrentVersion()));
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
exec( exec(
body.cmd, body.cmd,
{ cwd: path.join(process.cwd(), "print"), shell: true }, { cwd: path.join(process.cwd(), getCurrentVersion()), shell: true },
(err, stdout, stderr) => { (err, stdout, stderr) => {
// console.log(stdout, 1); // console.log(stdout, 1);
// console.log(stderr, 2); // console.log(stderr, 2);
console.log("err", err); console.log("err", err);
if (!err) { if (!err) {
exec( exec(
body.print_cmd, body.print_cmd,
{ cwd: path.join(process.cwd(), "print"), shell: true }, { cwd: path.join(process.cwd(), getCurrentVersion()), shell: true },
(err2) => { (err2) => {
console.log(err2); console.log(err2);
if (!err2) { if (!err2) {
...@@ -240,7 +256,7 @@ export const toSend = (body) => { ...@@ -240,7 +256,7 @@ export const toSend = (body) => {
fs.unlinkSync( fs.unlinkSync(
path.join( path.join(
process.cwd(), process.cwd(),
"print/Profile/" + `${getCurrentVersion()}/Profile/` +
body.fileName.replace(".png", "") + body.fileName.replace(".png", "") +
".xml" ".xml"
) )
...@@ -248,7 +264,7 @@ export const toSend = (body) => { ...@@ -248,7 +264,7 @@ export const toSend = (body) => {
fs.unlinkSync( fs.unlinkSync(
path.join( path.join(
process.cwd(), process.cwd(),
"print/Output/" + `${getCurrentVersion()}/Output/` +
body.fileName.replace(".png", "") + body.fileName.replace(".png", "") +
".arxp" ".arxp"
) )
...@@ -277,8 +293,13 @@ export const toSend = (body) => { ...@@ -277,8 +293,13 @@ export const toSend = (body) => {
}; };
export const writeProfileXml = (b) => { export const writeProfileXml = (b) => {
console.log(b);
try { try {
let p = path.join(process.cwd(), `./print/Profile/${b.byInk}.xml`); let p = path.join(
process.cwd(),
`./${getCurrentVersion()}/Profile/${b.byInk}.xml`
);
let file = fs.readFileSync(p, { encoding: "utf8" }); let file = fs.readFileSync(p, { encoding: "utf8" });
file = file.replace( file = file.replace(
/<uiCopies>(.*)<\/uiCopies>/i, /<uiCopies>(.*)<\/uiCopies>/i,
...@@ -376,11 +397,11 @@ export const writeProfileXml = (b) => { ...@@ -376,11 +397,11 @@ export const writeProfileXml = (b) => {
fs.writeFileSync( fs.writeFileSync(
path.join( path.join(
process.cwd(), process.cwd(),
`./print/Profile/${b.fileName.replace(".png", "")}.xml` `./${getCurrentVersion()}/Profile/${b.fileName.replace(".png", "")}.xml`
), ),
file file
); );
} catch (err) { } catch (err) {
console.log(err); console.log(404, err);
} }
}; };
...@@ -17,6 +17,7 @@ export default new Vuex.Store({ ...@@ -17,6 +17,7 @@ export default new Vuex.Store({
productDetail: {}, productDetail: {},
windowWH: { width: 0, height: 0 }, windowWH: { width: 0, height: 0 },
desktopDevice: 1, //1是兄弟,2是其他 desktopDevice: 1, //1是兄弟,2是其他
desktoVersion: "print", //print2.0是2.0,print4.0是4.0
WHproportion: 1, //宽高比例 WHproportion: 1, //宽高比例
defaultProportion: 1, defaultProportion: 1,
isPreView: false, isPreView: false,
...@@ -91,6 +92,9 @@ export default new Vuex.Store({ ...@@ -91,6 +92,9 @@ export default new Vuex.Store({
changeDesktopDevice(state, value) { changeDesktopDevice(state, value) {
state.desktopDevice = value; state.desktopDevice = value;
}, },
changeDesktoVersion(state, value) {
state.desktoVersion = value;
},
setProductDetail(state, value) { setProductDetail(state, value) {
state.productDetail = value; state.productDetail = value;
}, },
......
<script> <script>
import bus from "@/bus"; import bus from "@/bus";
import PrintDialog from "./printDialog.vue"; // import PrintDialog from "./printDialog.vue";
import { ipcRenderer } from "electron"; import { ipcRenderer } from "electron";
// import { grid } from "../data"; // import { grid } from "../data";
import pkg from "../../../../package.json"; import pkg from "../../../../package.json";
...@@ -14,7 +14,7 @@ const fs = require("fs"); ...@@ -14,7 +14,7 @@ const fs = require("fs");
import { mapState } from "vuex"; import { mapState } from "vuex";
export default { export default {
components: { PrintDialog, UpdateDialog }, components: { UpdateDialog },
props: { props: {
user: { user: {
default: () => ({ default: () => ({
...@@ -29,6 +29,7 @@ export default { ...@@ -29,6 +29,7 @@ export default {
return { return {
checkList: [], checkList: [],
desktopDevice: 1, desktopDevice: 1,
version: "print",
checked: false, checked: false,
isFirst: true, isFirst: true,
cacheList: [ cacheList: [
...@@ -101,6 +102,7 @@ export default { ...@@ -101,6 +102,7 @@ export default {
}); });
}, },
created() { created() {
this.version = localStorage.getItem("desktoVersion");
if (this.$dataStore.get("setting")) { if (this.$dataStore.get("setting")) {
this.setting = this.$dataStore.get("setting"); this.setting = this.$dataStore.get("setting");
} else { } else {
...@@ -412,18 +414,18 @@ export default { ...@@ -412,18 +414,18 @@ export default {
} catch (error) { } catch (error) {
console.error("清理目录时发生错误:", error.msg); console.error("清理目录时发生错误:", error.msg);
} }
if(this.factoryType!=='US'){ if (this.factoryType !== "US") {
const regex = /^[A-Z]{4}_/; //是否以四个大写字母加下划线开头 const regex = /^[A-Z]{4}_/; //是否以四个大写字母加下划线开头
if (regex.test(this.productionNo)) { if (regex.test(this.productionNo)) {
this.productionNo = this.productionNo =
this.productionNo.split("_")[0] + this.productionNo.split("_")[0] +
"-" + "-" +
this.productionNo.split("_")[this.productionNo.split("_").length - 1]; this.productionNo.split("_")[
this.productionNo.split("_").length - 1
];
} }
} }
console.log(423, this.productionNo); console.log(423, this.productionNo);
try { try {
...@@ -546,6 +548,7 @@ export default { ...@@ -546,6 +548,7 @@ export default {
this.$store.commit("changeImgList", []); this.$store.commit("changeImgList", []);
console.log(347, store.state.desktopDevice); console.log(347, store.state.desktopDevice);
}, },
async cutImgFn(arr) { async cutImgFn(arr) {
if (!arr.length) return arr; if (!arr.length) return arr;
console.log(arr); console.log(arr);
...@@ -705,6 +708,7 @@ export default { ...@@ -705,6 +708,7 @@ export default {
:show-file-list="false" :show-file-list="false"
multiple multiple
:before-upload="uploadImage" :before-upload="uploadImage"
style="height: 100%;"
> >
<el-button style="height: 100%;margin:0 8px" size="small"> <el-button style="height: 100%;margin:0 8px" size="small">
<i class="el-icon-picture" style="font-size: 15px;"></i> <i class="el-icon-picture" style="font-size: 15px;"></i>
...@@ -815,6 +819,9 @@ export default { ...@@ -815,6 +819,9 @@ export default {
>检查更新 >检查更新
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-form-item prop="language" label="驱动版本">
<b>{{ version === "print" ? "2.0" : "4.0" }}</b>
</el-form-item>
<!-- <el-form-item label="自动打印模式">--> <!-- <el-form-item label="自动打印模式">-->
<!-- <el-switch @change="(e)=>settingChange('autoPrint',e)" v-model="setting.autoPrint"></el-switch>--> <!-- <el-switch @change="(e)=>settingChange('autoPrint',e)" v-model="setting.autoPrint"></el-switch>-->
...@@ -1036,7 +1043,14 @@ export default { ...@@ -1036,7 +1043,14 @@ export default {
::v-deep { ::v-deep {
.el-select .el-input { .el-select .el-input {
max-width: 150px; max-width: 80px;
}
}
}
::v-deep {
.el-tooltip {
.el-upload--text {
height: 100%;
} }
} }
} }
......
...@@ -249,7 +249,7 @@ export default { ...@@ -249,7 +249,7 @@ export default {
}); });
}, },
moreImageCmd(arr) { moreImageCmd() {
var canvas1 = document.createElement("canvas"); var canvas1 = document.createElement("canvas");
let _canvas = document.getElementsByClassName("sucaitu")[0]; //目标块 let _canvas = document.getElementsByClassName("sucaitu")[0]; //目标块
var bodyW = parseInt(window.getComputedStyle(_canvas).width); var bodyW = parseInt(window.getComputedStyle(_canvas).width);
...@@ -261,7 +261,7 @@ export default { ...@@ -261,7 +261,7 @@ export default {
canvas1.style.background = "transparent"; canvas1.style.background = "transparent";
document.documentElement.scrollTop = 0; document.documentElement.scrollTop = 0;
document.body.scrollTop = 0; document.body.scrollTop = 0;
var context = canvas1.getContext("2d"); // var context = canvas1.getContext("2d");
// context.scale(2, 2); // context.scale(2, 2);
let that = this; let that = this;
html2canvas(_canvas, { html2canvas(_canvas, {
...@@ -423,6 +423,8 @@ export default { ...@@ -423,6 +423,8 @@ export default {
}; };
await this.toWritePrintLog(data); await this.toWritePrintLog(data);
console.log("data", data);
let res = await this.$api.post("/toPrint", data); let res = await this.$api.post("/toPrint", data);
this.$message.success(res.msg); this.$message.success(res.msg);
}, },
......
...@@ -22,6 +22,7 @@ export default { ...@@ -22,6 +22,7 @@ export default {
account: "", account: "",
password: "", password: "",
}, },
desktoVersion: "print",
}; };
}, },
computed: { computed: {
...@@ -96,6 +97,10 @@ export default { ...@@ -96,6 +97,10 @@ export default {
this.form.factoryCode = this.userList[v].factoryCode; this.form.factoryCode = this.userList[v].factoryCode;
this.form.password = this.userList[v].password; this.form.password = this.userList[v].password;
}, },
changeDesktoVersion(value) {
// this.$store.commit("changeDesktoVersion", value);
localStorage.setItem("desktoVersion", value);
},
}, },
}; };
</script> </script>
...@@ -105,24 +110,35 @@ export default { ...@@ -105,24 +110,35 @@ export default {
<div class="form-content"> <div class="form-content">
<el-form ref="formRef" :rules="rules" size="small" :model="form"> <el-form ref="formRef" :rules="rules" size="small" :model="form">
<el-form-item v-if="userList.length > 0"> <el-form-item v-if="userList.length > 0">
<el-select <div style="display: flex;">
@change="userChange" <el-select
filterable @change="userChange"
style="width: 100%" filterable
placeholder="登录记录" style="width: 100%"
v-model="form.user" placeholder="登录记录"
clearable v-model="form.user"
> clearable
<template slot="prefix"> >
<i class="el-icon-monitor"></i> <template slot="prefix">
</template> <i class="el-icon-monitor"></i>
<el-option </template>
v-for="(it, i) in userList" <el-option
:key="i" v-for="(it, i) in userList"
:label="`${it.account}(${it.factoryCode})`" :key="i"
:value="i" :label="`${it.account}(${it.factoryCode})`"
></el-option> :value="i"
</el-select> ></el-option>
</el-select>
<el-select
style="margin-left: 8px;"
v-model="desktoVersion"
@change="changeDesktoVersion"
placeholder="请选择版本"
>
<el-option label="驱动2.0" value="print"></el-option>
<el-option label="驱动4.0" value="print4.0"></el-option>
</el-select>
</div>
</el-form-item> </el-form-item>
<el-form-item prop="factoryCode"> <el-form-item prop="factoryCode">
<el-input <el-input
......
...@@ -104,6 +104,10 @@ module.exports = { ...@@ -104,6 +104,10 @@ module.exports = {
to: "../print", to: "../print",
}, },
{ {
from: "./print4.0/",
to: "../print4.0",
},
{
from: "./logs/", from: "./logs/",
to: "../logs", to: "../logs",
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment