<template>
  <div id="history-1">
    <el-row>
      <el-col :span="24" class="main">
        <el-col :span="24" class="one">
          <data-table @query="search" :fields="fields" :opera="opera" :data="list" :total="total"> </data-table>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
const { mapActions: baoan_work_warning } = createNamespacedHelpers('baoan_work_warning');
export default {
  name: 'history-1',
  props: {},
  components: {},
  data: function () {
    return {
      fields: [
        { label: '警告时间', model: 'warning_date', filter: 'date' },
        { label: '保安员', model: 'name', filter: 'input' },
        { label: '企业名称', model: 'company' },
        { label: '经度', model: 'longitude' },
        { label: '纬度', model: 'latitude' },
        { label: '描述', model: 'desc' },
      ],
      opera: [],
      list: [],
      total: 0,
    };
  },
  async created() {
    await this.search();
  },
  methods: {
    ...baoan_work_warning(['query']),
    async search({ skip = 0, limit = 10, ...info } = {}) {
      let res = await this.query({ skip, limit, ...info });
      if (this.$checkRes(res)) {
        this.$set(this, `list`, res.data);
        this.$set(this, `total`, res.total);
      }
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped></style>
