| | |
| | | width="800px" |
| | | > |
| | | <file-info |
| | | v-if="fileInfoVisible" |
| | | :info="fileData" |
| | | @ok="editOk" |
| | | @cancel="editCancel" |
| | |
| | | <el-checkbox-group v-model="winConfigForm.type"> |
| | | <el-checkbox label="Vol" name="type">电压(V)</el-checkbox> |
| | | <el-checkbox label="Res" name="type">内阻(mΩ)</el-checkbox> |
| | | <el-checkbox label="Cap" name="type">容量(Ah)</el-checkbox> |
| | | <!-- <el-checkbox label="Cap" name="type">容量(Ah)</el-checkbox> --> |
| | | <el-checkbox label="Chain" name="type">连接条(μΩ)</el-checkbox> |
| | | <el-checkbox label="Cond" name="type">电导(S)</el-checkbox> |
| | | <el-checkbox label="Table" name="type">表格</el-checkbox> |
| | |
| | | :close-on-press-escape="false" |
| | | width="600px" |
| | | > |
| | | <table class="table"> |
| | | <thead> |
| | | <tr> |
| | | <th>系数名称</th> |
| | | <th>系数值</th> |
| | | <th>评价</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | | <tr> |
| | | <td>低压系数K1</td> |
| | | <td> |
| | | <el-input |
| | | size="mini" |
| | | type="number" |
| | | v-model="params.volLowCoeK1" |
| | | placeholder="请输入低压系数K1" |
| | | ></el-input> |
| | | </td> |
| | | <td class="alarm"></td> |
| | | </tr> |
| | | <tr> |
| | | <td>高压系数K2</td> |
| | | <td> |
| | | <el-input |
| | | size="mini" |
| | | type="number" |
| | | v-model="params.volHighCoeK2" |
| | | placeholder="请输入高压系数K2" |
| | | ></el-input> |
| | | </td> |
| | | <td class="warn"></td> |
| | | </tr> |
| | | <tr> |
| | | <td>内阻告警K3</td> |
| | | <td> |
| | | <el-input |
| | | size="mini" |
| | | type="number" |
| | | v-model="params.resGoodCoeK3" |
| | | placeholder="请输入内阻告警K3" |
| | | ></el-input> |
| | | </td> |
| | | <td class="warn"></td> |
| | | </tr> |
| | | <tr> |
| | | <td>内阻更换K4</td> |
| | | <td> |
| | | <el-input |
| | | size="mini" |
| | | type="number" |
| | | v-model="params.resBadCoeK4" |
| | | placeholder="请输入内阻更换K4" |
| | | ></el-input> |
| | | </td> |
| | | <td class="alarm"></td> |
| | | </tr> |
| | | <tr> |
| | | <td>连接条K5</td> |
| | | <td> |
| | | <el-input |
| | | size="mini" |
| | | type="number" |
| | | v-model="params.chainResCoeK5" |
| | | placeholder="请输入连接条K5" |
| | | ></el-input> |
| | | </td> |
| | | <td class="alarm"></td> |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | <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>系数名称</th> |
| | | <th>系数值</th> |
| | | <th>评价</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | | <tr> |
| | | <td>低压告警(2V)</td> |
| | | <td> |
| | | <el-form-item prop="vol2LowCoeK1"> |
| | | <el-input |
| | | type="number" |
| | | v-model="p_params.vol2LowCoeK1" |
| | | 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="请输入高压告警" |
| | | > |
| | | <template slot="append">V</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </td> |
| | | <td class="warn"></td> |
| | | </tr> |
| | | <tr> |
| | | <td>低压告警(12V)</td> |
| | | <td> |
| | | <el-form-item prop="vol12LowCoeK1"> |
| | | <el-input |
| | | type="number" |
| | | v-model="p_params.vol12LowCoeK1" |
| | | 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="请输入高压告警" |
| | | > |
| | | <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="请输入内阻告警" |
| | | > |
| | | <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="请输入内阻更换" |
| | | > |
| | | <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="请输入连接条告警" |
| | | > |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </td> |
| | | <td class="alarm"></td> |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | </el-form> |
| | | <div class="footer"> |
| | | <el-button @click="paramsCancel">取消</el-button> |
| | | <el-button type="primary" @click="paramsOk">确定</el-button> |
| | |
| | | v-for="item in fileList" |
| | | :key="item.fileId" |
| | | :label="item.stationName + ' ' + item.fileName" |
| | | :value="item.fileUrl + '&&&&&' + item.fileId" |
| | | :value=" |
| | | item.fileUrl + '&&&&&' + item.fileId + '&&&&&' + item.fileName |
| | | " |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | |
| | | <script> |
| | | import FileInfo from "@/components/fileInfo"; |
| | | import { getXmlValue, getFileList, getParams, setParams } from "@/apis"; |
| | | import { mapMutations } from "vuex"; |
| | | import { |
| | | getXmlValue, |
| | | getParamByFileId, |
| | | getFileList, |
| | | getParams, |
| | | setParams, |
| | | updateFileParam, |
| | | } from "@/apis"; |
| | | import { mapGetters, mapMutations } from "vuex"; |
| | | import CONST from "@/assets/js/const"; |
| | | import testVal from "@/assets/js/testVal"; |
| | | |
| | | const O_rules = CONST.rules; |
| | | |
| | | export default { |
| | | name: "MenuList", |
| | |
| | | title: "关闭文件", |
| | | method: "closeFile", |
| | | }, |
| | | { |
| | | title: "关闭所有文件", |
| | | method: "closeAllFiles", |
| | | }, |
| | | // { |
| | | // title: "关闭所有文件", |
| | | // method: "closeAllFiles", |
| | | // }, |
| | | ], |
| | | }, |
| | | { |
| | |
| | | { |
| | | title: "分级评价", |
| | | method: "viewsParams", |
| | | }, |
| | | { |
| | | title: "查看属性", |
| | | method: "viewProp", |
| | | disabled: true, |
| | | }, |
| | | { |
| | | title: "生成报告", |
| | |
| | | ], |
| | | }, |
| | | { |
| | | title: "help", |
| | | title: "帮助", |
| | | visible: false, |
| | | children: [ |
| | | { |
| | | title: "说明书", |
| | | title: "仪表说明书", |
| | | method: "instructionBook", |
| | | }, |
| | | { |
| | | title: "软件说明书", |
| | | method: "softwareBook", |
| | | }, |
| | | { |
| | | title: "操作视频", |
| | |
| | | title: "联系支持", |
| | | method: "contact", |
| | | }, |
| | | // { |
| | | // title: "其它", |
| | | // }, |
| | | { |
| | | title: "关于福光", |
| | | method: "others", |
| | | }, |
| | | ], |
| | | }, |
| | | ]; |
| | | const params = { |
| | | chainResCoeK5: 1.2, |
| | | const p_params = { |
| | | chainResCoeK5: 120, |
| | | enabled: 1, |
| | | resBadCoeK4: 1.6, |
| | | resGoodCoeK3: 1.25, |
| | | volHighCoeK2: 1.2, |
| | | volLowCoeK1: 0.8, |
| | | resBadCoeK4: 160, |
| | | resGoodCoeK3: 125, |
| | | vol2HighCoeK2: 2.35, |
| | | vol2LowCoeK1: 1.8, |
| | | vol12HighCoeK2: 14.1, |
| | | vol12LowCoeK1: 10.8, |
| | | }; |
| | | const R_resGoodCoeK3 = { |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, O_rules.resGoodCoeK3); |
| | | }, |
| | | trigger: ["change", "blur"], |
| | | }; |
| | | const rules = { |
| | | vol2LowCoeK1: [ |
| | | { required: true, message: "请输入低压阈值", trigger: "blur" }, |
| | | { |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, O_rules.vol2LowCoeK1); |
| | | }, |
| | | trigger: ["change", "blur"], |
| | | }, |
| | | ], |
| | | vol2HighCoeK2: [ |
| | | { required: true, message: "请输入高压阈值", trigger: "blur" }, |
| | | { |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, O_rules.vol2HighCoeK2); |
| | | }, |
| | | trigger: ["change", "blur"], |
| | | }, |
| | | ], |
| | | vol12LowCoeK1: [ |
| | | { required: true, message: "请输入低压阈值", trigger: "blur" }, |
| | | { |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, O_rules.vol12LowCoeK1); |
| | | }, |
| | | trigger: ["change", "blur"], |
| | | }, |
| | | ], |
| | | vol12HighCoeK2: [ |
| | | { required: true, message: "请输入高压阈值", trigger: "blur" }, |
| | | { |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, O_rules.vol12HighCoeK2); |
| | | }, |
| | | trigger: ["change", "blur"], |
| | | }, |
| | | ], |
| | | resGoodCoeK3: [ |
| | | { required: true, message: "请输入内阻告警系数", trigger: "blur" }, |
| | | R_resGoodCoeK3, |
| | | ], |
| | | resBadCoeK4: [ |
| | | { required: true, message: "请输入内阻更换系数", trigger: "blur" }, |
| | | R_resGoodCoeK3, |
| | | ], |
| | | chainResCoeK5: [ |
| | | { required: true, message: "请输入连接条告警系数", trigger: "blur" }, |
| | | R_resGoodCoeK3, |
| | | ], |
| | | }; |
| | | return { |
| | | rules, |
| | | askInstallVisible: false, |
| | | pkgVersion: "", |
| | | pkgPath: "", |
| | |
| | | processVisible: false, |
| | | fileParseVisible: false, |
| | | fileUrl: "", |
| | | params, |
| | | p_params, |
| | | paramsVisible: false, |
| | | winConfigVisible: false, |
| | | winConfigForm: { |
| | |
| | | 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[3].disabled = !["compare", "result"].includes( |
| | | 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", [ |
| | |
| | | }, |
| | | initEvents() { |
| | | window.api.receive("selected-file", (path, data) => { |
| | | // console.log(path, data, 'selected-file') |
| | | if (data && data == "MenuList") { |
| | | // console.log(path.filePaths, "MenuList"); |
| | | this.parseFile(path.filePaths[0]); |
| | | this.parseTmpFile(path.filePaths[0]); |
| | | } |
| | | }); |
| | | |
| | | window.api.receive("messageupdate", (data) => { |
| | | // console.log(data, "====update?"); |
| | | if(data.status == -1) { |
| | | if (data.status == -1) { |
| | | this.$message.error(data.msg); |
| | | } else { |
| | | this.$message.info(data.msg); |
| | |
| | | this.pkgPath = downloadedFile; |
| | | this.askInstallVisible = true; |
| | | }); |
| | | |
| | | // 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"); |
| | |
| | | } |
| | | this.percent = Math.round(progressObj.percent * 100) / 100; |
| | | }, |
| | | parseFile(url, notTmp, cbfn) { |
| | | notTmp = notTmp || false; |
| | | let _url = url, |
| | | fileId; |
| | | if (notTmp) { |
| | | [_url, fileId] = url.split("&&&&&"); |
| | | } |
| | | parseTmpFile(url) { |
| | | const params = { |
| | | filePath: _url, |
| | | filePath: url, |
| | | }; |
| | | getXmlValue(params).then((res) => { |
| | | const { code, data, data2 } = res.data; |
| | | if (code && data) { |
| | | // console.log(data2, 'xxxxx'); |
| | | this.fileData = data2.fileParam; |
| | | this.currFile.name = !notTmp ? data2.fileNameTmp : data2.fileName; |
| | | this.currFile.name = data2.fileNameTmp; |
| | | this.currFile.url = data2.fileUrl; |
| | | this.currFile.fileId = undefined; |
| | | this.fileInfoVisible = true; |
| | | } else { |
| | | this.$message.error("文件解析失败"); |
| | | } |
| | | }); |
| | | }, |
| | | parseFile(url, cbfn) { |
| | | let [_url, 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.fileId = fileId; |
| | | this.fileInfoVisible = true; |
| | | if (cbfn && "function" == typeof cbfn) { |
| | |
| | | }, |
| | | editOk(data) { |
| | | this.fileInfoVisible = false; |
| | | // 没有fileId 不修改参数 |
| | | if (!this.currFile.fileId) { |
| | | this.toRes(data); |
| | | return false; |
| | | } |
| | | updateFileParam(this.currFile.fileId, data).then((res) => { |
| | | const { code, data } = res.data; |
| | | if (code && data) { |
| | | this.$message.success("修改成功"); |
| | | } else { |
| | | this.$message.error("修改失败"); |
| | | } |
| | | }); |
| | | this.toRes(); |
| | | }, |
| | | editCancel(data) { |
| | | this.fileInfoVisible = false; |
| | | this.toRes(); |
| | | }, |
| | | toRes() { |
| | | toRes(params) { |
| | | const { name, url, fileId } = this.currFile; |
| | | this.$router.push({ |
| | | path: "/result/" + name, |
| | | query: { |
| | | url, |
| | | fileId, |
| | | params, |
| | | }, |
| | | }); |
| | | this.$bus.$emit("checkScroll"); |
| | |
| | | id2: undefined, |
| | | type: [], |
| | | }; |
| | | this.compareVisible = true; |
| | | this.getFileList().then(() => { |
| | | this.compareVisible = true; |
| | | }); |
| | | }, |
| | | getFileList() { |
| | | getFileList().then((res) => { |
| | | return getFileList().then((res) => { |
| | | let { code, data, data2 } = res.data; |
| | | let list = []; |
| | | if (code && data) { |
| | |
| | | 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"); |
| | |
| | | }, |
| | | exportReport() { |
| | | this.$bus.$emit("export"); |
| | | }, |
| | | viewProp() { |
| | | this.$bus.$emit("viewProp"); |
| | | }, |
| | | // 分级评价 设置参数 |
| | | viewsParams() { |
| | |
| | | // } |
| | | // this.$bus.$emit("export"); |
| | | this.paramsVisible = true; |
| | | this.$nextTick(() => { |
| | | this.$refs.paramsForm.resetFields(); |
| | | }); |
| | | }, |
| | | paramsCancel() { |
| | | this.paramsVisible = false; |
| | | }, |
| | | paramsOk() { |
| | | // TODO |
| | | // 参数要查看 |
| | | const { |
| | | chainResCoeK5, |
| | | resBadCoeK4, |
| | | resGoodCoeK3, |
| | | volHighCoeK2, |
| | | volLowCoeK1, |
| | | } = this.params; |
| | | if ( |
| | | !volLowCoeK1 || |
| | | volLowCoeK1 != volLowCoeK1 * 1 || |
| | | !volHighCoeK2 || |
| | | volHighCoeK2 != volHighCoeK2 * 1 || |
| | | !resGoodCoeK3 || |
| | | resGoodCoeK3 != resGoodCoeK3 * 1 || |
| | | !resBadCoeK4 || |
| | | resBadCoeK4 != resBadCoeK4 * 1 || |
| | | !chainResCoeK5 || |
| | | chainResCoeK5 != chainResCoeK5 * 1 |
| | | ) { |
| | | this.$message.error("系数不能为空 应为大于0的数值"); |
| | | return false; |
| | | } |
| | | // console.log(this.params); |
| | | // 更新分级参数 |
| | | setParams(this.params).then((res) => { |
| | | const { code, data } = res.data; |
| | | if (code) { |
| | | this.$message.success("更新成功"); |
| | | this.$refs.paramsForm.validate((valid, info) => { |
| | | // 校验通过 |
| | | if (valid) { |
| | | // 更新分级参数 |
| | | setParams(this.p_params).then((res) => { |
| | | const { code, data } = res.data; |
| | | if (code) { |
| | | this.setParams(this.p_params); |
| | | this.$message.success("更新成功"); |
| | | this.paramsVisible = false; |
| | | this.$bus.$emit("paramsUpdated"); |
| | | } else { |
| | | this.$message.error("操作失败"); |
| | | } |
| | | }); |
| | | } else { |
| | | this.$message.error("操作失败"); |
| | | const field = { |
| | | vol2LowCoeK1: "低压阈值", |
| | | vol2HighCoeK2: "高压阈值", |
| | | vol12LowCoeK1: "低压阈值", |
| | | vol12HighCoeK2: "高压阈值", |
| | | resGoodCoeK3: "内阻告警系数", |
| | | resBadCoeK4: "内阻更换系数", |
| | | chainResCoeK5: "连接条告警系数", |
| | | }; |
| | | let errStr = ""; |
| | | Object.keys(info).forEach((val) => { |
| | | info[val].forEach((v) => { |
| | | errStr += field[val] + ": " + v.message + "; "; |
| | | }); |
| | | }); |
| | | this.$message.error({ |
| | | message: "存在校验未通过的数据!" + errStr, |
| | | duration: 5000, |
| | | }); |
| | | return false; |
| | | } |
| | | }); |
| | | this.paramsVisible = false; |
| | | }, |
| | | fileParseOk() { |
| | | if (!this.fileUrl) { |
| | |
| | | return false; |
| | | } |
| | | // console.log(this.fileUrl); |
| | | this.parseFile(this.fileUrl, true, () => { |
| | | this.parseFile(this.fileUrl, () => { |
| | | this.fileParseVisible = false; |
| | | }); |
| | | }, |
| | | parseOneFile() { |
| | | this.fileUrl = ""; |
| | | this.fileParseVisible = true; |
| | | this.getFileList().then(() => { |
| | | this.fileParseVisible = true; |
| | | }); |
| | | }, |
| | | getParams() { |
| | | getParams().then((res) => { |
| | | let { code, data } = res.data; |
| | | if (code) { |
| | | this.params = data; |
| | | // 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> |
| | |
| | | .footer { |
| | | text-align: right; |
| | | } |
| | | :deep(.el-form-item) { |
| | | margin-bottom: 0; |
| | | } |
| | | } |
| | | .table { |
| | | width: 100%; |