gaoluyang
2 天以前 ee56d420df75e3284a1fe4756363fa3c924b9190
src/views/energyManagement/energyTrends/index.vue
@@ -4,7 +4,7 @@
         <div>
            <span class="search_title">设备名称:</span>
            <el-input
               v-model="searchForm.customerName"
               v-model="searchForm.name"
               style="width: 240px"
               placeholder="请输入"
               @change="handleQuery"
@@ -14,6 +14,7 @@
            <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
            >搜索</el-button
            >
            <el-button @click="handleOut" style="margin-left: 10px">导出</el-button>
         </div>
      </div>
      <div class="table_list">
@@ -34,12 +35,15 @@
<script setup>
import {Search} from "@element-plus/icons-vue";
import {onMounted, ref} from "vue";
import {onMounted, ref, getCurrentInstance} from "vue";
import {listPageByTrend} from "@/api/energyManagement/index.js";
import { ElMessageBox } from "element-plus";
const { proxy } = getCurrentInstance();
const data = reactive({
   searchForm: {
      customerName: "",
      name: "",
   },
});
const { searchForm } = toRefs(data);
@@ -76,6 +80,7 @@
   },
]);
const tableData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
const page = reactive({
   current: 1,
@@ -106,6 +111,22 @@
      page.total = res.data.total;
   });
};
// 导出
const handleOut = () => {
   ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
   })
      .then(() => {
         proxy.download("/equipmentEnergyConsumption/exportTwo", {}, "能源趋势.xlsx");
      })
      .catch(() => {
         proxy.$modal.msg("已取消");
      });
};
onMounted(() => {
   getList();
});