初始化
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>卡树自动拷贝打印系统 V3.0</title>
|
||||
<% if (htmlWebpackPlugin.options.nodeModules) { %>
|
||||
<!-- Add `node_modules/` to global paths so `require` works properly in development -->
|
||||
<script>
|
||||
require('module').globalPaths.push('<%= htmlWebpackPlugin.options.nodeModules.replace(/\\/g, '\\\\') %>')
|
||||
</script>
|
||||
<% } %>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<!-- Set `__static` path to static files in production -->
|
||||
<% if (!process.browser) { %>
|
||||
<script>
|
||||
if (process.env.NODE_ENV !== 'development') window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
|
||||
</script>
|
||||
<% } %>
|
||||
|
||||
<!-- webpack builds are automatically injected -->
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,111 @@
|
||||
import * as ffi from "ffi-napi";
|
||||
import { app } from "electron";
|
||||
const fs = require("fs");
|
||||
const { ipcMain } = require("electron");
|
||||
// const { Input } = require("element-ui");
|
||||
const path = require("path");
|
||||
let root = "";
|
||||
if (process.env.NODE_ENV !== "development") {
|
||||
root = path.dirname(app.getPath("exe"));
|
||||
} else {
|
||||
root = "..\\..\\";
|
||||
}
|
||||
//console.log(root);
|
||||
let interval;
|
||||
const frp_cap = new ffi.Library(`${root}\\lib\\ID_FprCap.dll`, {
|
||||
LIVESCAN_Init: ["int", []], //初始化
|
||||
LIVESCAN_GetChannelCount: ["int", []], //获得采集器通道数量
|
||||
LIVESCAN_BeginCapture: ["int", ["int"]], // 准备采集一帧图像
|
||||
LIVESCAN_GetFPRawData: ["int", ["int", "uchar*"]], //采集一帧图像
|
||||
LIVESCAN_GetFPBmpData: ["int", ["int", "uchar*"]], //采集一帧 BMP 格式图像数据
|
||||
LIVESCAN_EndCapture: ["int", ["int"]], //结束采集
|
||||
});
|
||||
|
||||
ipcMain.on("get-root", (event) => {
|
||||
event.reply("get-root-callback", root);
|
||||
});
|
||||
ipcMain.on("init-frp", (event) => {
|
||||
let result1 = frp_cap.LIVESCAN_Init();
|
||||
let result2 = frp_cap.LIVESCAN_GetChannelCount();
|
||||
event.reply("init-frp-callback", result1 == 1 && result2 > 0);
|
||||
});
|
||||
|
||||
ipcMain.on("end-frp", (event) => {
|
||||
let result10 = frp_cap.LIVESCAN_EndCapture(0);
|
||||
clearInterval(interval);
|
||||
event.reply("end-frp-callback", result10);
|
||||
});
|
||||
|
||||
ipcMain.on("input-frp", (event) => {
|
||||
let result3 = frp_cap.LIVESCAN_BeginCapture(0);
|
||||
if (result3) {
|
||||
const buf1 = new Buffer.alloc(256 * 360 + 1078);
|
||||
const buf2 = new Buffer.alloc(256 * 360);
|
||||
let i = 0;
|
||||
interval = setInterval(() => {
|
||||
take(event, buf1, buf2, interval);
|
||||
i++;
|
||||
//console.log(i);
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
function take(event, buf1, buf2, interval) {
|
||||
let result4 = 0;
|
||||
let result5 = 0;
|
||||
let result6 = 0;
|
||||
result4 = frp_cap.LIVESCAN_GetFPBmpData(0, buf1);
|
||||
result5 = frp_cap.LIVESCAN_GetFPRawData(0, buf2);
|
||||
if (result4 == 1 && result5 == 1) {
|
||||
////console.log(buf1.toString('hex').substr(0,10))
|
||||
//console.log("BMP图像获取状态:", result4);
|
||||
////console.log(buf2.toString('hex').substr(0,10))
|
||||
//console.log("图像获取状态:", result5);
|
||||
|
||||
if (
|
||||
buf1.toString("hex").substr(0, 10) != " 424d000000" &&
|
||||
buf2.toString("hex").substr(0, 10) != "fafafafafa"
|
||||
) {
|
||||
// fs.writeFile('./src/renderer/assets/picture/1.jpg',buf1,'',()=>{});
|
||||
// fs.writeFile('./src/renderer/assets/picture/1.bmp',buf1,'',()=>{});
|
||||
event.reply("input-frp-callback", buf1, buf2);
|
||||
result6 = frp_cap.LIVESCAN_EndCapture(0);
|
||||
//console.log("结束录入:" + result6);
|
||||
clearInterval(interval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const fpr = new ffi.Library(`${root}\\lib\\ID_Fpr.dll`, {
|
||||
FP_Begin: ["int", []], //初始化操作
|
||||
FP_FeatureExtract: ["int", ["char", "char", "char*", "char*"]], //指纹图像特征提取
|
||||
FP_FeatureMatch: ["int", ["char*", "char*", "float*"]], //指纹特征数据进行比对
|
||||
FP_ImageMatch: ["int", ["char*", "char*", "float*"]], //图像和指纹特征进行比对
|
||||
FP_End: ["int", []], //结束操作
|
||||
});
|
||||
|
||||
ipcMain.on("ok-frp", (event, data) => {
|
||||
let result7 = fpr.FP_Begin();
|
||||
//console.log("初始化:" + result7);
|
||||
const buf3 = new Buffer.alloc(512);
|
||||
let result8 = fpr.FP_FeatureExtract(65, 99, data, buf3);
|
||||
//console.log("指纹特征提取:" + result8);
|
||||
// //console.log(buf3.toString("base64"));
|
||||
// //console.log("buf3:"+buf3);
|
||||
event.reply("ok-frp-callback", buf3.toString("base64"));
|
||||
});
|
||||
ipcMain.on("judge-frp", (event, data1, data2) => {
|
||||
const a = new Buffer.alloc(4);
|
||||
const Buffer1 = new Buffer.from(data1, "base64"); //把base64码转成buffer对象
|
||||
const Buffer2 = new Buffer.from(data2, "base64"); //把base64码转成buffer对象
|
||||
//console.log("Buffer1:" + Buffer1);
|
||||
//console.log("Buffer2:" + Buffer2);
|
||||
let result9 = fpr.FP_FeatureMatch(Buffer1, Buffer2, a);
|
||||
//console.log("调用相似度:" + result9);
|
||||
//console.log("相似度:" + a.readFloatLE(0).toFixed(2));
|
||||
event.reply("judge-frp-callback", {
|
||||
rate: a.readFloatLE(0).toFixed(2),
|
||||
data1: data1,
|
||||
data2: data2,
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,194 @@
|
||||
const { Menu, app, BrowserWindow } = require("electron");
|
||||
import "../renderer/store";
|
||||
const fs = require('fs');
|
||||
const child_process = require('child_process');
|
||||
const path = require('path')
|
||||
// require("./fingerprint/win");
|
||||
|
||||
// 获取日志文件的路径
|
||||
const logPath = path.join(app.getPath('userData'), 'app.log');
|
||||
// 写入日志的函数
|
||||
function writeLog(message) {
|
||||
const timestamp = new Date().toISOString();
|
||||
const logMessage = `${timestamp}: ${message}\n`;
|
||||
// 异步追加日志信息
|
||||
fs.appendFile(logPath, logMessage, (err) => {
|
||||
if (err) throw err;
|
||||
console.log('日志信息已追加到文件');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set `__static` path to static files in production
|
||||
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
|
||||
*/
|
||||
if (process.env.NODE_ENV !== "development") {
|
||||
global.__static = require("path")
|
||||
.join(__dirname, "/static")
|
||||
.replace(/\\/g, "\\\\");
|
||||
}
|
||||
|
||||
let mainWindow;
|
||||
const winURL =
|
||||
process.env.NODE_ENV === "development"
|
||||
? `http://localhost:9080`
|
||||
: `file://${__dirname}/index.html`;
|
||||
|
||||
function createWindow() {
|
||||
/**
|
||||
* Initial window options
|
||||
*/
|
||||
mainWindow = new BrowserWindow({
|
||||
height: 800,
|
||||
useContentSize: true,
|
||||
width: 1280,
|
||||
title: "卡树自动拷贝打印系统 V3.0",
|
||||
icon: "static/images/logo64.ico", // sets window icon
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
enableRemoteModule: true,
|
||||
webSecurity: false,
|
||||
},
|
||||
});
|
||||
// mainWindow.maximize();
|
||||
Menu.setApplicationMenu(null); //关闭菜单
|
||||
//mainWindow.webContents.openDevTools({mode:'bottom'});
|
||||
require("@electron/remote/main").initialize();
|
||||
require("@electron/remote/main").enable(mainWindow.webContents);
|
||||
mainWindow.loadURL(winURL);
|
||||
|
||||
mainWindow.on("closed", () => {
|
||||
mainWindow = null;
|
||||
});
|
||||
}
|
||||
app.commandLine.appendSwitch("no-sandbox");
|
||||
const gotTheLock = app.requestSingleInstanceLock();
|
||||
if (!gotTheLock) {
|
||||
app.quit();
|
||||
} else {
|
||||
app.on("second-instance", (event, commandLine, workingDirectory) => {
|
||||
// 当运行第二个实例时,将会聚焦到myWindow这个窗口
|
||||
if (mainWindow) {
|
||||
if (mainWindow.isMinimized()) mainWindow.restore();
|
||||
mainWindow.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
app.on("ready", createWindow);
|
||||
|
||||
app.on("window-all-closed", () => {
|
||||
if (process.platform !== "darwin") {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
||||
app.on("activate", () => {
|
||||
if (mainWindow === null) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
app.on("renderer-process-crashed", function (event, webContents, details) {
|
||||
// 输出一下捕捉到的reason,实际可以根据不同的“原因”进行具体处理
|
||||
console.error("renderer-process-crashed, reason => ", JSON.stringify(details));
|
||||
// 重启应用
|
||||
writeLog("renderer-process-crashed, reason => " + JSON.stringify(details))
|
||||
});
|
||||
|
||||
const { ipcMain } = require("electron");
|
||||
let preFilePath = "";
|
||||
// app.on("will-finish-launching", () => {
|
||||
app.on("open-file", (e, filePath) => {
|
||||
preFilePath = filePath;
|
||||
});
|
||||
|
||||
ipcMain.on('open-help-file', event => {
|
||||
var exePath = path.dirname(app.getPath('exe'));
|
||||
child_process.exec(`start "" "${exePath}/help/User Manual.pdf"`);
|
||||
});
|
||||
|
||||
if (process.platform === "win32" && process.argv.length >= 2) {
|
||||
console.log("process argv:", process.argv);
|
||||
// windows系统当没有路径参数时这个位置默认有个.,需要加以判断
|
||||
preFilePath = process.argv[1] === "." ? "" : process.argv[1];
|
||||
}
|
||||
// });
|
||||
|
||||
ipcMain.on("open-program", (event) => {
|
||||
if (process.env.NODE_ENV !== "development") {
|
||||
//调试模式下不运行此行
|
||||
if (preFilePath != "") {
|
||||
event.reply("open-program-callback", preFilePath);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 1. preFilePath
|
||||
//
|
||||
|
||||
// const ffi = require('ffi-napi');
|
||||
// const { ipcMain } = require("electron");
|
||||
// ipcMain.on("init-frp", (event) => {
|
||||
// let result1 = frp_cap.LIVESCAN_Init();
|
||||
// let result2 = frp_cap.LIVESCAN_GetChannelCount();
|
||||
// event.reply("init-frp-callback", result1 == 1 && result2 > 0);
|
||||
|
||||
// });
|
||||
|
||||
// const frp = new ffi.Library('../../lib/ID_FprCap.dll', {
|
||||
// 'LIVESCAN_Init':
|
||||
// [
|
||||
// 'int', [],
|
||||
// ],
|
||||
// 'LIVESCAN_BeginCapture':
|
||||
// [
|
||||
// 'int', ['int']
|
||||
// ]
|
||||
// });
|
||||
// let result = frp_cap.LIVESCAN_Init();//初始化
|
||||
// console.log(`LIVESCAN_Init: ` + result);
|
||||
|
||||
// result = frp_cap.LIVESCAN_GetChannelCount();//获得采集器通道数量
|
||||
// console.log(`LIVESCAN_GetChannelCount: ` + result);
|
||||
|
||||
// result = frp_cap.LIVESCAN_BeginCapture(0);// 准备采集一帧图像
|
||||
// console.log(`LIVESCAN_BeginCapture: ` + result);
|
||||
|
||||
// const buf = new Buffer.alloc(256 * 360 + 1078);
|
||||
// console.log("BMP图像获取状态:", frp_cap.LIVESCAN_GetFPBmpData(0, buf))
|
||||
// //console.log(buf.toString('hex'))
|
||||
// fs.writeFile('./1.bmp',buf,'',()=>{});//11
|
||||
// const buf2 = new Buffer.alloc(256 * 360);
|
||||
// console.log("图像获取状态:", frp_cap.LIVESCAN_GetFPRawData(0, buf2))
|
||||
// console.log(buf2.toString('hex'))
|
||||
|
||||
//console.log("buf", buf.toString("base64")); //12
|
||||
//console.log("test", frp_cap.LIVESCAN_GetFPRawData(0, buf));
|
||||
//console.log("buf", buf.toString("base64")); //
|
||||
//frp_cap.LIVESCAN_EndCapture(0);
|
||||
//result = frp.FP_Begin();
|
||||
//console.log(`FP_Begin`, result);
|
||||
//
|
||||
//const buf2 = new Buffer(512);
|
||||
//frp.FP_FeatureExtract(65, 99, buf, buf2);
|
||||
//console.log("buf2: ", buf2.toString("base64")); //111111
|
||||
/**
|
||||
* Auto Updater
|
||||
*
|
||||
* Uncomment the following code below and install `electron-updater` to
|
||||
* support auto updating. Code Signing with a valid certificate is required.
|
||||
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-electron-builder.html#auto-updating
|
||||
*/
|
||||
|
||||
/*
|
||||
import { autoUpdater } from 'electron-updater'
|
||||
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
autoUpdater.quitAndInstall()
|
||||
})
|
||||
|
||||
app.on('ready', () => {
|
||||
if (process.env.NODE_ENV === 'production') autoUpdater.checkForUpdates()
|
||||
})
|
||||
*/
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* This file is used specifically and only for development. It installs
|
||||
* `electron-debug` & `vue-devtools`. There shouldn't be any need to
|
||||
* modify this file, but it can be used to extend your development
|
||||
* environment.
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
// Install `electron-debug` with `devtron`
|
||||
require('electron-debug')({ showDevTools: true })
|
||||
|
||||
// Install `vue-devtools`
|
||||
require('electron').app.on('ready', () => {
|
||||
let installExtension = require('electron-devtools-installer')
|
||||
installExtension.default(installExtension.VUEJS_DEVTOOLS)
|
||||
.then(() => {})
|
||||
.catch(err => {
|
||||
console.log('Unable to install `vue-devtools`: \n', err)
|
||||
})
|
||||
})
|
||||
|
||||
// Require `main` process to boot app
|
||||
require('./index')
|
||||
@@ -0,0 +1,206 @@
|
||||
const { Menu, app, BrowserWindow } = require("electron");
|
||||
import "../renderer/store";
|
||||
const fs = require('fs');
|
||||
const child_process = require('child_process');
|
||||
const path = require('path')
|
||||
// require("./fingerprint/win");
|
||||
let root = "";
|
||||
if (process.env.NODE_ENV !== "development") {
|
||||
root = path.dirname(app.getPath("exe"));
|
||||
} else {
|
||||
root = "..\\..\\";
|
||||
}
|
||||
|
||||
// 获取日志文件的路径
|
||||
const logPath = path.join(app.getPath('userData'), 'app.log');
|
||||
// 写入日志的函数
|
||||
function writeLog(message) {
|
||||
const timestamp = new Date().toISOString();
|
||||
const logMessage = `${timestamp}: ${message}\n`;
|
||||
// 异步追加日志信息
|
||||
fs.appendFile(logPath, logMessage, (err) => {
|
||||
if (err) throw err;
|
||||
console.log('日志信息已追加到文件');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set `__static` path to static files in production
|
||||
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
|
||||
*/
|
||||
if (process.env.NODE_ENV !== "development") {
|
||||
global.__static = require("path")
|
||||
.join(__dirname, "/static")
|
||||
.replace(/\\/g, "\\\\");
|
||||
}
|
||||
|
||||
let mainWindow;
|
||||
const winURL =
|
||||
process.env.NODE_ENV === "development"
|
||||
? `http://localhost:9080`
|
||||
: `file://${__dirname}/index.html`;
|
||||
|
||||
function createWindow() {
|
||||
/**
|
||||
* Initial window options
|
||||
*/
|
||||
mainWindow = new BrowserWindow({
|
||||
height: 800,
|
||||
useContentSize: true,
|
||||
width: 1280,
|
||||
title: "卡树自动拷贝打印系统 V3.0",
|
||||
icon: "static/images/logo64.ico", // sets window icon
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
enableRemoteModule: true,
|
||||
webSecurity: false,
|
||||
},
|
||||
});
|
||||
// mainWindow.maximize();
|
||||
// 使窗口可以拖拽
|
||||
mainWindow.setIgnoreMouseEvents(false);
|
||||
Menu.setApplicationMenu(null); //关闭菜单
|
||||
//mainWindow.webContents.openDevTools({mode:'bottom'});
|
||||
require("@electron/remote/main").initialize();
|
||||
require("@electron/remote/main").enable(mainWindow.webContents);
|
||||
mainWindow.loadURL(winURL);
|
||||
|
||||
mainWindow.on("closed", () => {
|
||||
mainWindow = null;
|
||||
});
|
||||
}
|
||||
app.commandLine.appendSwitch("no-sandbox");
|
||||
const gotTheLock = app.requestSingleInstanceLock();
|
||||
if (!gotTheLock) {
|
||||
app.quit();
|
||||
} else {
|
||||
app.on("second-instance", (event, commandLine, workingDirectory) => {
|
||||
// 当运行第二个实例时,将会聚焦到myWindow这个窗口
|
||||
if (mainWindow) {
|
||||
if (mainWindow.isMinimized()) mainWindow.restore();
|
||||
mainWindow.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
app.on("ready", createWindow);
|
||||
|
||||
app.on("window-all-closed", () => {
|
||||
if (process.platform !== "darwin") {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
||||
app.on("activate", () => {
|
||||
if (mainWindow === null) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
app.on("renderer-process-crashed", function (event, webContents, details) {
|
||||
// 输出一下捕捉到的reason,实际可以根据不同的“原因”进行具体处理
|
||||
console.error("renderer-process-crashed, reason => ", JSON.stringify(details));
|
||||
// 重启应用
|
||||
writeLog("renderer-process-crashed, reason => " + JSON.stringify(details))
|
||||
});
|
||||
|
||||
const { ipcMain } = require("electron");
|
||||
let preFilePath = "";
|
||||
// app.on("will-finish-launching", () => {
|
||||
app.on("open-file", (e, filePath) => {
|
||||
preFilePath = filePath;
|
||||
});
|
||||
|
||||
ipcMain.on('open-help-file', event => {
|
||||
var exePath = path.dirname(app.getPath('exe'));
|
||||
child_process.exec(`start "" "${exePath}/help/User Manual.pdf"`);
|
||||
});
|
||||
|
||||
ipcMain.on("get-root", (event) => {
|
||||
event.reply("get-root-callback", root);
|
||||
});
|
||||
|
||||
if (process.platform === "win32" && process.argv.length >= 2) {
|
||||
console.log("process argv:", process.argv);
|
||||
// windows系统当没有路径参数时这个位置默认有个.,需要加以判断
|
||||
preFilePath = process.argv[1] === "." ? "" : process.argv[1];
|
||||
}
|
||||
// });
|
||||
|
||||
ipcMain.on("open-program", (event) => {
|
||||
if (process.env.NODE_ENV !== "development") {
|
||||
//调试模式下不运行此行
|
||||
if (preFilePath != "") {
|
||||
event.reply("open-program-callback", preFilePath);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 1. preFilePath
|
||||
//
|
||||
|
||||
// const ffi = require('ffi-napi');
|
||||
// const { ipcMain } = require("electron");
|
||||
// ipcMain.on("init-frp", (event) => {
|
||||
// let result1 = frp_cap.LIVESCAN_Init();
|
||||
// let result2 = frp_cap.LIVESCAN_GetChannelCount();
|
||||
// event.reply("init-frp-callback", result1 == 1 && result2 > 0);
|
||||
|
||||
// });
|
||||
|
||||
// const frp = new ffi.Library('../../lib/ID_FprCap.dll', {
|
||||
// 'LIVESCAN_Init':
|
||||
// [
|
||||
// 'int', [],
|
||||
// ],
|
||||
// 'LIVESCAN_BeginCapture':
|
||||
// [
|
||||
// 'int', ['int']
|
||||
// ]
|
||||
// });
|
||||
// let result = frp_cap.LIVESCAN_Init();//初始化
|
||||
// console.log(`LIVESCAN_Init: ` + result);
|
||||
|
||||
// result = frp_cap.LIVESCAN_GetChannelCount();//获得采集器通道数量
|
||||
// console.log(`LIVESCAN_GetChannelCount: ` + result);
|
||||
|
||||
// result = frp_cap.LIVESCAN_BeginCapture(0);// 准备采集一帧图像
|
||||
// console.log(`LIVESCAN_BeginCapture: ` + result);
|
||||
|
||||
// const buf = new Buffer.alloc(256 * 360 + 1078);
|
||||
// console.log("BMP图像获取状态:", frp_cap.LIVESCAN_GetFPBmpData(0, buf))
|
||||
// //console.log(buf.toString('hex'))
|
||||
// fs.writeFile('./1.bmp',buf,'',()=>{});//11
|
||||
// const buf2 = new Buffer.alloc(256 * 360);
|
||||
// console.log("图像获取状态:", frp_cap.LIVESCAN_GetFPRawData(0, buf2))
|
||||
// console.log(buf2.toString('hex'))
|
||||
|
||||
//console.log("buf", buf.toString("base64")); //12
|
||||
//console.log("test", frp_cap.LIVESCAN_GetFPRawData(0, buf));
|
||||
//console.log("buf", buf.toString("base64")); //
|
||||
//frp_cap.LIVESCAN_EndCapture(0);
|
||||
//result = frp.FP_Begin();
|
||||
//console.log(`FP_Begin`, result);
|
||||
//
|
||||
//const buf2 = new Buffer(512);
|
||||
//frp.FP_FeatureExtract(65, 99, buf, buf2);
|
||||
//console.log("buf2: ", buf2.toString("base64")); //111111
|
||||
/**
|
||||
* Auto Updater
|
||||
*
|
||||
* Uncomment the following code below and install `electron-updater` to
|
||||
* support auto updating. Code Signing with a valid certificate is required.
|
||||
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-electron-builder.html#auto-updating
|
||||
*/
|
||||
|
||||
/*
|
||||
import { autoUpdater } from 'electron-updater'
|
||||
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
autoUpdater.quitAndInstall()
|
||||
})
|
||||
|
||||
app.on('ready', () => {
|
||||
if (process.env.NODE_ENV === 'production') autoUpdater.checkForUpdates()
|
||||
})
|
||||
*/
|
||||
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<router-view />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'App'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
#app {
|
||||
font-family: 'Avenir', Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
// 引导样式
|
||||
.guide_body {
|
||||
position: relative;
|
||||
z-index: 200;
|
||||
background-color: #fff;
|
||||
padding: 0 10px;
|
||||
border-radius: 4px;
|
||||
border: 1px dashed #2e9bfb;
|
||||
}
|
||||
.guide_box {
|
||||
border: 1px dashed #2e9bfb;
|
||||
padding: 12px;
|
||||
.guide_title {
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
color: #000000;
|
||||
line-height: 30px;
|
||||
span {
|
||||
font-size: 13px;
|
||||
color: #999;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
.guide_desc {
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
line-height: 24px;
|
||||
a {
|
||||
color: #2e9bfb;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.guide_btns {
|
||||
padding: 10px 0 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: end;
|
||||
.guide_btn1 {
|
||||
color: #999;
|
||||
}
|
||||
.guide_btn2 {
|
||||
background-color: #2e9bfb;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-popover {
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 698 B |
|
After Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 789 B |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 556 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1677507265492" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2292" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M504.771134 451.921616c-9.198797 2.672858-14.5098 12.288204-11.854298 21.504358 0.468618 1.614129 46.809727 166.463511 34.052904 532.610338a17.304152 17.304152 0 0 0 16.731397 17.946332l0.624824 0.017356a17.35622 17.35622 0 0 0 17.321508-16.748753c12.965097-371.666106-33.410724-536.636981-35.371978-543.475332a17.390933 17.390933 0 0 0-21.504357-11.854299zM941.193298 286.013505A467.784855 467.784855 0 0 0 509.61352 0.000347c-62.256763 0-122.968822 12.166711-180.435269 36.153007a560.571209 560.571209 0 0 0-89.401891 46.931221 17.373577 17.373577 0 0 0 18.91828 29.123738 525.303369 525.303369 0 0 1 83.847901-44.015376A431.232654 431.232654 0 0 1 509.61352 34.712788a433.072414 433.072414 0 0 1 399.592264 264.838569c28.290639 66.890874 43.58147 190.050614 50.176834 257.531599a17.338864 17.338864 0 1 0 34.538878-3.401819c-8.278917-84.802493-24.142503-200.099866-52.728198-267.667632zM188.332522 168.546604a17.35622 17.35622 0 1 0-24.368133-24.715258C70.622635 235.784603-22.354638 406.795443 64.738876 699.178333a17.321508 17.321508 0 1 0 33.254518-9.893045C32.959636 470.909322 64.183477 290.85589 188.332522 168.546604z" fill="#2c2c2c" p-id="2293"></path><path d="M522.943097 104.380657a360.193644 360.193644 0 0 0-153.65462 27.87409C199.093379 203.259045 108.598045 390.411171 158.809591 567.618182c5.015948 17.720701 10.153389 36.569557 12.913028 55.348987 6.213527 42.505384 6.543295 120.72987 6.543295 244.80949a17.35622 17.35622 0 1 0 34.712441 0c0-129.442692-0.329768-204.872827-6.907776-249.86015-3.054695-20.862177-8.521904-40.96068-13.86762-59.774823-45.421229-160.302052 36.448063-329.62934 190.449808-393.864712a330.844275 330.844275 0 0 1 139.058038-25.235945c123.420084 4.443192 263.311221 113.231982 305.504193 237.589303 36.517488 107.591211 36.8299 290.890255 32.299927 455.965268a17.35622 17.35622 0 0 0 16.887602 17.824839c9.407072-0.173562 17.564495-7.272256 17.824839-16.887603 4.599398-168.16442 4.13078-355.29919-34.139686-468.07991C812.930829 226.481668 661.688724 109.344536 522.943097 104.380657z" fill="#2c2c2c" p-id="2294"></path><path d="M380.70887 283.548921a17.35622 17.35622 0 1 0-19.942297-28.412133c-89.384536 62.760093-128.227757 183.333757-96.587367 300.175834 0.364481 1.267004 35.597608 129.512117 35.597608 329.837614a17.35622 17.35622 0 1 0 34.712441 0c0-205.029033-35.371977-333.794833-36.847256-339.053767-27.787309-102.644688 5.606059-208.153152 83.066871-262.547548zM509.61352 208.274993c-18.866212 0-37.645642 2.030678-55.852318 6.057321a17.35622 17.35622 0 1 0 7.480531 33.896699c15.742092-3.471244 32.022227-5.241579 48.35443-5.241579 90.825102 0 172.399338 54.047271 207.788672 137.72161 42.175616 99.624706 44.935255 259.527565 35.198415 538.546165a17.321508 17.321508 0 0 0 16.731397 17.946332l0.624824 0.017357a17.35622 17.35622 0 0 0 17.321508-16.748753c10.136033-290.248075 7.046626-447.061527-37.923342-553.298953A259.787908 259.787908 0 0 0 509.61352 208.274993zM681.613665 833.203068a17.35622 17.35622 0 0 0-17.234727-17.477714h-0.121494a17.35622 17.35622 0 0 0-17.35622 17.234727c-0.086781 13.051878 0.347124 32.109008 0.815742 52.693485 0.676893 29.93948 1.440566 63.870891 0.694249 85.687661a17.304152 17.304152 0 0 0 17.35622 17.946332 17.35622 17.35622 0 0 0 17.321509-16.766109c0.798386-22.788718 0.017356-57.258171-0.676893-87.66627a1992.494113 1992.494113 0 0 1-0.798386-51.652112z" fill="#2c2c2c" p-id="2295"></path><path d="M509.61352 329.768536a138.190228 138.190228 0 0 0-53.474516 10.726145c-67.55041 28.186502-100.371023 104.397666-76.36737 177.276436 13.08659 39.728389 24.142503 247.707979 24.142503 454.160222a17.35622 17.35622 0 1 0 34.712441 0c0-185.833053-9.893046-416.462511-25.860769-465.00786-18.293456-55.487837 6.126746-113.266695 56.754841-134.389215a104.033186 104.033186 0 0 1 136.055413 55.644043c32.404064 76.697138 42.036766 215.546902 44.397212 318.538714a17.35622 17.35622 0 0 0 17.35622 16.957028h0.399193c9.580634-0.225631 17.165302-8.17478 16.957028-17.755414-2.447227-105.977082-12.600616-249.49567-47.20892-331.382318A138.554708 138.554708 0 0 0 509.61352 329.768536z" fill="#2c2c2c" p-id="2296"></path></svg>
|
||||
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1677506553614" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2085" width="200" height="200" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M504.771134 451.921616c-9.198797 2.672858-14.5098 12.288204-11.854298 21.504358 0.468618 1.614129 46.809727 166.463511 34.052904 532.610338a17.304152 17.304152 0 0 0 16.731397 17.946332l0.624824 0.017356a17.35622 17.35622 0 0 0 17.321508-16.748753c12.965097-371.666106-33.410724-536.636981-35.371978-543.475332a17.390933 17.390933 0 0 0-21.504357-11.854299zM941.193298 286.013505A467.784855 467.784855 0 0 0 509.61352 0.000347c-62.256763 0-122.968822 12.166711-180.435269 36.153007a560.571209 560.571209 0 0 0-89.401891 46.931221 17.373577 17.373577 0 0 0 18.91828 29.123738 525.303369 525.303369 0 0 1 83.847901-44.015376A431.232654 431.232654 0 0 1 509.61352 34.712788a433.072414 433.072414 0 0 1 399.592264 264.838569c28.290639 66.890874 43.58147 190.050614 50.176834 257.531599a17.338864 17.338864 0 1 0 34.538878-3.401819c-8.278917-84.802493-24.142503-200.099866-52.728198-267.667632zM188.332522 168.546604a17.35622 17.35622 0 1 0-24.368133-24.715258C70.622635 235.784603-22.354638 406.795443 64.738876 699.178333a17.321508 17.321508 0 1 0 33.254518-9.893045C32.959636 470.909322 64.183477 290.85589 188.332522 168.546604z" fill="#C7CAC7" p-id="2086"></path><path d="M522.943097 104.380657a360.193644 360.193644 0 0 0-153.65462 27.87409C199.093379 203.259045 108.598045 390.411171 158.809591 567.618182c5.015948 17.720701 10.153389 36.569557 12.913028 55.348987 6.213527 42.505384 6.543295 120.72987 6.543295 244.80949a17.35622 17.35622 0 1 0 34.712441 0c0-129.442692-0.329768-204.872827-6.907776-249.86015-3.054695-20.862177-8.521904-40.96068-13.86762-59.774823-45.421229-160.302052 36.448063-329.62934 190.449808-393.864712a330.844275 330.844275 0 0 1 139.058038-25.235945c123.420084 4.443192 263.311221 113.231982 305.504193 237.589303 36.517488 107.591211 36.8299 290.890255 32.299927 455.965268a17.35622 17.35622 0 0 0 16.887602 17.824839c9.407072-0.173562 17.564495-7.272256 17.824839-16.887603 4.599398-168.16442 4.13078-355.29919-34.139686-468.07991C812.930829 226.481668 661.688724 109.344536 522.943097 104.380657z" fill="#C7CAC7" p-id="2087"></path><path d="M380.70887 283.548921a17.35622 17.35622 0 1 0-19.942297-28.412133c-89.384536 62.760093-128.227757 183.333757-96.587367 300.175834 0.364481 1.267004 35.597608 129.512117 35.597608 329.837614a17.35622 17.35622 0 1 0 34.712441 0c0-205.029033-35.371977-333.794833-36.847256-339.053767-27.787309-102.644688 5.606059-208.153152 83.066871-262.547548zM509.61352 208.274993c-18.866212 0-37.645642 2.030678-55.852318 6.057321a17.35622 17.35622 0 1 0 7.480531 33.896699c15.742092-3.471244 32.022227-5.241579 48.35443-5.241579 90.825102 0 172.399338 54.047271 207.788672 137.72161 42.175616 99.624706 44.935255 259.527565 35.198415 538.546165a17.321508 17.321508 0 0 0 16.731397 17.946332l0.624824 0.017357a17.35622 17.35622 0 0 0 17.321508-16.748753c10.136033-290.248075 7.046626-447.061527-37.923342-553.298953A259.787908 259.787908 0 0 0 509.61352 208.274993zM681.613665 833.203068a17.35622 17.35622 0 0 0-17.234727-17.477714h-0.121494a17.35622 17.35622 0 0 0-17.35622 17.234727c-0.086781 13.051878 0.347124 32.109008 0.815742 52.693485 0.676893 29.93948 1.440566 63.870891 0.694249 85.687661a17.304152 17.304152 0 0 0 17.35622 17.946332 17.35622 17.35622 0 0 0 17.321509-16.766109c0.798386-22.788718 0.017356-57.258171-0.676893-87.66627a1992.494113 1992.494113 0 0 1-0.798386-51.652112z" fill="#C7CAC7" p-id="2088"></path><path d="M509.61352 329.768536a138.190228 138.190228 0 0 0-53.474516 10.726145c-67.55041 28.186502-100.371023 104.397666-76.36737 177.276436 13.08659 39.728389 24.142503 247.707979 24.142503 454.160222a17.35622 17.35622 0 1 0 34.712441 0c0-185.833053-9.893046-416.462511-25.860769-465.00786-18.293456-55.487837 6.126746-113.266695 56.754841-134.389215a104.033186 104.033186 0 0 1 136.055413 55.644043c32.404064 76.697138 42.036766 215.546902 44.397212 318.538714a17.35622 17.35622 0 0 0 17.35622 16.957028h0.399193c9.580634-0.225631 17.165302-8.17478 16.957028-17.755414-2.447227-105.977082-12.600616-249.49567-47.20892-331.382318A138.554708 138.554708 0 0 0 509.61352 329.768536z" fill="#C7CAC7" p-id="2089"></path></svg>
|
||||
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 484 B |
@@ -0,0 +1,215 @@
|
||||
<template>
|
||||
<div class="form">
|
||||
<el-form
|
||||
ref="form"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
status-icon>
|
||||
<el-form-item
|
||||
:label="$t('admin.userName')"
|
||||
prop="name">
|
||||
<el-input
|
||||
v-model="form.name"
|
||||
@blur="form.name = $event.target.value.trim()"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('work.password')"
|
||||
prop="pass1">
|
||||
<el-input
|
||||
v-model="form.pass1"
|
||||
show-password
|
||||
@blur="form.pass1 = $event.target.value.trim()"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('work.passwordConfirm')"
|
||||
prop="pass2">
|
||||
<el-input
|
||||
v-model="form.pass2"
|
||||
show-password
|
||||
@blur="form.pass2 = $event.target.value.trim()"></el-input>
|
||||
</el-form-item>
|
||||
<!--
|
||||
<el-form-item label="描述">
|
||||
<el-input type="textarea" :rows="3" v-model="form.text"></el-input>
|
||||
</el-form-item>
|
||||
-->
|
||||
</el-form>
|
||||
|
||||
<div class="finger">
|
||||
<finger
|
||||
:user_uuid="form.user_uuid"
|
||||
:isHave="false"
|
||||
@over="fingerChange" />
|
||||
</div>
|
||||
|
||||
<div class="bu">
|
||||
<el-button
|
||||
type="success"
|
||||
style="margin-right: 10px"
|
||||
@click="submit"
|
||||
>{{ $t('index.comfirm') }}</el-button
|
||||
>
|
||||
<el-button
|
||||
type="danger"
|
||||
@click="changevisiable(false)"
|
||||
>{{ $t('index.cancel') }}</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import finger from './finger.vue'
|
||||
export default {
|
||||
name: 'adduser',
|
||||
props: {
|
||||
changevisiable: {
|
||||
type: Function
|
||||
}
|
||||
},
|
||||
components: {
|
||||
finger
|
||||
},
|
||||
data() {
|
||||
var validateName = (rule, value, callback) => {
|
||||
if (value === '') {
|
||||
callback(new Error(this.$t('addUser.enterUsername')))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
var validatePass1 = (rule, value, callback) => {
|
||||
if (value === '') {
|
||||
callback(new Error(this.$t('addUser.enterPassword')))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
var validatePass2 = (rule, value, callback) => {
|
||||
if (value === '') {
|
||||
callback(new Error(this.$t('addUser.enterPassword')))
|
||||
} else if (this.form.pass1 != this.form.pass2) {
|
||||
callback(new Error(this.$t('addUser.errorPassword')))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
form: {
|
||||
user_uuid: '',
|
||||
name: '',
|
||||
pass1: '',
|
||||
pass2: '',
|
||||
fingerprint_value: '',
|
||||
text: ''
|
||||
},
|
||||
rules: {
|
||||
name: [{ validator: validateName, trigger: 'blur' }],
|
||||
pass1: [{ validator: validatePass1, trigger: 'blur' }],
|
||||
pass2: [{ validator: validatePass2, trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.form.user_uuid = new Date().getTime()
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
let url = `/user/Add?user_uuid=${this.form.user_uuid}&user_name=${this.form.name}&user_password=${this.form.pass1}`
|
||||
// if (this.form.fingerprint_value) {
|
||||
// url += '&fingerprint_value=' + this.form.fingerprint_value
|
||||
// }
|
||||
this.$axios({
|
||||
method: 'post',
|
||||
url: url
|
||||
})
|
||||
.then((res) => {
|
||||
this.$message({ offset: 100, message: this.$t('addUser.addSuccess'), type: 'success' })
|
||||
this.changevisiable(false)
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(this.$t('addUser.errorAdd'))
|
||||
})
|
||||
} else {
|
||||
console.log('error user!!')
|
||||
}
|
||||
})
|
||||
//changevisiable(false);
|
||||
},
|
||||
fingerChange(val) {
|
||||
this.form.fingerprint_value = val
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.form {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
.el-form {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
.el-form-item {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 20px;
|
||||
width: 100%;
|
||||
|
||||
/deep/.el-form-item__label {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
color: black;
|
||||
width: 20%;
|
||||
}
|
||||
/deep/ .el-form-item__content {
|
||||
width: 70%;
|
||||
.el-input {
|
||||
.el-input__inner {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.finger {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
// margin-top: 20px;
|
||||
img {
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
}
|
||||
p {
|
||||
position: absolute;
|
||||
font-weight: 500;
|
||||
font-size: 17px;
|
||||
color: black;
|
||||
}
|
||||
}
|
||||
.bu {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
width: 100%;
|
||||
margin-right: 20px;
|
||||
.el-button {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<el-tabs v-model="activeName">
|
||||
<el-tab-pane label="用户管理" name="first">{{ $t("admin.userManage") }}</el-tab-pane>
|
||||
<el-tab-pane label="配置管理" name="second">{{ $t("admin.configureManage") }}</el-tab-pane>
|
||||
<el-tab-pane label="角色管理" name="third">{{ $t("admin.roleManage") }}</el-tab-pane>
|
||||
<el-tab-pane label="定时任务补偿" name="fourth">{{ $t("admin.timeTask") }}</el-tab-pane>
|
||||
</el-tabs>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name:"admintest",
|
||||
data() {
|
||||
return {
|
||||
activeName: 'second'
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,315 @@
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<div class="brief">
|
||||
<el-row :gutter="20" style="height: 100%;">
|
||||
<el-col :span="12" style="height: 100%;">
|
||||
<div class="grid-content bg-purple b_left" style="padding-top:1px !important">
|
||||
<br></br><br></br>
|
||||
<p>1、开发接口——进卡、退卡、重置系统和清洁系统</p>
|
||||
<el-button icon="text" @click="move_usbReader()">读卡</el-button>
|
||||
<el-button icon="text" @click="move_Hopper()">退卡</el-button>
|
||||
<el-button icon="text" @click="reset_Printer()">重置系统</el-button>
|
||||
<el-button icon="text" @click="clean_Printer()">清洁系统</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12" style="height: 100%;">
|
||||
<div class="grid-content bg-purple b_mid" style="padding-top:1px !important;text-align: left"><br></br>
|
||||
<code>url: "/api/web/movetousbreader" //读卡<br>
|
||||
url: "/api/web/movetohopper" //退卡<br>
|
||||
url: "/api/web/resetprinter" //重置系统<br>
|
||||
url: "/api/web/cleanprinter" //清洁系统<br>
|
||||
url:"/api/web/cmd_getSummary" //获取系统状态<br>
|
||||
url:"/api/web/cspserver.log" //获取当前日志<br>
|
||||
url:"/api/web/cspserver“ //获取完整的日志信息</code>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<br>---------------------------------------------------------------------------------------------------------------</br>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="brief">
|
||||
<el-row :gutter="20" style="height: 100%;">
|
||||
<el-col :span="12" style="height: 100%;">
|
||||
<div class="grid-content bg-purple b_left" style="padding-top:1px !important">
|
||||
<p>2、开发接口——打印Demo</p>
|
||||
<el-form ref="form" label-width="120px">
|
||||
<el-form-item label="路径">
|
||||
<el-input v-model="file1"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="CS模板文件名">
|
||||
<el-input v-model="file2"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="CSV文件名">
|
||||
<el-input v-model="file3"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmitprint">提交</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12" style="height: 100%;">
|
||||
<div class="grid-content bg-purple b_mid" style="padding-top:1px !important;text-align: left"><br></br>
|
||||
<code>http://localhost:5080/api/rest/job/?CardSoon_File=0713&Json_File=1.soon&Udf_File=file:&print_flag=2&printCopys=1&&hasPrintTask=true&hasCopyTask=false</code><br><br>
|
||||
<code>
|
||||
CardSoon_File: 0713 //在缓存文件夹下的路径名<br>
|
||||
Json_File: 1.soon //标签名称<br>
|
||||
Udf_File: //csv字段名称<br>
|
||||
print_flag: 2 //指定打印标签的正反面,其中1是双面,2是正面,3是反面<br>
|
||||
printCopys: 1 //发行数量<br>
|
||||
hasPrintTask: true //是否打印<br>
|
||||
hasCopyTask: false //是否拷贝文件</code>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<br>---------------------------------------------------------------------------------------------------------------</br>
|
||||
|
||||
<div class="brief">
|
||||
<el-row :gutter="20" style="height: 100%;">
|
||||
<el-col :span="12" style="height: 100%;">
|
||||
<div class="grid-content bg-purple b_left" style="padding-top:1px !important">
|
||||
<p>3、开发接口——拷贝Demo</p>
|
||||
<el-form ref="form" label-width="120px">
|
||||
<el-form-item label="路径">
|
||||
<el-input v-model="file4"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="卷标">
|
||||
<el-input v-model="file5"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量">
|
||||
<el-input v-model="file6"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmitcopy">提交</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12" style="height: 100%;">
|
||||
<div class="grid-content bg-purple b_mid" style="padding-top:1px !important;text-align: left"><br></br>
|
||||
<code>
|
||||
http://192.168.3.74:5080/api/rest/job/?CardSoon_File=copydemo&file_type=0&label=2022-06-21&printCopys=1&disk_size=32&zone_type=0&hasPrintTask=false&hasCopyTask=true
|
||||
</code><br><br>
|
||||
<code>
|
||||
CardSoon_File: copydemo //在缓存文件夹下的路径名,拷贝文件需要放到该路径下data文件夹中<br>
|
||||
file_type: 0 //烧录内容<br>
|
||||
label: 2022-06-21 //卷标名<br>
|
||||
printCopys: 1 //发行数量<br>
|
||||
disk_size: 32 //U盘容量<br>
|
||||
zone_type: 0 //分区格式<br>
|
||||
hasPrintTask: false //是否打印<br>
|
||||
hasCopyTask: true //是否拷贝文件</code>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<br>---------------------------------------------------------------------------------------------------------------</br>
|
||||
|
||||
|
||||
<div class="brief">
|
||||
<el-row :gutter="20" style="height: 100%;">
|
||||
<el-col :span="12" style="height: 100%;">
|
||||
<div class="grid-content bg-purple b_left" style="padding-top:1px !important">
|
||||
<p>4、开发接口——拷贝+打印Demo</p>
|
||||
<el-form ref="form" label-width="120px">
|
||||
<el-form-item label="路径">
|
||||
<el-input v-model="file7"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="CS模板文件名">
|
||||
<el-input v-model="file8"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="CSV文件名">
|
||||
<el-input v-model="file9"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmitprintcopy">提交</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12" style="height: 100%;">
|
||||
<div class="grid-content bg-purple b_mid" style="padding-top:1px !important;text-align: left"><br></br>
|
||||
<code>http://localhost:5080/api/rest/job/?CardSoon_File=0619&Json_File=1.soon&Udf_File=file:2.csv&file_type=0&print_flag=2&label=2022-06-19&printCopys=1&disk_size=32&zone_type=0&hasPrintTask=true&hasCopyTask=true
|
||||
</code><br><br>
|
||||
<code>
|
||||
CardSoon_File: 0619 //在缓存文件夹下的路径名<br>
|
||||
Json_File: 1.soon //标签名称<br>
|
||||
Udf_File: file:2.csv //csv字段名称<br>
|
||||
file_type: 0 //烧录内容<br>
|
||||
print_flag: 2 //指定打印标签的正反面,其中1是双面,2是正面,3是反面<br>
|
||||
label: 2022-06-19 //卷标名<br>
|
||||
printCopys: 1 //发行数量<br>
|
||||
disk_size: 32 //U盘容量<br>
|
||||
zone_type: 0 //分区格式<br>
|
||||
hasPrintTask: true //是否打印<br>
|
||||
hasCopyTask: true //是否拷贝文件</code>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
export
|
||||
default {
|
||||
name: 'demo',
|
||||
data() {
|
||||
return {
|
||||
file1: "",
|
||||
file2: "",
|
||||
file3: "",
|
||||
file4: "",
|
||||
file5: "",
|
||||
file6: "",
|
||||
file7: "",
|
||||
file8: "",
|
||||
file9: "",
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSubmitprint (){
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: "/api/rest/job/?CardSoon_File=" + this.file1 + "&Json_File=" + this.file2 + "&Udf_File=file:" + this.file3 + "&print_flag=2&printCopys=1&&hasPrintTask=true&hasCopyTask=false"
|
||||
}).then(res=>{
|
||||
this.$message("发送成功");
|
||||
})
|
||||
|
||||
},
|
||||
onSubmitcopy(){
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: "/api/rest/job/?CardSoon_File=" + this.file4 + "&file_type=0&label=" + this.file5 + "&printCopys=" + this.file6 + "&disk_size=32&zone_type=0&hasPrintTask=false&hasCopyTask=true"
|
||||
}).then(res=>{
|
||||
this.$message("发送成功");
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
onSubmitprintcopy(){
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: "/api/rest/job/?CardSoon_File=" + this.file7 + "&Json_File=" + this.file8 + "&Udf_File=file:" + this.file9 + "&file_type=0&print_flag=2&label=2022-06-20&printCopys=1&disk_size=32&zone_type=0&hasPrintTask=true&hasCopyTask=true"
|
||||
}).then(res=>{
|
||||
this.$message("发送成功");
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
|
||||
move_usbReader(){
|
||||
this.$confirm('此操作将移动卡片到读卡器,请确保卡树系统没有正在工作', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
|
||||
this.$axios({
|
||||
method: "get",
|
||||
url: "/api/web/movetousbreader",
|
||||
});
|
||||
|
||||
this.$message({offset:100,
|
||||
type: 'success',
|
||||
message: '移动卡片到读卡器成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({offset:100,
|
||||
type: 'info',
|
||||
message: '已取消移动'
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
move_Hopper(){
|
||||
this.$confirm('此操作退卡,请确保卡树系统读卡器内有卡片,否则将报错!', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
|
||||
this.$axios({
|
||||
method: "get",
|
||||
url: "/api/web/movetohopper",
|
||||
});
|
||||
|
||||
this.$message({offset:100,
|
||||
type: 'success',
|
||||
message: '退卡成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({offset:100,
|
||||
type: 'info',
|
||||
message: '已取消退卡'
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
reset_Printer(){
|
||||
this.$confirm('此操作将重置卡树硬件系统,请确保现在系统没有正在工作!', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
|
||||
this.$axios({
|
||||
method: "get",
|
||||
url: "/api/web/resetprinter",
|
||||
});
|
||||
|
||||
this.$message({offset:100,
|
||||
type: 'success',
|
||||
message: '重置系统成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({offset:100,
|
||||
type: 'info',
|
||||
message: '已取消重置'
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
clean_Printer(){
|
||||
this.$confirm('此操作将清洁卡树系统走卡道,在点击确认前,请先将色带取出,然后将清洁卡放入进卡槽!', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
|
||||
this.$axios({
|
||||
method: "get",
|
||||
url: "/api/web/cleanprinter",
|
||||
});
|
||||
|
||||
this.$message({offset:100,
|
||||
type: 'success',
|
||||
message: '清洁成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({offset:100,
|
||||
type: 'info',
|
||||
message: '已取消清洁'
|
||||
});
|
||||
});
|
||||
},
|
||||
}}
|
||||
</script>
|
||||
@@ -0,0 +1,364 @@
|
||||
<template>
|
||||
<div class="dispose" v-if="show">
|
||||
<div class="title">{{ $t("dispose.configTitle") }}</div>
|
||||
<div class="row">
|
||||
<div class="lable">LogLevel</div>
|
||||
<el-select v-model="iniData.LogLevel">
|
||||
<el-option
|
||||
v-for="item in LogLevelOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<div class="tips">{{ $t("dispose.infoTips") }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="lable">AutoRetryTimes</div>
|
||||
<el-select v-model="iniData.AutoRetryTimes">
|
||||
<el-option
|
||||
v-for="item in autoRetryOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<div class="tips">{{ $t("dispose.errorTips1") }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="lable">TaskDir</div>
|
||||
<el-input v-model="iniData.TaskDir"></el-input>
|
||||
<div class="tips">{{ $t("dispose.monitorPath") }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="lable">SharedDir</div>
|
||||
<el-input v-model="iniData.SharedDir"></el-input>
|
||||
<div class="tips">{{ $t("dispose.taskPath") }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="lable">RejectConfig</div>
|
||||
<div class="switch">
|
||||
<el-switch v-model="iniData.RejectConfig"></el-switch>
|
||||
</div>
|
||||
<div class="tips">{{ $t("dispose.tips1") }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="lable">StopOnFailure</div>
|
||||
<div class="switch">
|
||||
<el-switch v-model="iniData.StopOnFailure"></el-switch>
|
||||
</div>
|
||||
<div class="tips">{{ $t("dispose.errorTips2") }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="lable">KeepCombinedImage</div>
|
||||
<div class="switch">
|
||||
<el-switch v-model="iniData.KeepCombinedImage"></el-switch>
|
||||
</div>
|
||||
<div class="tips">{{ $t("dispose.isReserveimg") }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="lable">CleanTaskFile</div>
|
||||
<div class="switch">
|
||||
<el-switch v-model="iniData.CleanTaskFile"></el-switch>
|
||||
</div>
|
||||
<div class="tips">{{ $t("dispose.isReservetask") }}</div>
|
||||
</div>
|
||||
<div
|
||||
class="row"
|
||||
style="
|
||||
align-items: start;
|
||||
height: 50px;
|
||||
border-bottom: 1px rgb(224, 224, 224) solid;
|
||||
"
|
||||
>
|
||||
<div class="lable">UploadSharedDir</div>
|
||||
<div class="switch">
|
||||
<el-switch v-model="iniData.UploadSharedDir"></el-switch>
|
||||
</div>
|
||||
<div class="tips">{{ $t("dispose.isUpload") }}</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="row"
|
||||
style="
|
||||
align-items: flex-start;
|
||||
justify-content: flex-end;
|
||||
margin-top: 40px;
|
||||
margin-right: 40px;
|
||||
height: 300px;
|
||||
"
|
||||
>
|
||||
<el-button @click="save">{{ $t("work.submit") }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const { ipcRenderer } = require("electron");
|
||||
var fs = require("fs"),
|
||||
ini = require("ini");
|
||||
export default {
|
||||
name: "dispose",
|
||||
data() {
|
||||
return {
|
||||
autoRetryOptions: [
|
||||
{
|
||||
value: 0,
|
||||
label: "0",
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: "1",
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: "2",
|
||||
},
|
||||
],
|
||||
LogLevelOptions: [
|
||||
{
|
||||
value: "TRACE",
|
||||
label: "TRACE",
|
||||
},
|
||||
{
|
||||
value: "DEBUG",
|
||||
label: "DEBUG",
|
||||
},
|
||||
{
|
||||
value: "INFO",
|
||||
label: "INFO",
|
||||
},
|
||||
{
|
||||
value: "WARNING",
|
||||
label: "WARNING",
|
||||
},
|
||||
{
|
||||
value: "ERROR",
|
||||
label: "ERROR",
|
||||
},
|
||||
{
|
||||
value: "FATAL",
|
||||
label: "FATAL",
|
||||
},
|
||||
],
|
||||
iniData: null,
|
||||
|
||||
AutoRetryTimes: null,
|
||||
LogLevel: "TRACE",
|
||||
TaskDir: null,
|
||||
SharedDir: null,
|
||||
RejectConfig: false,
|
||||
StopOnFailure: false,
|
||||
KeepCombinedImage: false,
|
||||
CleanTaskFile: false,
|
||||
show: true,
|
||||
root: "",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
save() {
|
||||
//console.log(this.iniData);
|
||||
//console.log(ini.stringify(this.iniData));
|
||||
//fs.writeFileSync("../Debug/config.ini");
|
||||
let that = this;
|
||||
fs.writeFile(
|
||||
this.root + "/../ProductionServer/config.ini",
|
||||
ini.stringify(this.iniData),
|
||||
function (err) {
|
||||
if (err) {
|
||||
that.$message.error(that.$t("dispose.errorReserve"));
|
||||
} else {
|
||||
that.$message({
|
||||
type: "success",
|
||||
message: that.$t("dispose.successReserve"),
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
let that = this;
|
||||
//var data = ini.parse(fs.readFileSync("F:\\controll\\config.ini", "utf-8"));
|
||||
ipcRenderer.on("get-root-callback", (event, data) => {
|
||||
this.root = data;
|
||||
fs.readFile(this.root + "/../ProductionServer/config.ini", "utf-8", (err, res) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
this.$message.error(that.$t("dispose.errorRead"));
|
||||
this.show = false;
|
||||
} else {
|
||||
console.log(res);
|
||||
let data = ini.parse(res);
|
||||
console.log(data);
|
||||
this.iniData = data;
|
||||
that.iniData.AutoRetryTimes = data.AutoRetryTimes
|
||||
? data.AutoRetryTimes
|
||||
: 0;
|
||||
that.iniData.TaskDir = data.TaskDir ? data.TaskDir : "";
|
||||
that.iniData.SharedDir = data.SharedDir ? data.SharedDir : "";
|
||||
that.iniData.LogLevel = data.LogLevel ? data.LogLevel : "";
|
||||
that.iniData.CleanTaskFile =
|
||||
data.CleanTaskFile == "true" ||
|
||||
data.CleanTaskFile == "True" ||
|
||||
data.CleanTaskFile
|
||||
? true
|
||||
: false;
|
||||
that.iniData.KeepCombinedImage =
|
||||
data.KeepCombinedImage == "true" ||
|
||||
data.KeepCombinedImage == "True" ||
|
||||
data.KeepCombinedImage
|
||||
? true
|
||||
: false;
|
||||
that.iniData.RejectConfig =
|
||||
data.RejectConfig == "true" ||
|
||||
data.RejectConfig == "True" ||
|
||||
data.RejectConfig
|
||||
? true
|
||||
: false;
|
||||
that.iniData.StopOnFailure =
|
||||
data.StopOnFailure == "true" ||
|
||||
data.StopOnFailure == "True" ||
|
||||
data.StopOnFailure
|
||||
? true
|
||||
: false;
|
||||
that.iniData.UploadSharedDir =
|
||||
data.UploadSharedDir == "true" ||
|
||||
data.UploadSharedDir == "True" ||
|
||||
data.UploadSharedDir
|
||||
? true
|
||||
: false;
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
ipcRenderer.send("get-root");
|
||||
|
||||
//iniparser.parse("../Debug/config.ini", function (err, data) {
|
||||
/*
|
||||
AutoRetryTimes: "0"
|
||||
CardsoonModel: "SF80"
|
||||
CleanTaskFile: "false"
|
||||
RejectConfig: "false"
|
||||
KeepCombinedImage: "True"
|
||||
LogLevel: "DEBUG"
|
||||
SharedDir: "C:\\CardSoonRepo"
|
||||
StopOnFailure: "false"
|
||||
SystemSn: "830001"
|
||||
TaskDir: "C:\\PrintTasks"
|
||||
Version: "V3.0"
|
||||
|
||||
iniparser.parse("F:\\controll\\config.ini", function (err, data) {
|
||||
console.log(err);
|
||||
if (err) {
|
||||
that.$message.error("读取配置文件失败!");
|
||||
} else {
|
||||
console.log(data);
|
||||
that.AutoRetryTimes = data.AutoRetryTimes ? data.AutoRetryTimes : 0;
|
||||
that.TaskDir = data.TaskDir ? data.TaskDir : "";
|
||||
that.SharedDir = data.SharedDir ? data.SharedDir : "";
|
||||
that.LogLevel = data.LogLevel ? data.LogLevel : "";
|
||||
that.CleanTaskFile =
|
||||
data.CleanTaskFile == "true" || data.CleanTaskFile == "True"
|
||||
? true
|
||||
: false;
|
||||
that.KeepCombinedImage =
|
||||
data.KeepCombinedImage == "true" || data.KeepCombinedImage == "True"
|
||||
? true
|
||||
: false;
|
||||
that.RejectConfig =
|
||||
data.RejectConfig == "true" || data.RejectConfig == "True"
|
||||
? true
|
||||
: false;
|
||||
that.StopOnFailure =
|
||||
data.StopOnFailure == "true" || data.StopOnFailure == "True"
|
||||
? true
|
||||
: false;
|
||||
}
|
||||
});
|
||||
*/
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.dispose {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 6px 3px 11px 0px rgb(0 0 0 / 12%), 0 0 6px rgb(0 0 0 / 4%);
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.title {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
width: 500px;
|
||||
height: 40px;
|
||||
color: rgb(139, 139, 139);
|
||||
padding-left: 10px;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
background-color: rgb(240, 240, 240);
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
.lable {
|
||||
width: 200px;
|
||||
margin-left: 20px;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
}
|
||||
.el-input {
|
||||
width: 200px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.el-select {
|
||||
width: 200px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.switch {
|
||||
display: flex;
|
||||
margin-left: 20px;
|
||||
justify-content: flex-start;
|
||||
width: 200px;
|
||||
}
|
||||
.tips {
|
||||
font-size: 14px;
|
||||
margin-left: 20px;
|
||||
width: calc(100% - 440px);
|
||||
text-align: left;
|
||||
}
|
||||
.el-button {
|
||||
color: rgb(154, 202, 128);
|
||||
width: 120px;
|
||||
height: 40px;
|
||||
font-size: 14px;
|
||||
border-radius: 1px;
|
||||
box-shadow: 1px 0px 2px 0px grey;
|
||||
}
|
||||
.el-button:hover {
|
||||
background-color: white;
|
||||
}
|
||||
.el-button:active {
|
||||
background-color: white;
|
||||
}
|
||||
.el-button:focus {
|
||||
background-color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,234 @@
|
||||
<template>
|
||||
<div class="form">
|
||||
<el-form ref="form" :model="form" :rules="rules" status-icon>
|
||||
<el-form-item label="ID">
|
||||
<div class="ID">{{ form.user_uuid }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('admin.userName')" prop="user_name">
|
||||
<el-input
|
||||
v-model="form.user_name"
|
||||
@blur="form.user_name = $event.target.value.trim()"
|
||||
v-if="form.user_name != 'admin'"
|
||||
></el-input>
|
||||
<div v-else>{{ form.user_name }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('work.password')" prop="pass1">
|
||||
<el-input
|
||||
v-model="form.pass1"
|
||||
show-password
|
||||
@blur="form.pass1 = $event.target.value.trim()"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('work.passwordConfirm')" prop="pass2">
|
||||
<el-input
|
||||
v-model="form.pass2"
|
||||
show-password
|
||||
@blur="form.pass2 = $event.target.value.trim()"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<!--
|
||||
<el-form-item label="描述">
|
||||
<el-input type="textarea" :rows="3" v-model="form.text"></el-input>
|
||||
</el-form-item>
|
||||
-->
|
||||
</el-form>
|
||||
|
||||
<div class="finger">
|
||||
<finger
|
||||
:user_uuid="form.user_uuid"
|
||||
v-if="form.text"
|
||||
:isHave="form.fingerprint_value&&form.fingerprint_value>0"
|
||||
@over="fingerChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="bu">
|
||||
<el-button type="success" style="margin-right: 10px" @click="submit">{{
|
||||
$t("index.comfirm")
|
||||
}}</el-button>
|
||||
<el-button type="danger" @click="changevisiable(false)">{{
|
||||
$t("admin.cancel")
|
||||
}}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import finger from "./finger.vue";
|
||||
export default {
|
||||
name: "adduser",
|
||||
props: {
|
||||
changevisiable: {
|
||||
type: Function,
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
},
|
||||
},
|
||||
components: {
|
||||
finger,
|
||||
},
|
||||
mounted() {
|
||||
this.form.user_name = this.data.userName;
|
||||
this.form.user_uuid = this.data.userUuid;
|
||||
this.form.fingerprint_value = this.data.fingerprintValue;
|
||||
this.form.text = "1";
|
||||
},
|
||||
data() {
|
||||
var validateName = (rule, value, callback) => {
|
||||
if (value === "") {
|
||||
callback(new Error(this.$t("addUser.enterUsername")));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
var validatePass1 = (rule, value, callback) => {
|
||||
callback();
|
||||
//if (value === "") {
|
||||
// callback(new Error("请输入密码"));
|
||||
//} else {
|
||||
// callback();
|
||||
//}
|
||||
};
|
||||
var validatePass2 = (rule, value, callback) => {
|
||||
//if (value === "") {
|
||||
// callback(new Error("请输入密码"));
|
||||
//} else
|
||||
if (this.form.pass1 != this.form.pass2) {
|
||||
callback(new Error(this.$t("addUser.errorPassword")));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
form: {
|
||||
user_uuid: null,
|
||||
user_name: "",
|
||||
pass1: "",
|
||||
pass2: "",
|
||||
text: "",
|
||||
fingerprint_value: "",
|
||||
},
|
||||
fingerprint_value: "",
|
||||
rules: {
|
||||
user_name: [{ validator: validateName, trigger: "blur" }],
|
||||
pass1: [{ validator: validatePass1, trigger: "blur" }],
|
||||
pass2: [{ validator: validatePass2, trigger: "blur" }],
|
||||
},
|
||||
deleteFinger: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
let url = `/user/update?user_uuid=${this.form.user_uuid}&user_name=${this.form.user_name}`;
|
||||
if (this.form.pass1) {
|
||||
url += "&user_password=" + this.form.pass1;
|
||||
}
|
||||
// if (this.fingerprint_value || this.deleteFinger) {
|
||||
// url += "&fingerprint_value=" + this.fingerprint_value;
|
||||
// }
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: url,
|
||||
})
|
||||
.then((res) => {
|
||||
this.$message({offset:100,
|
||||
type: "success",
|
||||
message: this.$t("addUser.editSuccess"),
|
||||
});
|
||||
this.$emit("editover");
|
||||
})
|
||||
.catch((e) => {});
|
||||
} else {
|
||||
console.log("error user!!");
|
||||
}
|
||||
});
|
||||
//changevisiable(false);
|
||||
},
|
||||
fingerChange(val) {
|
||||
if (val == "_DELETE_") {
|
||||
this.fingerprint_value = "";
|
||||
this.deleteFinger = true;
|
||||
} else {
|
||||
this.fingerprint_value = val;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.form {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
.el-form {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
.ID {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
.el-form-item {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 20px;
|
||||
width: 100%;
|
||||
|
||||
/deep/.el-form-item__label {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
color: black;
|
||||
width: 20%;
|
||||
}
|
||||
/deep/ .el-form-item__content {
|
||||
width: 70%;
|
||||
.el-input {
|
||||
.el-input__inner {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.finger {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
// margin-top: 20px;
|
||||
img {
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
}
|
||||
p {
|
||||
position: absolute;
|
||||
font-weight: 500;
|
||||
font-size: 17px;
|
||||
color: black;
|
||||
}
|
||||
}
|
||||
.bu {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
width: 100%;
|
||||
margin-right: 20px;
|
||||
.el-button {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1 @@
|
||||
{"files":["C:\\Users\\jerry\\Desktop\\cardsoon\\卡树产品保修条款.docx"]}
|
||||
@@ -0,0 +1,96 @@
|
||||
// 第一步,导入必要的模块
|
||||
const fs = require('fs');
|
||||
const archiver = require('archiver');
|
||||
archiver.registerFormat('zip-encrypted', require("archiver-zip-encrypted"));
|
||||
function zip(filesList,zippath,callback,isPassword,pass)
|
||||
{
|
||||
// 第二步,创建可写流来写入数据
|
||||
const output = fs.createWriteStream(zippath);// 将压缩包保存到当前项目的目录下,并且压缩包名为test.zip
|
||||
if(isPassword)
|
||||
{
|
||||
|
||||
const archive = archiver.create('zip-encrypted',
|
||||
{
|
||||
zlib: {
|
||||
level: 8,//压缩等级
|
||||
},
|
||||
encryptionMethod: 'aes256',//加密方法
|
||||
password:pass ,//解压密码
|
||||
});
|
||||
|
||||
// 第三步,建立管道连接
|
||||
archive.pipe(output);
|
||||
|
||||
// 第四步,压缩多个文件到压缩包中
|
||||
for (let i in filesList) {
|
||||
console.log("压缩:")
|
||||
if(filesList[i].folder)
|
||||
{
|
||||
archive.directory(i, filesList[i].name);
|
||||
console.log(filesList[i].name)
|
||||
}else{
|
||||
archive.append(i, {name: filesList[i].name});
|
||||
console.log(filesList[i].name)
|
||||
}
|
||||
}
|
||||
|
||||
//监听所有archive数据都写完
|
||||
output.on('close', function() {
|
||||
setTimeout(() => {
|
||||
callback(true);
|
||||
}, 1000);
|
||||
console.log('压缩完成', archive.pointer() / 1024 / 1024 + 'M');
|
||||
});
|
||||
archive.on('error', function(err) {
|
||||
callback(false);
|
||||
console.log("压缩失败!");
|
||||
throw err;
|
||||
});
|
||||
|
||||
// 第五步,完成压缩
|
||||
archive.finalize();
|
||||
}else{
|
||||
const archive = archiver('zip', {zlib: {level: 9}});// 设置压缩等级
|
||||
|
||||
// 第三步,建立管道连接
|
||||
archive.pipe(output);
|
||||
|
||||
// 第四步,压缩多个文件到压缩包中
|
||||
for (let i in filesList) {
|
||||
console.log("压缩:")
|
||||
if(filesList[i].folder)
|
||||
{
|
||||
archive.directory(i, filesList[i].name);
|
||||
console.log(filesList[i].name)
|
||||
}else{
|
||||
var stream = fs.createReadStream(i);
|
||||
archive.append(stream, {name: filesList[i].name});
|
||||
console.log(filesList[i].name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//监听所有archive数据都写完
|
||||
output.on('close', function() {
|
||||
setTimeout(() => {
|
||||
callback(true);
|
||||
}, 1000);
|
||||
console.log('压缩完成', archive.pointer() / 1024 / 1024 + 'M');
|
||||
});
|
||||
archive.on('error', function(err) {
|
||||
callback(false);
|
||||
console.log("压缩失败!");
|
||||
throw err;
|
||||
});
|
||||
|
||||
// 第五步,完成压缩
|
||||
archive.finalize();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
export {
|
||||
zip
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="progress">
|
||||
<div class="zip_text" v-if="isFalse" style="color: rgb(245, 31, 31)">
|
||||
{{ $t("dialog.compressFailed") }}
|
||||
</div>
|
||||
<div class="zip_text" v-else-if="isOver" style="color: rgb(103, 194, 58)">
|
||||
{{ $t("dialog.compressOver") }}
|
||||
</div>
|
||||
<div class="zip_text" v-else style="color: rgb(77, 77, 77)">
|
||||
{{ $t("dialog.compressing") }}
|
||||
</div>
|
||||
|
||||
<el-progress :percentage="percentage" :status="status"></el-progress>
|
||||
</div>
|
||||
<!-- status="success" -->
|
||||
<!-- <el-progress :percentage="100" status="warning"></el-progress>
|
||||
<el-progress :percentage="50" status="exception"></el-progress> -->
|
||||
<div class="last">
|
||||
<div class="text" v-if="isOver || isFalse">
|
||||
{{ $t("dialog.closeTips") }}
|
||||
</div>
|
||||
<div class="text" v-else>{{ $t("dialog.waitTips") }}</div>
|
||||
<div class="button">
|
||||
<el-button
|
||||
type="success"
|
||||
@click="changevisiable(false)"
|
||||
:disabled="!isOver"
|
||||
>{{ $t("dialog.over") }}</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
let interval;
|
||||
export default {
|
||||
name: "archiverdialog",
|
||||
props: {
|
||||
isOver: {
|
||||
type: Boolean,
|
||||
},
|
||||
isFalse: {
|
||||
type: Boolean,
|
||||
},
|
||||
changevisiable: {
|
||||
type: Function,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
percentage: 0,
|
||||
status: "",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
interval = setInterval(() => {
|
||||
this.percentage++;
|
||||
}, 250);
|
||||
},
|
||||
watch: {
|
||||
percentage: {
|
||||
handler(val) {
|
||||
if (this.percentage > 98) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
isOver: {
|
||||
handler(val) {
|
||||
if (this.isOver) {
|
||||
clearInterval(interval);
|
||||
this.percentage = 100;
|
||||
this.status = "success";
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
isFalse: {
|
||||
handler(val) {
|
||||
if (this.isFalse) {
|
||||
clearInterval(interval);
|
||||
this.status = "exception";
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.progress {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
.zip_text {
|
||||
font-size: 17px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.el-progress {
|
||||
width: 80%;
|
||||
}
|
||||
}
|
||||
|
||||
.last {
|
||||
height: 30px;
|
||||
width: 100%;
|
||||
margin-top: 35px;
|
||||
.button {
|
||||
float: right;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
width: 50%;
|
||||
.el-button {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 30px;
|
||||
width: 50px;
|
||||
}
|
||||
}
|
||||
.text {
|
||||
line-height: 30px;
|
||||
float: left;
|
||||
width: 50%;
|
||||
font-size: 12px;
|
||||
color: gray;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,58 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
// 使用promisify方法来promise化指定方法
|
||||
const { promisify } = require("util");
|
||||
const stat = promisify(fs.stat);
|
||||
const readdir = promisify(fs.readdir);
|
||||
|
||||
// 异步
|
||||
export async function calcSize(dirPath, callback) {
|
||||
let fileSize = 0;
|
||||
let error = null;
|
||||
async function calc(dirPath) {
|
||||
try {
|
||||
const statObj = await stat(dirPath);
|
||||
if (statObj.isDirectory()) {
|
||||
const files = await readdir(dirPath);
|
||||
let dirs = files.map((item) => {
|
||||
return path.join(dirPath, item);
|
||||
});
|
||||
let index = 0;
|
||||
async function next() {
|
||||
if (index < dirs.length) {
|
||||
let current = dirs[index++];
|
||||
await calc(current);
|
||||
await next();
|
||||
}
|
||||
}
|
||||
return await next();
|
||||
} else {
|
||||
fileSize += statObj.size;
|
||||
}
|
||||
} catch (err) {
|
||||
error = err;
|
||||
}
|
||||
}
|
||||
await calc(dirPath);
|
||||
callback(error, fileSize, dirPath);
|
||||
}
|
||||
|
||||
export function getFileName(name) {
|
||||
return name.substring(name.lastIndexOf("\\") + 1);
|
||||
}
|
||||
export function getExtension(name) {
|
||||
return name.substring(name.lastIndexOf(".") + 1);
|
||||
}
|
||||
|
||||
export function bytesToSize(bytes) {
|
||||
if (bytes === 0) return "0 B";
|
||||
var k = 1024,
|
||||
sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
|
||||
i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
return (bytes / Math.pow(k, i)).toPrecision(3) + " " + sizes[i];
|
||||
}
|
||||
|
||||
export function isFolder(path) {
|
||||
let _stat = fs.lstatSync(path);
|
||||
return _stat.isDirectory();
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
function copy(src, srcafter, isFolder, callback, fileList) {
|
||||
if (isFolder) {
|
||||
//复制文件夹
|
||||
fs.cp(src, srcafter, { recursive: true }, (err) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
callback(fileList,false);
|
||||
}else{
|
||||
console.log("copyover");
|
||||
console.log("err");
|
||||
callback(fileList,true);
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
// 复制文件
|
||||
fs.cp(src, srcafter, (err) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
console.log("err");
|
||||
callback(fileList,false);
|
||||
}else{
|
||||
console.log("copyover");
|
||||
callback(fileList,true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
export { copy };
|
||||
//'./src/renderer/components/files/test'
|
||||
//'./src/renderer/components/files/testafter/tset'
|
||||
@@ -0,0 +1,369 @@
|
||||
<template>
|
||||
<div class="files">
|
||||
<div class="btn-group" v-show="false">
|
||||
<div class="btn" @click="addFolder()" style="color: #67c23a">
|
||||
<i class="el-icon-folder" />
|
||||
{{ $t("file.addFolder") }}
|
||||
</div>
|
||||
<div class="btn" @click="addFile()" style="color: #67c23a">
|
||||
<i class="el-icon-files" />
|
||||
{{ $t("file.addFile") }}
|
||||
</div>
|
||||
</div>
|
||||
<fileEmpty v-if="allNumber == 0" />
|
||||
<fileList v-else :list="filesList" :del="delFile" :key="key" />
|
||||
<div v-if="progressVisible">
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
width="500px"
|
||||
:visible.sync="progressVisible"
|
||||
:append-to-body="true"
|
||||
class="prodialog"
|
||||
>
|
||||
<progressdialog
|
||||
:list="filesList"
|
||||
:overNumber="overNumber"
|
||||
:allNumber="allNumber"
|
||||
:changevisiable="changeProgressvisible"
|
||||
:changestate="changestate"
|
||||
:isSucess="isSucess"
|
||||
ref="progressdialog"
|
||||
></progressdialog>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
<div v-if="archiverVisible">
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
width="500px"
|
||||
:visible.sync="archiverVisible"
|
||||
:append-to-body="true"
|
||||
class="archiverDialog"
|
||||
:show-close="false"
|
||||
>
|
||||
<archiverdialog
|
||||
:isOver="archiverIsover"
|
||||
:isFalse="archiverIsfalse"
|
||||
:changevisiable="changeArchivervisible"
|
||||
></archiverdialog>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
const { dialog } = require("@electron/remote");
|
||||
const fs = require("fs");
|
||||
import fileEmpty from "./fileEmpty";
|
||||
import fileList from "./fileList";
|
||||
import progressdialog from "./progressdialog";
|
||||
import archiverdialog from "./archiverdialog";
|
||||
import { calcSize, getFileName, isFolder } from "./calc";
|
||||
import { copy } from "./copy";
|
||||
import { zip } from "./archiver";
|
||||
export default {
|
||||
name: "Files",
|
||||
props: {
|
||||
onSizechange: {
|
||||
type: Function,
|
||||
},
|
||||
complete: {
|
||||
type: Function,
|
||||
},
|
||||
saveWorkList: {
|
||||
type: Object | undefined,
|
||||
},
|
||||
},
|
||||
components: {
|
||||
fileEmpty,
|
||||
fileList,
|
||||
progressdialog,
|
||||
archiverdialog,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
filesList: {},
|
||||
key: 0,
|
||||
allSize: 0,
|
||||
progressVisible: false,
|
||||
archiverVisible: false,
|
||||
overNumber: 0,
|
||||
allNumber: 0,
|
||||
nowstate: true,
|
||||
archiverIsover: false,
|
||||
archiverIsfalse: false,
|
||||
zip_path: "",
|
||||
isCopy: false,
|
||||
isSucess: true,
|
||||
copyPath: "",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// this.$set(this, filesList, this.saveWorkList)
|
||||
const _this = this;
|
||||
document.addEventListener("drop", (e) => {
|
||||
e.preventDefault();
|
||||
// e.stopPropagation();
|
||||
for (const f of e.dataTransfer.files) {
|
||||
const isFolder = _this.dropFolderCheck(f);
|
||||
_this.insertList({
|
||||
name: getFileName(f.path),
|
||||
path: f.path,
|
||||
size: isFolder ? -1 : f.size,
|
||||
folder: isFolder,
|
||||
});
|
||||
|
||||
if (isFolder) {
|
||||
calcSize(f.path, _this.folderCalcCallback);
|
||||
}
|
||||
}
|
||||
});
|
||||
document.addEventListener("dragover", (e) => {
|
||||
e.preventDefault();
|
||||
// e.stopPropagation();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
insertList(f) {
|
||||
if (!this.filesList[f.path]) {
|
||||
this.allNumber++;
|
||||
this.$set(this.filesList, f.path, f);
|
||||
if (f.size != -1) {
|
||||
// 是文件夹
|
||||
this.sizeChange(f.size);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
//有了,不用加入
|
||||
return false;
|
||||
}
|
||||
},
|
||||
addFile() {
|
||||
const _this = this;
|
||||
dialog
|
||||
.showOpenDialog({
|
||||
properties: ["multiSelections"],
|
||||
})
|
||||
.then(async (res) => {
|
||||
for (const item of res.filePaths) {
|
||||
await fs.stat(item, function (err, res) {
|
||||
if (err) {
|
||||
return false;
|
||||
}
|
||||
_this.insertList({
|
||||
name: getFileName(item),
|
||||
path: item,
|
||||
size: res.size,
|
||||
folder: false,
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
addFolder() {
|
||||
const _this = this;
|
||||
dialog
|
||||
.showOpenDialog({
|
||||
properties: ["openDirectory", "multiSelections"],
|
||||
})
|
||||
.then((res) => {
|
||||
for (const item of res.filePaths) {
|
||||
const result = _this.insertList({
|
||||
name: getFileName(item),
|
||||
path: item,
|
||||
size: -1,
|
||||
folder: true,
|
||||
});
|
||||
if (result) {
|
||||
calcSize(item, _this.folderCalcCallback);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
folderCalcCallback(err, res, path) {
|
||||
if (this.filesList[path]) {
|
||||
this.filesList[path].size = res;
|
||||
this.$set(this.filesList, path, this.filesList[path]);
|
||||
this.sizeChange(this.filesList[path].size);
|
||||
}
|
||||
},
|
||||
delFile(path) {
|
||||
this.sizeChange(-this.filesList[path].size);
|
||||
delete this.filesList[path];
|
||||
this.key++;
|
||||
this.allNumber--;
|
||||
},
|
||||
dropFolderCheck(f) {
|
||||
//T是文件夹 F不是文件夹
|
||||
//拖放无法从参数判断是否为文件夹,需要额外处理
|
||||
if (f.size != 0 && f.size != 4096) {
|
||||
//返回大小不是0,则不是文件夹
|
||||
return false;
|
||||
}
|
||||
if (f.type != "") {
|
||||
//如果type不是空,则不是文件夹
|
||||
return false;
|
||||
}
|
||||
return isFolder(f.path);
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.allSize = this.allSize + size;
|
||||
if (this.allSize <= 0) {
|
||||
this.allSize = 0;
|
||||
}
|
||||
this.onSizechange(this.allSize);
|
||||
},
|
||||
fileBack(fileList, Sucess) {
|
||||
if (Sucess) {
|
||||
if (this.nowstate) {
|
||||
this.isSucess = true;
|
||||
fileList.state = true;
|
||||
this.overNumber++;
|
||||
if (this.overNumber == this.allNumber) {
|
||||
setTimeout(() => {
|
||||
this.changeProgressvisible(false);
|
||||
this.complete();
|
||||
}, 500);
|
||||
}
|
||||
} else {
|
||||
console.log("终止!!!!");
|
||||
}
|
||||
} else {
|
||||
this.isSucess = false;
|
||||
if (this.nowstate) {
|
||||
fileList.state = false;
|
||||
} else {
|
||||
console.log("终止!!!!");
|
||||
}
|
||||
}
|
||||
},
|
||||
archiverBack(state) {
|
||||
if (state) {
|
||||
this.archiverIsover = true;
|
||||
this.complete();
|
||||
} else {
|
||||
this.archiverIsfalse = true;
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
this.changeArchivervisible(false);
|
||||
}, 500);
|
||||
},
|
||||
resume(file_form) {
|
||||
//if (file_form == 0) {
|
||||
if (1) {
|
||||
if (this.isCopy) {
|
||||
this.overNumber = 0;
|
||||
this.changeProgressvisible(true);
|
||||
for (let i in this.filesList) {
|
||||
// const path = "D:\\copytest\\1\\" + this.filesList[i].name;
|
||||
const path = this.copyPath + this.filesList[i].name;
|
||||
console.log(this.copyPath);
|
||||
console.log(path);
|
||||
copy(
|
||||
i,
|
||||
path,
|
||||
this.filesList[i].folder,
|
||||
this.fileBack,
|
||||
this.filesList[i]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
//2023-04-24修改为所有都只上传文件路径,不需要压缩
|
||||
//文件和文件夹
|
||||
this.overNumber = 0;
|
||||
for (let i in this.filesList) {
|
||||
// const path = "D:\\copytest\\1\\" + this.filesList[i].name;
|
||||
// copy(i, path, this.filesList[i].folder, this.back, this.filesList[i]);
|
||||
this.fileBack(this.filesList[i], true);
|
||||
}
|
||||
}
|
||||
} else if (file_form == 1) {
|
||||
//电子光盘
|
||||
} else if (file_form == 2) {
|
||||
//zip
|
||||
this.archiverIsover = false;
|
||||
this.archiverIsfalse = false;
|
||||
this.zip_path = "D:/archivertest/1.zip";
|
||||
zip(this.filesList, this.zip_path, this.archiverBack, false);
|
||||
} else if (file_form == 3) {
|
||||
//加密zip
|
||||
this.archiverIsover = false;
|
||||
this.archiverIsfalse = false;
|
||||
this.zip_path = "D:/archivertest/2.zip";
|
||||
let password = "123456";
|
||||
zip(this.filesList, this.zip_path, this.archiverBack, true, password);
|
||||
} else if (file_form == 4) {
|
||||
//u盘
|
||||
}
|
||||
},
|
||||
changeProgressvisible(visiable) {
|
||||
this.progressVisible = visiable;
|
||||
},
|
||||
changeArchivervisible(visiable) {
|
||||
this.archiverVisible = visiable;
|
||||
},
|
||||
changestate(state) {
|
||||
this.nowstate = state;
|
||||
},
|
||||
getLists() {
|
||||
return this.filesList;
|
||||
},
|
||||
haveFolderIsCalc() {},
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
};
|
||||
</script>
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style lang="less" scoped>
|
||||
.prodialog {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.archiverDialog {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
/deep/.el-dialog__header {
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.files {
|
||||
width: 100%;
|
||||
background-color: #f5f5f5;
|
||||
margin: 10px auto 0;
|
||||
font-size: 12px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
||||
position: relative;
|
||||
height: 375px;
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
height: 30px;
|
||||
background-color: #e7e7ec;
|
||||
|
||||
.btn {
|
||||
color: #53809f;
|
||||
display: inline-block;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
font-size: 14px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background-color: #dfdfe4;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: #d1d1d7;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<div :style="'background-image:url(' + bgi + ');background-repeat: no-repeat;background-position: 50% 50%;'" class="empty"></div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "fileEmpty",
|
||||
data() {
|
||||
return {
|
||||
fileList: [],
|
||||
};
|
||||
},
|
||||
methods: {},
|
||||
computed: {
|
||||
bgi() {
|
||||
return this.$t("work.dropBg");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style lang="less" scoped>
|
||||
.empty {
|
||||
height: 345px;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<div class="list">
|
||||
<listItem v-for="(item, key) in list" :key="key" :info="item" :del="del" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import listItem from "./listItem";
|
||||
export default {
|
||||
name: "fileList",
|
||||
props: {
|
||||
list: {
|
||||
type: Object | Array,
|
||||
},
|
||||
del: {
|
||||
type: Function,
|
||||
},
|
||||
},
|
||||
components: {
|
||||
listItem,
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {},
|
||||
};
|
||||
</script>
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style lang="less" scoped>
|
||||
.list {
|
||||
height: 374px;
|
||||
max-height: 374px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
&::-webkit-scrollbar {
|
||||
/*滚动条整体样式*/
|
||||
width: 10px; /*高宽分别对应横竖滚动条的尺寸*/
|
||||
height: 1px;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
/*滚动条里面小方块*/
|
||||
border-radius: 10px;
|
||||
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
background: #c7c7cb;
|
||||
}
|
||||
&::-webkit-scrollbar-track {
|
||||
/*滚动条里面轨道*/
|
||||
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
border-radius: 10px;
|
||||
background: #ededed;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<div class="listItem">
|
||||
<div class="item-body">
|
||||
<el-row :gutter="10" class="row">
|
||||
<el-col class="col file-name" :span="16">
|
||||
<img :src="getIcon(info.name)" class="icon" />
|
||||
<div class="name">{{ info.name }}</div>
|
||||
</el-col>
|
||||
<el-col class="col file-size" :span="5">{{
|
||||
getSize(info.size)
|
||||
}}</el-col>
|
||||
<el-col class="col file-delete" :span="3">
|
||||
<i class="el-icon-close close" @click="del(info.path)"></i>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import folder from "../../assets/files/folder.png";
|
||||
import pdf from "../../assets/files/pdf.png";
|
||||
import compress from "../../assets/files/compress.png";
|
||||
import unknown from "../../assets/files/unknown.png";
|
||||
import { bytesToSize, getExtension } from "./calc";
|
||||
const types = { compress: ["zip", "rar", "7z"], pdf: ["pdf"] };
|
||||
export default {
|
||||
name: "listItem",
|
||||
props: {
|
||||
info: {
|
||||
type: Object,
|
||||
},
|
||||
del: {
|
||||
type: Function,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.info);
|
||||
},
|
||||
methods: {
|
||||
getSize(size) {
|
||||
if (size == -1) {
|
||||
return this.$t("file.calculate");
|
||||
}
|
||||
return bytesToSize(size);
|
||||
},
|
||||
getIcon(name) {
|
||||
if (this.info.folder) {
|
||||
return folder;
|
||||
}
|
||||
console.log(getExtension(name));
|
||||
const ext = getExtension(name);
|
||||
|
||||
let icon = unknown;
|
||||
for (const typeName in types) {
|
||||
if (types[typeName].indexOf(ext) != -1) {
|
||||
//属于这个分类
|
||||
icon = this.typeToObj(typeName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return icon;
|
||||
},
|
||||
typeToObj(typeName) {
|
||||
if (typeName == "compress") {
|
||||
return compress;
|
||||
} else if (typeName == "pdf") {
|
||||
return pdf;
|
||||
} else if (typeName == "unknown") {
|
||||
return unknown;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style lang="less" scoped>
|
||||
.listItem {
|
||||
height: 50px;
|
||||
width: 100%;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.item-body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-bottom: 1px solid #cdcdcd;
|
||||
}
|
||||
.row {
|
||||
height: 100%;
|
||||
}
|
||||
.col {
|
||||
height: 100%;
|
||||
}
|
||||
.file-name {
|
||||
padding-left: 20px !important;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
.name {
|
||||
font-size: 14px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
.file-size {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
.file-delete {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.close {
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
&:hover {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,254 @@
|
||||
<template>
|
||||
<div class="dialog">
|
||||
<div class="progress">
|
||||
<el-progress
|
||||
:percentage="parseInt(fake.progress * 100)"
|
||||
:format="format"
|
||||
></el-progress>
|
||||
<div class="txt">
|
||||
<div class="over">{{ overNumber }}</div>
|
||||
<div class="all">/{{ allNumber }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="records">
|
||||
<div class="record" v-for="(item, index) in progressList" :key="index">
|
||||
<div class="name">{{ item.name }}</div>
|
||||
<div class="state">
|
||||
<div v-if="item.state === true">{{ $t("dialog.haveOver") }}</div>
|
||||
<div v-else>{{ $t("dialog.notOver") }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="last">
|
||||
<div class="text" v-if="allNumber === overNumber && isSucess">
|
||||
{{ $t("dialog.closeTips") }}
|
||||
</div>
|
||||
<div v-else-if="!isSucess" style="color: red">文件上传失败!!!</div>
|
||||
<div class="button">
|
||||
<el-button
|
||||
ref="btnStop"
|
||||
type="success"
|
||||
@click="stop()"
|
||||
:disabled="overNumber == allNumber || !isSucess"
|
||||
>{{ $t("dialog.stop") }}</el-button
|
||||
>
|
||||
<el-button
|
||||
ref="btnOver"
|
||||
type="success"
|
||||
@click="changevisiable(flase)"
|
||||
:disabled="overNumber != allNumber && isSucess"
|
||||
>{{ $t("dialog.over") }}</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import FakeProgress from "fake-progress";
|
||||
export default {
|
||||
name: "progressdialog",
|
||||
props: {
|
||||
list: {
|
||||
type: Object | Array,
|
||||
},
|
||||
overNumber: {
|
||||
type: Number,
|
||||
},
|
||||
allNumber: {
|
||||
type: Number,
|
||||
},
|
||||
changevisiable: {
|
||||
type: Function,
|
||||
},
|
||||
changestate: {
|
||||
type: Function,
|
||||
},
|
||||
isSucess: {
|
||||
type: Boolean,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
percentage: 0,
|
||||
progressList: [],
|
||||
fake: new FakeProgress({}),
|
||||
sub: null,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
format(percentage) {
|
||||
return;
|
||||
},
|
||||
getPercent(num, total) {
|
||||
num = parseFloat(num);
|
||||
total = parseFloat(total);
|
||||
if (isNaN(num) || isNaN(total)) {
|
||||
return "-";
|
||||
}
|
||||
return total <= 0 ? "0" : Math.round((num / total) * 10000) / 10000.0;
|
||||
},
|
||||
stop() {
|
||||
this.changestate(false);
|
||||
this.isSucess = false;
|
||||
this.$message({offset:100,
|
||||
message: this.$t("dialog.haveStop"),
|
||||
type: "warning",
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
//const aProgress = this.fake.createSubProgress({
|
||||
// timeConstant: 1000,
|
||||
// end: 0.1,
|
||||
// autoStart: true
|
||||
// })
|
||||
},
|
||||
watch: {
|
||||
overNumber: {
|
||||
// 数据发生变化就会调用这个函数
|
||||
handler(newVal, oldVal) {
|
||||
if (this.sub) {
|
||||
this.sub.end();
|
||||
//console.log("sub end");
|
||||
}
|
||||
|
||||
const newlist = [];
|
||||
for (let i in this.list) {
|
||||
if (this.list[i].state == true) {
|
||||
newlist.push(this.list[i]);
|
||||
} else {
|
||||
newlist.unshift(this.list[i]);
|
||||
}
|
||||
}
|
||||
this.progressList = newlist;
|
||||
if (this.overNumber == this.allNumber) {
|
||||
return;
|
||||
}
|
||||
this.sub = this.fake.createSubProgress({
|
||||
timeConstant: 10000,
|
||||
end: this.getPercent(this.overNumber + 1, this.allNumber),
|
||||
autoStart: true,
|
||||
});
|
||||
//console.log(
|
||||
// "overNumber/allNumber:" +
|
||||
// this.getPercent(this.overNumber + 1, this.allNumber)
|
||||
//);
|
||||
},
|
||||
// 立即处理 进入页面就触发
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
isSucess:{
|
||||
// 数据发生变化就会调用这个函数
|
||||
handler(newVal, oldVal) {
|
||||
if(!this.isSucess){
|
||||
this.sub.stop();
|
||||
}
|
||||
|
||||
},
|
||||
// 立即处理 进入页面就触发
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.dialog {
|
||||
}
|
||||
.progress {
|
||||
// border: 1px black solid;
|
||||
/deep/ .el-progress-bar {
|
||||
width: 97%;
|
||||
}
|
||||
/deep/.el-progress__text {
|
||||
float: right;
|
||||
}
|
||||
.txt {
|
||||
position: absolute;
|
||||
top: 55px;
|
||||
right: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
|
||||
// border: 1px black solid;
|
||||
.over {
|
||||
// border: 1px black solid;
|
||||
color: rgb(103, 194, 58);
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.all {
|
||||
// border: 1px black solid;
|
||||
color: black;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.records {
|
||||
max-height: 400px;
|
||||
overflow: auto;
|
||||
&::-webkit-scrollbar {
|
||||
/*滚动条整体样式*/
|
||||
width: 10px; /*高宽分别对应横竖滚动条的尺寸*/
|
||||
height: 1px;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
/*滚动条里面小方块*/
|
||||
border-radius: 10px;
|
||||
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
background: #c7c7cb;
|
||||
}
|
||||
&::-webkit-scrollbar-track {
|
||||
/*滚动条里面轨道*/
|
||||
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
border-radius: 10px;
|
||||
background: #ededed;
|
||||
}
|
||||
}
|
||||
.record {
|
||||
margin-top: 15px;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-between;
|
||||
.name {
|
||||
}
|
||||
.state {
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.last {
|
||||
height: 30px;
|
||||
width: 100%;
|
||||
margin-top: 15px;
|
||||
.button {
|
||||
float: right;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
width: 50%;
|
||||
.el-button {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 30px;
|
||||
width: 50px;
|
||||
}
|
||||
}
|
||||
.text {
|
||||
line-height: 30px;
|
||||
float: left;
|
||||
width: 50%;
|
||||
font-size: 12px;
|
||||
color: gray;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<div class="footer">
|
||||
<div class="company">Copyright @ 2023 CARDSOON Corporation</div>
|
||||
|
||||
<div class="btns">
|
||||
<div class="help btn" @click="help">帮助</div>
|
||||
<div class="about btn" @click="dialogVisible = true">关于我们</div>
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
title="关于Soon Worker"
|
||||
:visible.sync="dialogVisible"
|
||||
width="400px"
|
||||
>
|
||||
<div>
|
||||
<img src="../../../static/images/logo256.png" style="width: 120px" />
|
||||
<div class="company-name white">Soon Worker</div>
|
||||
<div class="version white">版本3.0.0</div>
|
||||
<div class="copyright white">
|
||||
(c) 2023 上海卡树信息科技有限公司 保留所有权利
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const { ipcRenderer } = require("electron");
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
help() {
|
||||
ipcRenderer.send("open-help-file");
|
||||
},
|
||||
about() {
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.footer {
|
||||
width: calc(100% - 40px);
|
||||
background-color: #6dc14c;
|
||||
height: 50px;
|
||||
margin-bottom: 10px;
|
||||
box-shadow: 6px 3px 11px 0px rgb(0 0 0 / 12%), 0 0 6px rgb(0 0 0 / 4%);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 15px;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
.company {
|
||||
font-size: 15px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btns {
|
||||
position: absolute;
|
||||
right: 50px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
}
|
||||
.btn {
|
||||
padding: 0px 20px;
|
||||
cursor: pointer;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: white;
|
||||
transition: 100ms;
|
||||
}
|
||||
.btn:hover {
|
||||
background-color: rgb(79, 144, 53);
|
||||
}
|
||||
.btn:active {
|
||||
background-color: rgb(70, 127, 48);
|
||||
}
|
||||
|
||||
.company-name {
|
||||
font-size: 15px;
|
||||
}
|
||||
.version {
|
||||
font-size: 15px;
|
||||
}
|
||||
.copyright {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
/deep/ .el-dialog__body {
|
||||
background-color: #32363a;
|
||||
}
|
||||
|
||||
.white {
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,47 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
/**
|
||||
* Append a log message to a log file. If the file does not exist, it will be created.
|
||||
*
|
||||
* @param {string} logMessage - The log message to append.
|
||||
* @param {string} logFilePath - The path of the log file.
|
||||
* @returns {Promise<void>} - A promise that resolves when the log message has been appended.
|
||||
*/
|
||||
export function appendLog(logMessage, logFilePath) {
|
||||
logFilePath += "/log.txt";
|
||||
console.log(logFilePath);
|
||||
return new Promise((resolve, reject) => {
|
||||
// Ensure the directory for the log file exists
|
||||
const logDir = path.dirname(logFilePath);
|
||||
fs.mkdir(logDir, { recursive: true }, (err) => {
|
||||
if (err && err.code !== "EEXIST") {
|
||||
reject(err);
|
||||
} else {
|
||||
// Append the log message to the log file
|
||||
const localTime = new Date().toLocaleString();
|
||||
const logEntry = `${localTime} - ${logMessage}\n`;
|
||||
fs.appendFile(logFilePath, logEntry, "utf8", (err) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
/*
|
||||
// Example usage
|
||||
const logMessage = "This is a test log message";
|
||||
const logFilePath = "./logs/logfile.log";
|
||||
|
||||
appendLog(logMessage, logFilePath)
|
||||
.then(() => {
|
||||
console.log("Log message appended successfully");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error appending log message:", error.message);
|
||||
});
|
||||
*/
|
||||
@@ -0,0 +1,558 @@
|
||||
<template>
|
||||
<div
|
||||
class="log"
|
||||
@click="unfinger">
|
||||
<div class="user">
|
||||
<div class="title">{{ $t('login.userLogin') }}</div>
|
||||
<div class="user-form">
|
||||
<el-form
|
||||
ref="ruleForm"
|
||||
:model="ruleForm"
|
||||
status-icon
|
||||
:rules="rules">
|
||||
<el-form-item
|
||||
:label="$t('admin.userName')"
|
||||
label-position="top"
|
||||
prop="name">
|
||||
<el-input
|
||||
v-model="ruleForm.name"
|
||||
size="small"
|
||||
@blur="ruleForm.name = $event.target.value.trim()"
|
||||
:validate-event="false"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
:label="$t('work.password')"
|
||||
label-position="top"
|
||||
prop="pass">
|
||||
<el-input
|
||||
v-model="ruleForm.pass"
|
||||
show-password
|
||||
size="small"
|
||||
@blur="ruleForm.pass = $event.target.value.trim()"
|
||||
:validate-event="false"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<div class="remember">
|
||||
<el-checkbox
|
||||
v-model="checked"
|
||||
class="rememberMe"
|
||||
fill="#58c2c5"
|
||||
text-color="#58c2c5"
|
||||
>{{ $t('login.remberPasss') }}</el-checkbox
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="submit">
|
||||
<el-button @click="onSubmituser()">{{ $t('login.login') }}</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="finger"
|
||||
:class="{'finger1': input_state}"
|
||||
id="finger">
|
||||
<div class="title">{{ $t('login.fingerLogin') }}</div>
|
||||
<div class="icon">
|
||||
<!-- <img src="../assets/picture/finger.png" /> -->
|
||||
<finger
|
||||
ref="finger"
|
||||
:type="2"
|
||||
:isHave="false"
|
||||
class="finger_box"
|
||||
@changeStatus="(e) => input_state = e"
|
||||
@over="fingerLogin"
|
||||
@judgeOver="judgeOver" />
|
||||
</div>
|
||||
<!-- <el-button @click="onSubmitfinger()">登录</el-button> -->
|
||||
</div>
|
||||
<div class="maxtitle">
|
||||
<div class="p">{{ $t('login.title1') }}</div>
|
||||
<div class="p">{{ $t('login.title2') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import finger from './finger.vue'
|
||||
const { ipcRenderer } = require('electron')
|
||||
export default {
|
||||
name: 'login',
|
||||
components: {
|
||||
finger
|
||||
},
|
||||
data() {
|
||||
var validateName = (rule, value, callback) => {
|
||||
if (value === '') {
|
||||
callback(new Error(this.$t('addUser.enterUsername')))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
var validatePass = (rule, value, callback) => {
|
||||
if (value === '') {
|
||||
callback(new Error(this.$t('addUser.enterPassword')))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
ruleForm: {
|
||||
name: '',
|
||||
pass: ''
|
||||
},
|
||||
input_state: false,
|
||||
checked: false,
|
||||
rules: {
|
||||
name: [{ validator: validateName }],
|
||||
pass: [{ validator: validatePass }]
|
||||
},
|
||||
onClose: false,
|
||||
tempUserList: [],
|
||||
loginSuccess: false,
|
||||
callBackNum: 0,
|
||||
fingerLogining: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
localStorage.setItem('loginrole', '')
|
||||
localStorage.setItem('loginname', '')
|
||||
let username = localStorage.getItem('name')
|
||||
if (username) {
|
||||
this.ruleForm.name = localStorage.getItem('name')
|
||||
this.ruleForm.pass = localStorage.getItem('pass')
|
||||
this.checked = true
|
||||
}
|
||||
|
||||
ipcRenderer.on('end-frp-callback', (event, data) => {
|
||||
if (data) {
|
||||
} else {
|
||||
}
|
||||
})
|
||||
|
||||
window.addEventListener('keydown', this.keyDown)
|
||||
},
|
||||
destroyed() {
|
||||
window.removeEventListener('keydown', this.keyDown, false)
|
||||
},
|
||||
methods: {
|
||||
fingerLogin(data) {
|
||||
if (this.fingerLogining) {
|
||||
return
|
||||
}
|
||||
console.log(data)
|
||||
this.callBackNum = 0
|
||||
this.tempUserList = []
|
||||
this.loginSuccess = false
|
||||
this.fingerLogining = true
|
||||
this.$axios({
|
||||
method: 'get',
|
||||
url: '/user/AllUserInfo'
|
||||
})
|
||||
.then((res) => {
|
||||
this.tempUserList = res.data.userInfoList
|
||||
//console.log(datalist);
|
||||
for (let i in this.tempUserList) {
|
||||
this.$refs.finger.judge(data, this.tempUserList[i].fingerprintValue)
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(this.$t('login.serviceShut'))
|
||||
})
|
||||
},
|
||||
judgeOver(data) {
|
||||
if (this.loginSuccess) {
|
||||
return
|
||||
}
|
||||
if (data.rate >= 0.9) {
|
||||
this.loginSuccess = true
|
||||
this.$axios({
|
||||
method: 'post',
|
||||
url: `/user/loginbyhand?fingerprint_value=${data.data2}`
|
||||
})
|
||||
.then((res) => {
|
||||
this.$message({ offset: 100, message: this.$t('login.successLogin'), type: 'success' })
|
||||
localStorage.setItem('loginrole', res.data.userRole)
|
||||
localStorage.setItem('loginname', res.data.userName)
|
||||
this.$router.push({
|
||||
path: '/main'
|
||||
})
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loginSuccess = false
|
||||
this.handFail()
|
||||
//console.log(e);
|
||||
//if (res.data == 404) {
|
||||
// this.$message.error("登录失败");
|
||||
//}
|
||||
})
|
||||
} else {
|
||||
this.callBackNum++
|
||||
this.handFail()
|
||||
}
|
||||
},
|
||||
handFail() {
|
||||
if (this.callBackNum == this.tempUserList.length) {
|
||||
this.fingerLogining = false
|
||||
if (!this.onClose) {
|
||||
this.onClose = true
|
||||
this.$message({
|
||||
offset: 100,
|
||||
message: this.$t('login.errorFingerlogin'),
|
||||
type: 'error',
|
||||
onClose: () => {
|
||||
this.onClose = false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
onSubmituser() {
|
||||
if (this.ruleForm.name == '1') {
|
||||
this.$router.push({
|
||||
path: '/main'
|
||||
})
|
||||
}
|
||||
this.$refs.ruleForm.validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.checked) {
|
||||
localStorage.setItem('name', this.ruleForm.name)
|
||||
localStorage.setItem('pass', this.ruleForm.pass)
|
||||
} else {
|
||||
localStorage.removeItem('name')
|
||||
localStorage.removeItem('pass')
|
||||
}
|
||||
|
||||
this.$axios({
|
||||
method: 'post',
|
||||
url: `/user/loginbypassword?user_name=${this.ruleForm.name}&user_password=${this.ruleForm.pass}`
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.data.resultcode === 0) {
|
||||
this.$message({ offset: 100, message: this.$t('login.successLogin'), type: 'success' })
|
||||
console.log(res.data)
|
||||
localStorage.setItem('loginrole', res.data.resultinfo.userRole)
|
||||
localStorage.setItem('loginname', res.data.resultinfo.userName)
|
||||
const guideStep = [
|
||||
{
|
||||
show: false,
|
||||
placement: 'right',
|
||||
step: this.$t('guide.step1'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'right',
|
||||
step: this.$t('guide.step2'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'right',
|
||||
step: this.$t('guide.step3'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'left',
|
||||
step: this.$t('guide.step4'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'bottom',
|
||||
step: this.$t('guide.step5'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'bottom',
|
||||
step: this.$t('guide.step6'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'top',
|
||||
step: this.$t('guide.step7'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'right',
|
||||
step: this.$t('guide.step8'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'bottom',
|
||||
step: this.$t('guide.step9'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'bottom',
|
||||
step: this.$t('guide.step10'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'right',
|
||||
step: this.$t('guide.step11'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'right',
|
||||
step: this.$t('guide.step12'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'left',
|
||||
step: this.$t('guide.step13'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'bottom',
|
||||
step: this.$t('guide.step14'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'top',
|
||||
step: this.$t('guide.step15'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'top',
|
||||
step: this.$t('guide.step16'),
|
||||
},
|
||||
{
|
||||
show: false,
|
||||
placement: 'top',
|
||||
step: this.$t('guide.step17'),
|
||||
},
|
||||
]
|
||||
localStorage.setItem('guideStep', JSON.stringify(guideStep))
|
||||
localStorage.setItem('currentStep', 0)
|
||||
this.$router.push({
|
||||
path: '/main'
|
||||
})
|
||||
} else {
|
||||
if (res.data.resultcode === 2) {
|
||||
this.$message.error(this.$t('login.serviceOut'))
|
||||
return
|
||||
}
|
||||
if (res.data.resultcode === -1) {
|
||||
this.$message.error(this.$t('login.errorLogin'))
|
||||
return
|
||||
}
|
||||
this.$message.error(res.data.resultstr)
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.data.resultstr)
|
||||
})
|
||||
} else {
|
||||
console.log('error user!!')
|
||||
}
|
||||
})
|
||||
},
|
||||
// 监听回车键执行事件
|
||||
keyDown(e) {
|
||||
// 回车则执行登录方法 enter键的ASCII是13
|
||||
if (e.keyCode === 13) {
|
||||
this.onSubmituser() // 需要执行的方法方法
|
||||
}
|
||||
},
|
||||
// onSubmitfinger() {
|
||||
// if (this.$refs.finger.inputed_state) {
|
||||
// this.$router.push({
|
||||
// path: "/main",
|
||||
// });
|
||||
// console.log(" finger!!");
|
||||
// } else {
|
||||
// this.$message({offset:100,
|
||||
// message: "请录入指纹",
|
||||
// type: "warning",
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
unfinger(event) {
|
||||
var sp = document.getElementById('finger')
|
||||
if (sp) {
|
||||
if (!sp.contains(event.target)) {
|
||||
this.$refs.finger.input_state = false
|
||||
ipcRenderer.send('end-frp')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.log {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-image: url('../assets/picture/01.jpg');
|
||||
background-size: 100% 100%;
|
||||
|
||||
.user {
|
||||
margin-left: 6%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
width: 260px;
|
||||
height: 380px;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0px 0px 2px grey;
|
||||
background-color: white;
|
||||
|
||||
.title {
|
||||
height: 10%;
|
||||
width: 100%;
|
||||
font-size: 25px;
|
||||
color: rgb(88, 194, 197);
|
||||
}
|
||||
|
||||
.user-form {
|
||||
width: 70%;
|
||||
height: 65%;
|
||||
padding-top: 10%;
|
||||
|
||||
.el-form-item {
|
||||
margin-bottom: 0px;
|
||||
|
||||
/deep/.el-form-item__label {
|
||||
line-height: 30px;
|
||||
color: rgb(212, 212, 212);
|
||||
font-size: 13px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/deep/.el-form-item__content {
|
||||
line-height: 25px;
|
||||
margin-top: 40px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.el-input {
|
||||
/deep/.el-input__inner {
|
||||
padding: 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 2px rgb(153, 153, 153) solid;
|
||||
border-radius: 0;
|
||||
color: rgb(63, 64, 66);
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
/*
|
||||
letter-spacing: 2px;
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.remember {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.submit {
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.el-button {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: white;
|
||||
color: rgb(88, 194, 197);
|
||||
border: 2px rgb(88, 194, 197) solid;
|
||||
width: 125px;
|
||||
height: 35px;
|
||||
font-size: 15px;
|
||||
border-radius: 30px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.finger {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
width: 260px;
|
||||
height: 350px;
|
||||
border-radius: 0px 15px 15px 0px;
|
||||
box-shadow: 0px 0px 2px grey;
|
||||
background-color: rgb(40, 49, 60);
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 10%;
|
||||
width: 100%;
|
||||
font-size: 25px;
|
||||
color: rgb(125, 126, 130);
|
||||
}
|
||||
|
||||
.icon {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 50%;
|
||||
margin-top: 10px;
|
||||
|
||||
.finger_box {
|
||||
}
|
||||
}
|
||||
|
||||
// .el-button {
|
||||
// display: flex;
|
||||
// justify-content: center;
|
||||
// align-items: center;
|
||||
// color: rgb(122, 124, 121);
|
||||
// border: 2px rgb(139, 140, 139) solid;
|
||||
// width: 125px;
|
||||
// height: 35px;
|
||||
// font-size: 15px;
|
||||
// border-radius: 30px;
|
||||
// background: rgba(255, 255, 255, 0);
|
||||
// }
|
||||
}
|
||||
|
||||
.maxtitle {
|
||||
color: white;
|
||||
font-size: 35px;
|
||||
margin-left: 7%;
|
||||
width: 500px;
|
||||
|
||||
.p {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.finger {
|
||||
transition: All 0.4s ease-in-out;
|
||||
-webkit-transition: All 0.4s ease-in-out;
|
||||
-moz-transition: All 0.4s ease-in-out;
|
||||
-o-transition: All 0.4s ease-in-out;
|
||||
}
|
||||
|
||||
.finger1,
|
||||
.finger:hover {
|
||||
transform: scale(1.2);
|
||||
-webkit-transform: scale(1.2);
|
||||
-moz-transform: scale(1.2);
|
||||
-o-transform: scale(1.2);
|
||||
-ms-transform: scale(1.2);
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
// .finger:hover ~ .user{
|
||||
// height:45%;
|
||||
// background-color: antiquewhite;
|
||||
// }
|
||||
</style>
|
||||
@@ -0,0 +1,971 @@
|
||||
<template>
|
||||
<div class="system">
|
||||
<div class="restart" v-if="false">
|
||||
<div class="title">{{ $t("systemControl.restart") }}</div>
|
||||
<div class="service">
|
||||
<div class="tips" style="text-align: left">
|
||||
{{ $t("systemControl.nowState") }}
|
||||
<span style="font-weight: bold">{{
|
||||
state == null
|
||||
? this.$t("systemControl.detecting")
|
||||
: state
|
||||
? this.$t("systemControl.start")
|
||||
: this.$t("systemControl.stop")
|
||||
}}</span>
|
||||
<div>{{ $t("systemControl.tips1") }}</div>
|
||||
</div>
|
||||
<div class="serviceImg">
|
||||
<el-button
|
||||
icon="el-icon-video-play"
|
||||
circle
|
||||
@click="play"
|
||||
:disabled="state || state == null"
|
||||
></el-button>
|
||||
<el-button
|
||||
icon="el-icon-video-pause"
|
||||
circle
|
||||
@click="pause"
|
||||
:disabled="!state || state == null"
|
||||
></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control">
|
||||
<div class="title">{{ $t("systemControl.operatingWorkstation") }}</div>
|
||||
<div class="service">
|
||||
<div class="select">
|
||||
<div class="lable">{{ $t("systemControl.selectWorkstation") }}</div>
|
||||
<el-select v-model="workValue">
|
||||
<el-option
|
||||
v-for="item in printData"
|
||||
:key="item.PrinterID"
|
||||
:label="getPrintName(item.PrinterID)"
|
||||
:value="item.PrinterID"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="select">
|
||||
<div class="lable">工作站状态</div>
|
||||
{{ this.statusText }}
|
||||
</div>
|
||||
<div class="concrete">
|
||||
<div class="lable">{{ $t("systemControl.moveCardTo") }}</div>
|
||||
<div class="buttons">
|
||||
<el-button @click="handledkq">{{
|
||||
$t("systemControl.dkq")
|
||||
}}</el-button>
|
||||
<el-button @click="handlefkh">{{
|
||||
$t("systemControl.fkh")
|
||||
}}</el-button>
|
||||
<el-button @click="handleckk">{{
|
||||
$t("systemControl.ckk")
|
||||
}}</el-button>
|
||||
<el-button @click="handledd">{{
|
||||
$t("systemControl.dd")
|
||||
}}</el-button>
|
||||
<el-button @click="handledqk">{{
|
||||
$t("systemControl.dqk")
|
||||
}}</el-button>
|
||||
<el-button @click="handlehckk">{{
|
||||
$t("systemControl.hckk")
|
||||
}}</el-button>
|
||||
<!--<el-button @click="handleInCard">{{
|
||||
$t("systemControl.handleInCard")
|
||||
}}</el-button>
|
||||
<el-button @click="handleMoveReject">{{
|
||||
$t("systemControl.handleMoveReject")
|
||||
}}</el-button>
|
||||
<el-button @click="handleMoveToExit">{{
|
||||
$t("systemControl.handleMoveToExit")
|
||||
}}</el-button>
|
||||
<el-button @click="handleRestartPrint">{{
|
||||
$t("systemControl.handleRestartPrint")
|
||||
}}</el-button>
|
||||
<el-button @click="handleCleanPrint">{{
|
||||
$t("systemControl.handleCleanPrint")
|
||||
}}</el-button>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="concrete">
|
||||
<div class="lable">{{ $t("systemControl.serviceStation") }}</div>
|
||||
<div class="buttons">
|
||||
<el-button @click="handleczgzz">{{
|
||||
$t("systemControl.czgzz")
|
||||
}}</el-button>
|
||||
<el-button @click="handleczdyj">{{
|
||||
$t("systemControl.czdyj")
|
||||
}}</el-button>
|
||||
<el-button @click="handlejzsdd">{{
|
||||
$t("systemControl.jzsdd")
|
||||
}}</el-button>
|
||||
<el-button @click="handlecshjkc">{{
|
||||
$t("systemControl.cshjkc")
|
||||
}}</el-button>
|
||||
<!-- <el-button @click="handlebszjkc">{{
|
||||
$t("systemControl.bszjkc")
|
||||
}}</el-button> -->
|
||||
<el-button @click="handleqjgzz">{{
|
||||
$t("systemControl.qjgzz")
|
||||
}}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control" style="height: 240px">
|
||||
<div class="title">{{ $t("systemControl.system") }}</div>
|
||||
<div class="service">
|
||||
<div class="select">
|
||||
<div class="lable">{{ $t("systemControl.refreshTime1") }}</div>
|
||||
<el-input v-model="refreshTime1" type="number" style="width: 300px">
|
||||
<el-button
|
||||
slot="append"
|
||||
icon="el-icon-finished"
|
||||
@click="handleSaveTime1"
|
||||
></el-button>
|
||||
></el-input
|
||||
>
|
||||
</div>
|
||||
<div class="select">
|
||||
<div class="lable">{{ $t("systemControl.refreshTime2") }}</div>
|
||||
<el-input v-model="refreshTime2" type="number" style="width: 300px">
|
||||
<el-button
|
||||
slot="append"
|
||||
icon="el-icon-finished"
|
||||
@click="handleSaveTime2"
|
||||
></el-button
|
||||
></el-input>
|
||||
</div>
|
||||
<div class="select">
|
||||
<div class="lable">{{ $t("systemControl.guide") }}</div>
|
||||
<el-switch @change="changeStep" v-model="showStep" :active-text="$t('systemControl.show')" :inactive-text="$t('systemControl.hide')"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="languageer">
|
||||
<div class="title">{{ $t("systemControl.language") }}</div>
|
||||
<div class="select">
|
||||
<div class="lable">{{ $t("systemControl.changeLanguage") }}</div>
|
||||
<el-select v-model="selectLan">
|
||||
<el-option
|
||||
v-for="item in languages"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "systemControl",
|
||||
data() {
|
||||
return {
|
||||
showStep: false,
|
||||
workValue: "",
|
||||
languages: [
|
||||
{
|
||||
value: "zh",
|
||||
label: "中文(简体)",
|
||||
},
|
||||
{
|
||||
value: "ozh",
|
||||
label: "中文(繁体)",
|
||||
},
|
||||
{
|
||||
value: "en",
|
||||
label: "English",
|
||||
},
|
||||
],
|
||||
selectLan: "",
|
||||
printData: [],
|
||||
state: null,
|
||||
timer: 1,
|
||||
refreshTime1: 3000,
|
||||
refreshTime2: 180000,
|
||||
statusText: "",
|
||||
status: {
|
||||
87: { tag: "ERROR_INVALID_PARAMETER", err: 0 },
|
||||
0: { tag: "NORMAL", err: 0 },
|
||||
30016: { tag: "PAVO_DS_LOCKED", err: 0 },
|
||||
128: { tag: "PAVO_DS_OFFLINE", err: 0 },
|
||||
256: { tag: "PAVO_DS_0100_COVER_OPEN", err: 0 },
|
||||
257: { tag: "PAVO_DS_0200_IC_MISSING", err: 0 },
|
||||
512: { tag: "PAVO_DS_0201_RIBBON_MISSING", err: 0 },
|
||||
513: { tag: "PAVO_DS_0202_RIBON_MISMATCH", err: 0 },
|
||||
259: { tag: "PAVO_DS_0203_RIBBON_TYPE_ERROR", err: 0 },
|
||||
768: { tag: "PAVO_DS_0300_RIBBON_SEARCH_FAIL", err: 0 },
|
||||
769: { tag: "PAVO_DS_0301_RIBBON_OUT", err: 0 },
|
||||
770: { tag: "PAVO_DS_0302_PRINT_FAIL", err: 0 },
|
||||
771: { tag: "PAVO_DS_0303_PRINT_FAIL", err: 0 },
|
||||
772: { tag: "PAVO_DS_0304_RIBBON_OUT", err: 0 },
|
||||
1024: { tag: "PAVO_DS_0400_CARD_OUT", err: 1 },
|
||||
1280: { tag: "PAVO_DS_0500_CARD_JAM", err: 1 },
|
||||
1281: { tag: "PAVO_DS_0501_CARD_JAM", err: 1 },
|
||||
1282: { tag: "PAVO_DS_0502_CARD_JAM", err: 1 },
|
||||
1283: { tag: "PAVO_DS_0503_CARD_JAM", err: 1 },
|
||||
1284: { tag: "PAVO_DS_0504_CARD_JAM", err: 1 },
|
||||
1285: { tag: "PAVO_DS_0505_CARD_JAM", err: 1 },
|
||||
1286: { tag: "PAVO_DS_0506_CARD_JAM", err: 1 },
|
||||
1287: { tag: "PAVO_DS_0507_CARD_JAM", err: 1 },
|
||||
1288: { tag: "PAVO_DS_0508_CARD_JAM", err: 1 },
|
||||
1536: { tag: "PAVO_DS_0600_CARD_MISMATCH", err: 0 },
|
||||
1792: { tag: "PAVO_DS_0700_CAM_ERROR", err: 0 },
|
||||
2048: { tag: "PAVO_DS_0800_FLIPPER_ERROR", err: 0 },
|
||||
2049: { tag: "PAVO_DS_0801_FLIPPER_ERROR", err: 0 },
|
||||
2050: { tag: "PAVO_DS_0802_FLIPPER_ERROR", err: 0 },
|
||||
2051: { tag: "PAVO_DS_0803_FLIPPER_ERROR", err: 0 },
|
||||
2304: { tag: "PAVO_DS_0900_NVRAM_ERROR", err: 0 },
|
||||
4096: { tag: "PAVO_DS_1000_RIBBON_ERROR", err: 0 },
|
||||
4352: { tag: "PAVO_DS_1100_RBN_TAKE_CALIB_FAIL", err: 0 },
|
||||
4353: { tag: "PAVO_DS_1101_RBN_SUPPLY_CALIB_FAIL", err: 0 },
|
||||
4608: { tag: "PAVO_DS_1200_ADC_ERROR", err: 0 },
|
||||
4864: { tag: "PAVO_DS_1300_FW_ERROR", err: 0 },
|
||||
4865: { tag: "PAVO_DS_1301_FW_ERROR", err: 0 },
|
||||
5120: { tag: "PAVO_DS_1400_POWER_SUPPLY_ERROR", err: 0 },
|
||||
65537: { tag: "Firmware_Error", err: 0 },
|
||||
65539: { tag: "Encoder_Error3", err: 0 },
|
||||
65540: { tag: "Encoder_Error4", err: 0 },
|
||||
65541: { tag: "ADC_Error", err: 0 },
|
||||
65542: { tag: "Enocoder_Error_Film", err: 0 },
|
||||
65552: { tag: "Card_Jam", err: 1 },
|
||||
65553: { tag: "Card_Jam", err: 1 },
|
||||
65554: { tag: "Card_Jam", err: 1 },
|
||||
65555: { tag: "Card_Jam", err: 1 },
|
||||
65556: { tag: "Card_Jam", err: 1 },
|
||||
65557: { tag: "Card_Jam", err: 1 },
|
||||
65558: { tag: "Card_Jam", err: 1 },
|
||||
65559: { tag: "Card_Jam", err: 1 },
|
||||
65560: { tag: "Card_Jam", err: 1 },
|
||||
65561: { tag: "Card_Jam", err: 1 },
|
||||
65562: { tag: "Card_Jam", err: 1 },
|
||||
65563: { tag: "Card_Jam", err: 1 },
|
||||
65569: { tag: "Cover_open", err: 0 },
|
||||
65570: { tag: "Rejectbox_Open", err: 0 },
|
||||
65571: { tag: "Rejectbox_Full", err: 0 },
|
||||
65572: { tag: "Flat_Cover_Open", err: 0 },
|
||||
65587: { tag: "Flipper_Error", err: 0 },
|
||||
65601: { tag: "Ribbon_Out", err: 0 },
|
||||
65602: { tag: "Ribbon_Error", err: 0 },
|
||||
65603: { tag: "Ribbon_Missing", err: 0 },
|
||||
65604: { tag: "Ribbon_Unsupport", err: 0 },
|
||||
65605: { tag: "Ribbon_Missing", err: 0 },
|
||||
65606: { tag: "Ribbon_Out", err: 0 },
|
||||
65607: { tag: "Ribbon_Mismatch", err: 0 },
|
||||
65608: { tag: "Ribbon_Error", err: 0 },
|
||||
65609: { tag: "Ribbon_Error", err: 0 },
|
||||
65610: { tag: "Ribbon_Install_Error", err: 0 },
|
||||
65617: { tag: "Card_Feed_Error ", err: 1 },
|
||||
65618: { tag: "Card_Feed_Error ", err: 1 },
|
||||
65619: { tag: "Card_Feed_Error ", err: 1 },
|
||||
65630: { tag: "Card_Feed_Error ", err: 1 },
|
||||
65631: { tag: "Card_Out", err: 0 },
|
||||
65649: { tag: "Film_Out", err: 0 },
|
||||
65650: { tag: "Film_Error", err: 0 },
|
||||
65651: { tag: "Film_Missing", err: 0 },
|
||||
65652: { tag: "Film_Unsupport", err: 0 },
|
||||
65653: { tag: "Film_Missing", err: 0 },
|
||||
65654: { tag: "Film_Out", err: 0 },
|
||||
65655: { tag: "Film_Error", err: 0 },
|
||||
65656: { tag: "Film_Error", err: 0 },
|
||||
65657: { tag: "Film_Unsupport", err: 0 },
|
||||
65658: { tag: "Film_Install_Error", err: 0 },
|
||||
65701: { tag: "Printer_Memory_Full", err: 0 },
|
||||
69639: { tag: "Filpper_Not_Install", err: 0 },
|
||||
69640: { tag: "600DPI_Not_Enabled", err: 0 },
|
||||
69649: { tag: "Ribbon_Unmatched", err: 0 },
|
||||
69651: { tag: "Text_Image_Outside", err: 0 },
|
||||
69652: { tag: "No_Card", err: 0 },
|
||||
69653: { tag: "Take_Ribbon", err: 0 },
|
||||
131073: { tag: "Ribbon_Low", err: 0 },
|
||||
131074: { tag: "Card_Low", err: 0 },
|
||||
131075: { tag: "Waiting_Card_In", err: 0 },
|
||||
131076: { tag: "Waiting_Card_Out", err: 0 },
|
||||
131077: { tag: "Card_Low", err: 0 },
|
||||
131078: { tag: "Card_Low", err: 0 },
|
||||
131081: { tag: "Need_Cleaning", err: 0 },
|
||||
1167: { tag: "PAVO_DS_OFFLINE", err: 0 },
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.selectLan = localStorage.getItem("lang");
|
||||
this.getData();
|
||||
this.checkServerState(1);
|
||||
const refreshTempTime1 = localStorage.getItem("refreshTime1");
|
||||
const refreshTempTime2 = localStorage.getItem("refreshTime2");
|
||||
if (refreshTempTime1) {
|
||||
this.refreshTime1 = refreshTempTime1;
|
||||
} else {
|
||||
//默认值就是3000ms
|
||||
//this.refreshTempTime1 = 3000;
|
||||
}
|
||||
if (refreshTempTime2) {
|
||||
this.refreshTime2 = refreshTempTime2;
|
||||
} else {
|
||||
//默认值就是3000ms
|
||||
//this.refreshTempTime1 = 3000;
|
||||
}
|
||||
/*
|
||||
setInterval(() => {
|
||||
this.checkServerState();
|
||||
}, 2000);
|
||||
*/
|
||||
//setTimeout(() => {
|
||||
// this.checkServerState(
|
||||
// setTimeout(() => {
|
||||
// this.checkServerState();
|
||||
// }, 2000)
|
||||
// );
|
||||
//}, 2000);
|
||||
//this.workValue = !this.printData ? null : this.printData[0].PrinterID;
|
||||
if (!localStorage.getItem('hideStep')||localStorage.getItem('hideStep')==0) this.showStep = true
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.timer = null;
|
||||
},
|
||||
methods: {
|
||||
getStatus(printId) {
|
||||
this.statusText = "";
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: `/printer/checkstatus?printerid=${printId}`,
|
||||
}).then((res) => {
|
||||
console.log(this.status, [res.data]);
|
||||
this.statusText = this.$t(`index.${this.status[res.data].tag}`);
|
||||
});
|
||||
},
|
||||
handleSaveTime1() {
|
||||
localStorage.setItem("refreshTime1", parseInt(this.refreshTime1));
|
||||
this.$message({
|
||||
offset: 100,
|
||||
message: this.$t("systemControl.saveTimeSucc"),
|
||||
type: "success",
|
||||
});
|
||||
},
|
||||
handleSaveTime2() {
|
||||
localStorage.setItem("refreshTime2", parseInt(this.refreshTime2));
|
||||
this.$message({
|
||||
offset: 100,
|
||||
message: this.$t("systemControl.saveTimeSucc"),
|
||||
type: "success",
|
||||
});
|
||||
},
|
||||
getData() {
|
||||
this.$axios({
|
||||
method: "get",
|
||||
url: "/web/get_printer_info",
|
||||
}).then((res) => {
|
||||
this.printData = res.data.printerList;
|
||||
if (this.printData.length != 0) {
|
||||
//自动选择第一个
|
||||
this.workValue = this.printData[0].PrinterID;
|
||||
}
|
||||
});
|
||||
},
|
||||
checkServerState(callback) {
|
||||
this.$axios({
|
||||
method: "get",
|
||||
url: "/web/get_printer_info",
|
||||
})
|
||||
.then((res) => {
|
||||
this.state = true;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.state = false;
|
||||
});
|
||||
},
|
||||
handleAll(t2, t3, url, params) {
|
||||
if (this.workValue == "") {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
message: this.$t("systemControl.selectTips"),
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$confirm(t2, this.$t("index.tips"), {
|
||||
confirmButtonText: this.$t("admin.confirm"),
|
||||
cancelButtonText: this.$t("admin.cancel"),
|
||||
type: "warning",
|
||||
}).then(() => {
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url:
|
||||
`/printer/${url}?printerid=` +
|
||||
this.workValue +
|
||||
(params ? params : ""),
|
||||
})
|
||||
.then((res) => {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "success",
|
||||
message: t3,
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.getStatus(this.workValue);
|
||||
}, 1000);
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "error",
|
||||
message: "Fail",
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.getStatus(this.workValue);
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
},
|
||||
handledkq() {
|
||||
this.handleAll(
|
||||
this.$t("systemControl.tips1_dkq"),
|
||||
this.$t("systemControl.tips2_dkq"),
|
||||
"movetousbreader"
|
||||
);
|
||||
},
|
||||
handlefkh() {
|
||||
this.handleAll(
|
||||
this.$t("systemControl.tips1_fkh"),
|
||||
this.$t("systemControl.tips2_fkh"),
|
||||
"movetoReject"
|
||||
);
|
||||
},
|
||||
handleckk() {
|
||||
this.handleAll(
|
||||
this.$t("systemControl.tips1_ckk"),
|
||||
this.$t("systemControl.tips2_ckk"),
|
||||
"movetohopper"
|
||||
);
|
||||
},
|
||||
handledd() {
|
||||
this.handleAll(
|
||||
this.$t("systemControl.tips1_dd"),
|
||||
this.$t("systemControl.tips2_dd"),
|
||||
"movetoready"
|
||||
);
|
||||
},
|
||||
handledqk() {
|
||||
this.handleAll(
|
||||
this.$t("systemControl.tips1_dqk"),
|
||||
this.$t("systemControl.tips2_dqk"),
|
||||
"movetostandbyback"
|
||||
);
|
||||
},
|
||||
handlehckk() {
|
||||
this.handleAll(
|
||||
this.$t("systemControl.tips1_hckk"),
|
||||
this.$t("systemControl.tips2_hckk"),
|
||||
"movetofront"
|
||||
);
|
||||
},
|
||||
handleczgzz() {
|
||||
this.handleAll(
|
||||
this.$t("systemControl.tips1_czgzz"),
|
||||
this.$t("systemControl.tips2_czgzz"),
|
||||
"resetprinter",
|
||||
"&has_card=false"
|
||||
);
|
||||
},
|
||||
handleczdyj() {
|
||||
this.handleAll(
|
||||
this.$t("systemControl.tips1_czdyj"),
|
||||
this.$t("systemControl.tips2_czdyj"),
|
||||
"resetprinter",
|
||||
"&has_card=true"
|
||||
);
|
||||
},
|
||||
handlejzsdd() {
|
||||
this.handleAll(
|
||||
this.$t("systemControl.tips1_jzsdd"),
|
||||
this.$t("systemControl.tips2_jzsdd"),
|
||||
"cal_ribbonled"
|
||||
);
|
||||
},
|
||||
handlecshjkc() {
|
||||
this.handleAll(
|
||||
this.$t("systemControl.tips1_cshjkc"),
|
||||
this.$t("systemControl.tips2_cshjkc"),
|
||||
"reset_zero_num"
|
||||
);
|
||||
},
|
||||
handlebszjkc() {
|
||||
this.handleAll(
|
||||
this.$t("systemControl.tips1_bszjkc"),
|
||||
this.$t("systemControl.tips2_bszjkc"),
|
||||
"setunknowntype"
|
||||
);
|
||||
},
|
||||
handleqjgzz() {
|
||||
this.handleAll(
|
||||
this.$t("systemControl.tips1_qjgzz"),
|
||||
this.$t("systemControl.tips2_qjgzz"),
|
||||
"cleanprinter"
|
||||
);
|
||||
},
|
||||
handleInCard() {
|
||||
if (this.workValue == "") {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
message: this.$t("systemControl.selectTips"),
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$confirm(this.$t("systemControl.tips2"), this.$t("index.tips"), {
|
||||
confirmButtonText: this.$t("admin.confirm"),
|
||||
cancelButtonText: this.$t("admin.cancel"),
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: "/printer/movetousbreader?printerid=" + this.workValue,
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "success",
|
||||
message: this.$t("systemControl.moveTips"),
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "info",
|
||||
message: this.$t("systemControl.canceledMove"),
|
||||
});
|
||||
});
|
||||
// /printer/movetousbreader?printerid=3dc681034076126
|
||||
},
|
||||
handleCleanPrint() {
|
||||
if (this.workValue == "") {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
message: this.$t("systemControl.selectTips"),
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$confirm(this.$t("systemControl.tips3"), this.$t("index.tips"), {
|
||||
confirmButtonText: this.$t("admin.confirm"),
|
||||
cancelButtonText: this.$t("admin.cancel"),
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: "/printer/cleanprinter?printerid=" + this.workValue,
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "success",
|
||||
message: this.$t("systemControl.claenSuccess"),
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "info",
|
||||
message: this.$t("systemControl.canceledClean"),
|
||||
});
|
||||
});
|
||||
// /printer/cleanprinter?printerid=3dc681034076126
|
||||
},
|
||||
handleRestartPrint() {
|
||||
if (this.workValue == "") {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
message: this.$t("systemControl.selectTips"),
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$confirm(this.$t("systemControl.tips5"), this.$t("index.tips"), {
|
||||
confirmButtonText: this.$t("admin.confirm"),
|
||||
cancelButtonText: this.$t("admin.cancel"),
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: "/printer/resetprinter?printerid=" + this.workValue,
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "success",
|
||||
message: this.$t("systemControl.resetSuccess"),
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "info",
|
||||
message: this.$t("systemControl.canceledReset"),
|
||||
});
|
||||
});
|
||||
// /printer/resetprinter?printerid=3dc681034076126
|
||||
},
|
||||
handleMoveReject() {
|
||||
if (this.workValue == "") {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
message: this.$t("systemControl.selectTips"),
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$confirm(
|
||||
this.$t("systemControl.outCardtips"),
|
||||
this.$t("index.tips"),
|
||||
{
|
||||
confirmButtonText: this.$t("admin.confirm"),
|
||||
cancelButtonText: this.$t("admin.cancel"),
|
||||
type: "warning",
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: "/printer/movetoReject?printerid=" + this.workValue,
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
message: this.$t("systemControl.outCardsuccess"),
|
||||
type: "success",
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "info",
|
||||
message: this.$t("systemControl.canceledOut"),
|
||||
});
|
||||
});
|
||||
// /printer/movetoReject
|
||||
},
|
||||
handleMoveToExit() {
|
||||
if (this.workValue == "") {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
message: this.$t("systemControl.selectTips"),
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.$confirm(this.$t("systemControl.tips4"), this.$t("index.tips"), {
|
||||
confirmButtonText: this.$t("admin.confirm"),
|
||||
cancelButtonText: this.$t("admin.cancel"),
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: "/printer/movetohopper?printerid=" + this.workValue,
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "success",
|
||||
message: this.$t("systemControl.outCardsuccess"),
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "info",
|
||||
message: this.$t("systemControl.canceledOut"),
|
||||
});
|
||||
});
|
||||
// /printer/movetohopper
|
||||
},
|
||||
play() {
|
||||
this.state = null;
|
||||
var cmdShell = require("node-cmd");
|
||||
cmdShell.run(
|
||||
"chcp 65001>nul && net start CSPServer",
|
||||
(err, data, stderr) => {
|
||||
if (!err) {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "success",
|
||||
message: this.$t("systemControl.prepareStart"),
|
||||
});
|
||||
console.log("success", data);
|
||||
} else {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "error",
|
||||
message: this.$t("systemControl.startFailed"),
|
||||
});
|
||||
console.log("error", err);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
pause() {
|
||||
this.state = null;
|
||||
var cmdShell = require("node-cmd");
|
||||
cmdShell.run("net stop CSPServer", (err, data, stderr) => {
|
||||
if (!err) {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "success",
|
||||
message: this.$t("systemControl.pauseStart"),
|
||||
});
|
||||
console.log("success", data);
|
||||
} else {
|
||||
this.$message({
|
||||
offset: 100,
|
||||
type: "error",
|
||||
message: this.$t("systemControl.pauseFailed"),
|
||||
});
|
||||
console.log("error", err);
|
||||
}
|
||||
});
|
||||
},
|
||||
toChar(n) {
|
||||
return String.fromCharCode(65 + parseInt(n));
|
||||
},
|
||||
getPrintName(id) {
|
||||
return this.$t("index.wordSpace") + id.substr(-5);
|
||||
},
|
||||
getPrintName1(id) {
|
||||
for (let i = 0; i < this.printData.length; i++) {
|
||||
if (this.printData[i].PrinterID == id) {
|
||||
return this.$t("index.wordSpace") + this.toChar(i);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 引导开关
|
||||
changeStep() {
|
||||
let hideStep = this.showStep ? 0 : 1
|
||||
localStorage.setItem('hideStep', hideStep)
|
||||
let currentStep = this.showStep ? 0 : -1
|
||||
localStorage.setItem('currentStep', currentStep)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
selectLan(val) {
|
||||
localStorage.setItem("lang", val);
|
||||
this.$i18n.locale = val;
|
||||
},
|
||||
workValue: {
|
||||
immediate: true,
|
||||
handler() {
|
||||
this.getStatus(this.workValue);
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.system {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 6px 3px 11px 0px rgb(0 0 0 / 12%), 0 0 6px rgb(0 0 0 / 4%);
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
.restart {
|
||||
width: 100%;
|
||||
height: 180px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-bottom: 1px rgb(224, 224, 224) solid;
|
||||
.title {
|
||||
font-size: 14px;
|
||||
width: 300px;
|
||||
height: 40px;
|
||||
color: rgb(139, 139, 139);
|
||||
padding-left: 10px;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
background-color: rgb(240, 240, 240);
|
||||
font-weight: bold;
|
||||
}
|
||||
.service {
|
||||
width: 100%;
|
||||
height: 120px;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
.tips {
|
||||
color: rgb(94, 94, 94);
|
||||
font-size: 14px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.serviceImg {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: row;
|
||||
margin-left: 100px;
|
||||
.begin {
|
||||
width: 55px;
|
||||
height: 55px;
|
||||
}
|
||||
.stop {
|
||||
margin-left: 5px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.control {
|
||||
width: 100%;
|
||||
height: 420px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-bottom: 1px rgb(224, 224, 224) solid;
|
||||
.title {
|
||||
margin-top: 20px;
|
||||
font-size: 14px;
|
||||
width: 300px;
|
||||
height: 40px;
|
||||
color: rgb(139, 139, 139);
|
||||
padding-left: 10px;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
background-color: rgb(240, 240, 240);
|
||||
font-weight: bold;
|
||||
}
|
||||
.service {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.select {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
|
||||
.lable {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
margin-top: 5px;
|
||||
font-size: 14px;
|
||||
width: 150px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.el-select {
|
||||
width: 180px;
|
||||
}
|
||||
}
|
||||
.concrete {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
|
||||
.lable {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
width: 150px;
|
||||
margin-top: 5px;
|
||||
font-size: 14px;
|
||||
margin-top: 27px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.buttons {
|
||||
width: 650px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
.el-button {
|
||||
width: 180px;
|
||||
height: 35px;
|
||||
background-color: #ffffff;
|
||||
margin-top: 20px;
|
||||
margin-right: 30px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: rgb(154, 202, 128);
|
||||
box-shadow: 1px 0px 2px 0px grey;
|
||||
user-select: none;
|
||||
color: rgb(154, 202, 128);
|
||||
font-size: 14px;
|
||||
border-radius: 1px;
|
||||
box-shadow: 1px 0px 2px 0px grey;
|
||||
}
|
||||
.el-button:nth-child(4) {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
.el-button:hover {
|
||||
background-color: white;
|
||||
}
|
||||
.el-button:active {
|
||||
background-color: white;
|
||||
}
|
||||
.el-button:focus {
|
||||
background-color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.languageer {
|
||||
width: 100%;
|
||||
height: 220px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.title {
|
||||
margin-top: 20px;
|
||||
font-size: 14px;
|
||||
width: 300px;
|
||||
height: 40px;
|
||||
color: rgb(139, 139, 139);
|
||||
padding-left: 10px;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
background-color: rgb(240, 240, 240);
|
||||
font-weight: bold;
|
||||
}
|
||||
.select {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
margin-left: 20px;
|
||||
margin-top: 20px;
|
||||
.lable {
|
||||
margin-top: 5px;
|
||||
font-size: 14px;
|
||||
width: 150px;
|
||||
text-align: left;
|
||||
}
|
||||
.el-select {
|
||||
width: 180px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bu:hover {
|
||||
background-color: antiquewhite;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,245 @@
|
||||
<template>
|
||||
<div style="width:500px;height:auto">
|
||||
<el-form ref="form" label-width="120px">
|
||||
<el-form-item label="拷贝路径">
|
||||
<el-input v-model="file1"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="CS模板文件名">
|
||||
<el-input v-model="file2"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="CSV文件名">
|
||||
<el-input v-model="file3"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit">提交</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import work from "./work"
|
||||
export
|
||||
default {
|
||||
name: 'Test',
|
||||
data() {
|
||||
return {
|
||||
file1: "",
|
||||
file2: "",
|
||||
file3: "",
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSubmit(){
|
||||
this.$axios({
|
||||
method: "get",
|
||||
url: "/api/rest/job/?CardSoon_File=" + this.file1 + "&Json_File=" + this.file2 + "&Udf_File=file:" + this.file3 + "&file_type=0&print_flag=2&label=1970-01-01&printCopys=1&disk_size=32&zone_type=0&hasPrintTask=true&hasCopyTask=true"
|
||||
}).then(res=>{
|
||||
this.$message("发送成功");
|
||||
})
|
||||
/*
|
||||
http://localhost:8080/api/rest/job/?CardSoon_File=20220619144836-WEB-3enb0btn094&Json_File=0605.cs&Udf_File=file:0605%20-%20%E5%89%AF%E6%9C%AC.csv&file_type=0&print_flag=2&label=2022-06-19&printCopys=1&disk_size=32&zone_type=0&hasPrintTask=true&hasCopyTask=true
|
||||
CardSoon_File: 20220619144836-WEB-3enb0btn094
|
||||
Json_File: 0605.cs
|
||||
Udf_File: file:0605 - 副本.csv
|
||||
file_type: 0
|
||||
print_flag: 2
|
||||
label: 2022-06-19
|
||||
printCopys: 1
|
||||
disk_size: 32
|
||||
zone_type: 0
|
||||
hasPrintTask: true
|
||||
hasCopyTask: true
|
||||
*/
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style lang="less" scoped>
|
||||
.wLog{
|
||||
max-height: 600px;
|
||||
overflow: auto;
|
||||
}
|
||||
h1, h2 {
|
||||
font-weight: normal;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
a {
|
||||
color: #42b983;
|
||||
}
|
||||
.left{
|
||||
background-color: #E8E7EE;
|
||||
height: 100%;
|
||||
padding: 20px 5px;
|
||||
border-right: #B8B8B8 solid 1px;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
.title {
|
||||
color: #999999;
|
||||
font-size: 28px;
|
||||
}
|
||||
.card{
|
||||
background-color: #F5F5F5;
|
||||
height: 50px;
|
||||
line-height: 55px;
|
||||
color: #3A3A3A;
|
||||
border: #B8B8B8 solid 1px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.mid{
|
||||
background-color: #F5F5F5;
|
||||
height: 100%;
|
||||
padding-top: 20px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
overflow-y: auto;
|
||||
&::-webkit-scrollbar {
|
||||
/*滚动条整体样式*/
|
||||
width : 10px; /*高宽分别对应横竖滚动条的尺寸*/
|
||||
height: 1px;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
/*滚动条里面小方块*/
|
||||
border-radius: 10px;
|
||||
box-shadow : inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
background : #C7C7CB;
|
||||
}
|
||||
&::-webkit-scrollbar-track {
|
||||
/*滚动条里面轨道*/
|
||||
box-shadow : inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
border-radius: 10px;
|
||||
background : #ededed;
|
||||
}
|
||||
.title{
|
||||
font-size: 32px;
|
||||
.add{
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
.brief{
|
||||
height: 300px;
|
||||
width: 100%;
|
||||
background-color: #FFFFFF;
|
||||
box-shadow: 6px 3px 11px 0px rgb(0 0 0 / 12%), 0 0 6px rgb(0 0 0 / 4%);
|
||||
margin-top: 20px;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
|
||||
.item{
|
||||
margin-top: 12px;
|
||||
}
|
||||
.b_title{
|
||||
position: absolute;
|
||||
font-weight: bold;
|
||||
}
|
||||
.b_left{
|
||||
position: relative;
|
||||
height: 100%;
|
||||
border-right: #B8B8B8 solid 1px;
|
||||
text-align: left;
|
||||
}
|
||||
.b_mid{
|
||||
position: relative;
|
||||
height: 100%;
|
||||
text-align: left;
|
||||
//border-right: #B8B8B8 solid 1px;
|
||||
}
|
||||
.b_right{
|
||||
position: relative;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.work{
|
||||
height: 550px;
|
||||
width: 100%;
|
||||
background-color: #FFFFFF;
|
||||
box-shadow: 6px 3px 11px 0px rgb(0 0 0 / 12%), 0 0 6px rgb(0 0 0 / 4%);
|
||||
margin-top: 20px;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
.w_title{
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
.w_right{
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.right{
|
||||
background-color: #C8CFD7;
|
||||
height: 100%;
|
||||
padding: 20px 10px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
.title{
|
||||
color: #999999;
|
||||
font-size: 28px;
|
||||
}
|
||||
.log{
|
||||
padding: 20px;
|
||||
font-size: 18px;
|
||||
background-color: #e2e2e2;
|
||||
border: #B8B8B8 solid 1px;
|
||||
color: #333333;
|
||||
margin-top: 10px;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
.c_log{
|
||||
height: 410px;
|
||||
border-top: #dddddd solid 1px;
|
||||
border-bottom: #dddddd solid 1px;
|
||||
margin-top : 20px;
|
||||
padding: 20px;
|
||||
text-align : left;
|
||||
color: #999999;
|
||||
overflow-y : auto;
|
||||
&::-webkit-scrollbar {
|
||||
/*滚动条整体样式*/
|
||||
width : 10px; /*高宽分别对应横竖滚动条的尺寸*/
|
||||
height: 1px;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
/*滚动条里面小方块*/
|
||||
border-radius: 10px;
|
||||
box-shadow : inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
background : #C7C7CB;
|
||||
}
|
||||
&::-webkit-scrollbar-track {
|
||||
/*滚动条里面轨道*/
|
||||
box-shadow : inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
border-radius: 10px;
|
||||
background : #ededed;
|
||||
}
|
||||
}
|
||||
|
||||
/deep/ .el-dialog__body{
|
||||
padding: 30px 20px 30px !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<div class="card">
|
||||
<div class="title">
|
||||
<img src="../assets/gantan.png" class="icon" />{{ data.printName }}
|
||||
</div>
|
||||
<div class="content">{{ $t(`index.${data.tag}`) }}</div>
|
||||
<div v-if="data.err == 0">
|
||||
<el-button
|
||||
size="small"
|
||||
style="width: 100%; margin-top: 10px"
|
||||
class="btn"
|
||||
@click="ok"
|
||||
>
|
||||
OK
|
||||
</el-button>
|
||||
</div>
|
||||
<div v-if="data.err == 1">
|
||||
<el-button
|
||||
size="small"
|
||||
style="width: 40%; margin-top: 10px"
|
||||
class="btn"
|
||||
:disabled="loading"
|
||||
@click="ok"
|
||||
>
|
||||
OK
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
style="width: 40%; margin-top: 10px"
|
||||
class="btn"
|
||||
:loading="loading"
|
||||
@click="retry"
|
||||
>
|
||||
{{ !loading ? $t("warnCard.retry") : "" }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "warn-card",
|
||||
props: {
|
||||
data: Object,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
ok(retry) {
|
||||
this.$emit("ok", this.data.pid, retry);
|
||||
this.data.show = false;
|
||||
},
|
||||
retry() {
|
||||
this.loading = true;
|
||||
if (
|
||||
(this.data.code >= 1280 && this.data.code <= 1288) ||
|
||||
this.data.code == 65552 ||
|
||||
this.data.code == 65553 ||
|
||||
this.data.code == 65554 ||
|
||||
this.data.code == 65555 ||
|
||||
this.data.code == 65556 ||
|
||||
this.data.code == 65557 ||
|
||||
this.data.code == 65558 ||
|
||||
this.data.code == 65559 ||
|
||||
this.data.code == 65560 ||
|
||||
this.data.code == 65561 ||
|
||||
this.data.code == 65562 ||
|
||||
this.data.code == 65563
|
||||
) {
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: "/printer/movetoReject?printerid=" + this.data.pid,
|
||||
})
|
||||
.then((res) => {
|
||||
setTimeout(() => {
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: "/printer/resetprinter?printerid=" + this.data.pid,
|
||||
}).then((res) => {
|
||||
this.ok(true);
|
||||
});
|
||||
}, 5000);
|
||||
})
|
||||
.catch((e) => {
|
||||
setTimeout(() => {
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: "/printer/resetprinter?printerid=" + this.data.pid,
|
||||
}).then((res) => {
|
||||
this.ok(true);
|
||||
});
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
if (
|
||||
this.data.code == 1024 ||
|
||||
this.data.code == 65617 ||
|
||||
this.data.code == 65618 ||
|
||||
this.data.code == 65619 ||
|
||||
this.data.code == 65630
|
||||
) {
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: "/printer/resetprinter?printerid=" + this.data.pid,
|
||||
}).then((res) => {
|
||||
this.ok(true);
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.card {
|
||||
width: 124px;
|
||||
background-color: #fff;
|
||||
padding: 10px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
|
||||
margin-top: 20px;
|
||||
}
|
||||
.icon {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
.title {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
}
|
||||
.content {
|
||||
font-size: 10px;
|
||||
margin-top: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
.btn {
|
||||
background-color: #e7e7eb;
|
||||
border: #e7e7eb;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,61 @@
|
||||
// The Vue build version to load with the `import` command
|
||||
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
|
||||
import Vue from 'vue'
|
||||
import ElementUI from 'element-ui';
|
||||
//import 'element-ui/lib/theme-chalk/index.css';
|
||||
import './assets/index1.css';
|
||||
import App from './App'
|
||||
import router from './router'
|
||||
import axios from 'axios'
|
||||
import VueI18n from 'vue-i18n'
|
||||
import cnlang from './lang/cn.js'
|
||||
import ocnlang from './lang/ocn'
|
||||
import enlang from './lang/en.js'
|
||||
Vue.config.productionTip = false
|
||||
Vue.use(ElementUI);
|
||||
/* eslint-disable no-new */
|
||||
Vue.use(VueI18n);
|
||||
var type = navigator.appName;
|
||||
if (type == "Netscape"){
|
||||
var lang = navigator.language;//获取浏览器配置语言,支持非IE浏览器
|
||||
}else{
|
||||
var lang = navigator.userLanguage;//获取浏览器配置语言,支持IE5+ == navigator.systemLanguage
|
||||
};
|
||||
var lang1 = lang.substr(0, 2);//获取浏览器配置语言前两位
|
||||
console.log(lang,lang1);
|
||||
let lan = 'en';
|
||||
if(lang1=='zh'){
|
||||
if(lang == 'zh-TW' || lang == 'zh-HK'){
|
||||
lan = 'ozh';
|
||||
}else{
|
||||
lan = 'zh';
|
||||
}
|
||||
}else if(lang1=="en"){
|
||||
lan = 'en';
|
||||
}
|
||||
if(!localStorage.getItem('lang')){
|
||||
localStorage.setItem("lang",lan);
|
||||
}
|
||||
|
||||
const i18n = new VueI18n({
|
||||
//locale: lan, // 默认语言
|
||||
locale:(function(){
|
||||
if(localStorage.getItem('lang')){
|
||||
return localStorage.getItem('lang')
|
||||
}
|
||||
return 'en'
|
||||
}()),
|
||||
messages: {
|
||||
'zh': cnlang,
|
||||
'ozh': ocnlang,
|
||||
'en': enlang
|
||||
}
|
||||
})
|
||||
axios.defaults.baseURL = 'http://localhost:5080';
|
||||
new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
i18n,
|
||||
components: { App },
|
||||
template: '<App/>'
|
||||
})
|
||||
@@ -0,0 +1,39 @@
|
||||
import Vue from 'vue'
|
||||
import Router from 'vue-router'
|
||||
import axios from "axios"
|
||||
import main from '@/components/main'
|
||||
import finger from '@/components/finger'
|
||||
import login from '@/components/login'
|
||||
import admin from '@/components/admin'
|
||||
import less from 'less'
|
||||
import uploader from 'vue-simple-uploader'
|
||||
|
||||
|
||||
Vue.use(uploader)
|
||||
Vue.use(less)
|
||||
Vue.use(Router)
|
||||
Vue.prototype.$axios = axios
|
||||
export default new Router({
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'login',
|
||||
component: login
|
||||
},
|
||||
{
|
||||
path: '/main',
|
||||
name: 'main',
|
||||
component: main
|
||||
},
|
||||
{
|
||||
path: '/finger',
|
||||
name: 'finger',
|
||||
component: finger
|
||||
},
|
||||
{
|
||||
path: '/admin',
|
||||
name: 'admin',
|
||||
component: admin
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -0,0 +1,17 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
|
||||
import { createPersistedState, createSharedMutations } from 'vuex-electron'
|
||||
|
||||
import modules from './modules'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
export default new Vuex.Store({
|
||||
modules,
|
||||
plugins: [
|
||||
createPersistedState(),
|
||||
createSharedMutations()
|
||||
],
|
||||
strict: process.env.NODE_ENV !== 'production'
|
||||
})
|
||||
@@ -0,0 +1,25 @@
|
||||
const state = {
|
||||
main: 0
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
DECREMENT_MAIN_COUNTER (state) {
|
||||
state.main--
|
||||
},
|
||||
INCREMENT_MAIN_COUNTER (state) {
|
||||
state.main++
|
||||
}
|
||||
}
|
||||
|
||||
const actions = {
|
||||
someAsyncTask ({ commit }) {
|
||||
// do something async
|
||||
commit('INCREMENT_MAIN_COUNTER')
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* The file enables `@/store/index.js` to import all vuex modules
|
||||
* in a one-shot manner. There should not be any reason to edit this file.
|
||||
*/
|
||||
|
||||
const files = require.context('.', false, /\.js$/)
|
||||
const modules = {}
|
||||
|
||||
files.keys().forEach(key => {
|
||||
if (key === './index.js') return
|
||||
modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default
|
||||
})
|
||||
|
||||
export default modules
|
||||