<template>
  <div>
    <el-card :body-style="{ padding: '5px' }" style="margin-bottom:5px">
      <header-box :search="search" @check="check"/>
    </el-card>
    <el-card :body-style="{ padding: '5px' }">
      <!-- <div style="text-align:right;padding:5px 10px ">
        <el-button @click="diaBox('新增')" v-if="showButtons.add" size="mini" type="primary">新建</el-button>
      </div> -->
      <h3 style="padding-left: 30px;">统计表展示(全)</h3>
      <content-box />
    </el-card>
    <dia-box ref="diaBox" @cancel='cancel' :title='title' :isDiaBox='isDiaBox' @getData='getData' />
  </div>
</template>
<script>
  import {
    mapState
  } from "vuex";
  import diaBox from "./components/diaBox.vue"
  import headerBox from "./components/header.vue"
  import contentBox from "./components/content.vue"
  export default {
    data() {
      return {
        search: {
          year: "",
          time: '',
        },
        title: "",
        params: {},
        isDiaBox: false,
        tableData: [
          {leixing: '简化整理', timing: '整理简化档案', danghao: 'tianjin-1-001', quanzong: 'tianjin', zhidaoren: '管理员', neirong: '需要添加材料', shijian: '2022-03-01 10:05:07'}, 
          {leixing: '同步音像档案', timing: '音像档案', danghao: 'tianjin-1-002', quanzong: 'tianjin', zhidaoren: '管理员', neirong: '需要增加内容', shijian: '2022-01-06 15:20:32'}, 
          {leixing: '文档案卷目录', timing: '文档案卷目录', danghao: 'tianjin-2-001', quanzong: 'tianjin', zhidaoren: '管理员', neirong: '需要添加材料', shijian: '2021-11-12 09:35:29'}, 
          {leixing: '同步音像档案', timing: '整理音像档案', danghao: 'tianjin-2-002', quanzong: 'tianjin', zhidaoren: '管理员', neirong: '需要增加内容', shijian: '2021-10-06 15:21:32'}, 
          {leixing: '文档案卷目录', timing: '案卷目录', danghao: 'tianjin-3-001', quanzong: 'tianjin', zhidaoren: '管理员', neirong: '需要添加材料', shijian: '2021-09-13 17:15:19'}, 
          {leixing: '简化整理', timing: '简化档案', danghao: 'tianjin-3-002', quanzong: 'tianjin', zhidaoren: '管理员', neirong: '需要增加内容', shijian: '2021-07-03 16:21:12'}, 
        ],
        tableLoading: false,
        pagination: {
          pageSize: 10,
          pageNum: 1,
          total: 6,
        },
        showButtons: {},
      }
    },
    /* computed: {
      ...mapState({
        tableData: (state) => state.denseFrameParameters.tableData,
        pagination: (state) => state.denseFrameParameters.pagination,
        showButtons: (state) => state.denseFrameParameters.showButtons,
      }),
      tableLoading: {
        get() {
          return this.$store.state.denseFrameParameters.tableLoading;
        },
        set(val) {
          this.$store.state.denseFrameParameters.tableLoading = val;
        },
      },
    }, */
    components: {
      headerBox,
      contentBox,
      diaBox
    },
    methods: {
      getData() {
        this.params = {
          frameName: this.search.frameName,
          page: this.pagination.pageNum,
          limit: this.pagination.pageSize,
        }
        this.tableLoading = true
        this.$store.dispatch('denseFrameParameters/getData', this.params).catch(err => {
          this.tableLoading = false
        })
      },
      diaBox(str, val) {
        this.title = str
        this.isDiaBox = true
        if (str != '新增') {
          for (let key in this.$refs.diaBox.form) {
            for (let index in val) {
              if (key === index) {
                this.$refs.diaBox.form[key] = val[index]
              }
            }
          }
        }
      },
      check(){
        this.isDiaBox = true
      },
      cancel() {
        this.isDiaBox = false
      }
    },
    created() {
      /* let btnData = {
        menuid: this.$getMenuId(sessionStorage.getItem("routerIdList"), this.$route.path),
        roleid: sessionStorage.getItem("roleid")
      }
      this.$store.dispatch("denseFrameParameters/getButtonList", btnData); */
      // this.getData()
    }
  }

</script>
