导出功能怎么实现

2024-01-18 20:51:21 浏览数 (1)

导出功能源代码
代码语言:javascript复制
 exportExcel() {
 //导出条件,不符合条件则return
      if (!this.form.date[0] || !this.form.date[1]) {
        this.$message.info("请输入查询时间范围");
        return;
      }
      if (!this.form.selectedOptions[2]) {
        this.$message.info("请选择具体监测点");
        return;
      }
   //导出的接口
      historyExport({
        startTime: this.form.date[0],
        endTime: this.form.date[1],
        pointId: this.form.selectedOptions[2],
      }).then((msg) => {
        this.$message({
          type: "success",
          message: this.$t("message.operationSuccess"),
        });
        let exportObj = {
          taskId: msg,
          taskName: "站点列表",
          taskStatus: 0,
          rootPath: "historyPath",
        };
        //将导出任务丢入导出任务列表中
        //异步操作存储
        this.$store.dispatch("PushExportNotice", exportObj);
      });
    },
举一反三

0 人点赞