Преглед на файлове

chore: 日报日期改为区间

cfofpp преди 5 месеца
родител
ревизия
8502ef9bf2
променени са 1 файла, в които са добавени 34 реда и са изтрити 16 реда
  1. 34 16
      src/views/distributionnetwork/secure/daily-newspaper/index.vue

+ 34 - 16
src/views/distributionnetwork/secure/daily-newspaper/index.vue

@@ -2,14 +2,25 @@
   <div class="app-container">
     <el-form size="small" :inline="true">
       <el-form-item label="日期" prop="reportDate">
-        <el-date-picker
+        <!-- <el-date-picker
           v-model="queryParams.reportDate"
           style="width: 240px; margin-right: 8px"
           size="mini"
           type="date"
           value-format="yyyyMMdd"
           :clearable="false"
-        ></el-date-picker>
+        ></el-date-picker> -->
+        <el-date-picker
+          v-model="queryParams.reportDate"
+          style="width: 240px; margin-right: 8px"
+          type="daterange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          value-format="yyyyMMdd"
+          :clearable="false"
+        >
+        </el-date-picker>
       </el-form-item>
       <el-form-item label="作业单位" prop="company">
         <el-select
@@ -108,17 +119,15 @@ export default {
   data() {
     return {
       activeName: "violationSituationTableRef",
-      // 日期范围
-      dateRange: moment().subtract(1, "days").endOf("day").format("YYYYMMDD"),
       total: 0,
       loading: false,
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        reportDate: moment()
-          .subtract(1, "days")
-          .endOf("day")
-          .format("YYYYMMDD"),
+        reportDate: [
+          moment().endOf("day").format("YYYYMMDD"),
+          moment().endOf("day").format("YYYYMMDD"),
+        ],
         company: "", // 作业单位
       },
       workUnitOptions: [],
@@ -142,7 +151,10 @@ export default {
     async handleQuery() {
       this.loading = true;
       const { appointmentList, illegalList, nextDayList, planList } =
-        await getReportDay(this.queryParams);
+        await getReportDay({
+          ...this.queryParams,
+          reportDate: this.queryParams.reportDate[0],
+        });
       this.$nextTick(() => {
         this.$refs["violationSituationTableRef"].tableData = illegalList;
         this.$refs["executionStatusTableRef"].tableData = planList;
@@ -153,20 +165,26 @@ export default {
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.queryParams.reportDate = moment()
-        .subtract(1, "days")
-        .endOf("day")
-        .format("YYYYMMDD");
+      this.queryParams.reportDate = [
+        moment().endOf("day").format("YYYYMMDD"),
+        moment().endOf("day").format("YYYYMMDD"),
+      ];
       this.queryParams.company = "";
       this.handleQuery();
     },
     async onExport() {
-      const res = await dayExport(this.queryParams.reportDate,this.queryParams.reportDate);
+      const res = await dayExport(
+        this.queryParams.reportDate[0],
+        this.queryParams.reportDate[1]
+      );
       if (res) {
         const elink = document.createElement("a");
-        elink.download = `衡阳公司配电专业安全管控专班日报-${this.queryParams.reportDate}.doc`;
+        const date = `${this.queryParams.reportDate[0]}_${this.queryParams.reportDate[1]}`;
+        elink.download = `衡阳公司配电专业安全管控专班日报-${date}.doc`;
         elink.style.display = "none";
-        const blob = new Blob([res], { type: "application/msword;charset=UTF-8" });
+        const blob = new Blob([res], {
+          type: "application/msword;charset=UTF-8",
+        });
         elink.href = URL.createObjectURL(blob);
         document.body.appendChild(elink);
         elink.click();