| | |
| | | |
| | | <el-button style="margin-left: 10px;" type="primary" @click="exportExcel">导出EXCEL</el-button> |
| | | |
| | | <el-button style="margin-left: 10px;" type="primary" @click="resetinitv">重置初始值</el-button> |
| | | |
| | | </span> |
| | | |
| | | |
| | | </div> |
| | | |
| | | <el-table v-loading="listLoading" :data="list" element-loading-text="Loading" border fit height="100%" |
| | | class="table-container" highlight-current-row> |
| | | class="table-container" highlight-current-row @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55"> |
| | | </el-table-column> |
| | | <el-table-column fixed label="序号" width="80"> |
| | | |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.id }} |
| | | </template> |
| | |
| | | |
| | | |
| | | </el-table-column> |
| | | <el-table-column label="初始值东北天" width="250"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.ed + ';' + scope.row.nd + ';' + scope.row.td }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="添加时间"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.addtime }} |
| | |
| | | <el-button v-if="next" style="margin-left: 10px;" :type="nextyearprimary" @click="nextyear">下一年</el-button> |
| | | </div> |
| | | <span style=" display: flex;justify-content: center;align-items: center;font-size: 25px;"> {{ this.anchorname + "-" |
| | | + this.tagid +"变化趋势图"}}</span> |
| | | + this.tagid + "变化趋势图" }}</span> |
| | | <line-chart :chart-data="lineChartData" /> |
| | | |
| | | |
| | |
| | | import { formatTime1 } from "@/utils/index.js"; //日期格式转换 |
| | | import LineChart from "./components/LineChart"; |
| | | import Pagination from '@/components/Pagination' |
| | | import { getList, searcheveryday, handlechart2, handlechartupdate3,handlechartupdate2 } from '@/api/analysis' |
| | | import { getList, searcheveryday, handlechart2, handlechartupdate3, handlechartupdate2,resetinitv } from '@/api/analysis' |
| | | import { deepClone } from '@/utils' |
| | | |
| | | const lineChartData = { |
| | |
| | | time: undefined, |
| | | }, |
| | | uploadUrl: '', |
| | | |
| | | multipleSelection: [], |
| | | dialogVisible: false, |
| | | dialogType: 'create', |
| | | loading: false |
| | |
| | | this.fetchData() |
| | | }, |
| | | methods: { |
| | | handleSelectionChange(val) { |
| | | this.multipleSelection = val; |
| | | }, |
| | | resetinitv() { |
| | | console.log("重置初始值"); |
| | | console.log(this.multipleSelection); |
| | | if (this.multipleSelection.length == 0) { |
| | | this.$message({ |
| | | message: '请先选择一条数据', |
| | | type: 'error' |
| | | }) |
| | | } else if (this.multipleSelection.length > 1) { |
| | | this.$message({ |
| | | message: '请选择一条数据', |
| | | type: 'error' |
| | | }) |
| | | |
| | | |
| | | }else{ |
| | | |
| | | this.$confirm('你将确定将' + this.multipleSelection[0].tagid + ' 编号设备重置初始值为' + this.multipleSelection[0].ed + ';' + this.multipleSelection[0].nd + ';' + this.multipleSelection[0].td + ' 吗?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | center: true |
| | | }).then(() => { |
| | | |
| | | const params = { tagid: this.multipleSelection[0].tagid , initv: this.multipleSelection[0].ed + ';' + this.multipleSelection[0].nd + ';' + this.multipleSelection[0].td }; |
| | | resetinitv(params).then(response => { |
| | | console.log(response); |
| | | |
| | | |
| | | }) |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '重置成功!' |
| | | }); |
| | | }).catch(() => { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已取消重置' |
| | | }); |
| | | }); |
| | | |
| | | } |
| | | |
| | | }, |
| | | exportExcel() { |
| | | console.log(this.timeExport); |
| | | // const data = [] |
| | | const params = { date1: this.timeExport[1], date2: this.timeExport[0], username: localStorage.getItem('username') || '' }; |
| | | handlechartupdate2(params).then(response => { |
| | | console.log(response); |
| | | const data = response.data |
| | | // 获取要导出的数据 |
| | | // const data = this.list; // 假设list是表格的数据 |
| | | // 创建一个空的工作簿 |
| | | const workbook = XLSX.utils.book_new(); |
| | | // 创建一个工作表 |
| | | const worksheet = XLSX.utils.json_to_sheet(data); |
| | | // 将工作表添加到工作簿中 |
| | | XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1'); |
| | | // 将工作簿转换为二进制字符串 |
| | | const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' }); |
| | | // 将二进制字符串转换为Blob对象 |
| | | const blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8' }); |
| | | // 创建一个下载链接 |
| | | const url = URL.createObjectURL(blob); |
| | | // 创建一个隐藏的链接元素 |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = 'export.xlsx'; // 设置下载的文件名 |
| | | // 模拟点击下载链接 |
| | | link.click(); |
| | | // 释放URL对象 |
| | | URL.revokeObjectURL(url); |
| | | }) |
| | | // console.log(data); |
| | | const params = { date1: this.timeExport[1], date2: this.timeExport[0], username: localStorage.getItem('username') || '' }; |
| | | handlechartupdate2(params).then(response => { |
| | | console.log(response); |
| | | const data = response.data |
| | | // 获取要导出的数据 |
| | | // const data = this.list; // 假设list是表格的数据 |
| | | // 创建一个空的工作簿 |
| | | const workbook = XLSX.utils.book_new(); |
| | | // 创建一个工作表 |
| | | const worksheet = XLSX.utils.json_to_sheet(data); |
| | | // 将工作表添加到工作簿中 |
| | | XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1'); |
| | | // 将工作簿转换为二进制字符串 |
| | | const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' }); |
| | | // 将二进制字符串转换为Blob对象 |
| | | const blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8' }); |
| | | // 创建一个下载链接 |
| | | const url = URL.createObjectURL(blob); |
| | | // 创建一个隐藏的链接元素 |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = 'export.xlsx'; // 设置下载的文件名 |
| | | // 模拟点击下载链接 |
| | | link.click(); |
| | | // 释放URL对象 |
| | | URL.revokeObjectURL(url); |
| | | }) |
| | | // console.log(data); |
| | | |
| | | |
| | | }, |
| | | |
| | | }, |
| | | Export() { |
| | | |
| | | }, |
| | |
| | | const params = { date1: this.queryForm.time[1], date2: this.queryForm.time[0], username: localStorage.getItem('username') || '', tagid: scope.row.tagid }; |
| | | handlechart2(params).then(response => { |
| | | console.log(response); |
| | | |
| | | |
| | | this.lineChartData = response.data |
| | | this.analy = false |
| | | }) |
| | |
| | | search() { |
| | | this.listLoading = true |
| | | searcheveryday(this.listQuery).then(response => { |
| | | if (response.data!=null) { |
| | | if (response.data != null) { |
| | | this.list = response.data.records |
| | | this.total = response.data.total |
| | | }else{ |
| | | } else { |
| | | this.$message({ |
| | | message: '未搜索到数据', |
| | | type: 'error' |
| | | }) |
| | | } |
| | | |
| | | |
| | | this.listLoading = false |
| | | }) |
| | | }, |