智慧农业后台管理页面
shuishen
2022-07-29 d6a0abe9024f87fc517a2b71df0f17c5cadc41a0
src/views/monitor/log/error.vue
@@ -1,6 +1,7 @@
<template>
  <basic-container>
    <avue-crud :option="option"
        <avue-crud
            :option="option"
               :table-loading="loading"
               :data="data"
               ref="crud"
@@ -13,14 +14,14 @@
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
    </avue-crud>
            @on-load="onLoad"
        ></avue-crud>
  </basic-container>
</template>
<script>
  import {getErrorList, getErrorLogs} from "@/api/logs";
  import {mapGetters} from "vuex";
import { getErrorList, getErrorLogs } from "@/api/logs"
import { mapGetters } from "vuex"
  export default {
    data() {
@@ -110,52 +111,52 @@
          ]
        },
        data: []
      };
        }
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          viewBtn: this.vaildData(this.permission.log_error_view, false)
        };
            }
      }
    },
    methods: {
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
            this.query = {}
            this.onLoad(this.page)
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getErrorLogs(this.form.id).then(res => {
            this.form = res.data.data;
          });
                    this.form = res.data.data
                })
        }
        done();
            done()
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
            this.page.currentPage = currentPage
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
            this.page.pageSize = pageSize
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
            this.onLoad(this.page, this.query)
      },
      onLoad(page, params = {}) {
        this.loading = true;
            this.loading = true
        getErrorList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
        });
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
            })
      }
    }
  };