From cd327dcbaca3476df44b064e56b950dc054cbb87 Mon Sep 17 00:00:00 2001
From: he wei <858544502@qq.com>
Date: 星期四, 17 十一月 2022 16:58:56 +0800
Subject: [PATCH] UA 添加自动升级检测功能 添加几种类型电池告警阀值

---
 src/pages/compare.vue         |   48 +++
 src/assets/js/const.js        |   34 ++
 resXmlParser-0.1.4-Setup.exe  |    0 
 dependent/ResMeterManager.jar |    0 
 src/background.js             |   19 +
 src/components/menuList.vue   |  323 +++++++++++++++++++++++---
 update.info.json              |    7 
 README.md                     |    4 
 latest.yml                    |   12 
 src/pages/xmlResult.vue       |  145 +++++++----
 src/preload.js                |    4 
 .env.dev                      |    2 
 src/update.js                 |   54 ++-
 pack_update5.nsi              |    8 
 package.json                  |    4 
 hash.js                       |    2 
 resXmlParser-0.1.4-update.exe |    0 
 17 files changed, 526 insertions(+), 140 deletions(-)

diff --git a/.env.dev b/.env.dev
new file mode 100644
index 0000000..a241cb8
--- /dev/null
+++ b/.env.dev
@@ -0,0 +1,2 @@
+NODE_ENV=none
+VUE_APP_ENV="none"
\ No newline at end of file
diff --git a/README.md b/README.md
index c0837df..d12c629 100644
--- a/README.md
+++ b/README.md
@@ -22,3 +22,7 @@
 
 ### Customize configuration
 See [Configuration Reference](https://cli.vuejs.org/config/).
+
+
+### update db
+http://localhost:8093/res/dataBase/createTestDataSqlite
diff --git a/dependent/ResMeterManager.jar b/dependent/ResMeterManager.jar
index d5ba08c..eb6a77f 100644
--- a/dependent/ResMeterManager.jar
+++ b/dependent/ResMeterManager.jar
Binary files differ
diff --git a/hash.js b/hash.js
index a06b131..fc55632 100644
--- a/hash.js
+++ b/hash.js
@@ -2,7 +2,7 @@
 const fs = require('fs');
 const crypto = require('crypto');
 
-const YOUR_FILE_PATH = 'resXmlParser-0.1.3-update.exe';  //  POPULATE THIS
+const YOUR_FILE_PATH = 'resXmlParser-0.1.4-update.exe';  //  POPULATE THIS
 
 function hashFile(file, algorithm = 'sha512', encoding = 'base64', options) {
   return new Promise((resolve, reject) => {
diff --git a/latest.yml b/latest.yml
index 8f116b5..864bb85 100644
--- a/latest.yml
+++ b/latest.yml
@@ -1,8 +1,8 @@
-version: 0.1.3
+version: 0.1.5
 files:
-  - url: resXmlParser-0.1.3-update.exe
-    sha512: 9/tRIzuT2jbGSwX0M0xK2ZNMtwlpfwIZ9NS3Ev1W190DfDp2h2UbIz8IAl6GLtm1Pksg1TDce5MsllY0FEbZag==
+  - url: resXmlParser-0.1.4-update.exe
+    sha512: JwxDF3BQ4uD3DwIvwu6MdTn7jmLhSK2zte+Z6jx+o35ZT5ON4BL+aW/b647bLsZ1UuihVAanQBxYL4Ou05HjpQ==
     size: 162342321
-path: resXmlParser-0.1.3-update.exe
-sha512: 9/tRIzuT2jbGSwX0M0xK2ZNMtwlpfwIZ9NS3Ev1W190DfDp2h2UbIz8IAl6GLtm1Pksg1TDce5MsllY0FEbZag==
-releaseDate: '2022-11-7T08:38:57.198Z'
+path: resXmlParser-0.1.4-update.exe
+sha512: JwxDF3BQ4uD3DwIvwu6MdTn7jmLhSK2zte+Z6jx+o35ZT5ON4BL+aW/b647bLsZ1UuihVAanQBxYL4Ou05HjpQ==
+releaseDate: '2022-11-15T08:38:57.198Z'
diff --git a/pack_update5.nsi b/pack_update5.nsi
index 8f09918..c2aabd7 100644
--- a/pack_update5.nsi
+++ b/pack_update5.nsi
@@ -2,7 +2,7 @@
 
 ; HM NIS Edit Wizard helper defines
 !define PRODUCT_NAME "resXmlParser"
-!define PRODUCT_VERSION "0.1.3"
+!define PRODUCT_VERSION "0.1.4"
 !define PRODUCT_PUBLISHER "whyc"
 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\elevate.exe"
 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
@@ -18,7 +18,7 @@
 !define MUI_ABORTWARNING
 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\res-icon.ico"
 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
-!define MUI_WELCOMEFINISHPAGE_BITMAP "bar.bmp"
+;!define MUI_WELCOMEFINISHPAGE_BITMAP "bar.bmp"
 
 ; Language Selection Dialog Settings
 !define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
@@ -42,7 +42,7 @@
 !insertmacro MUI_UNPAGE_INSTFILES
 
 ; Language files
-!insertmacro MUI_LANGUAGE "English"
+;!insertmacro MUI_LANGUAGE "English"
 !insertmacro MUI_LANGUAGE "SimpChinese"
 
 ; Reserve files
@@ -56,7 +56,7 @@
 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
 ShowInstDetails show
 ShowUnInstDetails show
-BrandingText "福光 - 武汉源畅"
+BrandingText " "
 DirText "安装向导将把 $(^NameDA) 安装在下列文件夹,升级安装不支持更改安装路径,点击 [安装(I)] 开始安装。"
 
 Function disabledDir
diff --git a/package.json b/package.json
index d0a5a93..6a092e4 100644
--- a/package.json
+++ b/package.json
@@ -1,13 +1,15 @@
 {
   "name": "electron-res",
-  "version": "0.1.4",
+  "version": "0.1.5",
   "private": true,
   "scripts": {
     "serve": "vue-cli-service serve",
     "build": "vue-cli-service build",
     "lint": "vue-cli-service lint",
     "electron:build": "vue-cli-service electron:build",
+    "electron:build:test": "vue-cli-service electron:build --mode dev",
     "electron:serve": "vue-cli-service electron:serve",
+    "electron:serve:test": "vue-cli-service electron:serve --mode dev",
     "postinstall": "electron-builder install-app-deps",
     "postuninstall": "electron-builder install-app-deps",
     "pack": "electron-builder -w",
diff --git a/resXmlParser-0.1.4-Setup.exe b/resXmlParser-0.1.4-Setup.exe
new file mode 100644
index 0000000..ad7daa1
--- /dev/null
+++ b/resXmlParser-0.1.4-Setup.exe
Binary files differ
diff --git a/resXmlParser-0.1.4-update.exe b/resXmlParser-0.1.4-update.exe
new file mode 100644
index 0000000..96015ec
--- /dev/null
+++ b/resXmlParser-0.1.4-update.exe
Binary files differ
diff --git a/src/assets/js/const.js b/src/assets/js/const.js
index 3486eab..96c8712 100644
--- a/src/assets/js/const.js
+++ b/src/assets/js/const.js
@@ -26,7 +26,22 @@
       msg: '鍙栧�艰寖鍥�0~9999'
     },
 
-
+    // 浣庡帇闃堝�硷紙1.2V锛�	0~1.2  	3
+    vol1d2LowCoeK1: {
+      pattern: /^[0-9]{1}(\.[0-9]{0,3})?$/,
+      regVal: true,
+      min: 0,
+      max: 1.2,
+      msg: '鍙栧�艰寖鍥�0~1.2(淇濈暀3浣嶅皬鏁�)'
+    },
+    // 楂樺帇闃堝�硷紙1.2V锛�	0~3	3
+    vol1d2HighCoeK2: {
+      pattern: /^[0-9]{1}(\.[0-9]{0,3})?$/,
+      regVal: true,
+      min: 0,
+      max: 3,
+      msg: '鍙栧�艰寖鍥�0~3(淇濈暀3浣嶅皬鏁�)'
+    },
     // 浣庡帇闃堝�硷紙2V锛�	0~2  	3
     vol2LowCoeK1: {
       pattern: /^[0-9]{1}(\.[0-9]{0,3})?$/,
@@ -42,6 +57,22 @@
       min: 0,
       max: 5,
       msg: '鍙栧�艰寖鍥�0~5(淇濈暀3浣嶅皬鏁�)'
+    },
+    // 浣庡帇闃堝�硷紙6V锛�	0~6  	3
+    vol6LowCoeK1: {
+      pattern: /^[0-9]{1}(\.[0-9]{0,3})?$/,
+      regVal: true,
+      min: 0,
+      max: 6,
+      msg: '鍙栧�艰寖鍥�0~6(淇濈暀3浣嶅皬鏁�)'
+    },
+    // 楂樺帇闃堝�硷紙6V锛�	0~12	3
+    vol6HighCoeK2: {
+      pattern: /^[0-9]{1,2}(\.[0-9]{0,3})?$/,
+      regVal: true,
+      min: 0,
+      max: 12,
+      msg: '鍙栧�艰寖鍥�0~12(淇濈暀3浣嶅皬鏁�)'
     },
     // 浣庡帇闃堝�硷紙12V锛�	0~12	3
     vol12LowCoeK1: {
@@ -62,6 +93,7 @@
     // 鍐呴樆鍛婅绯绘暟	0~1000	0
     // 鍐呴樆鏇存崲绯绘暟	0~1000	0
     // 杩炴帴鏉″憡璀︾郴鏁�	0~1000	0
+    // 杩炴帴鏉℃洿鎹㈢郴鏁�	0~1000	0
     resGoodCoeK3: {
       pattern: /^[0-9]{1,4}$/,
       regVal: true,
diff --git a/src/background.js b/src/background.js
index ee05c10..2563e02 100644
--- a/src/background.js
+++ b/src/background.js
@@ -32,6 +32,11 @@
  * 
  * 
  */
+Object.defineProperty(app, 'isPackaged', {
+  get() {
+    return true;
+  }
+});
 
 // 鍗曚緥閿�
 const gotTheLock = app.requestSingleInstanceLock()
@@ -100,9 +105,19 @@
   }
   if (cb && 'function' == typeof cb) {
     win.once('ready-to-show', () => {
+      log.info('900')
       cb(win.webContents);
     })
   }
+  
+  // 鑷姩妫�娴嬫洿鏂� 杞欢鐨勭涓�涓疄渚嬫墦寮�鍚� 涓轰簡涓嶅奖鍝嶅姞杞介�熷害 鍦ㄦ寚瀹氭椂闂村悗鍋氫竴娆¤嚜妫�
+  win.once('ready-to-show', () => {
+    log.info('ready event');
+    // TODO
+    setTimeout(() => {
+      update(win.webContents, true);
+    }, 1000 * 10);
+  });
 
   win.webContents.session.on('will-download', (e, item) => {
     // const filePath = path.join(saveUrl, item.getFilename());
@@ -207,6 +222,10 @@
   update(event.sender);
 });
 
+ipcMain.on('download-update', () => {
+  autoUpdater.downloadUpdate();
+});
+
 ipcMain.on('quitAndInstall', () => {
   autoUpdater.quitAndInstall();
 });
diff --git a/src/components/menuList.vue b/src/components/menuList.vue
index da328a1..41b4891 100644
--- a/src/components/menuList.vue
+++ b/src/components/menuList.vue
@@ -141,116 +141,170 @@
         <table class="table">
           <thead>
             <tr>
-              <th>绯绘暟鍚嶇О</th>
-              <th>绯绘暟鍊�</th>
-              <th>璇勪环</th>
+              <th colspan="2">
+                <div class="cell-box">
+                  涓�鑸憡璀�
+                  <div class="color warn"></div>
+                </div>
+              </th>
+              <th colspan="2">
+                <div class="cell-box">
+                  涓ラ噸鍛婅
+                  <div class="color alarm"></div>
+                </div>
+              </th>
+            </tr>
+            <tr>
+              <th>鍛婅鍚嶇О</th>
+              <th>鍛婅鍊�</th>
+              <th>鍛婅鍚嶇О</th>
+              <th>鍛婅鍊�</th>
             </tr>
           </thead>
           <tbody>
+            <tr>
+              <td>浣庡帇鍛婅(1.2V)</td>
+              <td>
+                <el-form-item prop="vol1d2LowCoeK1">
+                  <el-input
+                    v-model="p_params.vol1d2LowCoeK1"
+                    placeholder="璇疯緭鍏�"
+                  >
+                    <template slot="append">V</template>
+                  </el-input>
+                </el-form-item>
+              </td>
+              <td>楂樺帇鍛婅(1.2V)</td>
+              <td>
+                <el-form-item prop="vol1d2HighCoeK2">
+                  <el-input
+                    v-model="p_params.vol1d2HighCoeK2"
+                    placeholder="璇疯緭鍏�"
+                  >
+                    <template slot="append">V</template>
+                  </el-input>
+                </el-form-item>
+              </td>
+            </tr>
             <tr>
               <td>浣庡帇鍛婅(2V)</td>
               <td>
                 <el-form-item prop="vol2LowCoeK1">
                   <el-input
-                    type="number"
                     v-model="p_params.vol2LowCoeK1"
-                    placeholder="璇疯緭鍏ヤ綆鍘嬪憡璀�"
+                    placeholder="璇疯緭鍏�"
                   >
                     <template slot="append">V</template>
                   </el-input>
                 </el-form-item>
               </td>
-              <td class="alarm"></td>
-            </tr>
-            <tr>
               <td>楂樺帇鍛婅(2V)</td>
               <td>
                 <el-form-item prop="vol2HighCoeK2">
                   <el-input
-                    type="number"
                     v-model="p_params.vol2HighCoeK2"
-                    placeholder="璇疯緭鍏ラ珮鍘嬪憡璀�"
+                    placeholder="璇疯緭鍏�"
                   >
                     <template slot="append">V</template>
                   </el-input>
                 </el-form-item>
               </td>
-              <td class="warn"></td>
+            </tr>
+            <tr>
+              <td>浣庡帇鍛婅(6V)</td>
+              <td>
+                <el-form-item prop="vol6LowCoeK1">
+                  <el-input
+                    v-model="p_params.vol6LowCoeK1"
+                    placeholder="璇疯緭鍏�"
+                  >
+                    <template slot="append">V</template>
+                  </el-input>
+                </el-form-item>
+              </td>
+              <td>楂樺帇鍛婅(6V)</td>
+              <td>
+                <el-form-item prop="vol6HighCoeK2">
+                  <el-input
+                    v-model="p_params.vol6HighCoeK2"
+                    placeholder="璇疯緭鍏�"
+                  >
+                    <template slot="append">V</template>
+                  </el-input>
+                </el-form-item>
+              </td>
             </tr>
             <tr>
               <td>浣庡帇鍛婅(12V)</td>
               <td>
                 <el-form-item prop="vol12LowCoeK1">
                   <el-input
-                    type="number"
                     v-model="p_params.vol12LowCoeK1"
-                    placeholder="璇疯緭鍏ヤ綆鍘嬪憡璀�"
+                    placeholder="璇疯緭鍏�"
                   >
                     <template slot="append">V</template>
                   </el-input>
                 </el-form-item>
               </td>
-              <td class="alarm"></td>
-            </tr>
-            <tr>
               <td>楂樺帇鍛婅(12V)</td>
               <td>
                 <el-form-item prop="vol12HighCoeK2">
                   <el-input
-                    type="number"
                     v-model="p_params.vol12HighCoeK2"
-                    placeholder="璇疯緭鍏ラ珮鍘嬪憡璀�"
+                    placeholder="璇疯緭鍏�"
                   >
                     <template slot="append">V</template>
                   </el-input>
                 </el-form-item>
               </td>
-              <td class="warn"></td>
             </tr>
             <tr>
               <td>鍐呴樆鍛婅</td>
               <td>
                 <el-form-item prop="resGoodCoeK3">
                   <el-input
-                    type="number"
                     v-model="p_params.resGoodCoeK3"
-                    placeholder="璇疯緭鍏ュ唴闃诲憡璀�"
+                    placeholder="璇疯緭鍏�"
                   >
                     <template slot="append">%</template>
                   </el-input>
                 </el-form-item>
               </td>
-              <td class="warn"></td>
-            </tr>
-            <tr>
               <td>鍐呴樆鏇存崲</td>
               <td>
                 <el-form-item prop="resBadCoeK4">
                   <el-input
-                    type="number"
                     v-model="p_params.resBadCoeK4"
-                    placeholder="璇疯緭鍏ュ唴闃绘洿鎹�"
+                    placeholder="璇疯緭鍏�"
                   >
                     <template slot="append">%</template>
                   </el-input>
                 </el-form-item>
               </td>
-              <td class="alarm"></td>
             </tr>
             <tr>
               <td>杩炴帴鏉″憡璀�</td>
               <td>
                 <el-form-item prop="chainResCoeK5">
                   <el-input
-                    type="number"
                     v-model="p_params.chainResCoeK5"
-                    placeholder="璇疯緭鍏ヨ繛鎺ユ潯鍛婅"
+                    placeholder="璇疯緭鍏�"
                   >
                     <template slot="append">%</template>
                   </el-input>
                 </el-form-item>
               </td>
-              <td class="alarm"></td>
+              <td>杩炴帴鏉℃洿鎹�</td>
+              <td>
+                <el-form-item prop="chainResChange">
+                  <el-input
+                    v-model="p_params.chainResChange"
+                    placeholder="璇疯緭鍏�"
+                  >
+                    <template slot="append">%</template>
+                  </el-input>
+                </el-form-item>
+              </td>
             </tr>
           </tbody>
         </table>
@@ -296,6 +350,48 @@
       ></el-progress>
     </div>
     <div class="process-mask" v-show="processVisible"></div>
+    <!-- 鏇存柊鏃ュ織 -->
+    <el-dialog
+      title="妫�娴嬪埌鏂扮増鏈�,璇风‘璁ゆ槸鍚︿笅杞�"
+      class="update-info"
+      :visible.sync="updateInfoVisible"
+      append-to-body
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      width="450px"
+    >
+      <div class="title">
+        妫�娴嬪埌鏂扮増鏈�
+        <div class="version">V{{ pkgVersion }}</div>
+        <div class="size">澶у皬锛歿{ pkgSize }} MB</div>
+      </div>
+      <div class="log">
+        <div class="title">鏇存柊鏃ュ織:</div>
+        <div class="log-list">
+          <div
+            class="log-item"
+            v-for="(item, index) in logList"
+            :key="'list_' + index"
+          >
+            <div class="item-version">V{{ item.version }}</div>
+            <div class="item-info">
+              <div
+                class="sub-item"
+                v-for="(note, idx) in item.notes"
+                :key="'note_' + idx"
+              >
+                <span class="index">{{ idx + 1 }})</span
+                >{{ note }}
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+      <div class="footer">
+        <el-button type="primary" @click="downloadOk">涓嬭浇鏇存柊</el-button>
+        <el-button @click="downloadCancel">鏆備笉鏇存柊</el-button>
+      </div>
+    </el-dialog>
     <!-- 鏄惁瀹夎鏇存柊 -->
     <el-dialog
       title="鏄惁瀹夎鏇存柊"
@@ -330,6 +426,7 @@
   setParams,
   updateFileParam,
 } from "@/apis";
+import axios from "axios";
 import { mapGetters, mapMutations } from "vuex";
 import CONST from "@/assets/js/const";
 import testVal from "@/assets/js/testVal";
@@ -436,12 +533,18 @@
       },
     ];
     const p_params = {
+      // chainResChange
+      chainResChange: 160,
       chainResCoeK5: 120,
       enabled: 1,
       resBadCoeK4: 160,
       resGoodCoeK3: 125,
+      vol1d2HighCoeK2: 1.44,
+      vol1d2LowCoeK1: 0.96,
       vol2HighCoeK2: 2.35,
       vol2LowCoeK1: 1.8,
+      vol6HighCoeK2: 7.05,
+      vol6LowCoeK1: 5.4,
       vol12HighCoeK2: 14.1,
       vol12LowCoeK1: 10.8,
     };
@@ -452,6 +555,24 @@
       trigger: ["change", "blur"],
     };
     const rules = {
+      vol1d2LowCoeK1: [
+        { required: true, message: "璇疯緭鍏ヤ綆鍘嬮槇鍊�", trigger: "blur" },
+        {
+          validator(rule, value, callback) {
+            testVal(rule, value, callback, O_rules.vol1d2LowCoeK1);
+          },
+          trigger: ["change", "blur"],
+        },
+      ],
+      vol1d2HighCoeK2: [
+        { required: true, message: "璇疯緭鍏ラ珮鍘嬮槇鍊�", trigger: "blur" },
+        {
+          validator(rule, value, callback) {
+            testVal(rule, value, callback, O_rules.vol1d2HighCoeK2);
+          },
+          trigger: ["change", "blur"],
+        },
+      ],
       vol2LowCoeK1: [
         { required: true, message: "璇疯緭鍏ヤ綆鍘嬮槇鍊�", trigger: "blur" },
         {
@@ -466,6 +587,24 @@
         {
           validator(rule, value, callback) {
             testVal(rule, value, callback, O_rules.vol2HighCoeK2);
+          },
+          trigger: ["change", "blur"],
+        },
+      ],
+      vol6LowCoeK1: [
+        { required: true, message: "璇疯緭鍏ヤ綆鍘嬮槇鍊�", trigger: "blur" },
+        {
+          validator(rule, value, callback) {
+            testVal(rule, value, callback, O_rules.vol6LowCoeK1);
+          },
+          trigger: ["change", "blur"],
+        },
+      ],
+      vol6HighCoeK2: [
+        { required: true, message: "璇疯緭鍏ラ珮鍘嬮槇鍊�", trigger: "blur" },
+        {
+          validator(rule, value, callback) {
+            testVal(rule, value, callback, O_rules.vol6HighCoeK2);
           },
           trigger: ["change", "blur"],
         },
@@ -500,12 +639,19 @@
         { required: true, message: "璇疯緭鍏ヨ繛鎺ユ潯鍛婅绯绘暟", trigger: "blur" },
         R_resGoodCoeK3,
       ],
+      chainResChange: [
+        { required: true, message: "璇疯緭鍏ヨ繛鎺ユ潯鏇存崲绯绘暟", trigger: "blur" },
+        R_resGoodCoeK3,
+      ],
     };
     return {
       rules,
       askInstallVisible: false,
+      updateInfoVisible: false,
       pkgVersion: "",
       pkgPath: "",
+      pkgSize: 0,
+      logList: [],
       percent: 0,
       processVisible: false,
       fileParseVisible: false,
@@ -570,7 +716,7 @@
     },
     params(n) {
       this.p_params = Object.assign({}, n);
-    }
+    },
   },
   methods: {
     ...mapMutations("setting", [
@@ -650,6 +796,9 @@
         this.askInstallVisible = true;
       });
 
+      // 妫�娴嬪埌鏇存柊  鏇存柊淇℃伅
+      window.api.receive("update-info", this.showUpdateInfo);
+
       // this.$bus.$on("checkCloseAll", this.checkCloseAll);
 
       this.$bus.$on("setAlarmValue", this.viewsParams);
@@ -665,6 +814,41 @@
     },
     installCancel() {
       this.askInstallVisible = false;
+    },
+    downloadOk() {
+      this.updateInfoVisible = false;
+      window.api.send("download-update");
+    },
+    downloadCancel() {
+      this.updateInfoVisible = false;
+    },
+    showUpdateInfo(data) {
+      const { info, updataPath, currentVersion } = data;
+      axios({
+        method: "GET",
+        url: `${updataPath}/update.info.json?t=${Math.random()}`,
+      }).then((res) => {
+        // console.log(res, info, "====json");
+        let { data, status } = res;
+        if (200 == status && data) {
+          const { versions, notes } = data;
+          let list = [];
+          this.pkgSize = Math.round(info.files[0].size / 1024 / 1024 * 100) / 100;
+          this.pkgVersion = info.version;
+          for (let i = versions.length; i-- >= 0; ) {
+            let version = versions[i];
+            if (version == currentVersion) {
+              break;
+            }
+            list.push({
+              version,
+              notes: notes[version],
+            });
+          }
+          this.logList = list;
+          this.updateInfoVisible = true;
+        }
+      });
     },
     updateProgress(progressObj) {
       if (!this.processVisible) {
@@ -869,13 +1053,18 @@
           });
         } else {
           const field = {
-            vol2LowCoeK1: "浣庡帇闃堝��",
-            vol2HighCoeK2: "楂樺帇闃堝��",
-            vol12LowCoeK1: "浣庡帇闃堝��",
-            vol12HighCoeK2: "楂樺帇闃堝��",
+            vol1d2LowCoeK1: "浣庡帇闃堝��(1.2V)",
+            vol1d2HighCoeK2: "楂樺帇闃堝��(1.2V)",
+            vol2LowCoeK1: "浣庡帇闃堝��(2V)",
+            vol2HighCoeK2: "楂樺帇闃堝��(2V)",
+            vol6LowCoeK1: "浣庡帇闃堝��(6V)",
+            vol6HighCoeK2: "楂樺帇闃堝��(6V)",
+            vol12LowCoeK1: "浣庡帇闃堝��(12V)",
+            vol12HighCoeK2: "楂樺帇闃堝��(12V)",
             resGoodCoeK3: "鍐呴樆鍛婅绯绘暟",
             resBadCoeK4: "鍐呴樆鏇存崲绯绘暟",
             chainResCoeK5: "杩炴帴鏉″憡璀︾郴鏁�",
+            chainResChange: "杩炴帴鏉℃洿鎹㈢郴鏁�",
           };
           let errStr = "";
           Object.keys(info).forEach((val) => {
@@ -1063,20 +1252,30 @@
     border: 1px #333 solid;
     padding: 4px;
   }
-  td {
-    // color: #13c2c2;
-    &.warn {
-      background: #ff0;
-    }
-    &.alarm {
-      background: #d9001b;
+  .cell-box {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    .color {
+      width: 6em;
+      height: 1.6em;
+      margin-left: 4px;
+      // border: 0.5px #000 solid;
+      box-shadow: 1px 1px #000;
+      display: inline-block;
+      &.warn {
+        background: #ff0;
+      }
+      &.alarm {
+        background: #d9001b;
+      }
     }
   }
 }
-:deep(input)[type="number"]::-webkit-outer-spin-button,
-:deep(input)[type="number"]::-webkit-inner-spin-button {
-  -webkit-appearance: none !important;
-}
+// :deep(input)[type="number"]::-webkit-outer-spin-button,
+// :deep(input)[type="number"]::-webkit-inner-spin-button {
+//   -webkit-appearance: none !important;
+// }
 .process-wrap {
   position: fixed;
   left: 50%;
@@ -1105,4 +1304,36 @@
     text-align: right;
   }
 }
+.update-info :deep(.el-dialog__body) {
+  padding: 10px 20px;
+  .title {
+    display: flex;
+    margin-bottom: 10px;
+  }
+  .size {
+    margin-left: 3em;
+  }
+  .item-version,
+  .version {
+    margin-left: 0.4em;
+    display: inline-block;
+    font-weight: 700;
+    color: #090;
+  }
+  .log-list {
+    max-height: 200px;
+    overflow-y: auto;
+  }
+  .item-info {
+    padding-left: 2em;
+    .index {
+      display: inline-block;
+      margin-right: 0.6em;
+    }
+  }
+  .footer {
+    margin-top: 1.6em;
+    text-align: right;
+  }
+}
 </style>
\ No newline at end of file
diff --git a/src/pages/compare.vue b/src/pages/compare.vue
index dce4c74..9018929 100644
--- a/src/pages/compare.vue
+++ b/src/pages/compare.vue
@@ -224,8 +224,12 @@
           const {
             resBadCoeK4,
             resGoodCoeK3,
+            vol1d2HighCoeK2,
+            vol1d2LowCoeK1,
             vol2HighCoeK2,
             vol2LowCoeK1,
+            vol6HighCoeK2,
+            vol6LowCoeK1,
             vol12HighCoeK2,
             vol12LowCoeK1,
           } = this.params;
@@ -239,14 +243,42 @@
             BIT
           );
 
-          if (2 == battVol) {
-            this.marks.volChart[0].y = toFixed(vol2HighCoeK2, BIT);
-            this.marks.volChart[1].y = toFixed(vol2LowCoeK1, BIT);
-          } else if (12 == battVol) {
-            this.marks.volChart[0].y = toFixed(vol12HighCoeK2, BIT);
-            this.marks.volChart[1].y = toFixed(vol12LowCoeK1, BIT);
-          } else {
-            this.marks.volChart = [];
+          if (!this.marks.volChart.length) {
+            this.marks.volChart = [
+              {
+                name: "楂樺帇鍛婅",
+                y: 0,
+                type: "high",
+                color: "#ff0",
+              },
+              {
+                name: "浣庡帇鍛婅",
+                y: 0,
+                type: "low",
+                color: "#d9001b",
+              },
+            ];
+          }
+          switch (battVol) {
+            case 1.2:
+              this.marks.volChart[0].y = toFixed(vol1d2HighCoeK2, BIT);
+              this.marks.volChart[1].y = toFixed(vol1d2LowCoeK1, BIT);
+              break;
+            case 2:
+              this.marks.volChart[0].y = toFixed(vol2HighCoeK2, BIT);
+              this.marks.volChart[1].y = toFixed(vol2LowCoeK1, BIT);
+              break;
+            case 6:
+              this.marks.volChart[0].y = toFixed(vol6HighCoeK2, BIT);
+              this.marks.volChart[1].y = toFixed(vol6LowCoeK1, BIT);
+              break;
+            case 12:
+              this.marks.volChart[0].y = toFixed(vol12HighCoeK2, BIT);
+              this.marks.volChart[1].y = toFixed(vol12LowCoeK1, BIT);
+              break;
+            default:
+              this.marks.volChart = [];
+              break;
           }
           this.$nextTick(() => {
             this.initChart();
diff --git a/src/pages/xmlResult.vue b/src/pages/xmlResult.vue
index 09737dd..0c4be1b 100644
--- a/src/pages/xmlResult.vue
+++ b/src/pages/xmlResult.vue
@@ -88,7 +88,12 @@
       :show-close="false"
       width="800px"
     >
-      <file-info v-if="fileInfoVisible" :info="fileData" @ok="editOk" @quit="quit"></file-info>
+      <file-info
+        v-if="fileInfoVisible"
+        :info="fileData"
+        @ok="editOk"
+        @quit="quit"
+      ></file-info>
     </el-dialog>
   </div>
 </template>
@@ -99,7 +104,7 @@
 import ChartContextMenu from "@/components/chartContextMenu";
 import offset from "@/assets/js/offset";
 import { mapGetters } from "vuex";
-import { Loading } from 'element-ui';
+import { Loading } from "element-ui";
 import {
   getXmlValue,
   testReport,
@@ -154,7 +159,13 @@
       ],
       chainVisiable: [
         {
-          name: "杩炴帴鏉�",
+          name: "杩炴帴鏉″憡璀�",
+          y: 0,
+          type: "high",
+          color: "#ff0",
+        },
+        {
+          name: "杩炴帴鏉℃洿鎹�",
           y: 0,
           type: "high",
           color: "#d9001b",
@@ -312,47 +323,72 @@
           let fileParam = data.fileParam;
 
           const {
+            chainResChange,
             chainResCoeK5,
             resBadCoeK4,
             resGoodCoeK3,
+            vol1d2HighCoeK2,
+            vol1d2LowCoeK1,
             vol2HighCoeK2,
             vol2LowCoeK1,
+            vol6HighCoeK2,
+            vol6LowCoeK1,
             vol12HighCoeK2,
             vol12LowCoeK1,
           } = this.params;
 
           this.marks.resVisiable[0].y = toFixed(
-            resGoodCoeK3 * fileParam.battRes / 100,
+            (resGoodCoeK3 * fileParam.battRes) / 100,
             BIT
           );
           this.marks.resVisiable[1].y = toFixed(
-            resBadCoeK4 * fileParam.battRes / 100,
+            (resBadCoeK4 * fileParam.battRes) / 100,
             BIT
           );
-          if (2 == fileParam.battVol) {
-            this.marks.volVisiable[0].y = toFixed(
-              vol2HighCoeK2,
-              BIT
-            );
-            this.marks.volVisiable[1].y = toFixed(
-              vol2LowCoeK1,
-              BIT
-            );
-          } else if (12 == fileParam.battVol) {
-            this.marks.volVisiable[0].y = toFixed(
-              vol12HighCoeK2,
-              BIT
-            );
-            this.marks.volVisiable[1].y = toFixed(
-              vol12LowCoeK1,
-              BIT
-            );
-          } else {
-            this.marks.volVisiable = [];
+          if (!this.marks.volVisiable.length) {
+            this.marks.volVisiable = [
+              {
+                name: "楂樺帇鍛婅",
+                y: 0,
+                type: "high",
+                color: "#ff0",
+              },
+              {
+                name: "浣庡帇鍛婅",
+                y: 0,
+                type: "low",
+                color: "#d9001b",
+              },
+            ];
+          }
+          switch(fileParam.battVol) {
+            case 1.2:
+              this.marks.volVisiable[0].y = toFixed(vol1d2HighCoeK2, BIT);
+              this.marks.volVisiable[1].y = toFixed(vol1d2LowCoeK1, BIT);
+              break;
+            case 2:
+              this.marks.volVisiable[0].y = toFixed(vol2HighCoeK2, BIT);
+              this.marks.volVisiable[1].y = toFixed(vol2LowCoeK1, BIT);
+              break;
+            case 6:
+              this.marks.volVisiable[0].y = toFixed(vol6HighCoeK2, BIT);
+              this.marks.volVisiable[1].y = toFixed(vol6LowCoeK1, BIT);
+              break;
+            case 12:
+              this.marks.volVisiable[0].y = toFixed(vol12HighCoeK2, BIT);
+              this.marks.volVisiable[1].y = toFixed(vol12LowCoeK1, BIT);
+              break;
+            default:
+              this.marks.volVisiable = [];
+              break;
           }
 
           this.marks.chainVisiable[0].y = toFixed(
-            chainResCoeK5 * fileParam.chainRes / 100,
+            (chainResCoeK5 * fileParam.chainRes) / 100,
+            BIT
+          );
+          this.marks.chainVisiable[1].y = toFixed(
+            (chainResChange * fileParam.chainRes) / 100,
             BIT
           );
 
@@ -384,47 +420,56 @@
           let fileParam = this.fileData;
 
           const {
+            chainResChange,
             chainResCoeK5,
             resBadCoeK4,
             resGoodCoeK3,
+            vol1d2HighCoeK2,
+            vol1d2LowCoeK1,
             vol2HighCoeK2,
             vol2LowCoeK1,
+            vol6HighCoeK2,
+            vol6LowCoeK1,
             vol12HighCoeK2,
             vol12LowCoeK1,
           } = this.params;
 
           this.marks.resVisiable[0].y = toFixed(
-            resGoodCoeK3 * fileParam.battRes / 100,
+            (resGoodCoeK3 * fileParam.battRes) / 100,
             BIT
           );
           this.marks.resVisiable[1].y = toFixed(
-            resBadCoeK4 * fileParam.battRes / 100,
+            (resBadCoeK4 * fileParam.battRes) / 100,
             BIT
           );
-          if (2 == fileParam.battVol) {
-            this.marks.volVisiable[0].y = toFixed(
-              vol2HighCoeK2,
-              BIT
-            );
-            this.marks.volVisiable[1].y = toFixed(
-              vol2LowCoeK1,
-              BIT
-            );
-          } else if (12 == fileParam.battVol) {
-            this.marks.volVisiable[0].y = toFixed(
-              vol12HighCoeK2,
-              BIT
-            );
-            this.marks.volVisiable[1].y = toFixed(
-              vol12LowCoeK1,
-              BIT
-            );
-          } else {
-            this.marks.volVisiable = [];
+          switch(fileParam.battVol) {
+            case 1.2:
+              this.marks.volVisiable[0].y = toFixed(vol1d2HighCoeK2, BIT);
+              this.marks.volVisiable[1].y = toFixed(vol1d2LowCoeK1, BIT);
+              break;
+            case 2:
+              this.marks.volVisiable[0].y = toFixed(vol2HighCoeK2, BIT);
+              this.marks.volVisiable[1].y = toFixed(vol2LowCoeK1, BIT);
+              break;
+            case 6:
+              this.marks.volVisiable[0].y = toFixed(vol6HighCoeK2, BIT);
+              this.marks.volVisiable[1].y = toFixed(vol6LowCoeK1, BIT);
+              break;
+            case 12:
+              this.marks.volVisiable[0].y = toFixed(vol12HighCoeK2, BIT);
+              this.marks.volVisiable[1].y = toFixed(vol12LowCoeK1, BIT);
+              break;
+            default:
+              this.marks.volVisiable = [];
+              break;
           }
 
           this.marks.chainVisiable[0].y = toFixed(
-            chainResCoeK5 * fileParam.chainRes / 100,
+            (chainResCoeK5 * fileParam.chainRes) / 100,
+            BIT
+          );
+          this.marks.chainVisiable[1].y = toFixed(
+            (chainResChange * fileParam.chainRes) / 100,
             BIT
           );
 
@@ -723,7 +768,7 @@
           const fileName = matchRes
             ? decodeURI(matchRes[1].trim())
             : "鏈煡鏂囦欢鍚�.xls";
-          
+
           let link = document.createElement("a");
           link.style.display = "none";
           link.href = url;
diff --git a/src/preload.js b/src/preload.js
index 5bf6ad0..f0920ab 100644
--- a/src/preload.js
+++ b/src/preload.js
@@ -15,7 +15,9 @@
   'autodownloadprogress',
   'isUpdateNow',
   'quitAndInstall',
-  "show-save-dialog"
+  "show-save-dialog",
+  "download-update",
+  "update-info"
 ];
 
 contextBridge.exposeInMainWorld('api', {
diff --git a/src/update.js b/src/update.js
index 0bf8850..fe9a054 100644
--- a/src/update.js
+++ b/src/update.js
@@ -1,9 +1,16 @@
 // 娉ㄦ剰杩欎釜autoUpdater涓嶆槸electron涓殑autoUpdater
 import { autoUpdater } from "electron-updater"
-import { dialog } from 'electron'
+// import { dialog } from 'electron'
 // import log from 'electron-log';
 
-function handleUpdate(sender) {
+/**
+ * 
+ * @param {*} sender 
+ * @param {*} quiet 闈欓粯妯″紡 锛堢郴缁熻嚜鍔ㄦ娴嬫椂 涓嶆彁绀烘鍦ㄦ鏌ユ洿鏂帮級
+ */
+function handleUpdate(sender, quiet) {
+  // log.info(autoUpdater);
+  const isTest = process.env.NODE_ENV == 'none';
   const returnData = {
     error: { status: -1, msg: '妫�娴嬫洿鏂版煡璇㈠紓甯�' },
     checking: { status: 0, msg: '姝e湪妫�鏌ュ簲鐢ㄧ▼搴忔洿鏂�' },
@@ -20,7 +27,7 @@
   /*
       閲嶇偣璇存槑鏈嶅姟鍣ㄧ殑鍦板潃鐨勫唴瀹癸紝鍐呭鏄墦鍖呬互鍚庣敓鎴愮殑latest.yml锛屾妸杩欎釜鏂囦欢鏀惧埌鏈嶅姟鍣ㄤ笂锛屽悓鏃跺拰浣犳墦鍖呬互鍚庣殑瀹夎鍖呭悓绾х洰褰曪紝杩欐牱latest.yml涓殑鍦板潃鎵嶈兘璇诲彇鍒�
   */
-  let updataPath = 'http://118.89.139.230:9098/res-update'
+  let updataPath = isTest ? 'http://118.89.139.230:9098/res-update-test' : 'http://118.89.139.230:9098/res-update';
   autoUpdater.setFeedURL({
     provider: 'generic',
     url: updataPath
@@ -30,37 +37,40 @@
 
   //鏇存柊閿欒
   autoUpdater.on('error', function (error) {
-    sendUpdateMessage(sender, returnData.error)
+    !quiet && sendUpdateMessage(sender, returnData.error)
   });
 
   //妫�鏌ヤ腑
   autoUpdater.on('checking-for-update', function () {
-    sendUpdateMessage(sender, returnData.checking);
+    !quiet && sendUpdateMessage(sender, returnData.checking);
   });
 
   //鍙戠幇鏂扮増鏈�
+  // autoUpdater.on('update-available', function (info) {
+  //   const options = {
+  //     type: 'info',
+  //     buttons: ['纭畾', '鍙栨秷'],
+  //     title: '鏇存柊鎻愮ず',
+  //     // ${info.version} Cannot read property 'version' of undefined
+  //     message: `鍙戠幇鏈夋柊鐗堟湰'${info.version}'锛屾槸鍚︿笅杞斤紵`,
+  //     cancelId: 1
+  //   }
+  //   dialog.showMessageBox(options).then(res => {
+  //     // log.info(JSON.stringify(res));
+  //     if (res.response === 0) {
+  //       autoUpdater.downloadUpdate()
+  //     } else {
+  //       return;
+  //     }
+  //   })
+  // });
   autoUpdater.on('update-available', function (info) {
-    const options = {
-      type: 'info',
-      buttons: ['纭畾', '鍙栨秷'],
-      title: '鏇存柊鎻愮ず',
-      // ${info.version} Cannot read property 'version' of undefined
-      message: `鍙戠幇鏈夋柊鐗堟湰'${info.version}'锛屾槸鍚︿笅杞斤紵`,
-      cancelId: 1
-    }
-    dialog.showMessageBox(options).then(res => {
-      // log.info(JSON.stringify(res));
-      if (res.response === 0) {
-        autoUpdater.downloadUpdate()
-      } else {
-        return;
-      }
-    })
+    sender.send('update-info', { info, updataPath, currentVersion: autoUpdater.currentVersion.version });
   });
 
   //褰撳墠鐗堟湰涓烘渶鏂扮増鏈�
   autoUpdater.on('update-not-available', function (info) {
-    setTimeout(function () {
+    !quiet && setTimeout(function () {
       sendUpdateMessage(sender, returnData.updateNotAva)
     }, 1000);
   });
diff --git a/update.info.json b/update.info.json
new file mode 100644
index 0000000..ee4d92c
--- /dev/null
+++ b/update.info.json
@@ -0,0 +1,7 @@
+{
+  "versions": ["0.1.4", "0.1.5"],
+  "notes": {
+    "0.1.4": ["娣诲姞浜嗗嚑涓父鐢ㄧ殑蹇嵎鎿嶄綔鎸夐挳", "璋冩暣浜嗗椤甸潰閫昏緫,鏂囦欢鐩稿叧椤甸潰鍙兘鍚屾椂鎵撳紑涓�涓�", "瀵煎嚭鎶ュ憡涔嬪悗鎵撳紑淇濆瓨鏂囦欢鐨勮矾寰�", "娣诲姞浜嗚蒋浠舵搷浣滆鏄庝功"],
+    "0.1.5": ["娣诲姞浜嗚嚜鍔ㄥ崌绾ф娴嬪姛鑳�", "娣诲姞澶氱鐢垫睜鐨勭數鍘嬪憡璀﹂榾鍊�", "娣诲姞鍗囩骇璇存槑"]
+  }
+}
\ No newline at end of file

--
Gitblit v1.9.1