| | |
| | | <el-table |
| | | :data="tableData" |
| | | style="width: 100%" |
| | | ref="table" |
| | | :default-sort="{ prop: 'date', order: 'descending' }" |
| | | stripe |
| | | size="small" |
| | |
| | | @toggleLabel="toggleLabel" |
| | | @updateChart="updateChart" |
| | | ></chart-context-menu> |
| | | <!-- 文件属性 --> |
| | | <el-dialog |
| | | title="属性" |
| | | 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" @quit="quit"></file-info> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import FileInfo from "@/components/fileInfo"; |
| | | import NormalBar from "@/components/myCharts/NormalBar"; |
| | | import ChartContextMenu from "@/components/chartContextMenu"; |
| | | import offset from "@/assets/js/offset"; |
| | | import { mapGetters } from "vuex"; |
| | | import { getXmlValue, testReport, getInfoByFileId } from "@/apis"; |
| | | import { Loading } from 'element-ui'; |
| | | import { |
| | | getXmlValue, |
| | | testReport, |
| | | getInfoByFileId, |
| | | getParamByFileId, |
| | | updateFileParam, |
| | | } from "@/apis"; |
| | | import { toFixed } from "@/assets/js/util"; |
| | | // 保留三位小数 |
| | | const BIT = 3; |
| | | |
| | | export default { |
| | | name: "", |
| | |
| | | ], |
| | | }; |
| | | return { |
| | | fileInfoVisible: false, |
| | | fileData: {}, |
| | | tmpParams: null, |
| | | stdDevBr: "", |
| | | stdDevBs: "", |
| | | stdDevBv: "", |
| | | stdDevCr: "", |
| | | resPic: '', |
| | | volPic: '', |
| | | resPic: "", |
| | | volPic: "", |
| | | fileParam: undefined, |
| | | stationInfo: undefined, |
| | | marks, |
| | |
| | | }, |
| | | { |
| | | prop: "cr", |
| | | label: "连接条(mΩ)", |
| | | label: "连接条(μΩ)", |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | |
| | | components: { |
| | | NormalBar, |
| | | ChartContextMenu, |
| | | FileInfo, |
| | | }, |
| | | computed: { |
| | | ...mapGetters("setting", [ |
| | |
| | | xLabel.push("#" + v.monNum); |
| | | resData.push(v.br); |
| | | volData.push(v.bv); |
| | | condData.push(v.cr); |
| | | condData.push(v.bs); |
| | | // capData.push() TODO |
| | | chainData.push(v.cr); |
| | | tableData.push({ ...v, monNum: "#" + v.monNum }); |
| | |
| | | chainResCoeK5, |
| | | resBadCoeK4, |
| | | resGoodCoeK3, |
| | | volHighCoeK2, |
| | | volLowCoeK1, |
| | | vol2HighCoeK2, |
| | | vol2LowCoeK1, |
| | | vol12HighCoeK2, |
| | | vol12LowCoeK1, |
| | | } = this.params; |
| | | |
| | | this.marks.resVisiable[0].y = resGoodCoeK3 * fileParam.battRes; |
| | | this.marks.resVisiable[1].y = resBadCoeK4 * fileParam.battRes; |
| | | this.marks.resVisiable[0].y = toFixed( |
| | | resGoodCoeK3 * fileParam.battRes / 100, |
| | | BIT |
| | | ); |
| | | this.marks.resVisiable[1].y = toFixed( |
| | | 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 = []; |
| | | } |
| | | |
| | | this.marks.volVisiable[0].y = volHighCoeK2 * fileParam.battVol; |
| | | this.marks.volVisiable[1].y = volLowCoeK1 * fileParam.battVol; |
| | | |
| | | this.marks.chainVisiable[0].y = chainResCoeK5 * fileParam.chainRes; |
| | | this.marks.chainVisiable[0].y = toFixed( |
| | | chainResCoeK5 * fileParam.chainRes / 100, |
| | | BIT |
| | | ); |
| | | |
| | | this.list = data.dataList; |
| | | |
| | |
| | | this.stdDevCr = data2.stdDevCr; |
| | | this.fileParam = fileParam; |
| | | this.stationInfo = data.stationInfo; |
| | | |
| | | this.initChart(); |
| | | this.$nextTick(() => { |
| | | this.initChart(); |
| | | }); |
| | | } else { |
| | | this.$message.error("查询数据失败"); |
| | | } |
| | |
| | | const { code, data, data2 } = res.data; |
| | | if (code && data) { |
| | | // console.log(data2, "====d"); |
| | | let fileParam = data2.fileParam; |
| | | this.fileData = this.tmpParams || data2.fileParam; |
| | | let fileParam = this.fileData; |
| | | |
| | | const { |
| | | chainResCoeK5, |
| | | resBadCoeK4, |
| | | resGoodCoeK3, |
| | | volHighCoeK2, |
| | | volLowCoeK1, |
| | | vol2HighCoeK2, |
| | | vol2LowCoeK1, |
| | | vol12HighCoeK2, |
| | | vol12LowCoeK1, |
| | | } = this.params; |
| | | |
| | | this.marks.resVisiable[0].y = resGoodCoeK3 * fileParam.battRes; |
| | | this.marks.resVisiable[1].y = resBadCoeK4 * fileParam.battRes; |
| | | this.marks.resVisiable[0].y = toFixed( |
| | | resGoodCoeK3 * fileParam.battRes / 100, |
| | | BIT |
| | | ); |
| | | this.marks.resVisiable[1].y = toFixed( |
| | | 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 = []; |
| | | } |
| | | |
| | | this.marks.volVisiable[0].y = volHighCoeK2 * fileParam.battVol; |
| | | this.marks.volVisiable[1].y = volLowCoeK1 * fileParam.battVol; |
| | | |
| | | this.marks.chainVisiable[0].y = chainResCoeK5 * fileParam.chainRes; |
| | | this.marks.chainVisiable[0].y = toFixed( |
| | | chainResCoeK5 * fileParam.chainRes / 100, |
| | | BIT |
| | | ); |
| | | |
| | | this.list = data2.battInfoList[0].battDataList; |
| | | let columns = ["", "bv", "br", "cr", "bs"].map((v) => ({ |
| | | property: v, |
| | | })); |
| | | let [a, stdDevBv, stdDevBr, stdDevCr, stdDevBs] = |
| | | this.summaryMethod({ columns, data: this.list }); |
| | | let [a, stdDevBv, stdDevBr, stdDevCr, stdDevBs] = this.summaryMethod({ |
| | | columns, |
| | | data: this.list, |
| | | }); |
| | | this.stdDevBr = stdDevBr; |
| | | this.stdDevBs = stdDevBs; |
| | | this.stdDevBv = stdDevBv; |
| | | this.stdDevCr = stdDevCr; |
| | | this.fileParam = fileParam; |
| | | this.initChart(); |
| | | this.$nextTick(() => { |
| | | this.initChart(); |
| | | }); |
| | | } else { |
| | | this.$message.error("文件解析失败"); |
| | | } |
| | |
| | | this.volPic = chart[0].getDataURL(); |
| | | } |
| | | }); |
| | | this.$nextTick(() => { |
| | | if (this.$refs.table[0]) { |
| | | this.$refs.table[0].doLayout(); |
| | | } |
| | | }); |
| | | }, |
| | | resize() { |
| | | this.$nextTick(() => { |
| | |
| | | } |
| | | chart[0].resize(); |
| | | }); |
| | | if (this.$refs.table[0]) { |
| | | this.$refs.table[0].doLayout(); |
| | | } |
| | | }); |
| | | }, |
| | | chartContextClick($e, item) { |
| | |
| | | this.resize(); |
| | | }); |
| | | }, |
| | | exportReport() { |
| | | // console.log(this, 'export') |
| | | if (this._directInactive) { |
| | | editOk(data) { |
| | | // 临时文件不修改 |
| | | if (!this.fileId) { |
| | | this.tmpParams = data; |
| | | this.refreshPage(); |
| | | this.fileInfoVisible = false; |
| | | return false; |
| | | } |
| | | updateFileParam(this.fileId, data).then((res) => { |
| | | const { code, data } = res.data; |
| | | if (code && data) { |
| | | this.$message.success("修改成功"); |
| | | this.refreshPage(); |
| | | this.fileInfoVisible = false; |
| | | } else { |
| | | this.$message.error("修改失败"); |
| | | } |
| | | }); |
| | | }, |
| | | quit() { |
| | | this.fileInfoVisible = false; |
| | | }, |
| | | viewProp() { |
| | | if (this._isDestroyed || this._directInactive) { |
| | | return false; |
| | | } |
| | | if (!this.fileId) { |
| | | const params = { |
| | | filePath: this.fileUrl, |
| | | }; |
| | | getXmlValue(params).then((res) => { |
| | | const { code, data, data2 } = res.data; |
| | | if (code && data) { |
| | | // console.log(data2, "====d"); |
| | | this.fileData = data2.fileParam; |
| | | this.fileInfoVisible = true; |
| | | } else { |
| | | this.$message.error("读取文件失败"); |
| | | } |
| | | }); |
| | | return false; |
| | | } |
| | | getParamByFileId(this.fileId).then((res) => { |
| | | const { code, data, data2 } = res.data; |
| | | if (code && data) { |
| | | this.fileData = data2; |
| | | this.fileInfoVisible = true; |
| | | } else { |
| | | this.$message.error("获取参数失败"); |
| | | } |
| | | }); |
| | | }, |
| | | refreshPage(force) { |
| | | if (!force && (this._isDestroyed || this._directInactive)) { |
| | | return false; |
| | | } |
| | | this.getWindowList(); |
| | | if (this.fileId) { |
| | | this.getInfoByFileId(); |
| | | } else { |
| | | this.getFileInfo(); |
| | | } |
| | | }, |
| | | exportReport() { |
| | | if (this._isDestroyed || this._directInactive) { |
| | | return false; |
| | | } |
| | | let loading = Loading.service({ fullscreen: true }); |
| | | // console.log(111,this._isDestroyed, this._directInactive, 'export') |
| | | const { |
| | | resPic, |
| | | volPic, |
| | |
| | | }; |
| | | testReport(params).then((res) => { |
| | | let { headers, data, status } = res; |
| | | loading.close(); |
| | | if (200 == status && data) { |
| | | let url = window.URL.createObjectURL(data); |
| | | const matchRes = /filename=(.*)/.exec(headers["content-disposition"]); |
| | | const fileName = matchRes |
| | | ? decodeURI(matchRes[1].trim()) |
| | | : "未知文件名.xls"; |
| | | |
| | | let link = document.createElement("a"); |
| | | link.style.display = "none"; |
| | | link.href = url; |
| | |
| | | } else { |
| | | this.getFileInfo(); |
| | | } |
| | | if (this.$route.query.params) { |
| | | this.tmpParams = this.$route.query.params; |
| | | } |
| | | this.addListener(); |
| | | this.$bus.$on("checkScroll", this.resize); |
| | | this.$bus.$on("chartResize", this.resize); |
| | | this.$bus.$on("export", this.exportReport); |
| | | this.$bus.$on("viewProp", this.viewProp); |
| | | this.$bus.$on("paramsUpdated", () => { |
| | | this.refreshPage(true); |
| | | }); |
| | | this.$bus.$on("windowConfigChanged", () => { |
| | | this.refreshPage(true); |
| | | }); |
| | | }, |
| | | }; |
| | | </script> |