fei.wang
2025-04-16 0b3d2deb37745ea5dce42fa4a18f22a29d2f4a12
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 }}
@@ -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,6 +217,53 @@
    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 = []