gaoluyang
昨天 ee56d420df75e3284a1fe4756363fa3c924b9190
src/views/energyManagement/energyPeriodTime/index.vue
@@ -16,7 +16,8 @@
         v-model="searchForm.date"
         type="date"
         placeholder="请选择日期"
         :size="size"
         value-format="YYYY-MM-DD"
                  format="YYYY-MM-DD"
      />
        <!-- <el-time-picker
            v-model="searchForm.timeRange"
@@ -41,6 +42,7 @@
      </div>
      <div>
        <el-button type="primary" @click="openForm('add')">新增</el-button>
        <el-button @click="handleOut">导出</el-button>
        <el-button type="danger" plain @click="handleDelete">删除</el-button>
      </div>
    </div>
@@ -160,7 +162,7 @@
</template>
<script setup>
import {Search} from "@element-plus/icons-vue";
import {onMounted, ref} from "vue";
import {onMounted, ref, getCurrentInstance} from "vue";
import {ElMessageBox} from "element-plus";
import {getToken} from "@/utils/auth.js";
import {periodListPage,periodDelete,periodAdd,periodUpdate} from "@/api/energyManagement/index.js";
@@ -316,7 +318,7 @@
};
const getList = () => {
   tableLoading.value = true;
   periodListPage({ ...searchForm, ...page.value }).then((res) => {
   periodListPage({ ...searchForm.value, ...page.value }).then((res) => {
         tableLoading.value = false;
         if (res && res.data) {
            tableData.value = res.data.records || [];
@@ -434,6 +436,22 @@
      proxy.$modal.msg("已取消");
   });
};
// 导出
const handleOut = () => {
   ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
   })
      .then(() => {
         proxy.download("/energyPeriod/export", {}, "用电时段管理.xlsx");
      })
      .catch(() => {
         proxy.$modal.msg("已取消");
      });
};
onMounted(() => {
   getList();
});