<template>
|
<div class="menu">
|
<ul class="main-ul">
|
<li class="main-li" v-for="(item, idx) in menuList" :key="'main_' + idx">
|
<div
|
:class="['title', { active: item.active }]"
|
@click="clickMain(item)"
|
>
|
{{ item.title }}
|
</div>
|
<ul class="sub-ul" v-show="item.visible">
|
<li
|
:class="['sub-li', { disabled: subItem.disabled }]"
|
v-for="(subItem, index) in item.children"
|
:key="'sub_' + index"
|
@click="clickSub(subItem)"
|
>
|
{{ subItem.title }}
|
</li>
|
</ul>
|
</li>
|
</ul>
|
<!-- mask -->
|
<div class="mask" v-show="maskVisible" @click="closeMenu"></div>
|
<!-- 文件属性 -->
|
<el-dialog
|
:title="$t('Properties')"
|
class="file-info"
|
:visible.sync="fileInfoVisible"
|
append-to-body
|
:close-on-click-modal="false"
|
:close-on-press-escape="false"
|
:show-close="false"
|
width="800px"
|
>
|
<file-info
|
v-if="fileInfoVisible"
|
:info="fileData"
|
@ok="editOk"
|
@cancel="editCancel"
|
@quit="quit"
|
></file-info>
|
</el-dialog>
|
<!-- 对比分析 -->
|
<el-dialog
|
:title="$t('ComparativeAnalysis')"
|
class="compare"
|
:visible.sync="compareVisible"
|
append-to-body
|
:close-on-click-modal="false"
|
:close-on-press-escape="false"
|
width="800px"
|
>
|
<el-form ref="compareForm" :model="compareForm" label-width="80px">
|
<el-form-item :label="$t('ReferenceObject')">
|
<el-select
|
v-model="compareForm.id1"
|
clearable
|
:placeholder="$t('Pleaseselectthereferenceobject')"
|
>
|
<el-option
|
v-for="item in fileList1"
|
:key="item.fileId"
|
:label="item.stationName + ' ' + item.fileName"
|
:value="item.fileId"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item :label="$t('ComparisonObject')">
|
<el-select
|
v-model="compareForm.id2"
|
clearable
|
:placeholder="$t('Pleaseselectthecomparisonobject')"
|
>
|
<el-option
|
v-for="item in fileList2"
|
:key="item.fileId"
|
:label="item.stationName + ' ' + item.fileName"
|
:value="item.fileId"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item :label="$t('ComparisonItem')">
|
<el-checkbox-group v-model="compareForm.type">
|
<el-checkbox :label="1" name="type">{{
|
$t("BatteryVoltage")
|
}}</el-checkbox>
|
<el-checkbox :label="2" name="type">{{
|
$t("BatteryResistance")
|
}}</el-checkbox>
|
</el-checkbox-group>
|
</el-form-item>
|
</el-form>
|
<div class="footer">
|
<el-button type="primary" @click="goCompare">{{
|
$t("StartComparativeAnalysis")
|
}}</el-button>
|
</div>
|
</el-dialog>
|
<!-- 窗口配置 -->
|
<el-dialog
|
:title="$t('WindowConfiguration')"
|
class="winconfig"
|
:visible.sync="winConfigVisible"
|
append-to-body
|
:close-on-click-modal="false"
|
:close-on-press-escape="false"
|
width="600px"
|
>
|
<el-form ref="form" :model="winConfigForm" label-position="top">
|
<el-form-item :label="$t('Pleasecheckthemodulestobedisplayed')">
|
<el-checkbox-group v-model="winConfigForm.type">
|
<el-checkbox label="Vol" name="type"
|
>{{ $t("Voltage") }}(V)</el-checkbox
|
>
|
<el-checkbox label="Res" name="type"
|
>{{ $t("Resistance") }}(mΩ)</el-checkbox
|
>
|
<!-- <el-checkbox label="Cap" name="type">{{ $t('Capacity') }}(Ah)</el-checkbox> -->
|
<el-checkbox label="Chain" name="type"
|
>{{ $t("ConnectionBar") }}(μΩ)</el-checkbox
|
>
|
<el-checkbox label="Cond" name="type"
|
>{{ $t("Conductance") }}(S)</el-checkbox
|
>
|
<el-checkbox label="Table" name="type">{{
|
$t("Sheet")
|
}}</el-checkbox>
|
</el-checkbox-group>
|
</el-form-item>
|
</el-form>
|
<div class="footer">
|
<el-button @click="winConfigCancel">{{
|
$t("operate.cancel")
|
}}</el-button>
|
<el-button type="primary" @click="winConfigOk">{{
|
$t("operate.ok")
|
}}</el-button>
|
</div>
|
</el-dialog>
|
|
<!-- 分级评价 -->
|
<el-dialog
|
:title="$t('GradedEvaluation')"
|
class="winconfig"
|
:visible.sync="paramsVisible"
|
append-to-body
|
:close-on-click-modal="false"
|
:close-on-press-escape="false"
|
width="600px"
|
>
|
<el-form
|
v-if="paramsVisible"
|
:model="p_params"
|
label-position="left"
|
size="mini"
|
:show-message="false"
|
ref="paramsForm"
|
:rules="rules"
|
>
|
<table class="table">
|
<thead>
|
<tr>
|
<th colspan="2">
|
<div class="cell-box">
|
{{ $t("GeneralAlarm") }}
|
<div class="color warn"></div>
|
</div>
|
</th>
|
<th colspan="2">
|
<div class="cell-box">
|
{{ $t("SeriousAlarm") }}
|
<div class="color alarm"></div>
|
</div>
|
</th>
|
</tr>
|
<tr>
|
<th>{{ $t("AlarmName") }}</th>
|
<th>{{ $t("AlarmValue") }}</th>
|
<th>{{ $t("AlarmName") }}</th>
|
<th>{{ $t("AlarmValue") }}</th>
|
</tr>
|
</thead>
|
<tbody>
|
<tr>
|
<td>{{ $t("LowvoltageAlarm") }}(1.2V)</td>
|
<td>
|
<el-form-item prop="vol1d2LowCoeK1">
|
<el-input
|
v-model="p_params.vol1d2LowCoeK1"
|
:placeholder="$t('form.inputMsg')"
|
>
|
<template slot="append">V</template>
|
</el-input>
|
</el-form-item>
|
</td>
|
<td>{{ $t("HighvoltageAlarm") }}(1.2V)</td>
|
<td>
|
<el-form-item prop="vol1d2HighCoeK2">
|
<el-input
|
v-model="p_params.vol1d2HighCoeK2"
|
:placeholder="$t('form.inputMsg')"
|
>
|
<template slot="append">V</template>
|
</el-input>
|
</el-form-item>
|
</td>
|
</tr>
|
<tr>
|
<td>{{ $t("LowvoltageAlarm") }}(2V)</td>
|
<td>
|
<el-form-item prop="vol2LowCoeK1">
|
<el-input
|
v-model="p_params.vol2LowCoeK1"
|
:placeholder="$t('form.inputMsg')"
|
>
|
<template slot="append">V</template>
|
</el-input>
|
</el-form-item>
|
</td>
|
<td>{{ $t("HighvoltageAlarm") }}(2V)</td>
|
<td>
|
<el-form-item prop="vol2HighCoeK2">
|
<el-input
|
v-model="p_params.vol2HighCoeK2"
|
placeholder="$t('form.inputMsg')"
|
>
|
<template slot="append">V</template>
|
</el-input>
|
</el-form-item>
|
</td>
|
</tr>
|
<tr>
|
<td>{{ $t("LowvoltageAlarm") }}(6V)</td>
|
<td>
|
<el-form-item prop="vol6LowCoeK1">
|
<el-input
|
v-model="p_params.vol6LowCoeK1"
|
placeholder="$t('form.inputMsg')"
|
>
|
<template slot="append">V</template>
|
</el-input>
|
</el-form-item>
|
</td>
|
<td>{{ $t("HighvoltageAlarm") }}(6V)</td>
|
<td>
|
<el-form-item prop="vol6HighCoeK2">
|
<el-input
|
v-model="p_params.vol6HighCoeK2"
|
:placeholder="$t('form.inputMsg')"
|
>
|
<template slot="append">V</template>
|
</el-input>
|
</el-form-item>
|
</td>
|
</tr>
|
<tr>
|
<td>{{ $t("LowvoltageAlarm") }}(12V)</td>
|
<td>
|
<el-form-item prop="vol12LowCoeK1">
|
<el-input
|
v-model="p_params.vol12LowCoeK1"
|
:placeholder="$t('form.inputMsg')"
|
>
|
<template slot="append">V</template>
|
</el-input>
|
</el-form-item>
|
</td>
|
<td>{{ $t("HighvoltageAlarm") }}(12V)</td>
|
<td>
|
<el-form-item prop="vol12HighCoeK2">
|
<el-input
|
v-model="p_params.vol12HighCoeK2"
|
:placeholder="$t('form.inputMsg')"
|
>
|
<template slot="append">V</template>
|
</el-input>
|
</el-form-item>
|
</td>
|
</tr>
|
<tr>
|
<td>{{ $t("ResistanceAlarm") }}</td>
|
<td>
|
<el-form-item prop="resGoodCoeK3">
|
<el-input
|
v-model="p_params.resGoodCoeK3"
|
:placeholder="$t('form.inputMsg')"
|
>
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
</td>
|
<td>{{ $t("ResistanceFail") }}</td>
|
<td>
|
<el-form-item prop="resBadCoeK4">
|
<el-input
|
v-model="p_params.resBadCoeK4"
|
:placeholder="$t('form.inputMsg')"
|
>
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
</td>
|
</tr>
|
<tr>
|
<td>{{ $t("ConnectionBarAlarm") }}</td>
|
<td>
|
<el-form-item prop="chainResCoeK5">
|
<el-input
|
v-model="p_params.chainResCoeK5"
|
:placeholder="$t('form.inputMsg')"
|
>
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
</td>
|
<td>{{ $t("ConnectionBarFail") }}</td>
|
<td>
|
<el-form-item prop="chainResChange">
|
<el-input
|
v-model="p_params.chainResChange"
|
:placeholder="$t('form.inputMsg')"
|
>
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
</td>
|
</tr>
|
</tbody>
|
</table>
|
</el-form>
|
<div class="footer">
|
<el-button @click="paramsCancel">{{ $t("operate.cancel") }}</el-button>
|
<el-button type="primary" @click="paramsOk">{{
|
$t("operate.ok")
|
}}</el-button>
|
</div>
|
</el-dialog>
|
<!-- 单数据分析 -->
|
<el-dialog
|
:title="$t('SingleDataAnalysis')"
|
class="fileParse"
|
:visible.sync="fileParseVisible"
|
append-to-body
|
:close-on-click-modal="false"
|
:close-on-press-escape="false"
|
width="800px"
|
>
|
<el-form ref="compareForm" label-width="80px">
|
<el-form-item :label="$t('File')">
|
<el-select
|
v-model="fileUrl"
|
clearable
|
:placeholder="$t('PleaseselecttheanalysisObjectm')"
|
>
|
<el-option
|
v-for="item in fileList"
|
:key="item.fileId"
|
:label="item.stationName + ' ' + item.fileName"
|
:value="
|
item.stationId + '&&&&&' + item.fileId + '&&&&&' + item.fileName
|
"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
</el-form>
|
<div class="footer">
|
<el-button type="primary" @click="fileParseOk">{{
|
$t("StartAnalysis")
|
}}</el-button>
|
</div>
|
</el-dialog>
|
<div class="process-wrap" v-show="processVisible">
|
<el-progress
|
:text-inside="true"
|
:stroke-width="26"
|
:percentage="percent"
|
></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="是否安装更新"
|
class="ask-install"
|
:visible.sync="askInstallVisible"
|
append-to-body
|
:close-on-click-modal="false"
|
:close-on-press-escape="false"
|
width="450px"
|
>
|
<div class="">
|
新版本
|
<div class="version">{{ pkgVersion }}</div>
|
已下载完成
|
</div>
|
<div class="">安装包路径:{{ pkgPath }}</div>
|
<div class="footer">
|
<el-button type="primary" @click="install">安装</el-button>
|
<el-button @click="installCancel">取消</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import FileInfo from "@/components/fileInfo";
|
import {
|
getXmlValue,
|
getParamByFileId,
|
getFileList,
|
getParams,
|
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";
|
import { versionBig } from "@/assets/js/util";
|
import config from "@/assets/js/config.js";
|
|
import i18n from "./i18n/menuList";
|
import { createI18nOption } from "@/assets/js/tools/i18n";
|
|
import i18nRule from '@/assets/js/i18n/const_rules.js';
|
const i18nMixin = createI18nOption(i18n, [[i18nRule, 'rule']]);
|
|
const { isStandard, lang } = config;
|
const O_rules = CONST.rules;
|
|
export default {
|
name: "MenuList",
|
mixins: [i18nMixin],
|
data() {
|
// const $t = this.$t;
|
let vm = this;
|
const menuList = [
|
{
|
title: this.$t("File"),
|
visible: false,
|
children: [
|
{
|
title: this.$t("OpenFile"),
|
method: "openFile",
|
},
|
{
|
title: this.$t("Closethefile"),
|
method: "closeFile",
|
},
|
// {
|
// title: $t('Closeallfiles'),
|
// method: "closeAllFiles",
|
// },
|
],
|
},
|
{
|
title: this.$t("Analyze"),
|
visible: false,
|
children: [
|
{
|
title: this.$t("SingleDataAnalysis"),
|
method: "parseOneFile",
|
},
|
{
|
title: this.$t("ComparativeAnalysis"),
|
method: "compareFiles",
|
},
|
{
|
title: this.$t("GradedEvaluation"),
|
method: "viewsParams",
|
},
|
{
|
title: this.$t("ViewProperties"),
|
method: "viewProp",
|
disabled: true,
|
},
|
{
|
title: this.$t("GenerateReport"),
|
method: "exportReport",
|
disabled: true,
|
},
|
],
|
},
|
{
|
title: this.$t("Configuration"),
|
visible: false,
|
children: [
|
{
|
title: this.$t("WindowConfiguration"),
|
method: "windowConfig",
|
},
|
{
|
title: this.$t("DataManagement"),
|
method: "goData",
|
},
|
// {
|
// title: "语言设置",
|
// },
|
],
|
},
|
{
|
title: this.$t("Help"),
|
visible: false,
|
children: [
|
{
|
title: this.$t("Update"),
|
method: "checkForUpdate",
|
},
|
],
|
},
|
];
|
// 标准版帮助菜单
|
if (isStandard) {
|
const menu0 = [
|
{
|
title: this.$t("AnalyzerManual"),
|
method: "instructionBook",
|
},
|
{
|
title: this.$t("SoftwareManual"),
|
method: "softwareBook",
|
},
|
{
|
title: this.$t("OperatingVideo"),
|
method: "video",
|
},
|
{
|
title: this.$t("Update"),
|
method: "checkForUpdate",
|
},
|
];
|
const menu1 = [
|
{
|
title: this.$t("Support"),
|
method: "contact",
|
},
|
{
|
title: this.$t("AboutFUGUANG"),
|
method: "others",
|
},
|
];
|
|
if (lang == "US") {
|
menuList[3].children = [...menu1];
|
} else {
|
menuList[3].children = [...menu0, ...menu1];
|
}
|
} else {
|
if (lang == "US") {
|
menuList.pop();
|
}
|
}
|
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,
|
};
|
const R_resGoodCoeK3 = {
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, O_rules.resGoodCoeK3, vm);
|
},
|
trigger: ["change", "blur"],
|
};
|
const rules = {
|
vol1d2LowCoeK1: [
|
{
|
required: true,
|
message: this.$t("Pleaseenterthelowvoltagethreshold"),
|
trigger: "blur",
|
},
|
{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, O_rules.vol1d2LowCoeK1, vm);
|
},
|
trigger: ["change", "blur"],
|
},
|
],
|
vol1d2HighCoeK2: [
|
{
|
required: true,
|
message: this.$t("Pleaseenterthehighvoltagethreshold"),
|
trigger: "blur",
|
},
|
{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, O_rules.vol1d2HighCoeK2, vm);
|
},
|
trigger: ["change", "blur"],
|
},
|
],
|
vol2LowCoeK1: [
|
{
|
required: true,
|
message: this.$t("Pleaseenterthelowvoltagethreshold"),
|
trigger: "blur",
|
},
|
{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, O_rules.vol2LowCoeK1, vm);
|
},
|
trigger: ["change", "blur"],
|
},
|
],
|
vol2HighCoeK2: [
|
{
|
required: true,
|
message: this.$t("Pleaseenterthehighvoltagethreshold"),
|
trigger: "blur",
|
},
|
{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, O_rules.vol2HighCoeK2, vm);
|
},
|
trigger: ["change", "blur"],
|
},
|
],
|
vol6LowCoeK1: [
|
{
|
required: true,
|
message: this.$t("Pleaseenterthelowvoltagethreshold"),
|
trigger: "blur",
|
},
|
{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, O_rules.vol6LowCoeK1, vm);
|
},
|
trigger: ["change", "blur"],
|
},
|
],
|
vol6HighCoeK2: [
|
{
|
required: true,
|
message: this.$t("Pleaseenterthehighvoltagethreshold"),
|
trigger: "blur",
|
},
|
{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, O_rules.vol6HighCoeK2, vm);
|
},
|
trigger: ["change", "blur"],
|
},
|
],
|
vol12LowCoeK1: [
|
{
|
required: true,
|
message: this.$t("Pleaseenterthelowvoltagethreshold"),
|
trigger: "blur",
|
},
|
{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, O_rules.vol12LowCoeK1, vm);
|
},
|
trigger: ["change", "blur"],
|
},
|
],
|
vol12HighCoeK2: [
|
{
|
required: true,
|
message: this.$t("Pleaseenterthehighvoltagethreshold"),
|
trigger: "blur",
|
},
|
{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, O_rules.vol12HighCoeK2, vm);
|
},
|
trigger: ["change", "blur"],
|
},
|
],
|
resGoodCoeK3: [
|
{
|
required: true,
|
message: this.$t("Pleaseentertheresistancealarmfactor"),
|
trigger: "blur",
|
},
|
R_resGoodCoeK3,
|
],
|
resBadCoeK4: [
|
{
|
required: true,
|
message: this.$t("Pleaseentertheresistancefailfactor"),
|
trigger: "blur",
|
},
|
R_resGoodCoeK3,
|
],
|
chainResCoeK5: [
|
{
|
required: true,
|
message: this.$t("Pleaseentertheconnectionbaralarmfactor"),
|
trigger: "blur",
|
},
|
R_resGoodCoeK3,
|
],
|
chainResChange: [
|
{
|
required: true,
|
message: this.$t("Pleaseentertheconnectionbarfailfactor"),
|
trigger: "blur",
|
},
|
R_resGoodCoeK3,
|
],
|
};
|
return {
|
rules,
|
askInstallVisible: false,
|
updateInfoVisible: false,
|
pkgVersion: "",
|
pkgPath: "",
|
pkgSize: 0,
|
logList: [],
|
percent: 0,
|
processVisible: false,
|
fileParseVisible: false,
|
fileUrl: "",
|
p_params,
|
paramsVisible: false,
|
winConfigVisible: false,
|
winConfigForm: {
|
type: [],
|
},
|
compareVisible: false,
|
compareForm: {
|
id1: undefined,
|
id2: undefined,
|
type: [],
|
},
|
fileList: [],
|
menuList,
|
maskVisible: false,
|
fileInfoVisible: false,
|
fileData: {},
|
currFile: {
|
name: "",
|
url: "",
|
stationId: 0,
|
fileId: undefined,
|
},
|
};
|
},
|
components: {
|
FileInfo,
|
},
|
computed: {
|
fileList1() {
|
return this.fileList.filter((v) => v.fileId != this.compareForm.id2);
|
},
|
fileList2() {
|
return this.fileList.filter((v) => v.fileId != this.compareForm.id1);
|
},
|
...mapGetters("setting", [
|
"volVisiable",
|
"resVisiable",
|
"capVisiable",
|
"chainVisiable",
|
"condVisiable",
|
"tableVisiable",
|
"params",
|
]),
|
// p_params() {
|
// return JSON.parse(JSON.stringify(this.params));
|
// }
|
},
|
watch: {
|
$route(n) {
|
// console.log(n, n.name, !["compare", "result"].includes(n.name));
|
this.menuList[1].children[4].disabled = !["compare", "result"].includes(
|
n.name
|
);
|
this.menuList[1].children[3].disabled = !["result"].includes(n.name);
|
this.menuList[0].children[1].disabled = !["compare", "result"].includes(
|
n.name
|
);
|
},
|
params(n) {
|
this.p_params = Object.assign({}, n);
|
},
|
},
|
methods: {
|
...mapMutations("setting", [
|
"setVolVisiable",
|
"setResVisiable",
|
"setCapVisiable",
|
"setTableVisiable",
|
"setChainVisiable",
|
"setCondVisiable",
|
"setParams",
|
]),
|
clickMain(obj) {
|
// console.log(obj)
|
this.closeMenu();
|
obj.visible = true;
|
obj.active = true;
|
this.maskVisible = true;
|
},
|
clickSub(obj) {
|
// console.log(obj)
|
if (
|
obj.method &&
|
"function" == typeof this[obj.method] &&
|
!obj.disabled
|
) {
|
this.closeMenu();
|
this[obj.method]();
|
}
|
},
|
closeMenu() {
|
this.menuList.forEach((v) => {
|
v.visible = false;
|
v.active = false;
|
});
|
this.maskVisible = false;
|
},
|
openFile() {
|
// console.log("openfile");
|
window.api.send("open-file-dialog", "MenuList");
|
},
|
closeFile() {
|
this.$bus.$emit("closeFile");
|
},
|
closeAllFiles() {
|
this.$bus.$emit("closeAll");
|
},
|
initEvents() {
|
window.api.receive("selected-file", (path, data) => {
|
// console.log(path, data, 'selected-file')
|
if (data && data == "MenuList") {
|
this.parseTmpFile(path.filePaths[0]);
|
}
|
});
|
|
window.api.receive("messageupdate", (data) => {
|
// console.log(data, "====update?");
|
if (data.status == -1) {
|
this.$message.error(data.msg);
|
} else {
|
this.$message.info(data.msg);
|
}
|
});
|
|
window.api.receive("autodownloadprogress", (data) => {
|
// console.log(data, "====autodownloadprogress?");
|
this.updateProgress(data);
|
});
|
|
window.api.receive("isUpdateNow", (data) => {
|
// console.log(data, "====isUpdateNow?");
|
const {
|
event: { version, downloadedFile },
|
} = data;
|
this.processVisible = false;
|
this.pkgVersion = version;
|
this.pkgPath = downloadedFile;
|
this.askInstallVisible = true;
|
});
|
|
// 检测到更新 更新信息
|
window.api.receive("update-info", this.showUpdateInfo);
|
|
// this.$bus.$on("checkCloseAll", this.checkCloseAll);
|
|
this.$bus.$on("setAlarmValue", this.viewsParams);
|
this.$bus.$on("windowConfirm", this.windowConfig);
|
// this.$bus.$on('viewProp', this.viewProp);
|
},
|
// checkCloseAll(bl) {
|
// this.menuList[0].children[2].disabled = !bl;
|
// },
|
install() {
|
this.askInstallVisible = false;
|
window.api.send("quitAndInstall");
|
},
|
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 (!versionBig(version, currentVersion)) {
|
break;
|
}
|
list.push({
|
version,
|
notes: notes[version],
|
});
|
}
|
this.logList = list;
|
console.log(list, "list");
|
this.updateInfoVisible = true;
|
}
|
});
|
},
|
updateProgress(progressObj) {
|
if (!this.processVisible) {
|
this.processVisible = true;
|
}
|
this.percent = Math.round(progressObj.percent * 100) / 100;
|
},
|
parseTmpFile(url) {
|
const params = {
|
filePath: url,
|
};
|
getXmlValue(params).then((res) => {
|
const { code, data, data2 } = res.data;
|
if (code && data) {
|
this.fileData = data2.fileParam;
|
this.currFile.name = data2.fileNameTmp;
|
this.currFile.url = data2.fileUrl;
|
this.currFile.stationId = 0;
|
this.currFile.fileId = undefined;
|
this.fileInfoVisible = true;
|
} else {
|
this.$message.error(this.$t("FileParsingFailed"));
|
}
|
});
|
},
|
parseFile(url, cbfn) {
|
let [stationId, fileId, fileName] = url.split("&&&&&");
|
getParamByFileId(fileId).then((res) => {
|
const { code, data, data2 } = res.data;
|
if (code && data) {
|
this.fileData = data2;
|
this.currFile.name = fileName;
|
// this.currFile.url = _url;
|
this.currFile.stationId = stationId;
|
this.currFile.fileId = fileId;
|
this.fileInfoVisible = true;
|
if (cbfn && "function" == typeof cbfn) {
|
cbfn();
|
}
|
} else {
|
this.$message.error(this.$t("FileParsingFailed"));
|
}
|
});
|
},
|
editOk(data) {
|
this.fileInfoVisible = false;
|
// 没有fileId 不修改参数
|
if (!this.currFile.fileId) {
|
this.toRes(data);
|
return false;
|
}
|
updateFileParam(this.currFile.stationId, data).then((res) => {
|
const { code, data } = res.data;
|
if (code && data) {
|
this.$message.success(this.$t("ModifySuccessfully"));
|
} else {
|
this.$message.error(this.$t("ModifyFailed"));
|
}
|
});
|
this.toRes();
|
},
|
editCancel(data) {
|
this.fileInfoVisible = false;
|
this.toRes();
|
},
|
toRes(params) {
|
const { name, url, fileId, stationId } = this.currFile;
|
this.$router.push({
|
path: "/result/" + name,
|
query: {
|
fileId,
|
url,
|
stationId,
|
params,
|
},
|
});
|
this.$bus.$emit("checkScroll");
|
},
|
quit() {
|
this.fileInfoVisible = false;
|
},
|
// 对比分析
|
compareFiles() {
|
this.compareForm = {
|
id1: undefined,
|
id2: undefined,
|
type: [],
|
};
|
this.getFileList().then(() => {
|
this.compareVisible = true;
|
});
|
},
|
getFileList() {
|
return getFileList().then((res) => {
|
let { code, data, data2 } = res.data;
|
let list = [];
|
if (code && data) {
|
// console.log(data2);
|
list = data2;
|
}
|
this.fileList = list;
|
});
|
},
|
goCompare() {
|
const { id1: baseFileId, id2: fileId, type } = this.compareForm;
|
if (!baseFileId) {
|
this.$message.warning(this.$t("Pleaseselectthereferenceobject"));
|
return false;
|
}
|
if (!fileId) {
|
this.$message.warning(this.$t("Pleaseselectthecomparisonobject"));
|
return false;
|
}
|
if (!type.length) {
|
this.$message.warning(this.$t("PleaseselectComparisonItem"));
|
return false;
|
}
|
const opts = type.reduce((total, num) => total + num);
|
this.compareVisible = false;
|
this.$router.push({
|
path: "/compare",
|
query: {
|
baseFileId,
|
fileId,
|
opts,
|
},
|
});
|
},
|
// 窗口配置
|
windowConfig() {
|
this.winConfigVisible = true;
|
},
|
winConfigCancel() {
|
this.winConfigVisible = false;
|
},
|
winConfigOk() {
|
const type = this.winConfigForm.type;
|
if (!type.length) {
|
this.$message.warning(this.$t("Pleaseselectatleastonemodule"));
|
return false;
|
}
|
["Vol", "Res", "Cap", "Table", "Chain", "Cond"].forEach((v) => {
|
let method = "set" + v + "Visiable";
|
this[method](type.some((val) => val == v));
|
});
|
this.winConfigVisible = false;
|
this.$bus.$emit("windowConfigChanged");
|
},
|
goData() {
|
this.$router.push("/data");
|
},
|
instructionBook() {
|
this.$router.push("/book");
|
},
|
softwareBook() {
|
// TODO
|
this.$router.push("/softwareBook");
|
},
|
video() {
|
this.$router.push("/qrcode");
|
},
|
contact() {
|
this.$router.push("/contact");
|
},
|
exportReport() {
|
this.$bus.$emit("export");
|
},
|
viewProp() {
|
this.$bus.$emit("viewProp");
|
},
|
// 分级评价 设置参数
|
viewsParams() {
|
// 如果当前页面不是分析页面则提示 并终止
|
// const { name, query } = this.$route;
|
// debugger;
|
// if (!["compare", "result"].includes(name)) {
|
// console.log(this.$route);
|
// this.$message.warning("当前活动页面不能分级评价");
|
// return false;
|
// }
|
// this.$bus.$emit("export");
|
this.paramsVisible = true;
|
this.$nextTick(() => {
|
this.$refs.paramsForm.resetFields();
|
});
|
},
|
paramsCancel() {
|
this.paramsVisible = false;
|
},
|
paramsOk() {
|
this.$refs.paramsForm.validate((valid, info) => {
|
const field = {
|
vol1d2LowCoeK1: this.$t("LowvoltageThreshold") + "(1.2V)",
|
vol1d2HighCoeK2: this.$t("HighvoltageThreshold") + "(1.2V)",
|
vol2LowCoeK1: this.$t("LowvoltageThreshold") + "(2V)",
|
vol2HighCoeK2: this.$t("HighvoltageThreshold") + "(2V)",
|
vol6LowCoeK1: this.$t("LowvoltageThreshold") + "(6V)",
|
vol6HighCoeK2: this.$t("HighvoltageThreshold") + "(6V)",
|
vol12LowCoeK1: this.$t("LowvoltageThreshold") + "(12V)",
|
vol12HighCoeK2: this.$t("HighvoltageThreshold") + "(12V)",
|
resGoodCoeK3: this.$t("ResistanceAlarmFactor"),
|
resBadCoeK4: this.$t("ResistanceFailFactor"),
|
chainResCoeK5: this.$t("ConnectionBarAlarmFactor"),
|
chainResChange: this.$t("ConnectionBarFailFactor"),
|
};
|
|
// 校验通过
|
if (valid) {
|
let params = this.p_params;
|
// 添加逻辑 严重告警必须大于次要告警 (电导相返)
|
if (params.vol1d2LowCoeK1 >= params.vol1d2HighCoeK2) {
|
this.$message.error(field['vol1d2LowCoeK1'] + this.$t('MustBe') + '< ' + field['vol1d2HighCoeK2']);
|
return false;
|
}
|
|
if (params.vol2LowCoeK1 >= params.vol2HighCoeK2) {
|
this.$message.error(field['vol2LowCoeK1'] + this.$t('MustBe') + '< ' + field['vol2HighCoeK2']);
|
return false;
|
}
|
|
if (params.vol6LowCoeK1 >= params.vol6HighCoeK2) {
|
this.$message.error(field['vol6LowCoeK1'] + this.$t('MustBe') + '< ' + field['vol6HighCoeK2']);
|
return false;
|
}
|
|
if (params.vol12LowCoeK1 >= params.vol12HighCoeK2) {
|
this.$message.error(field['vol12LowCoeK1'] + this.$t('MustBe') + '< ' + field['vol12HighCoeK2']);
|
return false;
|
}
|
|
if (params.resGoodCoeK3 >= params.resBadCoeK4) {
|
this.$message.error(field['resGoodCoeK3'] + this.$t('MustBe') + '< ' + field['resBadCoeK4']);
|
return false;
|
}
|
|
if (params.chainResCoeK5 >= params.chainResChange) {
|
this.$message.error(field['chainResCoeK5'] + this.$t('MustBe') + '< ' + field['chainResChange']);
|
return false;
|
}
|
|
// 更新分级参数
|
setParams(this.p_params).then((res) => {
|
const { code, data } = res.data;
|
if (code) {
|
this.setParams(this.p_params);
|
this.$message.success(this.$t("Updatesuccessfully"));
|
this.paramsVisible = false;
|
this.$bus.$emit("paramsUpdated");
|
} else {
|
this.$message.error(this.$t("OperationFailed"));
|
}
|
});
|
} else {
|
let errStr = "";
|
Object.keys(info).forEach((val) => {
|
info[val].forEach((v) => {
|
errStr += field[val] + ": " + v.message + "; ";
|
});
|
});
|
this.$message.error({
|
message: this.$t("Thereexistsunverifieddata") + errStr,
|
duration: 5000,
|
});
|
return false;
|
}
|
});
|
},
|
fileParseOk() {
|
if (!this.fileUrl) {
|
this.$message.warning(this.$t("Pleaseselectthefiletoanalyze"));
|
return false;
|
}
|
// console.log(this.fileUrl);
|
this.parseFile(this.fileUrl, () => {
|
this.fileParseVisible = false;
|
});
|
},
|
parseOneFile() {
|
this.fileUrl = "";
|
this.getFileList().then(() => {
|
this.fileParseVisible = true;
|
});
|
},
|
getParams() {
|
getParams().then((res) => {
|
let { code, data } = res.data;
|
if (code) {
|
// this.p_params = data;
|
this.setParams(data);
|
}
|
});
|
},
|
checkForUpdate() {
|
window.api.send("check-update");
|
},
|
others() {
|
this.$router.push("/others");
|
},
|
},
|
|
mounted() {
|
this.getParams();
|
this.initEvents();
|
this.getFileList();
|
this.winConfigForm.type = [
|
"Res",
|
"Vol",
|
"Cap",
|
"Cond",
|
"Chain",
|
"Table",
|
].filter((v) => this[v.toLowerCase() + "Visiable"]);
|
},
|
};
|
</script>
|
|
<style lang="less" scoped>
|
.main-ul {
|
position: relative;
|
z-index: 1000;
|
display: flex;
|
align-items: stretch;
|
.main-li {
|
flex: 1;
|
position: relative;
|
.title {
|
cursor: pointer;
|
border: 1px solid #333;
|
background: #0dced1;
|
line-height: 30px;
|
border-radius: 4px;
|
vertical-align: middle;
|
&.active {
|
background: #00f7f9;
|
}
|
&:hover {
|
background: #62cbfa;
|
}
|
}
|
}
|
.sub-ul {
|
// display: none;
|
display: flex;
|
flex-direction: column;
|
position: absolute;
|
left: 0;
|
top: 100%;
|
min-width: 8em;
|
background: #c0c0c0;
|
padding: 4px;
|
.sub-li {
|
border-radius: 4px;
|
border: 1px #fff solid;
|
background: #d9dce2;
|
&:hover {
|
background: #169bd5;
|
}
|
}
|
}
|
.disabled.disabled.disabled {
|
cursor: not-allowed;
|
color: #eee;
|
background: #999;
|
}
|
}
|
.mask {
|
position: fixed;
|
left: 0;
|
right: 0;
|
top: 0;
|
bottom: 0;
|
background: transparent;
|
z-index: 999;
|
}
|
.file-info {
|
:deep(.el-dialog__header) {
|
position: relative;
|
z-index: 0;
|
text-align: center;
|
padding-bottom: 16px;
|
filter: drop-shadow(0 1px 2px #333);
|
&::before {
|
content: "";
|
position: absolute;
|
left: 0;
|
top: 0;
|
bottom: 0;
|
right: 0;
|
background: #ccc;
|
z-index: -1;
|
clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%);
|
background: linear-gradient(#ccc 10%, #fff 50%, #ccc 90%);
|
}
|
}
|
}
|
.fileParse,
|
.compare {
|
:deep(.el-select) {
|
display: block;
|
}
|
.footer {
|
text-align: right;
|
}
|
}
|
.winconfig {
|
:deep(.el-form-item__label) {
|
font-weight: 700;
|
padding-bottom: 0;
|
}
|
:deep(.el-checkbox-group) {
|
display: flex;
|
flex-wrap: wrap;
|
.el-checkbox {
|
width: 30%;
|
margin-right: 0;
|
}
|
}
|
.footer {
|
text-align: right;
|
}
|
:deep(.el-form-item) {
|
margin-bottom: 0;
|
}
|
}
|
.table {
|
width: 100%;
|
table-layout: fixed;
|
border-collapse: collapse;
|
text-align: center;
|
color: #333;
|
margin-bottom: 10px;
|
thead {
|
font-weight: 700;
|
}
|
th,
|
td {
|
border: 1px #333 solid;
|
padding: 4px;
|
}
|
.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;
|
// }
|
.process-wrap {
|
position: fixed;
|
left: 50%;
|
top: 30%;
|
transform: translate(-50%, -70%);
|
width: 400px;
|
z-index: 1999;
|
}
|
.process-mask {
|
position: fixed;
|
z-index: 1998;
|
left: 0;
|
top: 0;
|
right: 0;
|
bottom: 0;
|
background: rgba(0, 0, 0, 0.4);
|
}
|
.ask-install {
|
.version {
|
display: inline-block;
|
font-weight: 700;
|
color: #090;
|
}
|
.footer {
|
margin-top: 1.6em;
|
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>
|