/*
  @description:
  1.审核状态、资格审查、招标方式公共使用
  2.列表查询条件折叠方法、分页参数公共使用
  @Modifier:haoFx
  @routerPath:
  @date:2019/11/22-10:48
*/
export const ListMixin = {
  data() {
    return {
      /* 表格高度*/
      smallTableHeight: null,
      /* 查询折叠 */
      toggleSearchStatus: false,
      /* 分页*/
      paginationData: {
        pageNo: 1, // 当前页
        pageSize: 10, // 每页显示个数
        total: 0
      },
      /* 审核状态 */
      auditStatusOptions: [
        {
          typecode: '00',
          typename: '待审核'
        },
        {
          typecode: '01',
          typename: '审核通过'
        },
        {
          typecode: '02',
          typename: '审核不通过'
        }
      ]
    }
  },
  beforeMount() {
    window.addEventListener('resize', this.getTbHeight)
  },
  created() {
    this.initPage()// 初始化分页
  },
  mounted() {
    this.$nextTick(function() {
      this.getTbHeight()
    })
  },
  methods: {
    // 初始化分页
    initPage() {
      // 判断是否已存储 分页条数
      if (this.$store.getters.sysLocal.pageSize) {
        this.paginationData.pageSize = this.$store.getters.sysLocal.pageSize
      } else {
        this.paginationData.pageSize = 10
      }
    },
    getTbHeight() {
      if (this.$refs.smallTable) {
        if (document.documentElement.clientWidth > 1366) {
          this.smallTableHeight = window.innerHeight - (this.$refs.smallTable.$el.offsetTop + 76) - 60
        } else {
          this.smallTableHeight = window.innerHeight - (this.$refs.smallTable.$el.offsetTop + 62) - 58
        }
      }
    },
    handleToggleSearch() {
      this.toggleSearchStatus = !this.toggleSearchStatus
    }
  }
}
