From 0b3d2deb37745ea5dce42fa4a18f22a29d2f4a12 Mon Sep 17 00:00:00 2001 From: fei.wang <wf18701153496@163.com> Date: 星期三, 16 四月 2025 09:13:24 +0800 Subject: [PATCH] v2.0.2更新时间4.16 --- src/views/analysis/index.vue | 133 +++++++++++++++++++++++++++++++------------ 1 files changed, 95 insertions(+), 38 deletions(-) diff --git a/src/views/analysis/index.vue b/src/views/analysis/index.vue index 6b5496e..92c50aa 100644 --- a/src/views/analysis/index.vue +++ b/src/views/analysis/index.vue @@ -26,14 +26,19 @@ <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> @@ -80,6 +85,11 @@ </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 }} @@ -111,7 +121,7 @@ <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" /> @@ -124,7 +134,7 @@ 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 = { @@ -197,7 +207,7 @@ time: undefined, }, uploadUrl: '', - + multipleSelection: [], dialogVisible: false, dialogType: 'create', loading: false @@ -207,40 +217,87 @@ 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() { }, @@ -253,7 +310,7 @@ 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 }) @@ -478,16 +535,16 @@ 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 }) }, -- Gitblit v1.9.3