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/components/menuList.vue | 323 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 277 insertions(+), 46 deletions(-) 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 -- Gitblit v1.9.1