测试 用electron + springboot 构建桌面应用
he wei
2022-04-02 11a9e0be944442d3914f239890886a7419244090
U 添加分隔线
2个文件已修改
1个文件已添加
98 ■■■■■ 已修改文件
src/main/demo/public/lib/app.jar 补丁 | 查看 | 原始文档 | blame | 历史
src/main/demo/src/background.js 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/demo/src/views/result.vue 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/demo/public/lib/app.jar
Binary files differ
src/main/demo/src/background.js
@@ -21,7 +21,7 @@
      win.focus()
    }
  })
}
// Scheme must be registered before the app is ready
@@ -52,15 +52,11 @@
  // loadingWin.show();
  cb(true);
  // 启动java程序
  if (isDevelopment) {
    serverProcess = true;
  } else {
    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');
    });
  }
}
@@ -182,7 +178,11 @@
app.on('ready', async () => {
  // require('child_process').spawn('cmd.exe', ['/c', 'echo ready >> 123.txt'])
  // startUp();
  showLoading(createWindow);
  if (isDevelopment) {
    createWindow();
  } else {
    showLoading(createWindow);
  }
})
// Exit cleanly on request from parent process in development mode.
if (isDevelopment) {
src/main/demo/src/views/result.vue
@@ -1,13 +1,21 @@
<template>
  <flex-layout>
    <div class="content_header" slot="header">
      <three-btn @click="goSelect">重选文件</three-btn>
      <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 class="summary-item">正极绝缘电阻:<span>{{ summary.PosInsRes }}KΩ</span></div>
        <div class="summary-item">负极绝缘电阻:<span>{{ summary.NegInsRes }}KΩ</span></div>
        <div class="summary-item">
          记录开始时间:<span>{{ summary.testStartTime }}</span>
        </div>
        <div class="summary-item">
          测试类型:<span>{{ summary.testType }}</span>
        </div>
        <div class="summary-item">
          正极绝缘电阻:<span>{{ summary.PosInsRes }}KΩ</span>
        </div>
        <div class="summary-item">
          负极绝缘电阻:<span>{{ summary.NegInsRes }}KΩ</span>
        </div>
      </div>
    </div>
    <div class="main">
@@ -15,12 +23,20 @@
        <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>
              <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>
              <normal-lines
                id="groupCurr"
                ref="groupCurr"
                unit="A"
              ></normal-lines>
            </flex-box>
          </div>
        </div>
@@ -91,20 +107,23 @@
      {
        label: "环境湿度",
        value: "humiEnvi",
      }
      },
    ];
    let capTest = fboDataStart.DataType == 0xfd || fboDataStart.DataType == 0xfc;
    let capTest =
      fboDataStart.DataType == 0xfd || fboDataStart.DataType == 0xfc;
    return {
      info,
      capTest,
      chartType: capTest ? "testCap" : "tempEnvi",
      chartTypes: capTest ? [
        {
          label: "测试容量",
          value: "testCap",
        },
        ...chartTypes
      ] : [...chartTypes],
      chartTypes: capTest
        ? [
            {
              label: "测试容量",
              value: "testCap",
            },
            ...chartTypes,
          ]
        : [...chartTypes],
      testCapOption: null,
      tempEnviOption: null,
      humiEnviOption: null,
@@ -114,7 +133,7 @@
        PosInsRes: lastRecord.PosInsRes,
        NegInsRes: lastRecord.NegInsRes,
      },
      optsTitle: capTest ? '测试容量拆线图' : '环境温度折线图'
      optsTitle: capTest ? "测试容量拆线图" : "环境温度折线图",
    };
  },
  methods: {
@@ -204,6 +223,21 @@
          },
        ],
      };
      if (!this.capTest) {
        currOption.series[0].markLine = {
          data: [
            {
              silent: true,
              lineStyle: {
                width: 1,
                color: "#0f0",
              },
              name: "充放电分隔线",
              yAxis: 0,
            },
          ],
        };
      }
      let volOption = {
        xData: times,
        series: SingleVol,
@@ -259,12 +293,14 @@
      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 + '折线图';
      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}});
      this.$router.push({ path: "/selectFile", query: { reselect: 1 } });
    },
    // 导出报表
    exportExcel() {