<template>
  <div class="content">
    <div class="topSearch">
      <div class="left">
        管理员搜索：
        <Input
          v-model="keyword"
          style="width:150px;"
          enter-button
          placeholder="请输入"
        />
        <span style="margin-left:10px">操作时间：</span>
        <DatePicker
          v-model="date"
          format="yyyy/MM/dd"
          type="daterange"
          placement="bottom-end"
          placeholder="Select date"
          style="width: 200px"
        ></DatePicker>
        <Button type="primary" @click="goDetail">查 询</Button>
        <Button type="primary" ghost>重 置</Button>
      </div>
    </div>
    <Table
      :loading="$store.state.app.isLoading"
      border
      ref="selection"
      :columns="columns"
      :data="data"
    >
      <template slot-scope="{ row }" slot="name">
        <span>{{ row.details.name }}</span>
      </template>
      <template slot-scope="{ row }" slot="title">
        <span>{{ row.details.title }}</span>
      </template>
      <template slot-scope="{ row }" slot="created_at">
        <span>{{ row.created_at | format }}</span>
      </template>
      <template slot-scope="{ row }" slot="enable">
        <i-switch
          :value="row.is_enable === 1 ? true : false"
          @on-change="
            value => {
              change(value, row);
            }
          "
        />
      </template>
      <template slot-scope="{ row }" slot="action">
        <a @click="edit(row)">编辑</a>
      </template>
      <template slot-scope="{ row }" slot="edit">
        <a @click="goTheme(row)">编辑</a>
      </template>
    </Table>
    <Pager
      class="margin-top-10"
      :config="config"
      @on-change="handlePager"
    ></Pager>

  </div>
</template>

<script>
import {
  adminLogs
} from "@/api/clock/activityClocks";
import Pager from "@/view/common/Pager.vue";
export default {
  name: "categories",
  components: {
    Pager
  },
  data() {
    return {
      config: { total: 0, size: 10, current: 1 },
      keyword: "",
      date: [],
      checkStatu: null,
      award_amount:null,
      comment:'',
      remark:'',
      data: [],
      pageIndex: 1,
      pageSize: 10,
      columns: [
        {
          title: "管理员账号",
          key: "account"
        },
        {
          title: "姓名",
          slot: "admin_name"
        },
        {
          title: "操作菜单",
          slot: "desc"
        },
        {
          title: "操作",
          key: "action"
        },
        {
          title: "操作时间",
          slot: "create_time"
        }
      ]
    };
  },
  methods: {
    search() {
      let params = {
        keyword: this.keyword,
        language: "cn",
        objectType: 1,
        startDate: this.date[0],
        endDate: this.date[1],
        pageIndex: this.pageIndex,
        pageSize: this.pageSize
      };
      adminLogs(params).then(res => {
        this.config.total = res.total;
        this.data = res.data;
      });
    },
    checkActivity() {
      let params = {
        award_amount: this.award_amount,
        check_status: 1,
        comment: this.comment,
        ids:[],
        object_type:1,
        remark:this.remark
      };
      checkActivityFile(params).then(res => {
        console.log(res)
      });
    },
    handlePager(pager) {
      this.pageIndex = pager.current;
      this.pageSize = pager.size;
      this.search();
    }
  },
  mounted() {}
};
</script>

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