5个文件已删除
240 文件已重命名
8个文件已添加
5个文件已修改
New file |
| | |
| | | <service> |
| | | <id>ResMeterManager</id> |
| | | <name>ResMeterManager</name> |
| | | <description>内阻计测方式xml文件解析 java服务</description> |
| | | <executable>"%BASE%\runtime\bin\java"</executable> |
| | | <arguments>-jar -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=2048m -Xms1024m -Xmx2048m "%BASE%\ResMeterManager.jar"</arguments> |
| | | <!-- 服务启动方式:Automatic, Manual, Boot, System --> |
| | | <startmode>Automatic</startmode> |
| | | <onfailure action="restart" delay="10 sec"/> |
| | | <onfailure action="restart" delay="20 sec"/> |
| | | <!-- 日志保存路径 --> |
| | | <logpath>%BASE%\logs</logpath> |
| | | <!-- 日志保存方式 --> |
| | | <log mode="roll-by-size-time"> |
| | | <sizeThreshold>10240</sizeThreshold> |
| | | <pattern>yyyyMMdd</pattern> |
| | | <autoRollAtTime>00:00:00</autoRollAtTime> |
| | | <zipOlderThanNumDays>5</zipOlderThanNumDays> |
| | | <zipDateFormat>yyyyMM</zipDateFormat> |
| | | </log> |
| | | </service> |
New file |
| | |
| | | The MIT License (MIT) |
| | | Copyright (c) 2022 whyc |
| | | |
| | | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
| | | |
| | | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
| | | |
| | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
New file |
| | |
| | | @echo off |
| | | ::echo 当前盘符:%~d0 |
| | | %~d0 |
| | | ::echo %cd% |
| | | cd %~dp0 |
| | | echo %cd% |
| | | set java_path=%cd%\runtime\bin\java.exe |
| | | |
| | | wmic process where "ExecutablePath='%java_path:\=\\%'" call terminate |
| | | |
| | | ResMeterManager.exe stop |
| | | ResMeterManager.exe uninstall |
| | | exit |
New file |
| | |
| | | @echo off |
| | | ::echo 当前盘符:%~d0 |
| | | %~d0 |
| | | ::echo %cd% |
| | | cd %~dp0 |
| | | echo %cd% |
| | | |
| | | ResMeterManager.exe stop |
| | | ResMeterManager.exe uninstall |
| | | ResMeterManager.exe install |
| | | ResMeterManager.exe start |
| | | exit |
New file |
| | |
| | | @echo off |
| | | ::echo 当前盘符:%~d0 |
| | | %~d0 |
| | | ::echo %cd% |
| | | cd %~dp0 |
| | | echo %cd% |
| | | |
| | | set java_path=%cd%\runtime\bin\java.exe |
| | | |
| | | wmic process where "ExecutablePath='%java_path:\=\\%'" call terminate |
| | | |
| | | exit |
| | |
| | | }, |
| | | "main": "background.js", |
| | | "dependencies": { |
| | | "@electron/remote": "^2.0.8", |
| | | "core-js": "^3.6.5", |
| | | "tree-kill": "^1.2.2", |
| | | "vue": "2.6.10", |
| | | "vue-router": "3.0.6", |
| | | "axios": "0.18.1", |
| | | "vue-layer": "^1.2.0", |
| | | "electron-log": "^4.4.8", |
| | | "vue-template-compiler": "2.6.10" |
| | | }, |
| | | "devDependencies": { |
| | |
| | | "less-loader": "^6.2.0", |
| | | "sass": "1.26.8", |
| | | "sass-loader": "8.0.2", |
| | | "minimal-request-promise": "^1.5.0", |
| | | "vue-cli-plugin-electron-builder": "~2.1.1" |
| | | }, |
| | | "eslintConfig": { |
| | |
| | | 'use strict' |
| | | |
| | | const { app, protocol, BrowserWindow, Menu, ipcMain, ipcRenderer } = require('electron'); |
| | | const { app, protocol, BrowserWindow, Menu, ipcMain, dialog, shell } = require('electron'); |
| | | const { createProtocol } = require('vue-cli-plugin-electron-builder/lib'); |
| | | const path = require('path'); |
| | | const child_process = require('child_process'); |
| | | const log = require('electron-log'); |
| | | const appUrl = 'http://localhost:8099/fbx/test/hello'; |
| | | const requestPromise = require('minimal-request-promise'); |
| | | const remote = require('@electron/remote/main'); |
| | | remote.initialize(); |
| | | |
| | | const isDevelopment = process.env.NODE_ENV !== 'production' |
| | | let win = null; |
| | | let loadingWin = null; |
| | | |
| | | |
| | | // 单例锁 |
| | | const gotTheLock = app.requestSingleInstanceLock() |
| | |
| | | if (win) { |
| | | if (win.isMinimized()) win.restore() |
| | | win.focus() |
| | | // TODO 双击文件 打开程序时 发送的事件 |
| | | if (commandLine[2]) { |
| | | win.webContents.send('selected-file', { filePaths: [commandLine[2]] }, 'MenuList'); |
| | | } |
| | | } |
| | | }) |
| | | |
| | |
| | | |
| | | // loading 窗口 |
| | | const loadingURL = isDevelopment ? path.join(__dirname, './loading.html') : `file://${__dirname}/loading.html`; |
| | | const showLoading = (cb) => { |
| | | const showLoading = (cb, argFn) => { |
| | | loadingWin = new BrowserWindow({ |
| | | // show: false, |
| | | frame: false, |
| | |
| | | loadingWin.loadURL(loadingURL); |
| | | loadingWin.setSkipTaskbar(true); |
| | | // loadingWin.show(); |
| | | cb(true); |
| | | cb(true, argFn); |
| | | // 启动java程序 |
| | | if (platform === 'win32') { |
| | | ipcMain.once('renderer-ready', (event, data) => { |
| | | let dir = path.resolve(__dirname, '..'); |
| | | serverProcess = require('child_process').execFile(dir + '/app_x64.exe'); |
| | | // if (platform === 'win32') { |
| | | // ipcMain.once('renderer-ready', (event, data) => { |
| | | // let dir = path.resolve(__dirname, '..'); |
| | | // serverProcess = require('child_process').execFile(dir + '/app_x64.exe'); |
| | | // }); |
| | | // } |
| | | requestPromise.get(appUrl).then(function () { |
| | | log.info('窗口初始化 服务正常'); |
| | | // ipcRenderer.send('java-ready'); |
| | | loadingWin.webContents.send('java-ready'); |
| | | }, function () { |
| | | log.info('窗口初始化 接口不通 重启服务'); |
| | | child_process.exec(`"${process.cwd()}\\ResMeterManager.exe" restart`, (err) => { |
| | | if (err) { |
| | | log.info('重启服务出错了stderr: ' + JSON.stringify(err)); |
| | | return |
| | | } |
| | | log.info('服务重启成功,连接中'); |
| | | // 等到服务就绪再重启 |
| | | checkService(() => { |
| | | loadingWin.webContents.send('java-ready'); |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // let appUrl = 'http://localhost:8099/test/hello'; |
| | | const platform = process.platform |
| | | let appStarted = false |
| | | const checkService = function (cb) { |
| | | requestPromise.get(appUrl).then(function (response) { |
| | | log.info(response); |
| | | log.info('Server started!'); |
| | | cb(); |
| | | }, function (response) { |
| | | log.warn(response); |
| | | log.info('Waiting for the server start...'); |
| | | setTimeout(function () { |
| | | checkService(cb); |
| | | }, 500) |
| | | }) |
| | | } |
| | | |
| | | // const platform = process.platform |
| | | let serverProcess |
| | | |
| | | if (!isDevelopment) { |
| | | Menu.setApplicationMenu(null); |
| | | } |
| | | async function createWindow(wait) { |
| | | async function createWindow(wait, cb) { |
| | | // Create the browser window. |
| | | win = new BrowserWindow({ |
| | | show: !wait, |
| | | width: 1200, |
| | | height: 800, |
| | | icon: `${__static}/icon/icon.png`, |
| | | width: 1000, |
| | | height: 600, |
| | | webPreferences: { |
| | | // webSecurity: false, |
| | | // Use pluginOptions.nodeIntegration, leave this alone |
| | | // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info |
| | | // nodeIntegration: true, |
| | | // contextIsolation: false |
| | | // nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION, |
| | | // contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION |
| | | nodeIntegration: false, |
| | |
| | | allowRunningInsecureContent: false, |
| | | contextIsolation: true, |
| | | enableRemoteModule: false, |
| | | preload: path.join(__dirname, './preload.js') |
| | | // preload: `${__dirname}/preload.js` |
| | | preload: path.join(__dirname, 'preload.js') |
| | | } |
| | | }); |
| | | }) |
| | | |
| | | // remote.enable(win.webContents); |
| | | if (process.env.WEBPACK_DEV_SERVER_URL) { |
| | | // Load the url of the dev server if in development mode |
| | | await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL) |
| | |
| | | } else { |
| | | createProtocol('app') |
| | | // Load the index.html when not in development |
| | | // win.webContents.openDevTools(); |
| | | win.loadURL('app://./index.html') |
| | | } |
| | | |
| | | if (wait) { |
| | | ipcMain.once("main-window-ready", () => { |
| | | ipcMain.on("java-ready", () => { |
| | | log.info('java-ready!'); |
| | | loadingWin.hide(); |
| | | loadingWin.close(); |
| | | win.show(); |
| | | }); |
| | | } |
| | | |
| | | if (cb && 'function' == typeof cb) { |
| | | win.once('ready-to-show', () => { |
| | | cb(win.webContents); |
| | | }) |
| | | } |
| | | |
| | | // 自动检测更新 软件的第一个实例打开后 为了不影响加载速度 在指定时间后做一次自检 |
| | | // win.once('ready-to-show', () => { |
| | | // log.info('ready event'); |
| | | // // TODO |
| | | // setTimeout(() => { |
| | | // update(win.webContents, true); |
| | | // }, 1000 * 30); |
| | | // }); |
| | | |
| | | win.webContents.session.on('will-download', (e, item) => { |
| | | //监听下载结束事件 |
| | | item.on('done', (e, state) => { |
| | | //如果窗口还在的话,去掉进度条 |
| | | // if (!win.isDestroyed()) { |
| | | // win.setProgressBar(-1); |
| | | // } |
| | | //下载被取消或中断了 |
| | | if (state === 'interrupted') { |
| | | dialog.showErrorBox('下载失败', `文件 ${item.getFilename()} 因为某些原因被中断下载`); |
| | | } |
| | | // 下载成功后打开文件所在文件夹 |
| | | if (state === 'completed') { |
| | | setTimeout(() => { |
| | | shell.showItemInFolder(item.getSavePath()) |
| | | }, 1000); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | // Quit when all windows are closed. |
| | | app.on('window-all-closed', (e) => { |
| | | if (serverProcess && process.platform !== 'darwin') { |
| | | e.preventDefault() |
| | | const kill = require('tree-kill') |
| | | kill(serverProcess.pid, 'SIGTERM', function () { |
| | | console.log('Server process killed') |
| | | serverProcess = null |
| | | app.quit() |
| | | }) |
| | | } else { |
| | | // On macOS it is common for applications and their menu bar |
| | | // to stay active until the user quits explicitly with Cmd + Q |
| | | if (process.platform !== 'darwin') { |
| | | app.quit() |
| | | } |
| | | app.on('window-all-closed', () => { |
| | | // On macOS it is common for applications and their menu bar |
| | | // to stay active until the user quits explicitly with Cmd + Q |
| | | if (process.platform !== 'darwin') { |
| | | app.quit() |
| | | } |
| | | }) |
| | | |
| | | app.on('activate', () => { |
| | | // On macOS it's common to re-create a window in the app when the |
| | | // dock icon is clicked and there are no other windows open. |
| | | if (BrowserWindow.getAllWindows().length === 0 && appStarted) createWindow() |
| | | if (BrowserWindow.getAllWindows().length === 0) createWindow() |
| | | }) |
| | | |
| | | // This method will be called when Electron has finished |
| | | // initialization and is ready to create browser windows. |
| | | // Some APIs can only be used after this event occurs. |
| | | |
| | | // const startUp = function () { |
| | | // const requestPromise = require('minimal-request-promise') |
| | | // requestPromise.get(appUrl).then(function (response) { |
| | | // // require('child_process').spawn('cmd.exe', ['/c', 'echo '+JSON.stringify(response)+' success >> 123.txt']) |
| | | // console.log(response); |
| | | // console.log('Server started!'); |
| | | // ipcRenderer.sendSync('java-ready'); |
| | | // // createWindow(); |
| | | // appStarted = true |
| | | // }, function (response) { |
| | | // console.log(response) |
| | | // // console.log('Waiting for the server start...'); |
| | | // // require('child_process').spawn('cmd.exe', ['/c', 'echo '+JSON.stringify(response)+' error >> 123.txt']) |
| | | // setTimeout(function () { |
| | | // startUp() |
| | | // }, 500) |
| | | // }) |
| | | // } |
| | | // // 启动java程序 |
| | | // if (isDevelopment) { |
| | | // serverProcess = true; |
| | | // } else { |
| | | // if (platform === 'win32') { |
| | | // ipcMain.once('renderer-ready', (event, data) => { |
| | | // serverProcess = require('child_process').execFile(__dirname + '/app_x64.exe'); |
| | | // startUp(); |
| | | // }); |
| | | // } |
| | | // } |
| | | // 禁用本地缓存 |
| | | // app.commandLine.appendSwitch("--disable-http-cache"); |
| | | |
| | | app.on('ready', async () => { |
| | | // require('child_process').spawn('cmd.exe', ['/c', 'echo ready >> 123.txt']) |
| | | // startUp(); |
| | | log.info('app ready event'); |
| | | let cb = undefined; |
| | | if (process.argv[1]) { |
| | | cb = (sender) => { |
| | | log.info('call selected-file..' + process.argv[1]); |
| | | sender.send('selected-file', { filePaths: [process.argv[1]] }, 'MenuList'); |
| | | } |
| | | } |
| | | if (isDevelopment) { |
| | | createWindow(); |
| | | } else { |
| | | showLoading(createWindow); |
| | | showLoading(createWindow, cb); |
| | | } |
| | | }) |
| | | |
| | | app.on('will-quit', () => { |
| | | // 注销快捷键 |
| | | globalShortcut.unregister('CommandOrControl+X') |
| | | ipcMain.on('open-file-dialog', (event, data) => { |
| | | log.info('open file dialog') |
| | | dialog.showOpenDialog({ |
| | | filters: [{ name: 'all', extensions: ['fbx', 'fbxc', 'mcp', 'mch', 'bres', 'alm'] }, { name: 'fbx', extensions: ['fbx', 'fbxc'] }, { name: 'fbs', extensions: ["mcp", "mch"] }, { name: 'res', extensions: ["bres"] }, { name: 'alm', extensions: ["alm"] }], |
| | | properties: ['openFile'] |
| | | }).then((files) => { |
| | | // console.log(files, '0000000') |
| | | if (files) { |
| | | event.sender.send('selected-file', files, data); |
| | | } |
| | | }) |
| | | }); |
| | | |
| | | // 注销所有快捷键 |
| | | globalShortcut.unregisterAll() |
| | | }) |
| | | // app.on('will-quit', () => { |
| | | // // 注销快捷键 |
| | | // globalShortcut.unregister('CommandOrControl+X') |
| | | |
| | | // // 注销所有快捷键 |
| | | // globalShortcut.unregisterAll() |
| | | // }) |
| | | // Exit cleanly on request from parent process in development mode. |
| | | if (isDevelopment) { |
| | | if (process.platform === 'win32') { |
| | |
| | | ipcRenderer |
| | | } = require('electron'); |
| | | |
| | | const validChannels = ['renderer-ready', 'main-window-ready']; |
| | | const validChannels = [ |
| | | 'renderer-ready', |
| | | 'main-window-ready', |
| | | 'open-file-dialog', |
| | | 'selected-file', |
| | | "show-save-dialog", |
| | | "java-ready" |
| | | ]; |
| | | |
| | | |
| | | |
| | | contextBridge.exposeInMainWorld('api', { |
| | | send: (channel, data) => { |
| | |
| | | ipcRenderer.send(channel, data); |
| | | } |
| | | }, |
| | | receive: (channel, func) => { |
| | | receive: (channel, func, replace) => { |
| | | if (validChannels.includes(channel)) { |
| | | console.log('receive: ' + channel); |
| | | // console.log('receive: ' + channel); |
| | | // 如果replace 则channel事件会被覆盖 避免重复触发 |
| | | if (replace) { |
| | | ipcRenderer._events[channel] = []; |
| | | } |
| | | ipcRenderer.on(channel, (event, ...args) => func(...args)); |
| | | } |
| | | } |
| | |
| | | }, |
| | | // 结果页面 |
| | | { |
| | | path: '/result', |
| | | path: '/result-fbx', |
| | | name: 'result', |
| | | meta: {}, |
| | | component: () => import('@/views/result') |
| | | } |
| | | }, |
| | | { |
| | | path: '/result-mcp', |
| | | name: 'result-mcp', |
| | | meta: {}, |
| | | component: () => import('@/views/result-mcp') |
| | | }, |
| | | { |
| | | path: '/result-res', |
| | | name: 'result-res', |
| | | meta: {}, |
| | | component: () => import('@/views/result-res') |
| | | }, |
| | | // { |
| | | // path: '/result', |
| | | // name: 'result', |
| | | // meta: {}, |
| | | // component: () => import('@/views/result') |
| | | // } |
| | | ]; |
New file |
| | |
| | | <template> |
| | | <flex-layout> |
| | | <div class="content_header" slot="header"> |
| | | <three-btn @click="goSelect">选择文件</three-btn> |
| | | <three-btn @click="exportExcel">导出</three-btn> |
| | | <div class="summary"> |
| | | <div class="summary-item"> |
| | | 记录开始时间:<span>{{ summary.testStartTime }}</span> |
| | | </div> |
| | | <div class="summary-item"> |
| | | 测试类型:<span>{{ summary.testType }}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="main"> |
| | | <div class="flex-row"> |
| | | <div class="flex-row-inner contain-flex-column"> |
| | | <div class="item"> |
| | | <flex-box class="item-inner" size="mini" title="组端电压折线图"> |
| | | <normal-lines |
| | | id="groupVol" |
| | | ref="groupVol" |
| | | unit="V" |
| | | ></normal-lines> |
| | | </flex-box> |
| | | </div> |
| | | <div class="item"> |
| | | <flex-box class="item-inner" size="mini" title="电池电流折线图"> |
| | | <normal-lines |
| | | id="groupCurr" |
| | | ref="groupCurr" |
| | | unit="A" |
| | | ></normal-lines> |
| | | </flex-box> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="flex-row"> |
| | | <div class="flex-row-inner contain-flex-column"> |
| | | <div class="item"> |
| | | <flex-box class="item-inner" size="mini" title="单体电压折线图"> |
| | | <normal-lines id="vol" ref="vol" unit="V"></normal-lines> |
| | | </flex-box> |
| | | </div> |
| | | <div class="item"> |
| | | <flex-box class="item-inner" size="mini" :title="optsTitle"> |
| | | <!-- <div slot="tools" class="chart-tools-wrapper"> |
| | | <el-select |
| | | v-model="chartType" |
| | | size="mini" |
| | | @change="changeChartType" |
| | | > |
| | | <el-option |
| | | v-for="item in chartTypes" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </div> --> |
| | | <normal-lines id="other" ref="other"></normal-lines> |
| | | </flex-box> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 导出用的图表 可变的那组图 --> |
| | | <div class="hideContain"> |
| | | <normal-lines id="hideChart" ref="hideChart"></normal-lines> |
| | | </div> |
| | | </flex-layout> |
| | | </template> |
| | | |
| | | <script> |
| | | import NormalLines from "@/components/myCharts/NormalLines"; |
| | | import FlexBox from "@/components/FlexBox"; |
| | | import ThreeBtn from "@/components/ThreeBtn"; |
| | | import axios from "@/assets/js/axios"; |
| | | const dataType = { |
| | | 0xfa: "放电", |
| | | 0xfb: "充电" |
| | | }; |
| | | |
| | | export default { |
| | | name: "", |
| | | components: { |
| | | NormalLines, |
| | | FlexBox, |
| | | ThreeBtn, |
| | | }, |
| | | data() { |
| | | let info = this.$route.query.data; |
| | | let { fbsDatas, monitorDataInfo, file_type } = info; |
| | | let lastRecord = fbsDatas[fbsDatas.length - 1]; |
| | | return { |
| | | info, |
| | | battInf: monitorDataInfo.battparam, |
| | | testCapOption: null, |
| | | // tempEnviOption: null, |
| | | // humiEnviOption: null, |
| | | summary: { |
| | | testStartTime: monitorDataInfo.monitorstate.startDT.time, |
| | | testType: dataType[file_type] || '未知', |
| | | }, |
| | | optsTitle: '测试容量折线图' |
| | | }; |
| | | }, |
| | | methods: { |
| | | formatData() { |
| | | let { fbsDatas, monitorDataInfo } = this.info; |
| | | // console.log(fbsDatas, fbsDatasStart, fbsDatasStop, "=====data?"); |
| | | let monCount = monitorDataInfo.battparam.eachGroupBattCount; |
| | | let times = [], |
| | | groupVol = [], |
| | | groupCurr = [], |
| | | testCap = [], |
| | | |
| | | // actualCap = [], |
| | | // residualCap = [], |
| | | // residualTime = [], |
| | | // PosInsRes = [], |
| | | // NegInsRes = [], |
| | | // humiEnvi = [], |
| | | SingleVol = []; |
| | | for (let i = 0, j = monCount; i < j; i++) { |
| | | SingleVol[i] = { |
| | | name: "#" + (i + 1) + "电压", |
| | | type: "line", |
| | | symbolSize: 0, |
| | | sampling: "average", |
| | | data: [], |
| | | }; |
| | | } |
| | | |
| | | for (let i = 0, j = fbsDatas.length; i < j; i++) { |
| | | let item = fbsDatas[i]; |
| | | let testtime = item.testTime; |
| | | let hour = testtime.hour > 9 ? testtime.hour : "0" + testtime.hour; |
| | | let minute = |
| | | testtime.minute > 9 ? testtime.minute : "0" + testtime.minute; |
| | | let second = |
| | | testtime.second > 9 ? testtime.second : "0" + testtime.second; |
| | | let time = "" + hour + ":" + minute + ":" + second; |
| | | // 时间 |
| | | times.push(time); |
| | | // 总电压 |
| | | groupVol.push(item.vcData.groupvol[0]); |
| | | // 总电流 |
| | | groupCurr.push(item.vcData.battcurr[0]); |
| | | // 测试容量 |
| | | testCap.push(item.vcData.battcap[0]); |
| | | // 实际容量 |
| | | // actualCap.push(item.actualCap); |
| | | // 剩余容量 |
| | | // residualCap.push(item.residualCap); |
| | | // 剩余时间 |
| | | // residualTime.push(item.residualTime); |
| | | // 正极绝缘电阻 |
| | | // PosInsRes.push(item.PosInsRes); |
| | | // 负极绝缘电阻 |
| | | // NegInsRes.push(item.NegInsRes); |
| | | // 环境温度 |
| | | // tempEnvi.push(item.Temp_Envi); |
| | | // 环境湿度 |
| | | // humiEnvi.push(item.Humi_Envi); |
| | | // 单体电压 |
| | | for (let m = 0, n = monCount; m < n; m++) { |
| | | SingleVol[m].data.push(item.mvol.vol[m]); |
| | | } |
| | | } |
| | | let groupVolOption = { |
| | | xData: times, |
| | | series: [ |
| | | { |
| | | name: "组端电压", |
| | | type: "line", |
| | | symbolSize: 0, |
| | | sampling: "average", |
| | | data: groupVol, |
| | | }, |
| | | ], |
| | | }; |
| | | let currOption = { |
| | | xData: times, |
| | | series: [ |
| | | { |
| | | name: "电流", |
| | | type: "line", |
| | | symbolSize: 0, |
| | | sampling: "average", |
| | | data: groupCurr, |
| | | }, |
| | | ], |
| | | }; |
| | | let volOption = { |
| | | xData: times, |
| | | series: SingleVol, |
| | | }; |
| | | let testCapOption = { |
| | | unit: "AH", |
| | | xData: times, |
| | | series: [ |
| | | { |
| | | name: "测试容量", |
| | | type: "line", |
| | | symbolSize: 0, |
| | | sampling: "average", |
| | | data: testCap, |
| | | }, |
| | | ], |
| | | }; |
| | | this.testCapOption = testCapOption; |
| | | // this.tempEnviOption = tempEnviOption; |
| | | // this.humiEnviOption = humiEnviOption; |
| | | |
| | | this.$refs.groupVol.setData(groupVolOption); |
| | | this.$refs.groupCurr.setData(currOption); |
| | | this.$refs.vol.setData(volOption); |
| | | this.$refs.other.setData(testCapOption); |
| | | // 建立联动 |
| | | this.$G.chartManage.connect(["groupVol", "groupCurr", "vol", "other"]); |
| | | }, |
| | | // changeChartType(v) { |
| | | // let label = this.chartTypes.filter((val) => { |
| | | // return val.value == v; |
| | | // })[0].label; |
| | | // this.optsTitle = label + "折线图"; |
| | | // this.$refs.other.setData(this[v + "Option"]); |
| | | // }, |
| | | goSelect() { |
| | | this.$router.push({ path: "/selectFile", query: { reselect: 1 } }); |
| | | }, |
| | | // 导出报表 |
| | | exportExcel() { |
| | | // 容量折线图 |
| | | let arr = ["testCap", "tempEnvi", "humiEnvi"]; |
| | | let o_pic = {}; |
| | | arr.forEach((v) => { |
| | | let option = this[v + "Option"]; |
| | | this.$refs.hideChart.setData(option); |
| | | o_pic[v] = this.$refs.hideChart.getDataURL(); |
| | | }); |
| | | let params = { |
| | | filePath: this.info.filePath, |
| | | groupVol_echart: this.$refs.groupVol.getDataURL(), |
| | | curr_echart: this.$refs.groupCurr.getDataURL(), |
| | | vol_echart: this.$refs.vol.getDataURL(), |
| | | tempEnvi_echart: o_pic.tempEnvi, |
| | | humiEnvi_echart: o_pic.humiEnvi, |
| | | }; |
| | | // if (this.capTest) { |
| | | // params.cap_echart = o_pic.testCap; |
| | | // } |
| | | |
| | | let baseURL = axios.defaults.baseURL; |
| | | baseURL = baseURL ? baseURL : ""; |
| | | var actionUrl = baseURL + "export"; |
| | | this.construtFormSubmit(actionUrl, params); |
| | | }, |
| | | construtFormSubmit(actionUrl, parms) { |
| | | var form = document.createElement("form"); |
| | | form.id = "specialGraph"; |
| | | form.style.display = "none"; |
| | | form.action = actionUrl; |
| | | form.enctype = "multipart/form-data"; |
| | | form.method = "post"; |
| | | document.body.appendChild(form); |
| | | |
| | | for (var key in parms) { |
| | | var input = document.createElement("input"); |
| | | input.type = "hidden"; |
| | | input.name = key; |
| | | input.value = parms[key]; |
| | | form.appendChild(input); |
| | | } |
| | | form.submit(); |
| | | document.body.removeChild(form); |
| | | }, |
| | | }, |
| | | |
| | | mounted() { |
| | | console.log(this.info, this); |
| | | if (!this.info || !this.info.fbsDatas) { |
| | | this.$router.push("/selectFile"); |
| | | } else { |
| | | this.formatData(); |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .main { |
| | | height: 100%; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-between; |
| | | } |
| | | .flex-row { |
| | | flex: 1; |
| | | position: relative; |
| | | } |
| | | .item-inner, |
| | | .flex-row-inner { |
| | | position: absolute; |
| | | left: 0; |
| | | top: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | } |
| | | .contain-flex-column { |
| | | display: flex; |
| | | flex-direction: row; |
| | | } |
| | | .item { |
| | | background: #0d43a7; |
| | | flex: 1; |
| | | position: relative; |
| | | } |
| | | .content_header { |
| | | padding: 8px 8px 12px; |
| | | display: flex; |
| | | color: #fff; |
| | | align-items: center; |
| | | } |
| | | .summary { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | } |
| | | .summary-item { |
| | | margin-left: 1em; |
| | | } |
| | | .summary-item span { |
| | | color: #ff0; |
| | | } |
| | | >>> .three-btn { |
| | | flex-shrink: 0; |
| | | } |
| | | >>> .three-btn + .three-btn { |
| | | margin-left: 8px; |
| | | } |
| | | .item + .item { |
| | | margin-left: 8px; |
| | | } |
| | | .flex-row + .flex-row { |
| | | margin-top: 8px; |
| | | } |
| | | .hideContain { |
| | | position: absolute; |
| | | width: 0; |
| | | height: 0; |
| | | display: none; |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <flex-layout> |
| | | <div class="content_header" slot="header"> |
| | | <three-btn @click="goSelect">选择文件</three-btn> |
| | | <three-btn @click="exportExcel">导出</three-btn> |
| | | <div class="summary"> |
| | | <div class="summary-item"> |
| | | 测试类型:<span>内阻测试</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="main"> |
| | | <div class="flex-row"> |
| | | <div class="flex-row-inner contain-flex-column"> |
| | | <div class="item"> |
| | | <flex-box class="item-inner" size="mini" title="单体电压折线图"> |
| | | <normal-lines |
| | | id="vol" |
| | | ref="vol" |
| | | unit="V" |
| | | ></normal-lines> |
| | | </flex-box> |
| | | </div> |
| | | <div class="item"> |
| | | <flex-box class="item-inner" size="mini" title="单体内阻折线图"> |
| | | <normal-lines |
| | | id="res" |
| | | ref="res" |
| | | unit="mΩ" |
| | | ></normal-lines> |
| | | </flex-box> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="flex-row"> |
| | | <div class="flex-row-inner contain-flex-column"> |
| | | <div class="item"> |
| | | <flex-box class="item-inner" size="mini" title="单体温度折线图"> |
| | | <normal-lines id="temp" ref="temp" unit="℃"></normal-lines> |
| | | </flex-box> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 导出用的图表 可变的那组图 --> |
| | | <div class="hideContain"> |
| | | <normal-lines id="hideChart" ref="hideChart"></normal-lines> |
| | | </div> |
| | | </flex-layout> |
| | | </template> |
| | | |
| | | <script> |
| | | import NormalLines from "@/components/myCharts/NormalLines"; |
| | | import FlexBox from "@/components/FlexBox"; |
| | | import ThreeBtn from "@/components/ThreeBtn"; |
| | | import axios from "@/assets/js/axios"; |
| | | |
| | | export default { |
| | | name: "", |
| | | components: { |
| | | NormalLines, |
| | | FlexBox, |
| | | ThreeBtn, |
| | | }, |
| | | data() { |
| | | let info = this.$route.query.data; |
| | | let { resDatas } = info; |
| | | let lastRecord = resDatas[resDatas.length - 1]; |
| | | return { |
| | | info, |
| | | testCapOption: null, |
| | | optsTitle: '测试容量折线图' |
| | | }; |
| | | }, |
| | | methods: { |
| | | formatData() { |
| | | let { resDatas } = this.info; |
| | | // console.log(resDatas, resDatasStart, resDatasStop, "=====data?"); |
| | | let monCount = resDatas[0] ? resDatas[0].battSum : 0; |
| | | let times = [], |
| | | vol = [], |
| | | res = [], |
| | | temp = []; |
| | | for (let i = 0, j = monCount; i < j; i++) { |
| | | vol[i] = { |
| | | name: "#" + (i + 1) + "电压", |
| | | type: "line", |
| | | symbolSize: 0, |
| | | sampling: "average", |
| | | data: [], |
| | | }; |
| | | res[i] = { |
| | | name: "#" + (i + 1) + "内阻", |
| | | type: "line", |
| | | symbolSize: 0, |
| | | sampling: "average", |
| | | data: [], |
| | | }; |
| | | temp[i] = { |
| | | name: "#" + (i + 1) + "温度", |
| | | type: "line", |
| | | symbolSize: 0, |
| | | sampling: "average", |
| | | data: [], |
| | | }; |
| | | } |
| | | |
| | | for (let i = 0, j = resDatas.length; i < j; i++) { |
| | | let item = resDatas[i]; |
| | | let testtime = item.data_Time; |
| | | // 时间 |
| | | times.push(testtime); |
| | | |
| | | for (let m = 0, n = monCount; m < n; m++) { |
| | | vol[m].data.push(item.monomerVol[m]); |
| | | res[m].data.push(item.monomerRes[m]); |
| | | temp[m].data.push(item.monomerTemp[m]); |
| | | } |
| | | } |
| | | let volOption = { |
| | | xData: times, |
| | | series: vol, |
| | | }; |
| | | let resOption = { |
| | | xData: times, |
| | | series: res, |
| | | }; |
| | | let tempOption = { |
| | | xData: times, |
| | | series: temp, |
| | | }; |
| | | |
| | | this.$refs.vol.setData(volOption); |
| | | this.$refs.res.setData(resOption); |
| | | this.$refs.temp.setData(tempOption); |
| | | // 建立联动 |
| | | this.$G.chartManage.connect(["vol", "res", "temp"]); |
| | | }, |
| | | // changeChartType(v) { |
| | | // let label = this.chartTypes.filter((val) => { |
| | | // return val.value == v; |
| | | // })[0].label; |
| | | // this.optsTitle = label + "折线图"; |
| | | // this.$refs.other.setData(this[v + "Option"]); |
| | | // }, |
| | | goSelect() { |
| | | this.$router.push({ path: "/selectFile", query: { reselect: 1 } }); |
| | | }, |
| | | // 导出报表 |
| | | exportExcel() { |
| | | let params = { |
| | | filePath: this.info.filePath, |
| | | vol_echart: this.$refs.vol.getDataURL(), |
| | | res_echart: this.$refs.res.getDataURL(), |
| | | tmp_echart: this.$refs.temp.getDataURL(), |
| | | }; |
| | | // if (this.capTest) { |
| | | // params.cap_echart = o_pic.testCap; |
| | | // } |
| | | |
| | | let baseURL = axios.defaults.baseURL; |
| | | baseURL = baseURL ? baseURL : ""; |
| | | var actionUrl = baseURL + "export"; |
| | | this.construtFormSubmit(actionUrl, params); |
| | | }, |
| | | construtFormSubmit(actionUrl, parms) { |
| | | var form = document.createElement("form"); |
| | | form.id = "specialGraph"; |
| | | form.style.display = "none"; |
| | | form.action = actionUrl; |
| | | form.enctype = "multipart/form-data"; |
| | | form.method = "post"; |
| | | document.body.appendChild(form); |
| | | |
| | | for (var key in parms) { |
| | | var input = document.createElement("input"); |
| | | input.type = "hidden"; |
| | | input.name = key; |
| | | input.value = parms[key]; |
| | | form.appendChild(input); |
| | | } |
| | | form.submit(); |
| | | document.body.removeChild(form); |
| | | }, |
| | | }, |
| | | |
| | | mounted() { |
| | | console.log(this.info, this); |
| | | if (!this.info || !this.info.resDatas) { |
| | | this.$router.push("/selectFile"); |
| | | } else { |
| | | this.formatData(); |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .main { |
| | | height: 100%; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-between; |
| | | } |
| | | .flex-row { |
| | | flex: 1; |
| | | position: relative; |
| | | } |
| | | .item-inner, |
| | | .flex-row-inner { |
| | | position: absolute; |
| | | left: 0; |
| | | top: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | } |
| | | .contain-flex-column { |
| | | display: flex; |
| | | flex-direction: row; |
| | | } |
| | | .item { |
| | | background: #0d43a7; |
| | | flex: 1; |
| | | position: relative; |
| | | } |
| | | .content_header { |
| | | padding: 8px 8px 12px; |
| | | display: flex; |
| | | color: #fff; |
| | | align-items: center; |
| | | } |
| | | .summary { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | } |
| | | .summary-item { |
| | | margin-left: 1em; |
| | | } |
| | | .summary-item span { |
| | | color: #ff0; |
| | | } |
| | | >>> .three-btn { |
| | | flex-shrink: 0; |
| | | } |
| | | >>> .three-btn + .three-btn { |
| | | margin-left: 8px; |
| | | } |
| | | .item + .item { |
| | | margin-left: 8px; |
| | | } |
| | | .flex-row + .flex-row { |
| | | margin-top: 8px; |
| | | } |
| | | .hideContain { |
| | | position: absolute; |
| | | width: 0; |
| | | height: 0; |
| | | display: none; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="main"> |
| | | <el-upload |
| | | class="upload" |
| | | action="" |
| | | drag |
| | | :auto-upload="false" |
| | | :on-change="change" |
| | | @drop.native="drop" |
| | | accept=".fbx,.fbxc" |
| | | > |
| | | <!-- <i class="icon el-icon-plus"></i> --> |
| | | <div ref="tt" class="el-upload__text"> |
| | | 将.fbx或.fbxc文件拖到此处,或点击此处选择文件 |
| | | <div class="upload" @click="selectFile" @dragover="dragover" @drop="drop"> |
| | | <div ref="txt" class="upload__text"> |
| | | 将文件拖到此处,或点击此处选择文件 |
| | | </div> |
| | | <div class="el-upload__tip" slot="tip">只能解析.fbx和.fbxc文件</div> |
| | | </el-upload> |
| | | </div> |
| | | <div class="upload__tip" slot="tip">只能解析.fbx .fbxc .mcp .mch .bres .alm文件</div> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | console.log(file); |
| | | this.loadFile(file.raw); |
| | | }, |
| | | loadFile(file) { |
| | | if (!/\.fbxc?$/.test(file.name.toLowerCase().trim())) { |
| | | loadFile(url) { |
| | | // TODO 文件类型判断 |
| | | let arr = url.split("."); |
| | | let type = arr.length > 1 ? arr[arr.length - 1].toLowerCase() : ""; |
| | | // 支持的类型 |
| | | let allowList = ["fbx", "fbxc", "mcp", "mch", "bres", "alm"]; |
| | | |
| | | if (!allowList.some((v) => v == type)) { |
| | | this.$layer.msg("文件类型错误"); |
| | | return false; |
| | | } |
| | | let suffixes = ""; |
| | | switch (type) { |
| | | case "fbx": |
| | | case "fbxc": |
| | | suffixes = "fbx"; |
| | | break; |
| | | case "mcp": |
| | | case "mch": |
| | | suffixes = "mcp"; |
| | | break; |
| | | case "bres": |
| | | suffixes = "res"; |
| | | break; |
| | | case "alm": |
| | | suffixes = "alm"; |
| | | break; |
| | | } |
| | | let loading = this.$layer.loading(1); |
| | | axios({ |
| | | url: "readFboFile", |
| | | method: "GET", |
| | | params: { |
| | | filePath: file.path, |
| | | filePath: url, |
| | | }, |
| | | }).then((res) => { |
| | | let { |
| | | code, |
| | | data, |
| | | } = res.data; |
| | | let { code, data } = res.data; |
| | | // console.log(res, res.code, "=========res"); |
| | | this.$layer.close(loading); |
| | | if (code) { |
| | | data.filePath = file.path; |
| | | data.filePath = url; |
| | | // 解析成功 跳转到结果页面 |
| | | this.$router.push({ |
| | | path: "/result", |
| | | path: `/result-${suffixes}`, |
| | | query: { |
| | | data, |
| | | }, |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | dragover(e) { |
| | | e.preventDefault(); |
| | | return true; |
| | | }, |
| | | drop(e) { |
| | | // console.log(e); |
| | |
| | | |
| | | //获得拖拽的文件集合 |
| | | var files = e.dataTransfer.files; |
| | | console.log(files); |
| | | // console.log(files); |
| | | if (!files) { |
| | | return false; |
| | | } |
| | | this.loadFile(files[0]); |
| | | let url = files[0] ? files[0].path : ""; |
| | | |
| | | if (url) { |
| | | this.loadFile(url); |
| | | } |
| | | }, |
| | | initEvents() { |
| | | console.log('initEvents') |
| | | window.api.receive("selected-file", (path, data) => { |
| | | console.log(path, data, "selected-file"); |
| | | if (data && data == "selectFile") { |
| | | let url = path.filePaths[0]; |
| | | if (url) { |
| | | this.loadFile(path.filePaths[0]); |
| | | } |
| | | } |
| | | }, true); |
| | | }, |
| | | selectFile() { |
| | | // console.log("openfile"); |
| | | window.api.send("open-file-dialog", "selectFile"); |
| | | }, |
| | | }, |
| | | |
| | | mounted() { |
| | | this.initEvents(); |
| | | |
| | | if (this.reselect) { |
| | | this.$refs.tt.click(); |
| | | this.$refs.txt.click(); |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | <style lang="less" scoped> |
| | | .main { |
| | | height: 100%; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: center; |
| | | align-items: center; |
| | | } |
| | |
| | | display: flex; |
| | | flex-direction: column; |
| | | text-align: center; |
| | | } |
| | | >>> .el-upload { |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | >>> .el-upload-dragger { |
| | | width: 100%; |
| | | height: 100%; |
| | | display: flex; |
| | | flex-direction: column; |
| | | background: #fff; |
| | | border-radius: 8px; |
| | | justify-content: center; |
| | | } |
| | | >>> .el-upload-list { |
| | | display: none; |
| | | } |
| | | >>> .el-upload__tip { |
| | | .upload__tip { |
| | | color: #fff; |
| | | } |
| | | // >>> .el-upload { |
| | | // width: 100%; |
| | | // height: 100%; |
| | | // } |
| | | // >>> .el-upload-dragger { |
| | | // width: 100%; |
| | | // height: 100%; |
| | | // display: flex; |
| | | // flex-direction: column; |
| | | // justify-content: center; |
| | | // } |
| | | // >>> .el-upload-list { |
| | | // display: none; |
| | | // } |
| | | // >>> .el-upload__tip { |
| | | // color: #fff; |
| | | // } |
| | | </style> |